Redesigned

This commit is contained in:
2021-01-07 20:42:12 +01:00
parent 204a77b89f
commit c75420a29e
16 changed files with 881 additions and 1028 deletions

View File

@@ -62,23 +62,23 @@ class DishList extends StatelessWidget {
Positioned.fill( Positioned.fill(
bottom: 20, bottom: 20,
child: Align( child: Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: FloatingActionButton.extended( child: RaisedButton.icon(
backgroundColor: Colors.grey[900], splashColor: Colors.orange,
onPressed: () { elevation: 5,
Navigator.pop(context); shape: RoundedRectangleBorder(
}, borderRadius: BorderRadius.circular(25)),
icon: Icon( color: Colors.grey[900],
Icons.keyboard_arrow_down_rounded, icon: Icon(
color: Colors.orange, Icons.keyboard_arrow_down_rounded,
), color: Colors.orange,
label: Text( ),
'Zamknij', label: Text(
style: "Zwiń",
TextStyle(color: Colors.white, fontWeight: FontWeight.w400), style: TextStyle(color: Colors.white),
), ),
), onPressed: () => Navigator.pop(context),
)) )))
]); ]);
} }
@@ -92,61 +92,3 @@ class DishList extends StatelessWidget {
return result; return result;
} }
} }
/*
class DishList extends StatelessWidget {
final String id;
final List<String> categories;
DishList({@required this.id, @required this.categories});
final MenuiServices services = new MenuiServices();
@override
Widget build(BuildContext context) {
return ListView(children: [
FutureBuilder<List<Dish>>(
future: services.fetchAllDishes(id),
builder: (BuildContext context, AsyncSnapshot<List<Dish>> snapshot) {
if (snapshot.hasData) {
final List<Dish> dishes = snapshot.data;
return ListView.builder(
controller: ScrollController(),
shrinkWrap: true,
itemCount: categories.length,
itemBuilder: (context, index) {
final filteredDishes =
filterDishesByCategory(dishes, categories[index]);
return ExpansionTile(
leading: Icon(
Icons.fastfood_rounded,
color: Colors.orange,
),
title: Text(
categories[index],
style: TextStyle(color: Colors.grey[300]),
),
children: <Widget>[
ListView.builder(
primary: false,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: filteredDishes.length,
itemBuilder: (context, index) {
return Container(
child: DishCard(dish: filteredDishes[index]),
);
},
)
],
);
},
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
}),
]);
} */

View File

