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

@@ -63,22 +63,22 @@ class DishList extends StatelessWidget {
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)),
color: Colors.grey[900],
icon: Icon( icon: Icon(
Icons.keyboard_arrow_down_rounded, Icons.keyboard_arrow_down_rounded,
color: Colors.orange, color: Colors.orange,
), ),
label: Text( label: Text(
'Zamknij', "Zwiń",
style: style: TextStyle(color: Colors.white),
TextStyle(color: Colors.white, fontWeight: FontWeight.w400),
), ),
), 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,10 +2,17 @@ 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) {
@@ -34,7 +41,7 @@ class DishView 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:
BorderRadius.all(Radius.circular(8))), BorderRadius.all(Radius.circular(8))),
child: Row( child: Row(
@@ -163,8 +170,8 @@ class DishView extends StatelessWidget {
), ),
Text( Text(
'Danie wegańskie', 'Danie wegańskie',
style: TextStyle( style:
color: Colors.grey[200], fontSize: 12), TextStyle(color: Colors.grey[200], fontSize: 12),
), ),
], ],
), ),
@@ -181,8 +188,8 @@ class DishView extends StatelessWidget {
), ),
Text( Text(
'Danie wegetariańskie', 'Danie wegetariańskie',
style: TextStyle( style:
color: Colors.grey[200], fontSize: 12), TextStyle(color: Colors.grey[200], fontSize: 12),
), ),
], ],
), ),
@@ -193,41 +200,72 @@ class DishView extends StatelessWidget {
) )
], ],
)), )),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Stack( 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())),
),
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], backgroundColor: Colors.grey[900],
child: Icon( leading: IconButton(
Icons.arrow_back_rounded, icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange, color: Colors.orange,
), ),
onPressed: () => Navigator.pop(context), 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);
},
), ),
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: () {},
),
),
)
], ],
)); ),
);
} }
} }

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, MenuiButton(
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.note_rounded,
Text( text: "Zamównienie",
'Szukaj',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())), MaterialPageRoute(builder: (context) => OrderView())),
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.note_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.favorite_rounded,
Text( text: "Ulubione",
'Zamówienie',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {}, onPressed: () {},
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.settings,
Text( text: "Ustawienia",
'Ulubione',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
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],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange, color: Colors.orange,
icon: Icons.home_rounded,
text: "Szukaj",
onPressed: () {},
), ),
Text( MenuiButton(
'Szukaj', color: Colors.orange,
style: TextStyle( icon: Icons.note_rounded,
color: Colors.grey[200], text: "Zamównienie",
fontSize: 12,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())), MaterialPageRoute(builder: (context) => OrderView())),
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.note_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.favorite_rounded,
Text( text: "Ulubione",
'Zamówienie',
style: TextStyle(
color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())), MaterialPageRoute(builder: (context) => FavoritesView())),
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.settings,
Text( text: "Ustawienia",
'Ulubione',
style: TextStyle(
color: Colors.grey[200],
fontSize: 12,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
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],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange, color: Colors.orange,
icon: Icons.home_rounded,
text: "Szukaj",
onPressed: () => Navigator.pop(context),
), ),
Text( MenuiButton(
'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, color: Colors.orange,
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrderView())),
), ),
Text( MenuiButton(
'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, color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FavoritesView())),
), ),
Text( MenuiButton(
'Ulubione', color: Colors.orange,
style: TextStyle(color: Colors.grey[200], fontSize: 12), icon: Icons.settings,
) text: "Ustawienia",
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
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],
elevation: 0,
padding:
EdgeInsets.symmetric(vertical: 12, horizontal: 4),
onPressed: () {
Navigator.pop(context);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.arrow_back_rounded,
color: Colors.orange, color: Colors.orange,
), onPressed: () => Navigator.pop(context),
Text( text: "Cofnij",
'Cofnij', icon: Icons.arrow_back_rounded,
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, MenuiButton(
children: <Widget>[
Icon(
Icons.home_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.note_rounded,
Text( text: "Zamównienie",
'Szukaj',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () {}, onPressed: () {},
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.note_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.favorite_rounded,
Text( text: "Ulubione",
'Zamówienie',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
onPressed: () => Navigator.push(context, onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => FavoritesView())), MaterialPageRoute(builder: (context) => FavoritesView())),
child: Column( ),
mainAxisSize: MainAxisSize.min, MenuiButton(
children: <Widget>[
Icon(
Icons.favorite_rounded,
color: Colors.orange, color: Colors.orange,
), icon: Icons.settings,
Text( text: "Ustawienia",
'Ulubione',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
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

@@ -38,20 +38,20 @@ class RestaurantCard extends StatelessWidget {
), ),
Expanded( Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Text( Padding(
padding: EdgeInsets.only(bottom: 4),
child: Text(
restaurant.name, restaurant.name,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle(color: Colors.orange[600], fontSize: 16), style:
TextStyle(color: Colors.orange[600], fontSize: 14),
),
), ),
Container(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
@@ -65,7 +65,7 @@ class RestaurantCard extends StatelessWidget {
child: Text( child: Text(
'${restaurant.city}, ${restaurant.adress}', '${restaurant.city}, ${restaurant.adress}',
style: style:
TextStyle(color: Colors.grey, fontSize: 12), TextStyle(color: Colors.grey, fontSize: 11),
), ),
), ),
]), ]),
@@ -82,7 +82,7 @@ class RestaurantCard extends StatelessWidget {
child: Text( child: Text(
'${restaurant.type}', '${restaurant.type}',
style: style:
TextStyle(color: Colors.grey, fontSize: 12), TextStyle(color: Colors.grey, fontSize: 11),
), ),
), ),
]), ]),
@@ -99,18 +99,17 @@ class RestaurantCard extends StatelessWidget {
child: Text( child: Text(
'$_openHours', '$_openHours',
style: style:
TextStyle(color: Colors.grey, fontSize: 12), TextStyle(color: Colors.grey, fontSize: 11),
), ),
), ),
]), ]),
Padding( Padding(
padding: EdgeInsets.only(top: 2),
child: LineOfIconsSmall(tags: restaurant.tags), 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(
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: () { onPressed: () {
Navigator.pop(context); showSettings(context, settings);
}, },
child: Icon( ),
Icons.arrow_back_outlined, ],
),
),
appBar: AppBar(
backgroundColor: Colors.grey[900],
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.orange, 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]),
child: FutureBuilder<Restaurant>(
future: services.fetchRestaurant(id),
builder:
(BuildContext context, AsyncSnapshot<Restaurant> snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
restaurant = snapshot.data; restaurant = snapshot.data;
categories = restaurant.categories; categories = restaurant.categories;
return ListView( return Scaffold(
body: Container(
decoration: BoxDecoration(color: Colors.grey[850]),
child: 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,118 +177,85 @@ class RestaurantView extends StatelessWidget {
], ],
) )
], ],
); ),
} else { ),
return Center( floatingActionButtonLocation:
child: CircularProgressIndicator(), FloatingActionButtonLocation.centerDocked,
); floatingActionButton: Column(
} mainAxisSize: MainAxisSize.min,
}, children: <Widget>[
)), Padding(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, padding: EdgeInsets.only(bottom: 4),
floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
RaisedButton( RaisedButton.icon(
color: Colors.grey[850], splashColor: Colors.orange,
elevation: 0, elevation: 5,
padding: EdgeInsets.all(8), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25)),
color: Colors.grey[900],
icon: Icon(
Icons.keyboard_arrow_up_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( onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())), context,
child: Column( MaterialPageRoute(
mainAxisSize: MainAxisSize.min, builder: (context) => HomePage())),
children: <Widget>[ ),
Icon( MenuiButton(
Icons.home_rounded,
color: Colors.orange, color: Colors.orange,
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrderView())),
), ),
Text( MenuiButton(
'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, color: Colors.orange,
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FavoritesView())),
), ),
Text( MenuiButton(
'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, color: Colors.orange,
), icon: Icons.settings,
Text( text: "Ustawienia",
'Ulubione',
style: TextStyle(
color: Colors.grey[200],
fontSize: 10,
fontWeight: FontWeight.w400),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
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: 10,
fontWeight: FontWeight.w400),
)
], ],
), ),
)
],
), ),
],
), ),
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.grey[850], backgroundColor: Colors.grey[900],
leading: IconButton( leading: IconButton(
icon: Icon( icon: Icon(
Icons.arrow_back_ios_rounded, Icons.arrow_back_ios_rounded,
@@ -291,10 +264,10 @@ class RestaurantView extends StatelessWidget {
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
), ),
actions: [ actions: [
RaisedButton( MenuiButton(
color: Colors.grey[850], color: Colors.grey,
elevation: 0, icon: Icons.map_rounded,
padding: EdgeInsets.all(8), text: "Mapa",
onPressed: () => Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
@@ -303,72 +276,31 @@ class RestaurantView extends StatelessWidget {
name: restaurant.name, name: restaurant.name,
type: restaurant.type, type: restaurant.type,
))), ))),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.map_rounded,
color: Colors.orange,
), ),
Text( MenuiButton(
'Mapa', color: Colors.grey,
style: TextStyle( icon: Icons.share_rounded,
color: Colors.grey[200], text: "Udostępnij",
fontSize: 10, onPressed: () => Share.share(
fontWeight: FontWeight.w400), 'https://www.menui.pl/restaurant/${restaurant.id}',
subject: '${restaurant.name}'),
),
FavoriteButton(
id: restaurant.id,
) )
], ],
), ),
),
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.share_rounded,
color: Colors.orange,
),
Text(
'Udostępnij',
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.favorite_rounded,
color: Colors.orange,
),
Text(
'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);
}
} }
showSettings(BuildContext context, MenuiSettings settings) async { // 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;
}
}
}
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