This commit is contained in:
ImBenji
2024-02-28 22:52:24 +00:00
parent 8b8cb0412f
commit 67e1cd3530
2 changed files with 253 additions and 239 deletions

View File

@@ -18,44 +18,17 @@ class pages_Home extends StatelessWidget {
child: Column(
children: [
Container(
height: 2,
color: Colors.white70,
),
Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 2,
spreadRadius: 4
)
]
child: SingleChildScrollView(
child: Column(
children: [
Container(
height: 2,
color: Colors.white70,
),
margin: EdgeInsets.all(20),
child: ibus_display(),
),
Container(
height: 2,
color: Colors.white70,
),
Container(
margin: EdgeInsets.all(20),
child: Container(
Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
boxShadow: [
@@ -66,148 +39,186 @@ class pages_Home extends StatelessWidget {
)
]
),
child: ManualAnnouncementPicker(
backgroundColor: Colors.grey.shade900,
outlineColor: Colors.white70,
announcements: [
...LiveInformation().manualAnnouncements
],
),
margin: EdgeInsets.all(20),
child: ibus_display(),
),
),
Container(
height: 2,
color: Colors.white70,
),
Container(
margin: EdgeInsets.all(20),
child: Container(
decoration: BoxDecoration(
Container(
height: 2,
color: Colors.white70,
),
Container(
margin: EdgeInsets.all(20),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 2,
spreadRadius: 4
color: Colors.black.withOpacity(0.3),
blurRadius: 2,
spreadRadius: 4
)
]
),
child: ManualAnnouncementPicker(
backgroundColor: Colors.grey.shade900,
outlineColor: Colors.white70,
announcements: [
...LiveInformation().manualAnnouncements
],
),
),
child: DelegateBuilder<BusRouteVariant>(
delegate: LiveInformation().routeVariantDelegate,
builder: (context, routeVariant) {
print("rebuilt stop announcement picker");
return StopAnnouncementPicker(
routeVariant: routeVariant,
backgroundColor: Colors.grey.shade900,
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 {
),
Container(
height: 2,
color: Colors.white70,
),
Container(
margin: EdgeInsets.all(20),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 2,
spreadRadius: 4
)
]
),
child: DelegateBuilder<BusRouteVariant>(
delegate: LiveInformation().routeVariantDelegate,
builder: (context, routeVariant) {
print("rebuilt stop announcement picker");
return StopAnnouncementPicker(
routeVariant: routeVariant,
backgroundColor: Colors.grey.shade900,
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: () 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"),
// ),
//
// ],
//
// ),
//
// ),
],
ElevatedButton(
onPressed: () async {
LiveInformation liveInformation = LiveInformation();
liveInformation.queueAnnouncement(await liveInformation.getDestinationAnnouncement(liveInformation.getRouteVariant()!, sendToServer: true));
},
child: Text("Announce Destination"),
),
// 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"),
// ),
//
// ],
//
// ),
//
// ),
],
),
)
);
@@ -535,10 +546,8 @@ class StopAnnouncementPicker extends ManualAnnouncementPicker {
ManualAnnouncementEntry(
shortName: stop.formattedStopName,
informationText: stop.formattedStopName,
audioSources: [
// AudioWrapperByteSource(
// LiveInformation().announcementCache[stop.getAudioFileName()]
// )
audioFileNames: [
stop.getAudioFileName()
]
)
]