From 482628b674ab15cfb29a9c9c599ccc022d640d9b Mon Sep 17 00:00:00 2001 From: Jonasz Bigda Date: Mon, 4 Jan 2021 19:24:15 +0100 Subject: [PATCH] Map / Order mechanics --- lib/components/homeScreen.dart | 19 ++++ lib/components/mapView.dart | 177 ++++++++++++++++++++++----------- lib/settings.dart | 23 +++++ 3 files changed, 161 insertions(+), 58 deletions(-) diff --git a/lib/components/homeScreen.dart b/lib/components/homeScreen.dart index 78e2081..4aa1005 100644 --- a/lib/components/homeScreen.dart +++ b/lib/components/homeScreen.dart @@ -52,6 +52,25 @@ class HomePage extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ + RaisedButton( + color: Colors.grey[850], + elevation: 0, + padding: EdgeInsets.all(8), + onPressed: () {}, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.home_rounded, + color: Colors.orange, + ), + Text( + 'Szukaj', + style: TextStyle(color: Colors.grey[200], fontSize: 12), + ) + ], + ), + ), RaisedButton( color: Colors.grey[850], elevation: 0, diff --git a/lib/components/mapView.dart b/lib/components/mapView.dart index 1bba3b3..ddc3b29 100644 --- a/lib/components/mapView.dart +++ b/lib/components/mapView.dart @@ -61,15 +61,108 @@ class MapViewState extends State { child = Column( children: [ Container( - height: 70, decoration: BoxDecoration(color: Colors.grey[850]), child: Column( children: [ SizedBox( - height: 40, + height: 20, ), Container( - height: 30, + decoration: BoxDecoration(color: Colors.grey[850]), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RaisedButton( + color: Colors.grey[850], + elevation: 0, + padding: + EdgeInsets.symmetric(vertical: 12, horizontal: 4), + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.location_pin, + color: Colors.orange, + ), + Text( + 'Promień', + style: TextStyle( + color: Colors.grey[200], fontSize: 12), + ), + Text( + '600m', + style: + TextStyle(color: Colors.grey, fontSize: 10), + ) + ], + ), + ), + RaisedButton( + color: Colors.grey[850], + elevation: 0, + padding: + EdgeInsets.symmetric(vertical: 12, horizontal: 4), + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.map_rounded, + color: Colors.orange, + ), + Text( + 'Kuchnia', + style: TextStyle( + color: Colors.grey[200], fontSize: 12), + ), + Text( + 'Wszystkie', + style: + TextStyle(color: Colors.grey, fontSize: 10), + ) + ], + ), + ), + RaisedButton( + color: Colors.grey[850], + elevation: 0, + padding: + EdgeInsets.symmetric(vertical: 12, horizontal: 4), + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.filter_list_alt, + color: Colors.orange, + ), + Text( + 'Filtry', + style: TextStyle( + color: Colors.grey[200], fontSize: 12), + ), + Text( + 'Brak', + style: + TextStyle(color: Colors.grey, fontSize: 10), + ) + ], + ), + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.grey[700] + ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -77,12 +170,9 @@ class MapViewState extends State { Icons.search_rounded, color: Colors.orange, ), - SizedBox( - width: 8, - ), Text( 'Znaleziono: ${data.markers.length}', - style: TextStyle(color: Colors.white), + style: TextStyle(color: Colors.white, fontSize: 12), ), ], ), @@ -104,26 +194,22 @@ class MapViewState extends State { decoration: BoxDecoration(color: Colors.grey[850]), child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ RaisedButton( color: Colors.grey[850], elevation: 0, - padding: - EdgeInsets.symmetric(vertical: 12, horizontal: 4), - onPressed: () { - Navigator.pop(context); - }, + padding: EdgeInsets.all(8), + onPressed: () {}, child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( - Icons.arrow_back, + Icons.home_rounded, color: Colors.orange, ), Text( - 'Cofnij', - style: TextStyle( - color: Colors.grey[200], fontSize: 12), + 'Szukaj', + style: TextStyle(color: Colors.grey[200], fontSize: 12), ) ], ), @@ -131,27 +217,18 @@ class MapViewState extends State { RaisedButton( color: Colors.grey[850], elevation: 0, - padding: - EdgeInsets.symmetric(vertical: 12, horizontal: 4), - onPressed: () { - Navigator.pop(context); - }, + padding: EdgeInsets.all(8), + onPressed: () {}, child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( - Icons.location_pin, + Icons.note_rounded, color: Colors.orange, ), Text( - 'Promień', - style: TextStyle( - color: Colors.grey[200], fontSize: 12), - ), - Text( - '600m', - style: - TextStyle(color: Colors.grey, fontSize: 10), + 'Zamówienie', + style: TextStyle(color: Colors.grey[200], fontSize: 12), ) ], ), @@ -159,27 +236,18 @@ class MapViewState extends State { RaisedButton( color: Colors.grey[850], elevation: 0, - padding: - EdgeInsets.symmetric(vertical: 12, horizontal: 4), - onPressed: () { - Navigator.pop(context); - }, + padding: EdgeInsets.all(8), + onPressed: () {}, child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( - Icons.map_rounded, + Icons.favorite_rounded, color: Colors.orange, ), Text( - 'Kuchnia', - style: TextStyle( - color: Colors.grey[200], fontSize: 12), - ), - Text( - 'Wszystkie', - style: - TextStyle(color: Colors.grey, fontSize: 10), + 'Ulubione', + style: TextStyle(color: Colors.grey[200], fontSize: 12), ) ], ), @@ -187,31 +255,24 @@ class MapViewState extends State { RaisedButton( color: Colors.grey[850], elevation: 0, - padding: - EdgeInsets.symmetric(vertical: 12, horizontal: 4), + padding: EdgeInsets.all(8), onPressed: () { - Navigator.pop(context); + //showSettings(context); }, child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( - Icons.filter_list_alt, + Icons.settings, color: Colors.orange, ), Text( - 'Filtry', - style: TextStyle( - color: Colors.grey[200], fontSize: 12), - ), - Text( - 'Brak', - style: - TextStyle(color: Colors.grey, fontSize: 10), + 'Ustawienia', + style: TextStyle(color: Colors.grey[200], fontSize: 12), ) ], ), - ), + ) ], ), ), diff --git a/lib/settings.dart b/lib/settings.dart index 07d959a..f3500fa 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -83,4 +83,27 @@ class MenuiSettings { return "Nie"; } } + + // ADD DISH TO ORDER --- TODO + void addToOrder(String id) async{ + final settings = await SharedPreferences.getInstance(); + if(settings.containsKey('order')){ + List order = settings.getStringList('order'); + order.add(id); + } else { + final List order = new List(); + order.add(id); + } + } + + // GET ORDER + Future> getOrder() async{ + final settings = await SharedPreferences.getInstance(); + if(settings.containsKey('order')){ + List order = settings.getStringList('order'); + return order; + } else { + return new List(); + } + } }