tolaptop
This commit is contained in:
@@ -44,7 +44,7 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
|
||||
String _padString(String input){
|
||||
|
||||
if (input.length < 40){
|
||||
if (input.length < 30){
|
||||
print("Input is too short");
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import 'package:bus_infotainment/pages/components/ibus_display.dart';
|
||||
import 'package:bus_infotainment/singletons/live_information.dart';
|
||||
import 'package:bus_infotainment/tfl_datasets.dart';
|
||||
import 'package:bus_infotainment/utils/audio%20wrapper.dart';
|
||||
import 'package:bus_infotainment/utils/delegates.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@@ -109,79 +110,102 @@ class pages_Home extends StatelessWidget {
|
||||
outlineColor: Colors.white70,
|
||||
);
|
||||
},
|
||||
defaultBuilder: (context) {
|
||||
BusRouteVariant? routeVariant = LiveInformation().getRouteVariant();
|
||||
if (routeVariant == null) {
|
||||
return Container(
|
||||
color: Colors.grey.shade900,
|
||||
child: Center(
|
||||
child: Text(
|
||||
"No route selected",
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 25,
|
||||
color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return StopAnnouncementPicker(
|
||||
routeVariant: routeVariant,
|
||||
backgroundColor: Colors.grey.shade900,
|
||||
outlineColor: Colors.white70,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
Container(
|
||||
|
||||
margin: EdgeInsets.all(20),
|
||||
|
||||
height: 300-45,
|
||||
|
||||
child: ListView(
|
||||
|
||||
scrollDirection: Axis.vertical,
|
||||
|
||||
children: [
|
||||
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.announceRouteVariant(liveInformation.getRouteVariant()!);
|
||||
},
|
||||
child: Text("Test announcement"),
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.updateServer();
|
||||
},
|
||||
child: Text("Update server"),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
|
||||
width: 100,
|
||||
|
||||
child: TextField(
|
||||
onChanged: (String value) {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
// liveInformation.documentID = value;
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
|
||||
width: 200,
|
||||
|
||||
child: TextField(
|
||||
onSubmitted: (String value) {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.queueAnnouncement(AnnouncementQueueEntry(
|
||||
displayText: value,
|
||||
audioSources: []
|
||||
));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.pullServer();
|
||||
},
|
||||
child: Text("Pull server"),
|
||||
),
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
|
||||
),
|
||||
// Container(
|
||||
//
|
||||
// margin: EdgeInsets.all(20),
|
||||
//
|
||||
// height: 300-45,
|
||||
//
|
||||
// child: ListView(
|
||||
//
|
||||
// scrollDirection: Axis.vertical,
|
||||
//
|
||||
// children: [
|
||||
//
|
||||
// ElevatedButton(
|
||||
// onPressed: () async {
|
||||
// LiveInformation liveInformation = LiveInformation();
|
||||
// liveInformation.queueAnnouncement(await liveInformation.getDestinationAnnouncement(liveInformation.getRouteVariant()!, sendToServer: false));
|
||||
// },
|
||||
// child: Text("Test announcement"),
|
||||
// ),
|
||||
//
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// LiveInformation liveInformation = LiveInformation();
|
||||
// liveInformation.updateServer();
|
||||
// },
|
||||
// child: Text("Update server"),
|
||||
// ),
|
||||
//
|
||||
// SizedBox(
|
||||
//
|
||||
// width: 100,
|
||||
//
|
||||
// child: TextField(
|
||||
// onChanged: (String value) {
|
||||
// LiveInformation liveInformation = LiveInformation();
|
||||
// // liveInformation.documentID = value;
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// SizedBox(
|
||||
//
|
||||
// width: 200,
|
||||
//
|
||||
// child: TextField(
|
||||
// onSubmitted: (String value) {
|
||||
// LiveInformation liveInformation = LiveInformation();
|
||||
// liveInformation.queueAnnouncement(AnnouncementQueueEntry(
|
||||
// displayText: value,
|
||||
// audioSources: []
|
||||
// ));
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
//
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// LiveInformation liveInformation = LiveInformation();
|
||||
// liveInformation.pullServer();
|
||||
// },
|
||||
// child: Text("Pull server"),
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
//
|
||||
// ),
|
||||
//
|
||||
// ),
|
||||
|
||||
],
|
||||
)
|
||||
@@ -194,7 +218,7 @@ class ManualAnnouncementPicker extends StatefulWidget {
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color outlineColor;
|
||||
final List<InformationAnnouncementEntry> announcements;
|
||||
final List<NamedAnnouncementQueueEntry> announcements;
|
||||
|
||||
const ManualAnnouncementPicker({super.key, required this.backgroundColor, required this.outlineColor, required this.announcements});
|
||||
|
||||
@@ -219,14 +243,16 @@ class _ManualAnnouncementPickerState extends State<ManualAnnouncementPicker> {
|
||||
return;
|
||||
}
|
||||
|
||||
for (InformationAnnouncementEntry announcement in widget.announcements!) {
|
||||
int i = 0;
|
||||
for (NamedAnnouncementQueueEntry announcement in widget.announcements!) {
|
||||
announcementWidgets.add(
|
||||
_ManualAnnouncementEntry(
|
||||
announcement: announcement,
|
||||
index: liveInformation.manualAnnouncements.indexOf(announcement),
|
||||
index: i,
|
||||
outlineColor: Colors.white70
|
||||
)
|
||||
);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -506,10 +532,14 @@ class StopAnnouncementPicker extends ManualAnnouncementPicker {
|
||||
outlineColor: outlineColor,
|
||||
announcements: [
|
||||
for (BusRouteStops stop in routeVariant.busStops)
|
||||
InformationAnnouncementEntry(
|
||||
ManualAnnouncementEntry(
|
||||
shortName: stop.formattedStopName,
|
||||
informationText: stop.formattedStopName,
|
||||
audioSources: []
|
||||
audioSources: [
|
||||
// AudioWrapperByteSource(
|
||||
// LiveInformation().announcementCache[stop.getAudioFileName()]
|
||||
// )
|
||||
]
|
||||
)
|
||||
]
|
||||
);
|
||||
@@ -521,7 +551,7 @@ int wrap(int i, int j, int length) {
|
||||
|
||||
class _ManualAnnouncementEntry extends StatelessWidget {
|
||||
|
||||
final InformationAnnouncementEntry announcement;
|
||||
final NamedAnnouncementQueueEntry announcement;
|
||||
final int index;
|
||||
final Color outlineColor;
|
||||
|
||||
|
||||
@@ -334,11 +334,19 @@ class _Variant extends StatelessWidget {
|
||||
child: const Text("Cancel"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
liveInformation.setRouteVariant(variant);
|
||||
|
||||
liveInformation.queueAnnouncement(
|
||||
await liveInformation.getDestinationAnnouncement(
|
||||
variant,
|
||||
sendToServer: true,
|
||||
)
|
||||
);
|
||||
|
||||
tfL_Dataset_TestState.setState(() {});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user