Dish view
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../services.dart';
|
||||
import 'dishView.dart';
|
||||
|
||||
class DishCard extends StatelessWidget {
|
||||
final Dish dish;
|
||||
@@ -13,7 +14,8 @@ class DishCard extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
margin: EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
onTap: () => Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => DishView(dish: dish))),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
|
||||
252
lib/components/dishView.dart
Normal file
252
lib/components/dishView.dart
Normal 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} zł',
|
||||
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} zł',
|
||||
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} zł',
|
||||
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} zł',
|
||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
152
lib/components/lineOfAllergens.dart
Normal file
152
lib/components/lineOfAllergens.dart
Normal 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),
|
||||
)
|
||||
],
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import '../services.dart';
|
||||
import 'lineOfIcons.dart';
|
||||
import 'dishList.dart';
|
||||
import 'socialMedia.dart';
|
||||
|
||||
class RestaurantView extends StatelessWidget {
|
||||
final String id;
|
||||
@@ -118,6 +119,10 @@ class RestaurantView extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
MenuiDoubleColorText(
|
||||
leading: 'Kuchnia: ',
|
||||
following: '${restaurant.type}',
|
||||
),
|
||||
MenuiDoubleColorText(
|
||||
leading: 'Adres: ',
|
||||
following:
|
||||
@@ -143,6 +148,18 @@ class RestaurantView extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
'Social media',
|
||||
style:
|
||||
TextStyle(color: Colors.orange, fontSize: 14),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SocialMedia(links: restaurant.links),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
44
lib/components/socialMedia.dart
Normal file
44
lib/components/socialMedia.dart
Normal 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);
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user