From fa15a161aea99a0bac3c303131ce25de560672b6 Mon Sep 17 00:00:00 2001 From: Jonasz Bigda Date: Sun, 27 Dec 2020 21:23:24 +0100 Subject: [PATCH] visual improvements / icons wrap / hours wrap / autocomplete fix --- lib/components/dishView.dart | 347 ++++++++++++-------- lib/components/iconChip.dart | 2 +- lib/components/lineOfAllergens.dart | 19 +- lib/components/lineOfIcons.dart | 20 +- lib/components/restaurantView.dart | 489 +++++++++++++++------------- lib/services.dart | 14 + 6 files changed, 529 insertions(+), 362 deletions(-) diff --git a/lib/components/dishView.dart b/lib/components/dishView.dart index 7351689..e3a6b90 100644 --- a/lib/components/dishView.dart +++ b/lib/components/dishView.dart @@ -10,146 +10,224 @@ class DishView extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - body: Container( - decoration: BoxDecoration(color: Colors.grey[850]), - child: Column( - children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage( - dish.imgUrl, + body: Container( + decoration: BoxDecoration(color: Colors.grey[850]), + child: ListView( + children: [ + Column( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage( + dish.imgUrl, + ), + fit: BoxFit.cover), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 160, + width: double.infinity, + ), + Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.grey[850], + borderRadius: + BorderRadius.all(Radius.circular(8))), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.restaurant, + color: Colors.orange, + ), + SizedBox( + width: 8, + ), + Text( + dish.name, + style: TextStyle( + fontSize: 24, + color: Colors.white, + fontWeight: FontWeight.w300), + ), + ], + ), + margin: EdgeInsets.all(12), + ) + ], + ), ), - fit: BoxFit.cover), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 160, - width: double.infinity, - ), - Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.grey[850], - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Row( - mainAxisSize: MainAxisSize.min, + 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, + ), + SizedBox( + height: 8, + ), + Prices(prices: dish.prices), + SizedBox( + height: 8, + ), + Divider( + height: 14, + thickness: 4, + ), + SizedBox( + height: 6, + ), + Text( + 'Składniki', + style: TextStyle(color: Colors.orange, fontSize: 14), + ), + SizedBox( + height: 12, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Text( + '${dish.ingredients}', + style: TextStyle(color: Colors.grey[200], fontSize: 12), + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 6, + ), + Divider( + height: 14, + thickness: 4, + ), + SizedBox( + height: 6, + ), + Wrap( + spacing: 10, children: [ - Icon( - Icons.restaurant, - color: Colors.orange, - ), - SizedBox( - width: 8, - ), - Text( - dish.name, - style: TextStyle( - fontSize: 24, - color: Colors.white, - fontWeight: FontWeight.w300), - ), + IconChip( + icon: Icons.battery_charging_full, + leading: "Wartość energetyczna", + value: (() { + if (dish.kCal != "") { + return dish.kCal + " kcal"; + } else { + return ""; + } + }())), + IconChip( + icon: Icons.cake, + leading: "Indeks glikemiczny", + value: dish.glicemicIndex), ], ), - margin: EdgeInsets.all(12), - ) - ], - ), - ), - SizedBox(height: 8), - Text( - 'Może zawierać', - style: TextStyle(color: Colors.orange, fontSize: 14), - ), - Allergens(allergens: dish.allergens), - Divider( - height: 14, - thickness: 4, - ), - SizedBox( - height: 8, - ), - Prices(prices: dish.prices), - SizedBox( - height: 8, - ), - Divider( - height: 14, - thickness: 4, - ), - SizedBox( - height: 6, - ), - Text( - 'Składniki', - style: TextStyle(color: Colors.orange, fontSize: 14), - ), - SizedBox( - height: 12, - ), - Text( - '${dish.ingredients}', - style: TextStyle(color: Colors.grey[200], fontSize: 12), - ), - SizedBox( - height: 6, - ), - Divider( - height: 14, - thickness: 4, - ), - SizedBox( - height: 6, - ), - Wrap( - spacing: 10, - children: [ - IconChip( - icon: Icons.battery_charging_full, - leading: "Wartość energetyczna", - value: dish.kCal), - IconChip( - icon: Icons.cake, - leading: "Indeks glikemiczny", - value: dish.glicemicIndex), + SizedBox( + height: 12, + ), + if (dish.notes != "") + Text( + 'Uwagi', + style: TextStyle(color: Colors.orange, fontSize: 14), + ), + SizedBox( + height: 12, + ), + if (dish.notes != "") + Text( + '${dish.notes}', + style: TextStyle(color: Colors.grey[200], fontSize: 12), + ), + if (dish.vegan) + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.info_rounded, + color: Colors.grey, + ), + SizedBox( + width: 6, + ), + Text( + 'Danie wegańskie', + style: TextStyle( + color: Colors.grey[200], fontSize: 12), + ), + ], + ), + if (dish.vegetarian) + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.info_rounded, + color: Colors.grey, + ), + SizedBox( + width: 6, + ), + Text( + 'Danie wegetariańskie', + style: TextStyle( + color: Colors.grey[200], fontSize: 12), + ), + ], + ), + ], + ), + SizedBox( + height: 28, + ) ], - ), - SizedBox( - height: 12, - ), - Text( - 'Uwagi', - style: TextStyle(color: Colors.orange, fontSize: 14), - ), - SizedBox( - height: 12, - ), - if (dish.notes == "") - Text( - '---', - style: TextStyle(color: Colors.grey[200], fontSize: 12), + )), + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButton: Stack( + children: [ + 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), + ), ), - if (dish.notes != "") - Text( - '${dish.notes}', - style: TextStyle(color: Colors.grey[200], fontSize: 12), - ), - if (dish.vegan) - 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), + ), + 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: [ 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], diff --git a/lib/components/iconChip.dart b/lib/components/iconChip.dart index a22111a..ed06b71 100644 --- a/lib/components/iconChip.dart +++ b/lib/components/iconChip.dart @@ -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 != "") diff --git a/lib/components/lineOfAllergens.dart b/lib/components/lineOfAllergens.dart index 6287e02..db65104 100644 --- a/lib/components/lineOfAllergens.dart +++ b/lib/components/lineOfAllergens.dart @@ -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: [ 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', diff --git a/lib/components/lineOfIcons.dart b/lib/components/lineOfIcons.dart index a7ba066..125bc91 100644 --- a/lib/components/lineOfIcons.dart +++ b/lib/components/lineOfIcons.dart @@ -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: [ 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', diff --git a/lib/components/restaurantView.dart b/lib/components/restaurantView.dart index 28d6b68..420eb70 100644 --- a/lib/components/restaurantView.dart +++ b/lib/components/restaurantView.dart @@ -16,187 +16,239 @@ class RestaurantView extends StatelessWidget { services.fetchAllDishes(id); List categories = []; return Scaffold( - body: Container( - decoration: BoxDecoration(color: Colors.grey[850]), - child: FutureBuilder( - future: services.fetchRestaurant(id), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasData) { - final Restaurant restaurant = snapshot.data; - categories = restaurant.categories; - return Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - image: NetworkImage( - restaurant.imgUrl, - ), - fit: BoxFit.cover)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 160, - ), - Row( - children: [ - Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - color: Colors.grey[850], - borderRadius: - BorderRadius.all(Radius.circular(8))), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - restaurant.name, - style: TextStyle( - fontSize: 24, - color: Colors.orange, - fontWeight: FontWeight.w300), - ), - Text( - restaurant.city, - style: TextStyle(color: Colors.grey), - ) - ], + body: Container( + decoration: BoxDecoration(color: Colors.grey[850]), + child: FutureBuilder( + future: services.fetchRestaurant(id), + builder: + (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.hasData) { + final Restaurant restaurant = snapshot.data; + categories = restaurant.categories; + return ListView( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + image: NetworkImage( + restaurant.imgUrl, ), - margin: EdgeInsets.all(12), - ), - Container( - margin: EdgeInsets.only(right: 12), - decoration: BoxDecoration( - color: Colors.grey[850], - borderRadius: BorderRadius.circular(30)), - child: IconButton( - icon: Icon( - Icons.map, - color: Colors.orange, - ), - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - RestaurantMapView( - coordinates: - restaurant.coordinates, - name: restaurant.name, - type: restaurant.type, - )))), - ) - ], - mainAxisAlignment: MainAxisAlignment.spaceBetween, - ) - ], - ), - ), - Container( - decoration: BoxDecoration(color: Colors.grey[850]), - child: Column( - children: [ - LineOfIcons( - tags: restaurant.tags, - ), - Divider( - height: 14, - thickness: 4, - ), - Padding( - padding: EdgeInsets.symmetric( - vertical: 4, horizontal: 12), - child: Text( - restaurant.description, - style: TextStyle( - fontSize: 12, color: Colors.grey[300]), - textAlign: TextAlign.center, + fit: BoxFit.cover)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 160, ), - ), - Divider( - height: 14, - thickness: 4, - ), - Text( - 'Informacje', - style: - TextStyle(color: Colors.orange, fontSize: 14), - ), - SizedBox( - height: 6, - ), - MenuiDoubleColorText( - leading: 'Kuchnia: ', - following: '${restaurant.type}', - ), - MenuiDoubleColorText( - leading: 'Adres: ', - following: - '${restaurant.city}, ${restaurant.adress}', - ), - MenuiDoubleColorText( - leading: 'Kontakt: ', - following: '${restaurant.phone}', - ), - SizedBox( - height: 6, - ), - Text( - 'Godziny otwarcia', - style: - TextStyle(color: Colors.orange, fontSize: 14), - ), - SizedBox( - height: 6, - ), - WorkingHoursList( - workingHours: restaurant.workingHours), - SizedBox( - height: 6, - ), - Text( - 'Social media', - style: - TextStyle(color: Colors.orange, fontSize: 14), - ), - SizedBox( - height: 6, - ), - SocialMedia(links: restaurant.links), - SizedBox( - height: 6, - ), - ], + Row( + children: [ + Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.grey[850], + borderRadius: BorderRadius.all( + Radius.circular(8))), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + restaurant.name, + style: TextStyle( + fontSize: 24, + color: Colors.orange, + fontWeight: FontWeight.w300), + ), + Text( + restaurant.city, + style: TextStyle(color: Colors.grey), + ) + ], + ), + margin: EdgeInsets.all(12), + ), + Container( + margin: EdgeInsets.only(right: 12), + decoration: BoxDecoration( + color: Colors.grey[850], + borderRadius: + BorderRadius.circular(30)), + child: IconButton( + icon: Icon( + Icons.map, + color: Colors.orange, + ), + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + RestaurantMapView( + coordinates: restaurant + .coordinates, + name: restaurant.name, + type: restaurant.type, + )))), + ) + ], + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + ) + ], + ), ), - ) - ], - ); - } else { - return Center( - child: CircularProgressIndicator(), - ); - } - }, - )), - floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, - floatingActionButton: FloatingActionButton.extended( - onPressed: () { - showMenu(context, categories); - }, - label: Text( - 'Menu', - style: TextStyle(color: Colors.white, fontWeight: FontWeight.w400), - ), - icon: Icon( - Icons.arrow_upward_rounded, - color: Colors.orange, - ), - backgroundColor: Colors.grey[900], - )); + Container( + decoration: BoxDecoration(color: Colors.grey[850]), + child: Column( + children: [ + LineOfIcons( + tags: restaurant.tags, + ), + Divider( + height: 14, + thickness: 4, + ), + Padding( + padding: EdgeInsets.symmetric( + vertical: 4, horizontal: 20), + child: Text( + restaurant.description, + style: TextStyle( + fontSize: 12, color: Colors.grey[300]), + textAlign: TextAlign.center, + ), + ), + Divider( + height: 14, + thickness: 4, + ), + SizedBox( + height: 8, + ), + Text( + 'Informacje', + style: TextStyle( + color: Colors.orange, fontSize: 14), + ), + SizedBox( + height: 6, + ), + MenuiDoubleColorText( + leading: 'Kuchnia: ', + following: '${restaurant.type}', + ), + MenuiDoubleColorText( + leading: 'Adres: ', + following: + '${restaurant.city}, ${restaurant.adress}', + ), + MenuiDoubleColorText( + leading: 'Kontakt: ', + following: '${restaurant.phone}', + ), + SizedBox( + height: 12, + ), + Text( + 'Godziny otwarcia', + style: TextStyle( + color: Colors.orange, fontSize: 14), + ), + SizedBox( + height: 12, + ), + WorkingHoursList( + workingHours: restaurant.workingHours), + SizedBox( + height: 12, + ), + Text( + 'Social media', + style: TextStyle( + color: Colors.orange, fontSize: 14), + ), + SizedBox( + height: 6, + ), + SocialMedia(links: restaurant.links), + SizedBox( + height: 6, + ), + ], + ), + ), + SizedBox( + height: 80, + ) + ], + ) + ], + ); + } else { + return Center( + child: CircularProgressIndicator(), + ); + } + }, + )), + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButton: Stack( + children: [ + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: EdgeInsets.only(bottom: 4), + child: FloatingActionButton.extended( + heroTag: null, + onPressed: () { + showMenu(context, categories); + }, + label: Text( + '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 categories) { @@ -265,31 +317,37 @@ class WorkingHoursDay extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: EdgeInsets.all(6), - child: Container( - padding: EdgeInsets.all(6), - decoration: BoxDecoration( - color: background(), - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Column( - children: [ - Text( - day, - style: TextStyle(fontWeight: FontWeight.w300), - ), - Divider( - height: 4, - thickness: 2, - color: Colors.white, - ), - Text( - formatTodayHours(workingHours), - style: TextStyle(color: Colors.white, fontSize: 11), - ) - ], + return Container( + constraints: BoxConstraints(maxWidth: 80), + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: background(), + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Column( + children: [ + Text( + day, + style: + TextStyle(fontWeight: FontWeight.w300, color: Colors.grey[200]), ), - )); + SizedBox( + height: 4, + ), + Divider( + height: 4, + thickness: 1, + color: Colors.grey[850], + ), + SizedBox( + height: 4, + ), + Text( + formatTodayHours(workingHours), + style: TextStyle(color: Colors.white, fontSize: 11), + ) + ], + ), + ); } } @@ -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: [ - 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), - ]) + WorkingHoursDay('Pn', workingHours.pn, 1), + WorkingHoursDay('Wt', workingHours.wt, 2), + WorkingHoursDay('Śr', workingHours.sr, 3), + WorkingHoursDay('Cz', workingHours.cz, 4), + WorkingHoursDay('Pt', workingHours.pt, 5), + WorkingHoursDay('So', workingHours.sb, 6), + WorkingHoursDay('Nd', workingHours.nd, 7), ], ); } diff --git a/lib/services.dart b/lib/services.dart index 45c84e6..7c1ff5f 100644 --- a/lib/services.dart +++ b/lib/services.dart @@ -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 {