@@ -2,232 +2,270 @@ import 'package:flutter/material.dart';
import 'package:menui_mobile/services.dart'; import 'package:menui_mobile/services.dart';
import 'lineOfAllergens.dart'; import 'lineOfAllergens.dart';
import 'iconChip.dart'; import 'iconChip.dart';
import 'orderView.dart';
import 'favoritesView.dart';
import '../settings.dart';
import 'homeScreen.dart';
import 'package:share/share.dart';
import 'menuiButton.dart';
class DishView extends StatelessWidget { class DishView extends StatelessWidget {
final Dish dish; final Dish dish;
DishView({@required this.dish}); DishView({@required this.dish});
final MenuiSettings settings = new MenuiSettings();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[850]),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
Column( Column(
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: NetworkImage( image: NetworkImage(
dish.imgUrl, dish.imgUrl,
),
fit: BoxFit.cover),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 160,
width: double.infinity,
), ),
Container( fit: BoxFit.cover),
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[850],
borderRadius:
BorderRadius.all(Radius.circular(8))),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.restaurant,
color: Colors.orange,
),
SizedBox(
width: 8,
),
Text(
dish.name,
style: TextStyle(
fontSize: 24,
color: Colors.white,
fontWeight: FontWeight.w300),
),
],
),
margin: EdgeInsets.all(12),
)
],
),
), ),
SizedBox( child: Column(
height: 6, crossAxisAlignment: CrossAxisAlignment.start,
),
if (dish.allergens.hasAllergens()) SizedBox(height: 8),
if (dish.allergens.hasAllergens())
Text(
'Może zawierać',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
Allergens(allergens: dish.allergens),
if (dish.allergens.hasAllergens())
Divider(
height: 14,
thickness: 4,
),
SizedBox(
height: 8,
),
Prices(prices: dish.prices),
SizedBox(
height: 8,
),
Divider(
height: 14,
thickness: 4,
),
SizedBox(
height: 6,
),
Text(
'Składniki',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Text(
'${dish.ingredients}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
textAlign: TextAlign.center,
),
),
SizedBox(
height: 6,
),
Divider(
height: 14,
thickness: 4,
),
SizedBox(
height: 6,
),
Wrap(
spacing: 10,
children: <Widget>[ children: <Widget>[
IconChip( SizedBox(
icon: Icons.battery_charging_full, height: 160,
leading: "Wartość energetyczna", width: double.infinity,
value: (() { ),
if (dish.kCal != "") { Container(
return dish.kCal + " kcal"; padding: EdgeInsets.all(12),
} else { decoration: BoxDecoration(
return ""; color: Colors.grey[900],
} borderRadius:
}())), BorderRadius.all(Radius.circular(8))),
IconChip( child: Row(
icon: Icons.cake, mainAxisSize: MainAxisSize.min,
leading: "Indeks glikemiczny", children: <Widget>[
value: dish.glicemicIndex), Icon(
Icons.restaurant,
color: Colors.orange,
),
SizedBox(
width: 8,
),
Text(
dish.name,
style: TextStyle(
fontSize: 24,
color: Colors.white,
fontWeight: FontWeight.w300),
),
],
),
margin: EdgeInsets.all(12),
)
], ],
), ),
SizedBox( ),
height: 12, SizedBox(
height: 6,
),
if (dish.allergens.hasAllergens()) SizedBox(height: 8),
if (dish.allergens.hasAllergens())
Text(
'Może zawierać',
style: TextStyle(color: Colors.orange, fontSize: 14),
), ),
if (dish.notes != "") Allergens(allergens: dish.allergens),
Text( if (dish.allergens.hasAllergens())
'Uwagi', Divider(
style: TextStyle(color: Colors.orange, fontSize: 14), height: 14,
), thickness: 4,
SizedBox(
height: 12,
), ),
if (dish.notes != "") SizedBox(
Text( height: 8,
'${dish.notes}', ),
style: TextStyle(color: Colors.grey[200], fontSize: 12), Prices(prices: dish.prices),
), SizedBox(
if (dish.vegan) height: 8,
Row( ),
mainAxisAlignment: MainAxisAlignment.center, Divider(
children: [ height: 14,
Icon( thickness: 4,
Icons.info_rounded, ),
color: Colors.grey, SizedBox(
), height: 6,
SizedBox( ),
width: 6, Text(
), 'Składniki',
Text( style: TextStyle(color: Colors.orange, fontSize: 14),
'Danie wegańskie', ),
style: TextStyle( SizedBox(
color: Colors.grey[200], fontSize: 12), height: 12,
), ),
], Padding(
), padding: EdgeInsets.symmetric(horizontal: 12),
if (dish.vegetarian) child: Text(
Row( '${dish.ingredients}',
mainAxisAlignment: MainAxisAlignment.center, style: TextStyle(color: Colors.grey[200], fontSize: 12),
children: [ textAlign: TextAlign.center,
Icon( ),
Icons.info_rounded, ),
color: Colors.grey, SizedBox(
), height: 6,
SizedBox( ),
width: 6, Divider(
), height: 14,
Text( thickness: 4,
'Danie wegetariańskie', ),
style: TextStyle( SizedBox(
color: Colors.grey[200], fontSize: 12), height: 6,
), ),
], Wrap(
), spacing: 10,
], children: <Widget>[
), IconChip(
SizedBox( icon: Icons.battery_charging_full,
height: 28, leading: "Wartość energetyczna",
) value: (() {
], if (dish.kCal != "") {
)), return dish.kCal + " kcal";
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, } else {
floatingActionButton: Stack( return "";
}
}())),
IconChip(
icon: Icons.cake,
leading: "Indeks glikemiczny",
value: dish.glicemicIndex),
],
),
SizedBox(
height: 12,
),
if (dish.notes != "")
Text(
'Uwagi',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
if (dish.notes != "")
Text(
'${dish.notes}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
if (dish.vegan)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.info_rounded,
color: Colors.grey,
),
SizedBox(
width: 6,
),
Text(
'Danie wegańskie',
style:
TextStyle(color: Colors.grey[200], fontSize: 12),
),
],
),
if (dish.vegetarian)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.info_rounded,
color: Colors.grey,
),
SizedBox(
width: 6,
),
Text(
'Danie wegetariańskie',
style:
TextStyle(color: Colors.grey[200], fontSize: 12),
),
],
),
],
),
SizedBox(
height: 28,
)
],
)),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Align( MenuiButton(
alignment: Alignment.bottomLeft, color: Colors.orange,
child: Padding( icon: Icons.home_rounded,
padding: EdgeInsets.only(left: 18), text: "Szukaj",
child: FloatingActionButton( onPressed: () => Navigator.push(
heroTag: null, context, MaterialPageRoute(builder: (context) => HomePage())),
backgroundColor: Colors.grey[900], ),
child: Icon( MenuiButton(
Icons.arrow_back_rounded, color: Colors.orange,
color: Colors.orange, icon: Icons.note_rounded,
), text: "Zamównienie",
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.push(context,
), MaterialPageRoute(builder: (context) => OrderView())),
), ),
MenuiButton(
color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.settings,
text: "Ustawienia",
onPressed: () {
showSettings(context, settings);
},
), ),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: EdgeInsets.only(right: 18),
child: FloatingActionButton(
heroTag: null,
backgroundColor: Colors.grey[900],
child: Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
onPressed: () {},
),
),
)
], ],
)); ),
),
appBar: AppBar(
backgroundColor: Colors.grey[900],
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
),
actions: [
MenuiButton(
color: Colors.grey,
icon: Icons.share_rounded,
text: "Udostępnij",
onPressed: () => Share.share('https://www.menui.pl/dish/${dish.id}',
subject: '${dish.name}'),
),
MenuiButton(
color: Colors.grey,
icon: Icons.note_add_rounded,
text: "Do zamówienia",
onPressed: () {
settings.addToOrder(dish.id);
},
),
],
),
);
} }
} }

