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

View File

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

View File

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

View File

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

View File

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

View File

@@ -409,6 +409,20 @@ class MenuiAllergens {
MenuiAllergens(this.gluten, this.lactose, this.soy, this.eggs, this.seaFood,
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 {