visual improvements / icons wrap / hours wrap / autocomplete fix

This commit is contained in:
2020-12-27 21:23:24 +01:00
parent 223feb8c5c
commit fa15a161ae
6 changed files with 529 additions and 362 deletions

View File

@@ -12,7 +12,9 @@ class DishView extends StatelessWidget {
return Scaffold( return Scaffold(
body: Container( body: Container(
decoration: BoxDecoration(color: Colors.grey[850]), decoration: BoxDecoration(color: Colors.grey[850]),
child: Column( child: ListView(
children: <Widget>[
Column(
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -33,7 +35,8 @@ class DishView extends StatelessWidget {
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[850], color: Colors.grey[850],
borderRadius: BorderRadius.all(Radius.circular(8))), borderRadius:
BorderRadius.all(Radius.circular(8))),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
@@ -58,12 +61,17 @@ class DishView extends StatelessWidget {
], ],
), ),
), ),
SizedBox(height: 8), SizedBox(
height: 6,
),
if (dish.allergens.hasAllergens()) SizedBox(height: 8),
if (dish.allergens.hasAllergens())
Text( Text(
'Może zawierać', 'Może zawierać',
style: TextStyle(color: Colors.orange, fontSize: 14), style: TextStyle(color: Colors.orange, fontSize: 14),
), ),
Allergens(allergens: dish.allergens), Allergens(allergens: dish.allergens),
if (dish.allergens.hasAllergens())
Divider( Divider(
height: 14, height: 14,
thickness: 4, thickness: 4,
@@ -89,9 +97,13 @@ class DishView extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Text( Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Text(
'${dish.ingredients}', '${dish.ingredients}',
style: TextStyle(color: Colors.grey[200], fontSize: 12), style: TextStyle(color: Colors.grey[200], fontSize: 12),
textAlign: TextAlign.center,
),
), ),
SizedBox( SizedBox(
height: 6, height: 6,
@@ -109,7 +121,13 @@ class DishView extends StatelessWidget {
IconChip( IconChip(
icon: Icons.battery_charging_full, icon: Icons.battery_charging_full,
leading: "Wartość energetyczna", leading: "Wartość energetyczna",
value: dish.kCal), value: (() {
if (dish.kCal != "") {
return dish.kCal + " kcal";
} else {
return "";
}
}())),
IconChip( IconChip(
icon: Icons.cake, icon: Icons.cake,
leading: "Indeks glikemiczny", leading: "Indeks glikemiczny",
@@ -119,6 +137,7 @@ class DishView extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (dish.notes != "")
Text( Text(
'Uwagi', 'Uwagi',
style: TextStyle(color: Colors.orange, fontSize: 14), style: TextStyle(color: Colors.orange, fontSize: 14),
@@ -126,30 +145,89 @@ class DishView extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (dish.notes == "")
Text(
'---',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
if (dish.notes != "") if (dish.notes != "")
Text( Text(
'${dish.notes}', '${dish.notes}',
style: TextStyle(color: Colors.grey[200], fontSize: 12), style: TextStyle(color: Colors.grey[200], fontSize: 12),
), ),
if (dish.vegan) if (dish.vegan)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.info_rounded,
color: Colors.grey,
),
SizedBox(
width: 6,
),
Text( Text(
'Danie wegańskie', 'Danie wegańskie',
style: TextStyle(color: Colors.grey[200], fontSize: 12), style: TextStyle(
), color: Colors.grey[200], fontSize: 12),
if (dish.vegetarian)
Text(
'Danie wegetariań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.centerFloat,
floatingActionButton: Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: EdgeInsets.only(left: 18),
child: FloatingActionButton(
heroTag: null,
backgroundColor: Colors.grey[900],
child: Icon(
Icons.arrow_back_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
),
),
),
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: () {},
),
),
)
],
));
} }
} }
@@ -161,7 +239,7 @@ class Prices extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
if (prices.price1.priceName == "") if (prices.price1.priceName == "")
Container( Container(
@@ -185,6 +263,7 @@ class Prices extends StatelessWidget {
), ),
if (prices.price1.priceName != "") if (prices.price1.priceName != "")
Container( Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[800], color: Colors.grey[800],
@@ -209,6 +288,7 @@ class Prices extends StatelessWidget {
), ),
if (prices.price2.priceName != "") if (prices.price2.priceName != "")
Container( Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[800], color: Colors.grey[800],
@@ -233,6 +313,7 @@ class Prices extends StatelessWidget {
), ),
if (prices.price3.priceName != "") if (prices.price3.priceName != "")
Container( Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[800], color: Colors.grey[800],

View File

@@ -29,7 +29,7 @@ class IconChip extends StatelessWidget {
SizedBox(height: 4), SizedBox(height: 4),
if (value == "") if (value == "")
Text( Text(
'brak danych :(', '-',
style: TextStyle(color: Colors.white, fontSize: 14), style: TextStyle(color: Colors.white, fontSize: 14),
), ),
if (value != "") if (value != "")

View File

@@ -4,16 +4,18 @@ import '../services.dart';
class Allergens extends StatelessWidget { class Allergens extends StatelessWidget {
final MenuiAllergens allergens; final MenuiAllergens allergens;
final double edgeInsets = 4; final double edgeInsets = 4;
final double imagesWidth = 14; final double imagesWidth = 16;
final double fontSize = 8; final double fontSize = 9;
final double maxWidth = 50;
Allergens({@required this.allergens}); Allergens({@required this.allergens});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Wrap(
mainAxisAlignment: MainAxisAlignment.center, spacing: 4.0,
crossAxisAlignment: CrossAxisAlignment.start, alignment: WrapAlignment.center,
direction: Axis.horizontal,
children: <Widget>[ children: <Widget>[
if (allergens.eggs == true) if (allergens.eggs == true)
Container( Container(
@@ -21,6 +23,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_eggs.png', 'img/i_eggs.png',
@@ -41,6 +44,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_gluten.png', 'img/i_gluten.png',
@@ -61,6 +65,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_lactose.png', 'img/i_lactose.png',
@@ -81,6 +86,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_peanuts.png', 'img/i_peanuts.png',
@@ -101,6 +107,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_seaFood.png', 'img/i_seaFood.png',
@@ -121,6 +128,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_sesame.png', 'img/i_sesame.png',
@@ -141,6 +149,7 @@ class Allergens extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_soy.png', 'img/i_soy.png',

View File

@@ -4,16 +4,18 @@ import '../services.dart';
class LineOfIcons extends StatelessWidget { class LineOfIcons extends StatelessWidget {
final MenuiTags tags; final MenuiTags tags;
final double edgeInsets = 4; final double edgeInsets = 4;
final double imagesWidth = 14; final double imagesWidth = 16;
final double fontSize = 8; final double fontSize = 9;
final double maxWidth = 50;
LineOfIcons({@required this.tags}); LineOfIcons({@required this.tags});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Wrap(
mainAxisAlignment: MainAxisAlignment.center, spacing: 4.0,
crossAxisAlignment: CrossAxisAlignment.start, alignment: WrapAlignment.center,
direction: Axis.horizontal,
children: <Widget>[ children: <Widget>[
if (tags.alcohol == true) if (tags.alcohol == true)
Container( Container(
@@ -21,6 +23,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_alcohol.png', 'img/i_alcohol.png',
@@ -41,6 +44,8 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
width: maxWidth,
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_card.png', 'img/i_card.png',
@@ -66,6 +71,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_delivery.png', 'img/i_delivery.png',
@@ -86,6 +92,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_glutenFree.png', 'img/i_glutenFree.png',
@@ -106,6 +113,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_pets.png', 'img/i_pets.png',
@@ -131,6 +139,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_vegan.png', 'img/i_vegan.png',
@@ -151,6 +160,7 @@ class LineOfIcons extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
constraints: BoxConstraints(maxWidth: maxWidth),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
'img/i_vegetarian.png', 'img/i_vegetarian.png',

View File

@@ -25,7 +25,9 @@ class RestaurantView extends StatelessWidget {
if (snapshot.hasData) { if (snapshot.hasData) {
final Restaurant restaurant = snapshot.data; final Restaurant restaurant = snapshot.data;
categories = restaurant.categories; categories = restaurant.categories;
return Column( return ListView(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
@@ -48,8 +50,8 @@ class RestaurantView extends StatelessWidget {
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[850], color: Colors.grey[850],
borderRadius: borderRadius: BorderRadius.all(
BorderRadius.all(Radius.circular(8))), Radius.circular(8))),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
@@ -73,7 +75,8 @@ class RestaurantView extends StatelessWidget {
margin: EdgeInsets.only(right: 12), margin: EdgeInsets.only(right: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[850], color: Colors.grey[850],
borderRadius: BorderRadius.circular(30)), borderRadius:
BorderRadius.circular(30)),
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons.map, Icons.map,
@@ -84,14 +87,15 @@ class RestaurantView extends StatelessWidget {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
RestaurantMapView( RestaurantMapView(
coordinates: coordinates: restaurant
restaurant.coordinates, .coordinates,
name: restaurant.name, name: restaurant.name,
type: restaurant.type, type: restaurant.type,
)))), )))),
) )
], ],
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
) )
], ],
), ),
@@ -109,7 +113,7 @@ class RestaurantView extends StatelessWidget {
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 4, horizontal: 12), vertical: 4, horizontal: 20),
child: Text( child: Text(
restaurant.description, restaurant.description,
style: TextStyle( style: TextStyle(
@@ -121,10 +125,13 @@ class RestaurantView extends StatelessWidget {
height: 14, height: 14,
thickness: 4, thickness: 4,
), ),
SizedBox(
height: 8,
),
Text( Text(
'Informacje', 'Informacje',
style: style: TextStyle(
TextStyle(color: Colors.orange, fontSize: 14), color: Colors.orange, fontSize: 14),
), ),
SizedBox( SizedBox(
height: 6, height: 6,
@@ -143,25 +150,25 @@ class RestaurantView extends StatelessWidget {
following: '${restaurant.phone}', following: '${restaurant.phone}',
), ),
SizedBox( SizedBox(
height: 6, height: 12,
), ),
Text( Text(
'Godziny otwarcia', 'Godziny otwarcia',
style: style: TextStyle(
TextStyle(color: Colors.orange, fontSize: 14), color: Colors.orange, fontSize: 14),
), ),
SizedBox( SizedBox(
height: 6, height: 12,
), ),
WorkingHoursList( WorkingHoursList(
workingHours: restaurant.workingHours), workingHours: restaurant.workingHours),
SizedBox( SizedBox(
height: 6, height: 12,
), ),
Text( Text(
'Social media', 'Social media',
style: style: TextStyle(
TextStyle(color: Colors.orange, fontSize: 14), color: Colors.orange, fontSize: 14),
), ),
SizedBox( SizedBox(
height: 6, height: 6,
@@ -172,6 +179,11 @@ class RestaurantView extends StatelessWidget {
), ),
], ],
), ),
),
SizedBox(
height: 80,
)
],
) )
], ],
); );
@@ -183,20 +195,60 @@ class RestaurantView extends StatelessWidget {
}, },
)), )),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended( floatingActionButton: Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(bottom: 4),
child: FloatingActionButton.extended(
heroTag: null,
onPressed: () { onPressed: () {
showMenu(context, categories); showMenu(context, categories);
}, },
label: Text( label: Text(
'Menu', 'Karta dań',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400), style: TextStyle(
color: Colors.white, fontWeight: FontWeight.w400),
), ),
icon: Icon( icon: Icon(
Icons.arrow_upward_rounded, Icons.arrow_upward_rounded,
color: Colors.orange, color: Colors.orange,
), ),
backgroundColor: Colors.grey[900], backgroundColor: Colors.grey[900],
)); ),
)),
Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: EdgeInsets.only(left: 16),
child: FloatingActionButton(
heroTag: null,
backgroundColor: Colors.grey[900],
child: Icon(
Icons.arrow_back_rounded,
color: Colors.orange,
),
onPressed: () => Navigator.pop(context),
),
)),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: EdgeInsets.only(right: 16),
child: FloatingActionButton(
heroTag: null,
backgroundColor: Colors.grey[900],
child: Icon(
Icons.favorite_rounded,
color: Colors.orange,
),
onPressed: () {},
),
))
],
),
);
} }
showMenu(BuildContext context, List<String> categories) { showMenu(BuildContext context, List<String> categories) {
@@ -265,10 +317,9 @@ class WorkingHoursDay extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Container(
padding: EdgeInsets.all(6), constraints: BoxConstraints(maxWidth: 80),
child: Container( padding: EdgeInsets.all(8),
padding: EdgeInsets.all(6),
decoration: BoxDecoration( decoration: BoxDecoration(
color: background(), color: background(),
borderRadius: BorderRadius.all(Radius.circular(8))), borderRadius: BorderRadius.all(Radius.circular(8))),
@@ -276,12 +327,19 @@ class WorkingHoursDay extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Text( Text(
day, day,
style: TextStyle(fontWeight: FontWeight.w300), style:
TextStyle(fontWeight: FontWeight.w300, color: Colors.grey[200]),
),
SizedBox(
height: 4,
), ),
Divider( Divider(
height: 4, height: 4,
thickness: 2, thickness: 1,
color: Colors.white, color: Colors.grey[850],
),
SizedBox(
height: 4,
), ),
Text( Text(
formatTodayHours(workingHours), formatTodayHours(workingHours),
@@ -289,7 +347,7 @@ class WorkingHoursDay extends StatelessWidget {
) )
], ],
), ),
)); );
} }
} }
@@ -299,23 +357,18 @@ class WorkingHoursList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Wrap(
crossAxisAlignment: CrossAxisAlignment.center, spacing: 8.0,
runSpacing: 8.0,
alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
WorkingHoursDay('Pn', workingHours.pn, 1), WorkingHoursDay('Pn', workingHours.pn, 1),
WorkingHoursDay('Wt', workingHours.wt, 2), WorkingHoursDay('Wt', workingHours.wt, 2),
WorkingHoursDay('Śr', workingHours.sr, 3), WorkingHoursDay('Śr', workingHours.sr, 3),
WorkingHoursDay('Cz', workingHours.cz, 4), WorkingHoursDay('Cz', workingHours.cz, 4),
],
),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
WorkingHoursDay('Pt', workingHours.pt, 5), WorkingHoursDay('Pt', workingHours.pt, 5),
WorkingHoursDay('So', workingHours.sb, 6), WorkingHoursDay('So', workingHours.sb, 6),
WorkingHoursDay('Nd', workingHours.nd, 7), WorkingHoursDay('Nd', workingHours.nd, 7),
])
], ],
); );
} }

View File

@@ -409,6 +409,20 @@ class MenuiAllergens {
MenuiAllergens(this.gluten, this.lactose, this.soy, this.eggs, this.seaFood, MenuiAllergens(this.gluten, this.lactose, this.soy, this.eggs, this.seaFood,
this.peanuts, this.sesame); this.peanuts, this.sesame);
bool hasAllergens() {
if (!this.gluten &&
!this.lactose &&
!this.soy &&
!this.eggs &&
!this.seaFood &&
!this.peanuts &&
!this.sesame) {
return false;
} else {
return true;
}
}
} }
class MenuiLunchMenuSet { class MenuiLunchMenuSet {