View File

@@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
import '../settings.dart';
import 'menuiButton.dart';
class FavoriteButton extends StatefulWidget {
final String id;
FavoriteButton({@required this.id, Key key}) : super(key: key);
@override
_FavoriteButtonState createState() => _FavoriteButtonState();
}
class _FavoriteButtonState extends State<FavoriteButton> {
final MenuiSettings settings = new MenuiSettings();
Future<bool> isInFavorites;
bool inFavorites = false;
@override
void initState() {
super.initState();
isInFavorites = settings.isInFavorites(widget.id);
}
@override
Widget build(BuildContext context) => FutureBuilder(
initialData: false,
future: isInFavorites,
builder: (context, snapshot) {
if (snapshot.hasData) {
inFavorites = snapshot.data;
if (inFavorites) {
return MenuiButton(
color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Usuń",
onPressed: () {
settings.addToFavorites(widget.id);
setState(() {
isInFavorites = settings.isInFavorites(widget.id);
});
},
);
} else {
return MenuiButton(
color: Colors.grey,
icon: Icons.favorite_rounded,
text: "Dodaj",
onPressed: () {
settings.addToFavorites(widget.id);
setState(() {
isInFavorites = settings.isInFavorites(widget.id);
});
},
);
}
} else {
return MenuiButton(
color: Colors.grey,
icon: Icons.favorite_rounded,
text: "Dodaj",
onPressed: () {},
);
}
},
);
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../settings.dart'; import '../settings.dart';
import 'homeScreen.dart'; import 'homeScreen.dart';
import 'orderView.dart'; import 'orderView.dart';
import 'menuiButton.dart';
class FavoritesView extends StatelessWidget { class FavoritesView extends StatelessWidget {
final settings = new MenuiSettings(); final settings = new MenuiSettings();
@@ -16,19 +17,19 @@ class FavoritesView extends StatelessWidget {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[900],
elevation: 0, elevation: 0,
padding: padding:
EdgeInsets.symmetric(vertical: 12, horizontal: 4), EdgeInsets.symmetric(vertical: 12, horizontal: 4),
@@ -45,7 +46,9 @@ class FavoritesView extends StatelessWidget {
Text( Text(
'Cofnij', 'Cofnij',
style: TextStyle( style: TextStyle(
color: Colors.grey[200], fontSize: 12), color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
) )
], ],
), ),
@@ -64,90 +67,38 @@ class FavoritesView extends StatelessWidget {
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container( floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.home_rounded,
padding: EdgeInsets.all(8), text: "Szukaj",
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())), context, MaterialPageRoute(builder: (context) => HomePage())),
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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.note_rounded,
padding: EdgeInsets.all(8), text: "Zamównienie",
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())), MaterialPageRoute(builder: (context) => OrderView())),
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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.favorite_rounded,
padding: EdgeInsets.all(8), text: "Ulubione",
onPressed: () {}, 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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.settings,
padding: EdgeInsets.all(8), text: "Ustawienia",
onPressed: () { onPressed: () {
showSettings(context, settings); showSettings(context, settings);
}, },
child: Column( ),
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
)
], ],
), ),
), ),

View File

