minor changes

This commit is contained in:
ImBenji
2024-03-04 10:37:02 +00:00
parent 429eb4ad5f
commit 564c8853ec
7 changed files with 76586 additions and 6713 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -227,9 +227,11 @@ class AnnouncementModule extends InfoModule {
String audioRoute = "R_${routeVariant.busRoute.routeNumber}_001.mp3"; String audioRoute = "R_${routeVariant.busRoute.routeNumber}_001.mp3";
await announcementCache.loadAnnouncements([audioRoute]); await announcementCache.loadAnnouncements([audioRoute, "R_RAIL_REPLACEMENT_SERVICE_001.mp3"]);
AudioWrapperSource sourceRoute = AudioWrapperByteSource(announcementCache[audioRoute]!); AudioWrapperSource sourceRoute = !routeNumber.toLowerCase().startsWith("ul") ?
AudioWrapperByteSource(announcementCache[audioRoute]!) :
AudioWrapperByteSource(announcementCache["R_RAIL_REPLACEMENT_SERVICE_001.mp3"]!);
AudioWrapperSource sourceDestination = AudioWrapperByteSource(await routeVariant.destination!.getAudioBytes()); AudioWrapperSource sourceDestination = AudioWrapperByteSource(await routeVariant.destination!.getAudioBytes());
AnnouncementQueueEntry announcement = AnnouncementQueueEntry( AnnouncementQueueEntry announcement = AnnouncementQueueEntry(

View File

@@ -113,15 +113,23 @@ class TrackerModule extends InfoModule {
{ {
// Testing some audio stuff // Testing some audio stuff
Uint8List? audioBytes = liveInformation.announcementModule.announcementCache[nearestStop!.getAudioFileName()]; Uint8List? audioBytes = liveInformation.announcementModule.announcementCache[nearestStop!.getAudioFileName()];
AudioWrapperByteSource audioSource = AudioWrapperByteSource(audioBytes!);
AudioWrapper audio = AudioWrapper(); if (audioBytes != null) {
AudioWrapperByteSource audioSource = AudioWrapperByteSource(audioBytes!);
await audio.loadSource(audioSource); AudioWrapper audio = AudioWrapper();
await audio.loadSource(audioSource);
duration = await audio.getDuration();
print("Duration of audio: $duration");
} else {
print("Audio bytes are null");
duration = Duration(seconds: 0);
}
duration = await audio.getDuration();
print("Duration of audio: $duration");
} }
// get the estimated distance travelled in 5 seconds, in meters // get the estimated distance travelled in 5 seconds, in meters

View File

@@ -52,7 +52,7 @@ class AudioCacheTest extends StatelessWidget {
children: announcements, children: announcements,
); );
} else { } else {
return CircularProgressIndicator(); return const CircularProgressIndicator();
} }
} }
) )

View File

@@ -341,89 +341,144 @@ class _Variant extends StatelessWidget {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
contentPadding: const EdgeInsets.all(0),
// no curved corners
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(0),
),
contentPadding: const EdgeInsets.only(
top: 15,
left: 15,
right: 15,
bottom: 8,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Select the following route?",
style: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w700,
color: Colors.black,
),
),
Text(
"${route.routeNumber} to ${variant.busStops.last.formattedStopName}",
style: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w500,
color: Colors.black,
),
),
],
), ),
actionsPadding: const EdgeInsets.only( content: Container(
left: 15,
right: 15,
bottom: 15,
),
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom( decoration: BoxDecoration(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5), color: Colors.grey.shade900,
),
), border: Border.all(
color: Colors.white70,
width: 2,
)
child: const Text("Cancel"),
), ),
ElevatedButton(
onPressed: () async {
Navigator.of(context).pop();
LiveInformation liveInformation = LiveInformation(); padding: const EdgeInsets.all(8),
await liveInformation.setRouteVariant(variant);
liveInformation.announcementModule.queueAnnouncementByRouteVariant( child: Column(
routeVariant: variant,
scheduledTime: liveInformation.syncedTimeModule.Now(),
sendToServer: false
);
tfL_Dataset_TestState.setState(() {}); mainAxisSize: MainAxisSize.min,
}, crossAxisAlignment: CrossAxisAlignment.start,
children: [
style: ElevatedButton.styleFrom( Text(
shape: RoundedRectangleBorder( "Select the following route?",
borderRadius: BorderRadius.circular(5), style: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w700,
color: Colors.white70,
height: 1
),
), ),
),
child: const Text("Confirm"), SizedBox(height: 4),
Text(
"${route.routeNumber} to ${variant.busStops.last.formattedStopName}",
style: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w500,
color: Colors.white70,
height: 1
),
),
SizedBox(height: 8),
Row(
children: [
Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: Colors.white70,
width: 2,
),
),
margin: const EdgeInsets.all(0),
padding: const EdgeInsets.all(0),
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
child: const Text("Cancel"),
),
),
SizedBox(width: 8),
Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: Colors.white70,
width: 2,
),
),
child: ElevatedButton(
onPressed: () async {
Navigator.of(context).pop();
LiveInformation liveInformation = LiveInformation();
await liveInformation.setRouteVariant(variant);
liveInformation.announcementModule.queueAnnouncementByRouteVariant(
routeVariant: variant,
scheduledTime: liveInformation.syncedTimeModule.Now(),
sendToServer: false
);
tfL_Dataset_TestState.setState(() {});
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
child: const Text("Confirm"),
),
),
],
)
],
), ),
],
),
actionsPadding: EdgeInsets.all(0)
); );
} }
); );

View File

@@ -40,6 +40,8 @@ class TfL_Dataset_TestState extends State<TfL_Dataset_Test> {
]; ];
} }
ibus_display _ibus_display = ibus_display();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -192,7 +194,7 @@ class TfL_Dataset_TestState extends State<TfL_Dataset_Test> {
margin: const EdgeInsets.all(6), margin: const EdgeInsets.all(6),
child: ibus_display(), child: _ibus_display,
), ),
if (!hideUI) if (!hideUI)