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 createState() => TfL_Dataset_TestState(); } class TfL_Dataset_TestState extends State { int _selectedIndex = 0; bool hideUI = false; late final List 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: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Bus Infotainment", style: GoogleFonts.teko( fontSize: 25, fontWeight: FontWeight.bold, color: Colors.white, height: 1, ), ), Row( children: [ Text( "Selected: ", style: GoogleFonts.teko( fontSize: 20, fontWeight: FontWeight.w600, color: Colors.white, height: 1, ), ), 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: 20, fontWeight: FontWeight.w500, color: Colors.orange.shade900, ), ), ) else Text( "None", style: GoogleFonts.teko( fontSize: 20, 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, ); } }