@@ -4,6 +4,7 @@ import '../settings.dart';
import 'mapView.dart'; import 'mapView.dart';
import 'orderView.dart'; import 'orderView.dart';
import 'favoritesView.dart'; import 'favoritesView.dart';
import 'menuiButton.dart';
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
final MenuiSettings settings = new MenuiSettings(); final MenuiSettings settings = new MenuiSettings();
@@ -29,7 +30,7 @@ class HomePage extends StatelessWidget {
style: TextStyle(color: Colors.grey[500]), style: TextStyle(color: Colors.grey[500]),
), ),
RaisedButton.icon( RaisedButton.icon(
color: Colors.grey[850], color: Colors.grey[900],
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => MapView())), MaterialPageRoute(builder: (context) => MapView())),
icon: Icon( icon: Icon(
@@ -38,7 +39,7 @@ class HomePage extends StatelessWidget {
), ),
label: Text( label: Text(
'Pokaż w pobliżu', 'Pokaż w pobliżu',
style: TextStyle(color: Colors.grey[400]), style: TextStyle(color: Colors.grey[300]),
), ),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)), borderRadius: BorderRadius.circular(50)),
@@ -49,102 +50,38 @@ class HomePage extends StatelessWidget {
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container( floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.home_rounded,
padding: EdgeInsets.all(8), text: "Szukaj",
onPressed: () {}, 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,
fontWeight: FontWeight.w400),
)
],
),
), ),
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.note_rounded,
padding: EdgeInsets.all(8), text: "Zamównienie",
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())), MaterialPageRoute(builder: (context) => OrderView())),
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,
fontWeight: FontWeight.w400),
)
],
),
), ),
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.favorite_rounded,
padding: EdgeInsets.all(8), text: "Ulubione",
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())), MaterialPageRoute(builder: (context) => FavoritesView())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
Text(
'Ulubione',
style: TextStyle(
color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
)
],
),
), ),
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.settings,
padding: EdgeInsets.all(8), text: "Ustawienia",
onPressed: () { onPressed: () {
showSettings(context, settings); showSettings(context, settings);
}, },
child: Column( ),
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(
color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
)
],
),
)
], ],
), ),
), ),

View File

@@ -1,9 +1,13 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:menui_mobile/settings.dart';
import '../services.dart'; import '../services.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'restaurantView.dart'; import 'restaurantView.dart';
import 'menuiButton.dart';
import 'orderView.dart';
import 'favoritesView.dart';
class MapView extends StatefulWidget { class MapView extends StatefulWidget {
@override @override
@@ -13,6 +17,7 @@ class MapView extends StatefulWidget {
class MapViewState extends State<MapView> { class MapViewState extends State<MapView> {
Completer<GoogleMapController> _controller = Completer(); Completer<GoogleMapController> _controller = Completer();
MenuiServices services = new MenuiServices(); MenuiServices services = new MenuiServices();
final MenuiSettings settings = new MenuiSettings();
Position position; Position position;
Future<MarkersAndLocation> createMarkers() async { Future<MarkersAndLocation> createMarkers() async {
@@ -68,15 +73,15 @@ class MapViewState extends State<MapView> {
height: 20, height: 20,
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[900],
elevation: 0, elevation: 0,
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 12, horizontal: 4), vertical: 12, horizontal: 4),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
@@ -90,21 +95,23 @@ class MapViewState extends State<MapView> {
Text( Text(
'Promień', 'Promień',
style: TextStyle( style: TextStyle(
color: Colors.grey[200], fontSize: 12), color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
), ),
Text( Text(
'600m', '600m',
style: style: TextStyle(
TextStyle(color: Colors.grey, fontSize: 10), color: Colors.grey, fontSize: 10),
) )
], ],
), ),
), ),
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[900],
elevation: 0, elevation: 0,
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 12, horizontal: 4), vertical: 12, horizontal: 4),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
@@ -118,21 +125,23 @@ class MapViewState extends State<MapView> {
Text( Text(
'Kuchnia', 'Kuchnia',
style: TextStyle( style: TextStyle(
color: Colors.grey[200], fontSize: 12), color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
), ),
Text( Text(
'Wszystkie', 'Wszystkie',
style: style: TextStyle(
TextStyle(color: Colors.grey, fontSize: 10), color: Colors.grey, fontSize: 10),
) )
], ],
), ),
), ),
RaisedButton( RaisedButton(
color: Colors.grey[850], color: Colors.grey[900],
elevation: 0, elevation: 0,
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(vertical: 12, horizontal: 4), vertical: 12, horizontal: 4),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
@@ -146,12 +155,14 @@ class MapViewState extends State<MapView> {
Text( Text(
'Filtry', 'Filtry',
style: TextStyle( style: TextStyle(
color: Colors.grey[200], fontSize: 12), color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
), ),
Text( Text(
'Brak', 'Brak',
style: style: TextStyle(
TextStyle(color: Colors.grey, fontSize: 10), color: Colors.grey, fontSize: 10),
) )
], ],
), ),
@@ -160,9 +171,7 @@ class MapViewState extends State<MapView> {
), ),
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(color: Colors.grey[800]),
color: Colors.grey[700]
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -172,7 +181,8 @@ class MapViewState extends State<MapView> {
), ),
Text( Text(
'Znaleziono: ${data.markers.length}', 'Znaleziono: ${data.markers.length}',
style: TextStyle(color: Colors.white, fontSize: 12), style:
TextStyle(color: Colors.white, fontSize: 12),
), ),
], ],
), ),
@@ -191,88 +201,42 @@ class MapViewState extends State<MapView> {
), ),
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.home_rounded,
padding: EdgeInsets.all(8), text: "Szukaj",
onPressed: () {}, onPressed: () => Navigator.pop(context),
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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.note_rounded,
padding: EdgeInsets.all(8), text: "Zamównienie",
onPressed: () {}, onPressed: () => Navigator.push(
child: Column( context,
mainAxisSize: MainAxisSize.min, MaterialPageRoute(
children: <Widget>[ builder: (context) => OrderView())),
Icon(
Icons.note_rounded,
color: Colors.orange,
),
Text(
'Zamówienie',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
), ),
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.favorite_rounded,
padding: EdgeInsets.all(8), text: "Ulubione",
onPressed: () {}, onPressed: () => Navigator.push(
child: Column( context,
mainAxisSize: MainAxisSize.min, MaterialPageRoute(
children: <Widget>[ builder: (context) => FavoritesView())),
Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
Text(
'Ulubione',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
), ),
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.settings,
padding: EdgeInsets.all(8), text: "Ustawienia",
onPressed: () { onPressed: () {
//showSettings(context); showSettings(context, settings);
}, },
child: Column( ),
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
)
], ],
), ),
), ),

