From 11ba31da8da1b35c48864ec4dbb59a2e0e220efa Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sun, 15 May 2022 03:51:53 -0700 Subject: [PATCH 1/5] created view file for suggestions page --- src/lib/view/Pages/foodfeup_suggestion_view.dart | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/lib/view/Pages/foodfeup_suggestion_view.dart diff --git a/src/lib/view/Pages/foodfeup_suggestion_view.dart b/src/lib/view/Pages/foodfeup_suggestion_view.dart new file mode 100644 index 0000000..e69de29 From c61d0d8e727af2d138d8d3572564031735761cd9 Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sun, 15 May 2022 03:58:11 -0700 Subject: [PATCH 2/5] created model file for suggestions page --- src/lib/model/foodfeup_suggestion_model.dart | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/lib/model/foodfeup_suggestion_model.dart diff --git a/src/lib/model/foodfeup_suggestion_model.dart b/src/lib/model/foodfeup_suggestion_model.dart new file mode 100644 index 0000000..e69de29 From 26665a2723b5cfc33f1e4bede74ad7e2a7bad938 Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sun, 15 May 2022 04:36:32 -0700 Subject: [PATCH 3/5] added dropdownBox to suggestion page Changed recomendation button to transition suggestions page --- src/lib/model/foodfeup_suggestion_model.dart | 59 +++++++++++++++++++ .../view/Pages/foodfeup_suggestion_view.dart | 41 +++++++++++++ src/lib/view/Widgets/foodfeup_main_menu.dart | 11 +++- 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/src/lib/model/foodfeup_suggestion_model.dart b/src/lib/model/foodfeup_suggestion_model.dart index e69de29..8fc36f7 100644 --- a/src/lib/model/foodfeup_suggestion_model.dart +++ b/src/lib/model/foodfeup_suggestion_model.dart @@ -0,0 +1,59 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../view/Pages/foodfeup_suggestion_view.dart'; +import '../view/Pages/secondary_page_view.dart'; + +class FoodFeupSuggestionPage extends StatefulWidget { + const FoodFeupSuggestionPage({Key key}) : super(key: key); + + @override + _FoodFeupSuggestionPageState createState() => _FoodFeupSuggestionPageState(); +} + +class _FoodFeupSuggestionPageState extends SecondaryPageViewState { + final int weekDay = DateTime + .now() + .weekday; + + + final List options = [ + 'indiferente', + 'Carne', + 'Peixe', + 'Vegetariano', + 'Dieta', + 'Sopa', + ]; + + @override + void initState() { + super.initState(); + + } + + @override + void dispose() { + super.dispose(); + } + + Widget LoadingScreen() { + + return Center( + child: SizedBox( + width: 60, + height: 60, + child: CircularProgressIndicator(), + ) + ); + } + + + @override + Widget getBody(BuildContext context) { + return FoodFeupSuggestionPageView( + options: options, + + ); + } +} \ No newline at end of file diff --git a/src/lib/view/Pages/foodfeup_suggestion_view.dart b/src/lib/view/Pages/foodfeup_suggestion_view.dart index e69de29..7067848 100644 --- a/src/lib/view/Pages/foodfeup_suggestion_view.dart +++ b/src/lib/view/Pages/foodfeup_suggestion_view.dart @@ -0,0 +1,41 @@ + + +import 'package:flutter/material.dart'; + +class FoodFeupSuggestionPageView extends StatelessWidget { + FoodFeupSuggestionPageView({ + Key key, + @required this.options + }); + + final List options; + String dropdownValue; + + @override + Widget build(BuildContext context){ + dropdownValue = options[0]; + + return Column( + children: [ + DropdownButton( + value: dropdownValue, + icon: const Icon(Icons.arrow_downward), + elevation: 16, + style: const TextStyle(color: Colors.red), + underline: Container( + height: 2, + color: Colors.redAccent, + ), + onChanged: (String newValue){ + dropdownValue = newValue; + }, + items: options.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + )], + ); + } + } \ No newline at end of file diff --git a/src/lib/view/Widgets/foodfeup_main_menu.dart b/src/lib/view/Widgets/foodfeup_main_menu.dart index 6d0dcd9..cfac719 100644 --- a/src/lib/view/Widgets/foodfeup_main_menu.dart +++ b/src/lib/view/Widgets/foodfeup_main_menu.dart @@ -6,6 +6,7 @@ import 'package:uni/view/Widgets/page_transition.dart'; import '../../main.dart'; import '../../model/entities/restaurant.dart'; +import '../../model/foodfeup_suggestion_model.dart'; class FoodFeupMainMenu extends StatefulWidget{ @override @@ -118,6 +119,14 @@ bool transitionToEstablishment(BuildContext context, String buttonName) { return true; } +bool transitionToSuggestion(BuildContext context, String buttonName) { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const FoodFeupSuggestionPage())); + + return true; +} + Future> getWidgets(BuildContext context) async { final List widgets = []; await RestaurantFetcherHtml().getRestaurants(state).then((restaurants) { @@ -138,7 +147,7 @@ Future> getWidgets(BuildContext context) async { }); widgets.add(Padding(padding: EdgeInsets.symmetric(horizontal: 8, vertical: 0))); - widgets.add(createButton(context, 'Recomendação', 'Hoje', Colors.grey , transitionToEstablishment)); + widgets.add(createButton(context, 'Recomendação', 'Hoje', Colors.grey , transitionToSuggestion)); return widgets; } From b2dc70a3c8cfb3db3fd64240751923aa3f6cea23 Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sun, 15 May 2022 07:07:53 -0700 Subject: [PATCH 4/5] added all elements to suggestion page --- .../view/Pages/foodfeup_suggestion_view.dart | 106 ++++++++++++++---- 1 file changed, 84 insertions(+), 22 deletions(-) diff --git a/src/lib/view/Pages/foodfeup_suggestion_view.dart b/src/lib/view/Pages/foodfeup_suggestion_view.dart index 7067848..cc83965 100644 --- a/src/lib/view/Pages/foodfeup_suggestion_view.dart +++ b/src/lib/view/Pages/foodfeup_suggestion_view.dart @@ -1,41 +1,103 @@ import 'package:flutter/material.dart'; +import 'package:uni/view/Widgets/page_title.dart'; class FoodFeupSuggestionPageView extends StatelessWidget { FoodFeupSuggestionPageView({ Key key, - @required this.options + @required this.options, + this.mealType, + this.mealRating, + this.mealRatingQuant, + this.mealName, + this.establishment }); final List options; String dropdownValue; + String mealType; + int mealRating; + String mealRatingQuant; + String mealName; + String establishment; @override Widget build(BuildContext context){ - dropdownValue = options[0]; - - return Column( - children: [ - DropdownButton( - value: dropdownValue, - icon: const Icon(Icons.arrow_downward), - elevation: 16, - style: const TextStyle(color: Colors.red), - underline: Container( - height: 2, - color: Colors.redAccent, - ), - onChanged: (String newValue){ - dropdownValue = newValue; - }, - items: options.map>((String value) { - return DropdownMenuItem( + dropdownValue = options[0];//TODO: read these from somewhere + establishment = "Cantina almoço"; + mealType = "Vegetariano"; + mealRating = 4; + mealRatingQuant = "23"; + mealName = "Jardineira de soja (batata,ervilhas e cenoura)"; + + + + return (SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [createDropdownButton(), + PageTitle(name: establishment), + Text(mealType), + Row( children: [ + Text("Stars go here"), + Text("(" + mealRatingQuant + ")") + ], + mainAxisAlignment: MainAxisAlignment.center, + ), + Text(mealName), + createReviewButton()] + ,) + )); + } + + Widget createDropdownButton(){ + return DropdownButton( + value: dropdownValue, + icon: const Icon(Icons.arrow_downward), + elevation: 16, + style: const TextStyle(color: Colors.red), + underline: Container( + height: 2, + color: Colors.redAccent, + ), + onChanged: (String newValue){//TODO:Make this update the page content + dropdownValue = newValue; + }, + items: options.map>((String value) { + return DropdownMenuItem( value: value, child: Text(value), - ); - }).toList(), - )], + ); + }).toList(), ); } + + Widget createReviewButton(){ + return Padding( + padding: EdgeInsets.symmetric(horizontal: 0, vertical: 0), + child: SizedBox( + height: 55, + width: 55, + child: ElevatedButton( + child: Center( + child: Icon(Icons.star,color: Colors.white,size: 35,), + ), + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(55), + ), + primary: Colors.red, + ), + onPressed: decoy,//TODO change to real function + + ) + ), + ); + } + + bool decoy(){ + return false; + } + } \ No newline at end of file From 710bf052bf4a087438acf3a55aee85ac90223a09 Mon Sep 17 00:00:00 2001 From: Diogo Nunes Date: Sun, 15 May 2022 10:12:02 -0700 Subject: [PATCH 5/5] finished styling and spacing UI elements --- .../view/Pages/foodfeup_suggestion_view.dart | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/lib/view/Pages/foodfeup_suggestion_view.dart b/src/lib/view/Pages/foodfeup_suggestion_view.dart index cc83965..202a40d 100644 --- a/src/lib/view/Pages/foodfeup_suggestion_view.dart +++ b/src/lib/view/Pages/foodfeup_suggestion_view.dart @@ -36,30 +36,43 @@ class FoodFeupSuggestionPageView extends StatelessWidget { return (SingleChildScrollView( scrollDirection: Axis.vertical, child: Column( - children: [createDropdownButton(), - PageTitle(name: establishment), - Text(mealType), - Row( children: [ - Text("Stars go here"), - Text("(" + mealRatingQuant + ")") - ], - mainAxisAlignment: MainAxisAlignment.center, - ), - Text(mealName), - createReviewButton()] + children: [ + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 15)), + createDropdownButton(Theme.of(context).accentColor), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 15)), + Text(establishment, + style: TextStyle(fontWeight: FontWeight.w400,fontSize: 30),), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 15)), + Text(mealType,style: TextStyle(fontWeight: FontWeight.w500,fontSize: 30, + color:Theme.of(context).accentColor ),), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 3)), + Row( children: [ + Text("Stars go here"), + Text("(" + mealRatingQuant + ")",style: TextStyle(fontWeight: FontWeight.w600,fontSize: 14, + color:Theme.of(context).accentColor )) + ], + mainAxisAlignment: MainAxisAlignment.center, + ), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 15)), + Divider(thickness: 3,indent: 20,endIndent: 20,color: Theme.of(context).accentColor), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 15)), + Text(mealName,style: TextStyle(fontWeight: FontWeight.w500,fontSize: 18, + color:Colors.black , ), textAlign: TextAlign.center,overflow: TextOverflow.fade), + Padding(padding: EdgeInsets.symmetric(horizontal: 0, vertical: 40)), + createReviewButton(Theme.of(context).accentColor)] ,) )); } - Widget createDropdownButton(){ + Widget createDropdownButton(Color color){ return DropdownButton( value: dropdownValue, icon: const Icon(Icons.arrow_downward), - elevation: 16, - style: const TextStyle(color: Colors.red), + style: const TextStyle(color: Colors.black), + borderRadius: BorderRadius.circular(1), underline: Container( height: 2, - color: Colors.redAccent, + color: color, ), onChanged: (String newValue){//TODO:Make this update the page content dropdownValue = newValue; @@ -73,7 +86,7 @@ class FoodFeupSuggestionPageView extends StatelessWidget { ); } - Widget createReviewButton(){ + Widget createReviewButton(Color color){ return Padding( padding: EdgeInsets.symmetric(horizontal: 0, vertical: 0), child: SizedBox( @@ -87,7 +100,7 @@ class FoodFeupSuggestionPageView extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(55), ), - primary: Colors.red, + primary: color, ), onPressed: decoy,//TODO change to real function