FylleKak2/lib/screens/InformationScreen.dart

313 lines
12 KiB
Dart

// ignore_for_file: prefer_const_constructors
// ignore_for_file: prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:google_maps_flutter_platform_interface/src/types/location.dart';
import 'package:pvt_v1/screens/Map_screen.dart';
import 'ListOrMap_screen.dart';
import 'Restaurang.dart';
class InformationScreen extends StatefulWidget {
InformationScreen(
{Key? key,
required this.markerLatLng,
required this.latitude,
required this.longitude,
required this.restaurants,
required this.restaurantName,
required this.restaurantAddress})
: super(key: key);
LatLng markerLatLng;
double latitude;
double longitude;
String restaurantName;
List<Restaurang> restaurants;
String restaurantAddress;
@override
State<InformationScreen> createState() => _InformationScreenState(
markerLatLng,
latitude,
longitude,
restaurants,
restaurantName,
restaurantAddress);
}
class _InformationScreenState extends State<InformationScreen> {
LatLng markerLatLng;
double latitude;
double longitude;
List<Restaurang> restaurants;
String restaurantName;
String restaurantAddress;
_InformationScreenState(this.markerLatLng, this.latitude, this.longitude,
this.restaurants, this.restaurantName, this.restaurantAddress);
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/blueBackground.png"),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0, // tar bort skuggan från appbar
centerTitle: true,
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
tooltip:
MaterialLocalizations.of(context).openAppDrawerTooltip,
);
},
),
title: Container(
child: Text(
'FylleKäk',
style: TextStyle(fontSize: 28),
),
),
//backgroundColor: Colors.transparent,
bottom: TabBar(
indicatorColor: Colors.white,
labelStyle: TextStyle(
fontSize: 16.0, fontFamily: 'AlfaSlabOne'), //For Selected tab
unselectedLabelStyle: TextStyle(
fontSize: 16.0, fontFamily: 'AlfaSlabOne'), //For Un-selec
tabs: [
Container(
height: 40,
child: new Tab(text: "Info"),
),
Tab(
height: 40,
child: new Tab(text: "Recensioner"),
),
],
),
),
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
Center(
child: Container(
// INFO
decoration: BoxDecoration(
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
restaurantName,
style: TextStyle(
fontFamily: 'AlfaSlabOne',
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 22,
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
"Betyg: ",
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
"Öppettider:",
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
"Prisklass: ",
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
"Telefonnummer: ",
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
restaurantAddress,
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
),
Padding(
padding: const EdgeInsets.all(4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Matkategorier:",
style: TextStyle(
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
color: Color.fromRGBO(0, 160, 227, 1),
fontSize: 14,
),
),
Row(
children: [
Image.asset(
'assets/NotPressedIcons/burgerNotPressed.png',
height: 65,
width: 65),
Image.asset(
'assets/NotPressedIcons/korvNotPressed.png',
height: 65,
width: 65),
],
)
]),
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
height: 50,
width: 350,
child: ElevatedButton(
onPressed: () async {
/*
markerLatLng = LatLng(latitude, longitude);
setTargetLatLng(markerLatLng);
PolylineResult pointsBetweenUserAndTarget =
await createPointsBetweenUserAndTarget(markerLatLng);
addPointsToRouteList(pointsBetweenUserAndTarget);
createPolyLine();
setState(() {});
*/
},
child: InkWell(
child: Text("Hitta hit",
style: TextStyle(
fontSize: 25,
fontFamily: 'AlfaSlabOne')),
onTap: () async {
PolylineResult pointsBetweenUserAndTarget =
await createPointsBetweenUserAndTarget(
markerLatLng);
addPointsToRouteList(
pointsBetweenUserAndTarget);
createPolyLine();
setState(() {});
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ListOrMap_screen(
latitude: latitude,
longitude: longitude,
restaurants: restaurants,
fromMain: false,
),
),
);
},
),
style: ButtonStyle(
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(18.0),
side: BorderSide(
color: Color.fromRGBO(
0, 160, 227, 1)))),
),
),
),
),
),
],
),
),
),
),
Center(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
//Divider(height: 50, thickness: 3,color: Colors.white,),
SizedBox(height: 20),
Container(
alignment: Alignment.center,
//margin: const EdgeInsets.all(110) ,
child: Container(
child: Column(
mainAxisSize: MainAxisSize.max,
// Skriv ut reviewsen här om vi vill
// Annars endast så användaren kan lämna
),
),
),
],
),
),
),
],
),
),
),
);
}
}