View File

@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
class MenuiButton extends StatelessWidget {
final Color color;
final String text;
final IconData icon;
final Function onPressed;
MenuiButton(
{@required this.color,
@required this.icon,
@required this.text,
@required this.onPressed});
@override
Widget build(BuildContext context) {
return RaisedButton(
splashColor: Colors.orange,
color: Colors.grey[900],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: onPressed,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
icon,
color: color,
),
Text(
text,
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
);
}
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../settings.dart'; import '../settings.dart';
import 'homeScreen.dart'; import 'homeScreen.dart';
import 'favoritesView.dart'; import 'favoritesView.dart';
import 'menuiButton.dart';
class OrderView extends StatelessWidget { class OrderView extends StatelessWidget {
final settings = new MenuiSettings(); final settings = new MenuiSettings();
@@ -23,57 +24,25 @@ class OrderView extends StatelessWidget {
height: 20, height: 20,
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, onPressed: () => Navigator.pop(context),
padding: text: "Cofnij",
EdgeInsets.symmetric(vertical: 12, horizontal: 4), icon: Icons.arrow_back_rounded,
onPressed: () {
Navigator.pop(context);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.arrow_back_rounded,
color: Colors.orange,
),
Text(
'Cofnij',
style: TextStyle(
color: Colors.grey[200], fontSize: 12),
)
],
),
), ),
Row( Row(
children: [ children: [
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0,
padding: EdgeInsets.symmetric(
vertical: 12, horizontal: 4),
onPressed: () { onPressed: () {
settings.clearOrder(); settings.clearOrder();
}, },
child: Column( text: "Wyczyść",
mainAxisSize: MainAxisSize.min, icon: Icons.delete_forever_rounded,
children: <Widget>[
Icon(
Icons.delete_forever_rounded,
color: Colors.orange,
),
Text(
'Wyczyść',
style: TextStyle(
color: Colors.grey[200], fontSize: 12),
),
],
),
), ),
], ],
) )
@@ -81,7 +50,7 @@ class OrderView extends StatelessWidget {
), ),
), ),
Container( Container(
decoration: BoxDecoration(color: Colors.grey[700]), decoration: BoxDecoration(color: Colors.grey[800]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@@ -104,90 +73,38 @@ class OrderView extends StatelessWidget {
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container( floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.home_rounded,
padding: EdgeInsets.all(8), text: "Szukaj",
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())), context, MaterialPageRoute(builder: (context) => HomePage())),
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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.note_rounded,
padding: EdgeInsets.all(8), text: "Zamównienie",
onPressed: () {}, 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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.favorite_rounded,
padding: EdgeInsets.all(8), text: "Ulubione",
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())), MaterialPageRoute(builder: (context) => FavoritesView())),
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( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.settings,
padding: EdgeInsets.all(8), text: "Ustawienia",
onPressed: () { onPressed: () {
showSettings(context, settings); showSettings(context, settings);
}, },
child: Column( ),
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
)
], ],
), ),
), ),

View File

