Map / Order mechanics

This commit is contained in:
2021-01-04 19:24:15 +01:00
parent b42d60c683
commit 482628b674
3 changed files with 161 additions and 58 deletions

View File

@@ -52,6 +52,25 @@ class HomePage extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange,
),
Text(
'Szukaj',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[850],
elevation: 0, elevation: 0,

View File

@@ -61,73 +61,17 @@ class MapViewState extends State<MapView> {
child = Column( child = Column(
children: <Widget>[ children: <Widget>[
Container( Container(
height: 70,
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[850]),
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: 40, height: 20,
),
Container(
height: 30,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.search_rounded,
color: Colors.orange,
),
SizedBox(
width: 8,
),
Text(
'Znaleziono: ${data.markers.length}',
style: TextStyle(color: Colors.white),
),
],
),
)
],
),
),
Expanded(
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: _initialPosition,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
markers: Set<Marker>.of(data.markers.values),
),
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[850]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ 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: <Widget>[
Icon(
Icons.arrow_back,
color: Colors.orange,
),
Text(
'Cofnij',
style: TextStyle(
color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[850],
elevation: 0, elevation: 0,
@@ -215,6 +159,123 @@ class MapViewState extends State<MapView> {
], ],
), ),
), ),
Container(
decoration: BoxDecoration(
color: Colors.grey[700]
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.search_rounded,
color: Colors.orange,
),
Text(
'Znaleziono: ${data.markers.length}',
style: TextStyle(color: Colors.white, fontSize: 12),
),
],
),
)
],
),
),
Expanded(
child: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: _initialPosition,
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
markers: Set<Marker>.of(data.markers.values),
),
),
Container(
decoration: BoxDecoration(color: Colors.grey[850]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange,
),
Text(
'Szukaj',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.note_rounded,
color: Colors.orange,
),
Text(
'Zamówienie',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
Text(
'Ulubione',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {
//showSettings(context);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
)
],
),
),
], ],
); );
} else if (snapshot.hasError) { } else if (snapshot.hasError) {

View File

@@ -83,4 +83,27 @@ class MenuiSettings {
return "Nie"; return "Nie";
} }
} }
// ADD DISH TO ORDER --- TODO
void addToOrder(String id) async{
final settings = await SharedPreferences.getInstance();
if(settings.containsKey('order')){
List<String> order = settings.getStringList('order');
order.add(id);
} else {
final List<String> order = new List<String>();
order.add(id);
}
}
// GET ORDER
Future<List<String>> getOrder() async{
final settings = await SharedPreferences.getInstance();
if(settings.containsKey('order')){
List<String> order = settings.getStringList('order');
return order;
} else {
return new List<String>();
}
}
} }