ToLaptop
This commit is contained in:
148
lib/pages/tfl_dataset_test.dart
Normal file
148
lib/pages/tfl_dataset_test.dart
Normal file
@@ -0,0 +1,148 @@
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:bus_infotainment/pages/display.dart';
|
||||
import 'package:bus_infotainment/pages/home.dart';
|
||||
import 'package:bus_infotainment/pages/routes.dart';
|
||||
import 'package:bus_infotainment/pages/settings.dart';
|
||||
import 'package:bus_infotainment/singletons/live_information.dart';
|
||||
import 'package:bus_infotainment/tfl_datasets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
|
||||
class TfL_Dataset_Test extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State<TfL_Dataset_Test> createState() => TfL_Dataset_TestState();
|
||||
}
|
||||
|
||||
class TfL_Dataset_TestState extends State<TfL_Dataset_Test> {
|
||||
|
||||
int _selectedIndex = 0;
|
||||
|
||||
bool hideUI = false;
|
||||
|
||||
late final List<Widget> Pages;
|
||||
|
||||
TfL_Dataset_TestState() {
|
||||
Pages = [
|
||||
pages_Home(),
|
||||
pages_Routes(),
|
||||
pages_Display(this),
|
||||
pages_Settings(),
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
|
||||
_selectedIndex = min(_selectedIndex, Pages.length - 1);
|
||||
_selectedIndex = max(_selectedIndex, 0);
|
||||
|
||||
return Scaffold(
|
||||
|
||||
appBar: !hideUI ? AppBar(
|
||||
|
||||
surfaceTintColor: Colors.transparent,
|
||||
|
||||
title: Column(
|
||||
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
children: [
|
||||
|
||||
Text(
|
||||
"Bus Infotainment",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
|
||||
children: [
|
||||
|
||||
Text(
|
||||
"Selected: ",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
if (liveInformation.getRouteVariant() != null)
|
||||
Container(
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||
|
||||
child: Text(
|
||||
"${liveInformation.getRouteVariant()!.busRoute.routeNumber} to ${liveInformation.getRouteVariant()!.busStops.last.formattedStopName}",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.orange.shade900,
|
||||
),
|
||||
),
|
||||
|
||||
)
|
||||
else
|
||||
Text(
|
||||
"None",
|
||||
style: GoogleFonts.montserrat(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
)
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
) : null,
|
||||
body: Pages[_selectedIndex],
|
||||
|
||||
|
||||
bottomNavigationBar: !hideUI ? NavigationBar(
|
||||
selectedIndex: _selectedIndex,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.home),
|
||||
label: "Home",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.bus_alert),
|
||||
label: "Routes",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.tv),
|
||||
label: "Display",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.settings),
|
||||
label: "Settings",
|
||||
),
|
||||
],
|
||||
onDestinationSelected: (int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
},
|
||||
|
||||
) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user