@@ -37,80 +37,79 @@ class RestaurantCard extends StatelessWidget {
padding: EdgeInsets.only(right: 8), padding: EdgeInsets.only(right: 8),
), ),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
Text( children: <Widget>[
restaurant.name, Padding(
overflow: TextOverflow.ellipsis, padding: EdgeInsets.only(bottom: 4),
maxLines: 1, child: Text(
style: TextStyle(color: Colors.orange[600], fontSize: 16), restaurant.name,
), overflow: TextOverflow.ellipsis,
Container( maxLines: 1,
child: Column( style:
mainAxisSize: MainAxisSize.min, TextStyle(color: Colors.orange[600], fontSize: 14),
crossAxisAlignment: CrossAxisAlignment.start, ),
children: <Widget>[ ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.location_city, Icons.location_city,
size: 14, size: 14,
color: Colors.white, color: Colors.white,
),
Padding(
padding: EdgeInsets.only(left: 4),
child: Text(
'${restaurant.city}, ${restaurant.adress}',
style:
TextStyle(color: Colors.grey, fontSize: 11),
), ),
Padding( ),
padding: EdgeInsets.only(left: 4), ]),
child: Text( Row(
'${restaurant.city}, ${restaurant.adress}', crossAxisAlignment: CrossAxisAlignment.center,
style: children: <Widget>[
TextStyle(color: Colors.grey, fontSize: 12), Icon(
), Icons.restaurant,
size: 14,
color: Colors.white,
),
Padding(
padding: EdgeInsets.only(left: 4),
child: Text(
'${restaurant.type}',
style:
TextStyle(color: Colors.grey, fontSize: 11),
), ),
]), ),
Row( ]),
crossAxisAlignment: CrossAxisAlignment.center, Row(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.center,
Icon( children: <Widget>[
Icons.restaurant, Icon(
size: 14, Icons.timer,
color: Colors.white, size: 14,
color: Colors.white,
),
Padding(
padding: EdgeInsets.only(left: 4),
child: Text(
'$_openHours',
style:
TextStyle(color: Colors.grey, fontSize: 11),
), ),
Padding( ),
padding: EdgeInsets.only(left: 4), ]),
child: Text( Padding(
'${restaurant.type}', padding: EdgeInsets.only(top: 2),
style: child: LineOfIconsSmall(tags: restaurant.tags),
TextStyle(color: Colors.grey, fontSize: 12), )
), ],
), ),
]), ),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.timer,
size: 14,
color: Colors.white,
),
Padding(
padding: EdgeInsets.only(left: 4),
child: Text(
'$_openHours',
style:
TextStyle(color: Colors.grey, fontSize: 12),
),
),
]),
Padding(
child: LineOfIconsSmall(tags: restaurant.tags),
padding: EdgeInsets.only(top: 4),
)
],
)),
],
)),
Container( Container(
child: Icon( child: Icon(
Icons.arrow_right, Icons.arrow_right,
@@ -121,8 +120,8 @@ class RestaurantCard extends StatelessWidget {
], ],
), ),
), ),
color: Color.fromRGBO(50, 50, 50, 0.8), color: Colors.grey[900],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(11)),
margin: EdgeInsets.symmetric(horizontal: 12), margin: EdgeInsets.symmetric(horizontal: 12),
), ),
); );

View File

@@ -1,6 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:menui_mobile/settings.dart';
import 'orderView.dart';
import 'favoritesView.dart';
import 'homeScreen.dart';
import 'menuiButton.dart';
class RestaurantMapView extends StatefulWidget { class RestaurantMapView extends StatefulWidget {
final List coordinates; final List coordinates;
@@ -15,6 +20,7 @@ class RestaurantMapView extends StatefulWidget {
} }
class RestaurantMapViewState extends State<RestaurantMapView> { class RestaurantMapViewState extends State<RestaurantMapView> {
final MenuiSettings settings = new MenuiSettings();
Completer<GoogleMapController> _controller = Completer(); Completer<GoogleMapController> _controller = Completer();
Map<MarkerId, Marker> markers = <MarkerId, Marker>{}; Map<MarkerId, Marker> markers = <MarkerId, Marker>{};
@@ -43,20 +49,54 @@ class RestaurantMapViewState extends State<RestaurantMapView> {
}, },
markers: Set<Marker>.of(markers.values), markers: Set<Marker>.of(markers.values),
), ),
floatingActionButton: Padding( floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
padding: EdgeInsets.only(bottom: 20), floatingActionButton: Container(
child: FloatingActionButton( decoration: BoxDecoration(color: Colors.grey[900]),
backgroundColor: Colors.grey[800], child: Row(
onPressed: () { mainAxisAlignment: MainAxisAlignment.center,
Navigator.pop(context); children: <Widget>[
}, MenuiButton(
child: Icon( color: Colors.orange,
Icons.arrow_back_outlined, icon: Icons.home_rounded,
color: Colors.orange, text: "Szukaj",
), onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.settings,
text: "Ustawienia",
onPressed: () {
showSettings(context, settings);
},
),
],
),
),
appBar: AppBar(
backgroundColor: Colors.grey[900],
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
), ),
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.startDocked,
); );
} }
} }

View File

