Dish view

This commit is contained in:
2020-12-04 21:40:44 +01:00
parent ab1e47dfee
commit f840ade2c8
7 changed files with 476 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../services.dart'; import '../services.dart';
import 'dishView.dart';
class DishCard extends StatelessWidget { class DishCard extends StatelessWidget {
final Dish dish; final Dish dish;
@@ -13,7 +14,8 @@ class DishCard extends StatelessWidget {
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 5), margin: EdgeInsets.symmetric(horizontal: 12, vertical: 5),
child: InkWell( child: InkWell(
onTap: () {}, onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (context) => DishView(dish: dish))),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[

View File

@@ -0,0 +1,252 @@
import 'package:flutter/material.dart';
import 'package:menui_mobile/services.dart';
import 'lineOfAllergens.dart';
class DishView extends StatelessWidget {
final Dish dish;
DishView({@required this.dish});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(color: Colors.grey[850]),
child: Column(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
dish.imgUrl,
),
fit: BoxFit.cover),
),
child: Column(
children: <Widget>[
SizedBox(
height: 160,
width: double.infinity,
),
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[850],
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
dish.name,
style: TextStyle(
fontSize: 24,
color: Colors.orange,
fontWeight: FontWeight.w300),
),
],
),
margin: EdgeInsets.all(12),
)
],
),
),
SizedBox(height: 8),
Allergens(allergens: dish.allergens),
Divider(
height: 14,
thickness: 4,
),
Text(
'Cena',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Prices(prices: dish.prices),
SizedBox(
height: 12,
),
Divider(
height: 14,
thickness: 4,
),
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: 12,
),
Text(
'Porcja',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Text(
'${dish.weight}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
SizedBox(
height: 12,
),
Text(
'Wartość energetyczna',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Text(
'${dish.kCal}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
SizedBox(
height: 12,
),
Text(
'Indeks glikemiczny',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Text(
'${dish.glicemicIndex}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
SizedBox(
height: 12,
),
Text(
'Uwagi',
style: TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
Text(
'${dish.notes}',
style: TextStyle(color: Colors.grey[200], fontSize: 12),
),
],
),
),
);
}
}
class Prices extends StatelessWidget {
final MenuiPrices prices;
Prices({@required this.prices});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
if (prices.price1.priceName == "")
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[800],
borderRadius: BorderRadius.all(Radius.circular(12))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.attach_money,
color: Colors.orange,
),
SizedBox(height: 8),
Text(
'${prices.price1.price}',
style: TextStyle(color: Colors.white, fontSize: 14),
),
]),
),
if (prices.price1.priceName != "")
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[800],
borderRadius: BorderRadius.all(Radius.circular(12))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.attach_money,
color: Colors.orange,
),
SizedBox(height: 8),
Text(
'(${prices.price1.priceName})',
style: TextStyle(color: Colors.white, fontSize: 11),
),
Text(
'${prices.price1.price}',
style: TextStyle(color: Colors.white, fontSize: 14),
),
]),
),
if (prices.price2.priceName != "")
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[800],
borderRadius: BorderRadius.all(Radius.circular(12))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.attach_money,
color: Colors.orange,
),
SizedBox(height: 8),
Text(
'(${prices.price2.priceName})',
style: TextStyle(color: Colors.white, fontSize: 11),
),
Text(
'${prices.price2.price}',
style: TextStyle(color: Colors.white, fontSize: 14),
),
]),
),
if (prices.price3.priceName != "")
Container(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.grey[800],
borderRadius: BorderRadius.all(Radius.circular(12))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.attach_money,
color: Colors.orange,
),
SizedBox(height: 8),
Text(
'(${prices.price3.priceName})',
style: TextStyle(color: Colors.white, fontSize: 11),
),
Text(
'${prices.price3.price}',
style: TextStyle(color: Colors.white, fontSize: 14),
),
]),
),
],
);
}
}

View File

@@ -0,0 +1,152 @@
import 'package:flutter/material.dart';
import '../services.dart';
class Allergens extends StatelessWidget {
final MenuiAllergens allergens;
final double edgeInsets = 6;
Allergens({@required this.allergens});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (allergens.eggs == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_eggs.png',
width: 18,
),
height: 26,
),
Text(
'Jaja',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.gluten == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_gluten.png',
width: 18,
),
height: 26,
),
Text(
'Gluten',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.lactose == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_lactose.png',
width: 18,
),
height: 26,
),
Text(
'Laktoza',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.peanuts == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_peanuts.png',
width: 18,
),
height: 26,
),
Text(
'Orzechy',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.seaFood == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_seaFood.png',
width: 18,
),
height: 26,
),
Text(
'Owoce morza',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.sesame == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_sesame.png',
width: 18,
),
height: 26,
),
Text(
'Sezam',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (allergens.soy == true)
Container(
margin: EdgeInsets.all(edgeInsets),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_soy.png',
width: 18,
),
height: 26,
),
Text(
'Soja',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
],
);
}
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../services.dart'; import '../services.dart';
import 'lineOfIcons.dart'; import 'lineOfIcons.dart';
import 'dishList.dart'; import 'dishList.dart';
import 'socialMedia.dart';
class RestaurantView extends StatelessWidget { class RestaurantView extends StatelessWidget {
final String id; final String id;
@@ -118,6 +119,10 @@ class RestaurantView extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
MenuiDoubleColorText(
leading: 'Kuchnia: ',
following: '${restaurant.type}',
),
MenuiDoubleColorText( MenuiDoubleColorText(
leading: 'Adres: ', leading: 'Adres: ',
following: following:
@@ -143,6 +148,18 @@ class RestaurantView extends StatelessWidget {
SizedBox( SizedBox(
height: 12, height: 12,
), ),
Text(
'Social media',
style:
TextStyle(color: Colors.orange, fontSize: 14),
),
SizedBox(
height: 12,
),
SocialMedia(links: restaurant.links),
SizedBox(
height: 12,
),
], ],
), ),
) )

View File

@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:menui_mobile/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class SocialMedia extends StatelessWidget {
final MenuiLinks links;
SocialMedia({@required this.links});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
if (links.facebook != "")
IconButton(
icon: FaIcon(
FontAwesomeIcons.facebook,
color: Colors.white,
),
onPressed: () {
print(links.facebook);
}),
if (links.instagram != "")
IconButton(
icon: FaIcon(
FontAwesomeIcons.instagram,
color: Colors.white,
),
onPressed: () {
print(links.instagram);
}),
if (links.www != "")
IconButton(
icon: FaIcon(
FontAwesomeIcons.globe,
color: Colors.white,
),
onPressed: () {
print(links.www);
})
],
);
}
}

View File

@@ -86,6 +86,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
font_awesome_flutter:
dependency: "direct main"
description:
name: font_awesome_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "8.10.0"
geolocator: geolocator:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -23,6 +23,7 @@ environment:
dependencies: dependencies:
http: ^0.12.2 http: ^0.12.2
geolocator: ^6.1.0 geolocator: ^6.1.0
font_awesome_flutter: ^8.10.0
flutter: flutter:
sdk: flutter sdk: flutter
shared_preferences: ^0.5.12 shared_preferences: ^0.5.12