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,
child: Align(
alignment: Alignment.bottomCenter,
child: FloatingActionButton.extended(
backgroundColor: Colors.grey[900],
onPressed: () {
Navigator.pop(context);
},
child: RaisedButton.icon(
splashColor: Colors.orange,
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25)),
color: Colors.grey[900],
icon: Icon(
Icons.keyboard_arrow_down_rounded,
color: Colors.orange,
),
label: Text(
'Zamknij',
style:
TextStyle(color: Colors.white, fontWeight: FontWeight.w400),
"Zwiń",
style: TextStyle(color: Colors.white),
),
),
))
onPressed: () => Navigator.pop(context),
)))
]);
}
@@ -92,61 +92,3 @@ class DishList extends StatelessWidget {
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 'lineOfAllergens.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 {
final Dish dish;
DishView({@required this.dish});
final MenuiSettings settings = new MenuiSettings();
@override
Widget build(BuildContext context) {
@@ -34,7 +41,7 @@ class DishView extends StatelessWidget {
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[850],
color: Colors.grey[900],
borderRadius:
BorderRadius.all(Radius.circular(8))),
child: Row(
@@ -163,8 +170,8 @@ class DishView extends StatelessWidget {
),
Text(
'Danie wegańskie',
style: TextStyle(
color: Colors.grey[200], fontSize: 12),
style:
TextStyle(color: Colors.grey[200], fontSize: 12),
),
],
),
@@ -181,8 +188,8 @@ class DishView extends StatelessWidget {
),
Text(
'Danie wegetariańskie',
style: TextStyle(
color: Colors.grey[200], fontSize: 12),
style:
TextStyle(color: Colors.grey[200], fontSize: 12),
),
],
),
@@ -193,41 +200,72 @@ class DishView extends StatelessWidget {
)
],
)),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Stack(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: EdgeInsets.only(left: 18),
child: FloatingActionButton(
heroTag: null,
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],
child: Icon(
Icons.arrow_back_rounded,
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);
},
),
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 'homeScreen.dart';
import 'orderView.dart';
import 'menuiButton.dart';
class FavoritesView extends StatelessWidget {
final settings = new MenuiSettings();
@@ -16,19 +17,19 @@ class FavoritesView extends StatelessWidget {
child: Column(
children: <Widget>[
Container(
decoration: BoxDecoration(color: Colors.grey[850]),
decoration: BoxDecoration(color: Colors.grey[900]),
child: Column(
children: [
SizedBox(
height: 20,
),
Container(
decoration: BoxDecoration(color: Colors.grey[850]),
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RaisedButton(
color: Colors.grey[850],
color: Colors.grey[900],
elevation: 0,
padding:
EdgeInsets.symmetric(vertical: 12, horizontal: 4),
@@ -45,7 +46,9 @@ class FavoritesView extends StatelessWidget {
Text(
'Cofnij',
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,
floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]),
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
MenuiButton(
color: Colors.orange,
icon: Icons.home_rounded,
text: "Szukaj",
onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => HomePage())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.home_rounded,
),
MenuiButton(
color: Colors.orange,
),
Text(
'Szukaj',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
icon: Icons.note_rounded,
text: "Zamównienie",
onPressed: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderView())),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.note_rounded,
),
MenuiButton(
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),
icon: Icons.favorite_rounded,
text: "Ulubione",
onPressed: () {},
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.favorite_rounded,
),
MenuiButton(
color: Colors.orange,
),
Text(
'Ulubione',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
)
],
),
),
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.all(8),
icon: Icons.settings,
text: "Ustawienia",
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: 12),
)
],
),
)
],
),
),

View File

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

View File

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

View File

@@ -38,20 +38,20 @@ class RestaurantCard extends StatelessWidget {
),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
Padding(
padding: EdgeInsets.only(bottom: 4),
child: Text(
restaurant.name,
overflow: TextOverflow.ellipsis,
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(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
@@ -65,7 +65,7 @@ class RestaurantCard extends StatelessWidget {
child: Text(
'${restaurant.city}, ${restaurant.adress}',
style:
TextStyle(color: Colors.grey, fontSize: 12),
TextStyle(color: Colors.grey, fontSize: 11),
),
),
]),
@@ -82,7 +82,7 @@ class RestaurantCard extends StatelessWidget {
child: Text(
'${restaurant.type}',
style:
TextStyle(color: Colors.grey, fontSize: 12),
TextStyle(color: Colors.grey, fontSize: 11),
),
),
]),
@@ -99,18 +99,17 @@ class RestaurantCard extends StatelessWidget {
child: Text(
'$_openHours',
style:
TextStyle(color: Colors.grey, fontSize: 12),
TextStyle(color: Colors.grey, fontSize: 11),
),
),
]),
Padding(
padding: EdgeInsets.only(top: 2),
child: LineOfIconsSmall(tags: restaurant.tags),
padding: EdgeInsets.only(top: 4),
)
],
)),
],
)),
),
),
Container(
child: Icon(
Icons.arrow_right,
@@ -121,8 +120,8 @@ class RestaurantCard extends StatelessWidget {
],
),
),
color: Color.fromRGBO(50, 50, 50, 0.8),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
color: Colors.grey[900],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(11)),
margin: EdgeInsets.symmetric(horizontal: 12),
),
);

View File

@@ -1,6 +1,11 @@
import 'dart:async';
import 'package:flutter/material.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 {
final List coordinates;
@@ -15,6 +20,7 @@ class RestaurantMapView extends StatefulWidget {
}
class RestaurantMapViewState extends State<RestaurantMapView> {
final MenuiSettings settings = new MenuiSettings();
Completer<GoogleMapController> _controller = Completer();
Map<MarkerId, Marker> markers = <MarkerId, Marker>{};
@@ -43,20 +49,54 @@ class RestaurantMapViewState extends State<RestaurantMapView> {
},
markers: Set<Marker>.of(markers.values),
),
floatingActionButton: Padding(
padding: EdgeInsets.only(bottom: 20),
child: FloatingActionButton(
backgroundColor: Colors.grey[800],
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: 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: () {
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,
),
onPressed: () => Navigator.pop(context),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.startDocked,
);
}
}

View File

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

View File

@@ -2,9 +2,15 @@ import '../services.dart';
import 'package:flutter/material.dart';
import 'package:menui_mobile/components/restaurantCard.dart';
import 'searchBar.dart';
import 'menuiButton.dart';
import 'homeScreen.dart';
import 'orderView.dart';
import 'favoritesView.dart';
import '../settings.dart';
class SearchResults extends StatelessWidget {
final List<Restaurant> restaurants;
final MenuiSettings settings = new MenuiSettings();
SearchResults({@required this.restaurants});
@@ -51,88 +57,39 @@ class SearchResults extends StatelessWidget {
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container(
decoration: BoxDecoration(color: Colors.grey[850]),
decoration: BoxDecoration(color: Colors.grey[900]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
color: Colors.grey[850],
elevation: 0,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 4),
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: () {
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.lunchMenu,
this.dishes});
Restaurant.empty(
{this.adress = "",
this.city = "",
this.coordinates = const [],
this.id = "",
this.imgUrl = "",
this.name = "",
this.type = ""});
}
class Dish {

View File

@@ -114,9 +114,53 @@ class MenuiSettings {
final settings = await SharedPreferences.getInstance();
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();
final String languageCode = await settings.getLanguage();
final String language = settings.decodeLanguage(languageCode);

View File

@@ -163,6 +163,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description:
@@ -226,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description:

View File

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