@@ -8,30 +8,36 @@ import 'orderView.dart';
import 'favoritesView.dart'; import 'favoritesView.dart';
import '../settings.dart'; import '../settings.dart';
import 'homeScreen.dart'; import 'homeScreen.dart';
import 'package:share/share.dart';
import 'favoriteButton.dart';
import 'menuiButton.dart';
class RestaurantView extends StatelessWidget { class RestaurantView extends StatefulWidget {
final String id; final String id;
RestaurantView({@required this.id, Key key}) : super(key: key);
_RestaurantViewState createState() => _RestaurantViewState();
}
class _RestaurantViewState extends State<RestaurantView> {
final MenuiServices services = new MenuiServices(); final MenuiServices services = new MenuiServices();
final MenuiSettings settings = new MenuiSettings(); final MenuiSettings settings = new MenuiSettings();
Restaurant restaurant = new Restaurant.empty();
RestaurantView({@required this.id});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
services.fetchAllDishes(id);
List<String> categories = []; List<String> categories = [];
Restaurant restaurant; return FutureBuilder<Restaurant>(
return Scaffold( future: services.fetchRestaurant(widget.id),
body: Container( builder: (BuildContext context, AsyncSnapshot<Restaurant> snapshot) {
decoration: BoxDecoration(color: Colors.grey[850]), if (snapshot.hasData) {
child: FutureBuilder<Restaurant>( restaurant = snapshot.data;
future: services.fetchRestaurant(id), categories = restaurant.categories;
builder: return Scaffold(
(BuildContext context, AsyncSnapshot<Restaurant> snapshot) { body: Container(
if (snapshot.hasData) { decoration: BoxDecoration(color: Colors.grey[850]),
restaurant = snapshot.data; child: ListView(
categories = restaurant.categories;
return ListView(
children: [ children: [
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@@ -55,7 +61,7 @@ class RestaurantView extends StatelessWidget {
Container( Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[850], color: Colors.grey[900],
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(8))), Radius.circular(8))),
child: Column( child: Column(
@@ -171,204 +177,130 @@ class RestaurantView extends StatelessWidget {
], ],
) )
], ],
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
},
)),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: 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: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange,
),
Text(
'Szukaj',
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.note_rounded,
color: Colors.orange,
),
Text(
'Zamówienie',
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
Text(
'Ulubione',
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {
showSettings(context, settings);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
)
],
),
),
appBar: AppBar(
backgroundColor: Colors.grey[850],
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
),
actions: [
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RestaurantMapView(
coordinates: restaurant.coordinates,
name: restaurant.name,
type: restaurant.type,
))),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.map_rounded,
color: Colors.orange,
), ),
Text( ),
'Mapa', floatingActionButtonLocation:
style: TextStyle( FloatingActionButtonLocation.centerDocked,
color: Colors.grey[200], floatingActionButton: Column(
fontSize: 10, mainAxisSize: MainAxisSize.min,
fontWeight: FontWeight.w400), children: <Widget>[
) Padding(
], padding: EdgeInsets.only(bottom: 4),
), child: Row(
), mainAxisAlignment: MainAxisAlignment.center,
RaisedButton( children: <Widget>[
color: Colors.grey[850], RaisedButton.icon(
elevation: 0, splashColor: Colors.orange,
padding: EdgeInsets.all(8), elevation: 5,
onPressed: () => Navigator.push( shape: RoundedRectangleBorder(
context, MaterialPageRoute(builder: (context) => OrderView())), borderRadius: BorderRadius.circular(25)),
child: Column( color: Colors.grey[900],
mainAxisSize: MainAxisSize.min, icon: Icon(
children: <Widget>[ Icons.keyboard_arrow_up_rounded,
Icon( color: Colors.orange,
Icons.share_rounded, ),
color: Colors.orange, label: Text(
"Karta dań",
style: TextStyle(color: Colors.white),
),
onPressed: () =>
showMenu(context, restaurant.categories),
)
],
),
),
Container(
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MenuiButton(
color: Colors.orange,
icon: Icons.home_rounded,
text: "Szukaj",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrderView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FavoritesView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.settings,
text: "Ustawienia",
onPressed: () {
showSettings(context, settings);
},
),
],
),
),
],
),
appBar: AppBar(
backgroundColor: Colors.grey[900],
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
), ),
Text( actions: [
'Udostępnij', MenuiButton(
style: TextStyle( color: Colors.grey,
color: Colors.grey[200], icon: Icons.map_rounded,
fontSize: 10, text: "Mapa",
fontWeight: FontWeight.w400), onPressed: () => Navigator.push(
) context,
], MaterialPageRoute(
), builder: (context) => RestaurantMapView(
), coordinates: restaurant.coordinates,
RaisedButton( name: restaurant.name,
color: Colors.grey[850], type: restaurant.type,
elevation: 0, ))),
padding: EdgeInsets.all(8), ),
onPressed: () => Navigator.push( MenuiButton(
context, MaterialPageRoute(builder: (context) => OrderView())), color: Colors.grey,
child: Column( icon: Icons.share_rounded,
mainAxisSize: MainAxisSize.min, text: "Udostępnij",
children: <Widget>[ onPressed: () => Share.share(
Icon( 'https://www.menui.pl/restaurant/${restaurant.id}',
Icons.favorite_rounded, subject: '${restaurant.name}'),
color: Colors.orange, ),
), FavoriteButton(
Text( id: restaurant.id,
'Dodaj', )
style: TextStyle( ],
color: Colors.grey[200], ),
fontSize: 10, );
fontWeight: FontWeight.w400), } else {
) return Scaffold(
], body: Container(
), decoration: BoxDecoration(color: Colors.grey[850]),
), child: Center(
], child: CircularProgressIndicator(),
), ),
); ));
}
});
} }
showMenu(BuildContext context, List<String> categories) { showMenu(BuildContext context, List<String> categories) {
@@ -380,7 +312,7 @@ class RestaurantView extends StatelessWidget {
builder: (BuildContext context) { builder: (BuildContext context) {
return DishList( return DishList(
categories: categories, categories: categories,
id: id, id: widget.id,
); );
}); });
} }
@@ -456,7 +388,7 @@ class WorkingHoursDay extends StatelessWidget {
Divider( Divider(
height: 4, height: 4,
thickness: 1, thickness: 1,
color: Colors.grey[850], color: Colors.white,
), ),
SizedBox( SizedBox(
height: 4, height: 4,

View File

@@ -2,9 +2,15 @@ import '../services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:menui_mobile/components/restaurantCard.dart'; import 'package:menui_mobile/components/restaurantCard.dart';
import 'searchBar.dart'; import 'searchBar.dart';
import 'menuiButton.dart';
import 'homeScreen.dart';
import 'orderView.dart';
import 'favoritesView.dart';
import '../settings.dart';
class SearchResults extends StatelessWidget { class SearchResults extends StatelessWidget {
final List<Restaurant> restaurants; final List<Restaurant> restaurants;
final MenuiSettings settings = new MenuiSettings();
SearchResults({@required this.restaurants}); SearchResults({@required this.restaurants});
@@ -51,88 +57,39 @@ class SearchResults extends StatelessWidget {
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container( floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[900]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.orange,
elevation: 0, icon: Icons.home_rounded,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 4), text: "Szukaj",
onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())),
),
MenuiButton(
color: Colors.orange,
icon: Icons.settings,
text: "Ustawienia",
onPressed: () { onPressed: () {
Navigator.pop(context); showSettings(context, settings);
}, },
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: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.settings,
color: Colors.orange,
),
Text(
'Ustawienia',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
)
], ],
), ),
), ),

