near final
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
|
||||
import 'package:bus_infotainment/singletons/live_information.dart';
|
||||
import 'package:bus_infotainment/backend/live_information.dart';
|
||||
import 'package:bus_infotainment/pages/components/ibus_display.dart';
|
||||
import 'package:bus_infotainment/tfl_datasets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@@ -20,7 +21,19 @@ class _pages_RoutesState extends State<pages_Routes> {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
|
||||
List<Widget> routes = [];
|
||||
routes.add(SizedBox(height: 10));
|
||||
// routes.add(Container(
|
||||
// width: double.infinity,
|
||||
// height: 16,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.grey.shade900,
|
||||
// border: const Border.symmetric(
|
||||
// horizontal: BorderSide(
|
||||
// color: Colors.white70,
|
||||
// width: 2,
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// ));
|
||||
for (BusRoute route in liveInformation.busSequences!.routes.values) {
|
||||
|
||||
if (!route.routeNumber.toLowerCase().contains(_controller.text.toLowerCase())) {
|
||||
@@ -28,53 +41,81 @@ class _pages_RoutesState extends State<pages_Routes> {
|
||||
}
|
||||
|
||||
routes.add(_Route(route, this));
|
||||
routes.add(SizedBox(height: 10));
|
||||
routes.add(Container(
|
||||
width: double.infinity,
|
||||
height: 16,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade900,
|
||||
border: const Border.symmetric(
|
||||
horizontal: BorderSide(
|
||||
color: Colors.white70,
|
||||
width: 2,
|
||||
),
|
||||
)
|
||||
),
|
||||
));
|
||||
}
|
||||
if(!routes.isEmpty){
|
||||
routes.removeLast();
|
||||
}
|
||||
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
width: double.infinity,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
|
||||
children: [
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade900,
|
||||
),
|
||||
|
||||
width: double.infinity,
|
||||
|
||||
child: Column(
|
||||
|
||||
Container(
|
||||
children: [
|
||||
|
||||
padding: const EdgeInsets.all(10),
|
||||
Container(
|
||||
|
||||
margin: const EdgeInsets.all(10),
|
||||
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
onChanged: (String value) {
|
||||
setState(() {});
|
||||
},
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
decoration: InputDecoration(
|
||||
hintText: ">",
|
||||
),
|
||||
onChanged: (String value) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 2,
|
||||
color: Colors.white70,
|
||||
),
|
||||
|
||||
if (routes.isNotEmpty)
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: routes,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
"No routes found",
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 50,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white70,
|
||||
height: 1
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
@@ -93,28 +134,23 @@ class _Route extends StatelessWidget {
|
||||
List<Widget> Variants = [];
|
||||
|
||||
for (BusRouteVariant variant in route.routeVariants.values) {
|
||||
Variants.add(const SizedBox(height: 10));
|
||||
Variants.add(_Variant(route, variant, tfL_Dataset_TestState));
|
||||
|
||||
if (route.routeVariants.values.last != variant) {
|
||||
Variants.add(Container(
|
||||
width: double.infinity,
|
||||
height: 2,
|
||||
color: Colors.white70,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Container(
|
||||
|
||||
alignment: Alignment.center,
|
||||
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 4,
|
||||
),
|
||||
],
|
||||
color: Colors.grey.shade900,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
|
||||
margin: const EdgeInsets.symmetric(horizontal: 10),
|
||||
padding: const EdgeInsets.all(10),
|
||||
color: Colors.grey.shade900,
|
||||
|
||||
width: 100,
|
||||
|
||||
@@ -125,21 +161,27 @@ class _Route extends StatelessWidget {
|
||||
|
||||
children: [
|
||||
|
||||
|
||||
|
||||
Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade800,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Colors.white70,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.all(4),
|
||||
|
||||
child: Text(
|
||||
"Route: ${route.routeNumber}",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 20,
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: Colors.white70,
|
||||
height: 1
|
||||
),
|
||||
|
||||
@@ -147,12 +189,35 @@ class _Route extends StatelessWidget {
|
||||
|
||||
),
|
||||
|
||||
ListView(
|
||||
children: Variants,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 2,
|
||||
color: Colors.white70
|
||||
|
||||
),
|
||||
|
||||
Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Colors.white70,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
margin: const EdgeInsets.all(4),
|
||||
|
||||
child: ListView(
|
||||
children: Variants,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
@@ -181,7 +246,7 @@ class _Variant extends StatelessWidget {
|
||||
Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade800,
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
|
||||
@@ -198,10 +263,10 @@ class _Variant extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
"Start:",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: Colors.white70,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
@@ -210,14 +275,14 @@ class _Variant extends StatelessWidget {
|
||||
|
||||
Expanded(
|
||||
child: TextScroll(
|
||||
"${variant.busStops.first.formattedStopName}",
|
||||
variant.busStops.first.formattedStopName,
|
||||
mode: TextScrollMode.bouncing,
|
||||
pauseBetween: const Duration(seconds: 2),
|
||||
pauseOnBounce: const Duration(seconds: 2),
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
color: Colors.white70,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
@@ -232,10 +297,11 @@ class _Variant extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
"End:",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: Colors.white70,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -247,10 +313,10 @@ class _Variant extends StatelessWidget {
|
||||
mode: TextScrollMode.bouncing,
|
||||
pauseBetween: const Duration(seconds: 2),
|
||||
pauseOnBounce: const Duration(seconds: 2),
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
color: Colors.white70,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
@@ -338,13 +404,12 @@ class _Variant extends StatelessWidget {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.setRouteVariant(variant);
|
||||
await liveInformation.setRouteVariant(variant);
|
||||
|
||||
liveInformation.queueAnnouncement(
|
||||
await liveInformation.getDestinationAnnouncement(
|
||||
variant,
|
||||
sendToServer: true,
|
||||
)
|
||||
liveInformation.announcementModule.queueAnnouncementByRouteVariant(
|
||||
routeVariant: variant,
|
||||
scheduledTime: liveInformation.syncedTimeModule.Now(),
|
||||
sendToServer: false
|
||||
);
|
||||
|
||||
tfL_Dataset_TestState.setState(() {});
|
||||
|
||||
Reference in New Issue
Block a user