Alot of changes

This commit is contained in:
ImBenji
2024-05-01 12:29:59 +01:00
parent 8cc4016836
commit fc4d3ef898
23 changed files with 1755 additions and 430 deletions

View File

@@ -22,204 +22,206 @@ class pages_Home extends StatelessWidget {
child: Column(
children: [
Row(
children: [
Speedometer(),
],
),
Container(
height: 2,
color: Colors.white70,
),
SingleChildScrollView(
child: Column(
child: SingleChildScrollView(
child: Column(
children: [
Row(
children: [
Container(
margin: EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
),
child: AnnouncementPicker(
backgroundColor: Colors.grey.shade900,
outlineColor: Colors.white70,
announcements: [
for (NamedAnnouncementQueueEntry announcement in LiveInformation().announcementModule.manualAnnouncements)
_AnnouncementEntry(
label: announcement.shortName,
index: LiveInformation().announcementModule.manualAnnouncements.indexOf(announcement),
outlineColor: Colors.white70,
onPressed: (){
LiveInformation liveInformation = LiveInformation();
liveInformation.announcementModule.queueAnnounementByInfoIndex(
infoIndex: liveInformation.announcementModule.manualAnnouncements.indexOf(announcement),
sendToServer: true
);
},
)
],
Speedometer(),
],
),
Container(
height: 2,
color: Colors.white70,
),
SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
),
child: AnnouncementPicker(
backgroundColor: Colors.grey.shade900,
outlineColor: Colors.white70,
announcements: [
for (NamedAnnouncementQueueEntry announcement in LiveInformation().announcementModule.manualAnnouncements)
_AnnouncementEntry(
label: announcement.shortName,
index: LiveInformation().announcementModule.manualAnnouncements.indexOf(announcement),
outlineColor: Colors.white70,
onPressed: (){
LiveInformation liveInformation = LiveInformation();
liveInformation.announcementModule.queueAnnounementByInfoIndex(
infoIndex: liveInformation.announcementModule.manualAnnouncements.indexOf(announcement),
sendToServer: true
);
},
)
],
),
),
),
),
Container(
height: 2,
color: Colors.white70,
),
Container(
margin: EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
),
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(10),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade900,
),
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,
);
}
},
),
),
),
),
ElevatedButton(
onPressed: () async {
LiveInformation liveInformation = LiveInformation();
final commandModule = liveInformation.commandModule;
// commandModule.executeCommand(
// "announce dest"
// );
liveInformation.announcementModule.queueAnnouncementByRouteVariant(
routeVariant: liveInformation.getRouteVariant()!
);
},
child: Text("Announce current 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"),
// ),
//
// ],
//
// ),
//
// ),
],
ElevatedButton(
onPressed: () async {
LiveInformation liveInformation = LiveInformation();
final commandModule = liveInformation.commandModule;
// commandModule.executeCommand(
// "announce dest"
// );
liveInformation.announcementModule.queueAnnouncementByRouteVariant(
routeVariant: liveInformation.getRouteVariant()!
);
},
child: Text("Announce current 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"),
// ),
//
// ],
//
// ),
//
// ),
],
),
),
),
],
],
),
)
);