View File

@@ -338,6 +338,15 @@ class Restaurant {
this.lunchHours, this.lunchHours,
this.lunchMenu, this.lunchMenu,
this.dishes}); this.dishes});
Restaurant.empty(
{this.adress = "",
this.city = "",
this.coordinates = const [],
this.id = "",
this.imgUrl = "",
this.name = "",
this.type = ""});
} }
class Dish { class Dish {

View File

@@ -114,9 +114,53 @@ class MenuiSettings {
final settings = await SharedPreferences.getInstance(); final settings = await SharedPreferences.getInstance();
settings.setStringList('order', new List<String>()); settings.setStringList('order', new List<String>());
} }
// ADD TO FAVORITES (OR REMOVE)
void addToFavorites(String id) async {
final settings = await SharedPreferences.getInstance();
if (settings.containsKey('favorites')) {
List<String> favorites = settings.getStringList('favorites');
if (favorites.contains(id)) {
favorites.remove(id);
settings.setStringList('favorites', favorites);
} else {
favorites.add(id);
settings.setStringList('favorites', favorites);
}
} else {
List<String> favorites = new List<String>();
favorites.add(id);
settings.setStringList('favorites', favorites);
}
}
// GET FAVORITES
Future<List<String>> getFavs() async {
final settings = await SharedPreferences.getInstance();
if (settings.containsKey('favorites')) {
return settings.getStringList('favorites');
} else {
return [];
}
}
// CHECK IF ID IS IN FAVORITES
Future<bool> isInFavorites(String id) async {
final settings = await SharedPreferences.getInstance();
if (settings.containsKey('favorites')) {
List<String> favorites = settings.getStringList('favorites');
if (favorites.contains(id)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
} }
showSettings(BuildContext context, MenuiSettings settings) async { void showSettings(BuildContext context, MenuiSettings settings) async {
FocusManager.instance.primaryFocus.unfocus(); FocusManager.instance.primaryFocus.unfocus();
final String languageCode = await settings.getLanguage(); final String languageCode = await settings.getLanguage();
final String language = settings.decodeLanguage(languageCode); final String language = settings.decodeLanguage(languageCode);

View File

@@ -163,6 +163,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.3"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7"
package_info: package_info:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -226,6 +233,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.13" version: "3.0.13"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5+4"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -21,6 +21,7 @@ environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"
dependencies: dependencies:
share: '>=0.6.5+4 <2.0.0'
http: ^0.12.2 http: ^0.12.2
geolocator: ^6.1.0 geolocator: ^6.1.0
font_awesome_flutter: ^8.10.0 font_awesome_flutter: ^8.10.0