restaurant view | tags component

This commit is contained in:
2020-10-18 19:54:53 +02:00
parent 9c69610585
commit 735f0eadfd
4 changed files with 258 additions and 1 deletions

View File

@@ -0,0 +1,159 @@
import 'package:flutter/material.dart';
import '../services.dart';
class LineOfIcons extends StatelessWidget {
final MenuiTags tags;
LineOfIcons({@required this.tags});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (tags.alcohol == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_alcohol.png',
width: 20,
),
height: 30,
),
Text(
'Alkohol',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.cardPayments == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_card.png',
width: 20,
),
height: 30,
),
Text(
'Płatność',
style: TextStyle(fontSize: 10, color: Colors.grey),
),
Text(
'kartą',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.delivery == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_delivery.png',
width: 20,
),
height: 30,
),
Text(
'Dowozimy',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.glutenFree == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_glutenFree.png',
width: 20,
),
height: 30,
),
Text(
'Bezglutenowe',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.petFriendly == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_pets.png',
width: 20,
),
height: 30,
),
Text(
'Lubimy',
style: TextStyle(fontSize: 10, color: Colors.grey),
),
Text(
'zwierzaczki',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.vegan == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_vegan.png',
width: 20,
),
height: 30,
),
Text(
'Wegańskie',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
if (tags.vegetarian == true)
Container(
margin: EdgeInsets.all(8),
child: Column(
children: [
Container(
alignment: Alignment.center,
child: Image.asset(
'img/i_vegetarian.png',
width: 20,
),
height: 30,
),
Text(
'Wegetariańskie',
style: TextStyle(fontSize: 10, color: Colors.grey),
)
],
)),
],
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'restaurantView.dart';
import 'package:menui_mobile/services.dart';
class RestaurantCard extends StatelessWidget {
@@ -10,7 +11,10 @@ class RestaurantCard extends StatelessWidget {
Widget build(BuildContext context) {
return Card(
child: InkWell(
onTap: () {},
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RestaurantView(restaurant: restaurant))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
children: <Widget>[

View File

@@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import '../services.dart';
import 'lineOfIcons.dart';
class RestaurantView extends StatelessWidget {
final Restaurant restaurant;
RestaurantView({@required this.restaurant});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("img/bg_tile.jpg"), fit: BoxFit.cover)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
restaurant.imgUrl,
),
fit: BoxFit.cover)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 160,
),
Row(
children: <Widget>[
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(
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: () {}),
)
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
)
],
),
),
Container(
decoration: BoxDecoration(color: Colors.grey[850]),
child: Column(
children: <Widget>[
LineOfIcons(
tags: restaurant.tags,
),
Text('1234')
],
),
)
],
),
),
);
}
}