diff --git a/frontend/lib/modules/landmark_card.dart b/frontend/lib/modules/landmark_card.dart index 70e8de5..909a7f3 100644 --- a/frontend/lib/modules/landmark_card.dart +++ b/frontend/lib/modules/landmark_card.dart @@ -15,59 +15,64 @@ class _LandmarkCardState extends State { @override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); - return Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), - child: Row( - children: [ - Container( - width: 160, - height: 160, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(15.0), - bottomLeft: Radius.circular(15.0), - ), - image: DecorationImage( - image: NetworkImage(widget.landmark.imageURL), + return Container( + height: 160, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), + elevation: 5, + clipBehavior: Clip.antiAliasWithSaveLayer, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( // the image on the left + // inherit the height of the parent container + height: double.infinity, + // force a fixed width + width: 160, + child: Image.network( + widget.landmark.imageURL, + // cover the whole container meaning the image will be cropped fit: BoxFit.cover, ), ), - ), - Padding( - padding: EdgeInsets.all(10), - - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Flexible( + child: Padding( + padding: EdgeInsets.all(10), + child: Column( children: [ - Text( - widget.landmark.name, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), + Row( + children: [ + Flexible( + child: Text( + widget.landmark.name, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + maxLines: 2, + ), + ) + ], + ), + Row( + children: [ + Flexible( + child: Text( + "${widget.landmark.name} (${widget.landmark.type.name})", + style: const TextStyle(fontSize: 14), + ), + ) + ] ), ], ), - SizedBox(height: 5), - Text( - "${widget.landmark.name} (${widget.landmark.type.name})", - style: TextStyle(fontSize: 14), - ), - ], + ), ), - ), - - // Align( - // alignment: Alignment.topRight, - // child: Icon(Icons.push_pin, color: theme.primaryColor), - // ), - ], + ], + ), ), ); } -} \ No newline at end of file +} diff --git a/frontend/lib/modules/landmarks_overview.dart b/frontend/lib/modules/landmarks_overview.dart index c967a65..722bfca 100644 --- a/frontend/lib/modules/landmarks_overview.dart +++ b/frontend/lib/modules/landmarks_overview.dart @@ -42,10 +42,13 @@ class _loadLandmarksOverviewState extends State { } else { children = [Center(child: CircularProgressIndicator())]; } - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: children, + return Padding( + padding: const EdgeInsets.all(10), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: children, + ), ), ); }, @@ -56,46 +59,54 @@ class _loadLandmarksOverviewState extends State { Widget landmarksWithSteps(List landmarks) { List children = []; - for (Landmark landmark in landmarks) { - children.add(LandmarkCard(landmark)); - children.add(stepBetweenLandmarks()); + for (int i = 0; i < landmarks.length; i++) { + children.add(LandmarkCard(landmarks[i])); + if (i < landmarks.length - 1) { + Widget step = stepBetweenLandmarks(landmarks[i], landmarks[i + 1]); + children.add(step); + } } return Column( - children: children.sublist(0, children.length - 1) + children: children ); } -Widget stepBetweenLandmarks() { +Widget stepBetweenLandmarks(Landmark before, Landmark after) { // This is a simple widget that draws a line between landmark-cards // It's a vertical dotted line // Next to the line is the icon for the mode of transport (walking for now) and the estimated time // There is also a button to open the navigation instructions as a new intent - return Row( - children: [ - Container( - width: 50, - height: 50, - decoration: BoxDecoration( - border: Border( - left: BorderSide(width: 1.0, color: Colors.black), - ), - ), - child: Column( + return Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border( + left: BorderSide(width: 3.0, color: Colors.black), + ), + // gradient: LinearGradient( + // begin: Alignment.topLeft, + // end: Alignment.bottomRight, + // colors: [Colors.grey, Colors.white, Colors.white], + // ), + ), + child: Row( + children: [ + Column( children: [ Icon(Icons.directions_walk), Text("5 min", style: TextStyle(fontSize: 10)), ], ), - ), - Spacer(), - ElevatedButton( - onPressed: () { - // Open navigation instructions - }, - child: Text("Navigate"), - ), - ], + Spacer(), + ElevatedButton( + onPressed: () { + // Open navigation instructions + }, + child: Text("Navigate"), + ), + ], + ), ); } \ No newline at end of file diff --git a/frontend/lib/pages/profile.dart b/frontend/lib/pages/profile.dart index 10fefe8..68d8348 100644 --- a/frontend/lib/pages/profile.dart +++ b/frontend/lib/pages/profile.dart @@ -51,7 +51,7 @@ class ImportanceSliders extends StatefulWidget { class _ImportanceSlidersState extends State { - UserPreferences _prefs = UserPreferences(); + final UserPreferences _prefs = UserPreferences(); @override void initState() { @@ -80,7 +80,7 @@ class _ImportanceSlidersState extends State { }, ) ), - margin: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 0), + margin: const EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 0), shadowColor: Colors.grey, )); }