toPC
This commit is contained in:
@@ -124,7 +124,7 @@ class _ibus_displayState extends State<ibus_display> {
|
|||||||
Transform.translate(
|
Transform.translate(
|
||||||
offset: Offset(0, -7),
|
offset: Offset(0, -7),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Bus Stopping",
|
"",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import 'package:bus_infotainment/pages/components/ibus_display.dart';
|
import 'package:bus_infotainment/pages/components/ibus_display.dart';
|
||||||
import 'package:bus_infotainment/singletons/live_information.dart';
|
import 'package:bus_infotainment/singletons/live_information.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
class pages_Home extends StatelessWidget {
|
class pages_Home extends StatelessWidget {
|
||||||
const pages_Home({super.key});
|
const pages_Home({super.key});
|
||||||
@@ -30,7 +31,13 @@ class pages_Home extends StatelessWidget {
|
|||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
|
|
||||||
_QuickAnnouncements(),
|
_QuickAnnouncements_IBUS(),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
|
||||||
|
QuickAnnouncement(),
|
||||||
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -39,27 +46,27 @@ class pages_Home extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _QuickAnnouncements extends StatefulWidget {
|
class _QuickAnnouncements_IBUS extends StatefulWidget {
|
||||||
|
|
||||||
|
|
||||||
_QuickAnnouncements({super.key});
|
_QuickAnnouncements_IBUS({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_QuickAnnouncements> createState() => _QuickAnnouncementsState();
|
State<_QuickAnnouncements_IBUS> createState() => _QuickAnnouncementsState_IBUS();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _QuickAnnouncementsState extends State<_QuickAnnouncements> {
|
class _QuickAnnouncementsState_IBUS extends State<_QuickAnnouncements_IBUS> {
|
||||||
|
|
||||||
List<Widget> announcements = [];
|
List<Widget> announcements = [];
|
||||||
|
|
||||||
int _currentIndex = 0;
|
int _currentIndex = 0;
|
||||||
|
|
||||||
_QuickAnnouncementsState() {
|
_QuickAnnouncementsState_IBUS() {
|
||||||
LiveInformation liveInformation = LiveInformation();
|
LiveInformation liveInformation = LiveInformation();
|
||||||
|
|
||||||
for (ManualAnnouncementEntry announcement in liveInformation.manualAnnouncements) {
|
for (ManualAnnouncementEntry announcement in liveInformation.manualAnnouncements) {
|
||||||
announcements.add(
|
announcements.add(
|
||||||
_QuickAnnouncement(announcement: announcement, index: liveInformation.manualAnnouncements.indexOf(announcement))
|
_QuickAnnouncement_IBUS(announcement: announcement, index: liveInformation.manualAnnouncements.indexOf(announcement))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,12 +329,12 @@ int wrap(int i, int j, int length) {
|
|||||||
return ((i - j) % length + length) % length;
|
return ((i - j) % length + length) % length;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _QuickAnnouncement extends StatelessWidget {
|
class _QuickAnnouncement_IBUS extends StatelessWidget {
|
||||||
|
|
||||||
final ManualAnnouncementEntry announcement;
|
final ManualAnnouncementEntry announcement;
|
||||||
final int index;
|
final int index;
|
||||||
|
|
||||||
const _QuickAnnouncement({super.key, required this.announcement, required this.index});
|
const _QuickAnnouncement_IBUS({super.key, required this.announcement, required this.index});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -408,3 +415,163 @@ class _QuickAnnouncement extends StatelessWidget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QuickAnnouncement extends StatelessWidget {
|
||||||
|
|
||||||
|
List<Widget> announcementButtons = [];
|
||||||
|
|
||||||
|
QuickAnnouncement({super.key}){
|
||||||
|
|
||||||
|
LiveInformation liveInformation = LiveInformation();
|
||||||
|
|
||||||
|
for (ManualAnnouncementEntry entry in liveInformation.manualAnnouncements) {
|
||||||
|
announcementButtons.add(
|
||||||
|
_QuickAnnouncement_Entry(manualAnnouncementEntry: entry)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int _currentIndex = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
List<Widget> UsingAnnouncements = [];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
|
||||||
|
Widget widget = announcementButtons[wrap(_currentIndex + i, 0, announcementButtons.length)];
|
||||||
|
|
||||||
|
UsingAnnouncements.add(widget);
|
||||||
|
UsingAnnouncements.add(
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||||
|
color: Colors.grey.shade900,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.3),
|
||||||
|
blurRadius: 4,
|
||||||
|
spreadRadius: 4
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
|
||||||
|
child: Column(
|
||||||
|
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
||||||
|
children: [
|
||||||
|
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.shade800,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
|
||||||
|
child: Text(
|
||||||
|
"Quick Announcements",
|
||||||
|
style: GoogleFonts.montserrat(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
height: 1
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Container
|
||||||
|
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
_currentIndex = wrap(_currentIndex + 4, 0, announcementButtons.length);
|
||||||
|
// setState(() {});
|
||||||
|
},
|
||||||
|
child: const Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Colors.white,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
_currentIndex = wrap(_currentIndex + 4, 0, announcementButtons.length);
|
||||||
|
// setState(() {});
|
||||||
|
},
|
||||||
|
child: const Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
color: Colors.white,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 10),
|
||||||
|
height: 1,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
|
||||||
|
...UsingAnnouncements,
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QuickAnnouncement_Entry extends StatelessWidget {
|
||||||
|
|
||||||
|
final ManualAnnouncementEntry manualAnnouncementEntry;
|
||||||
|
|
||||||
|
const _QuickAnnouncement_Entry({super.key, required this.manualAnnouncementEntry});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// TODO: implement build
|
||||||
|
return Container(
|
||||||
|
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.shade800,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
),
|
||||||
|
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
|
||||||
|
width: double.infinity,
|
||||||
|
|
||||||
|
child: Text(
|
||||||
|
manualAnnouncementEntry.shortName,
|
||||||
|
style: GoogleFonts.montserrat(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -110,6 +110,7 @@ class _Route extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
color: Colors.grey.shade900,
|
color: Colors.grey.shade900,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 10),
|
margin: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
@@ -128,16 +129,10 @@ class _Route extends StatelessWidget {
|
|||||||
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade800,
|
color: Colors.grey.shade800,
|
||||||
boxShadow: [
|
borderRadius: BorderRadius.circular(5),
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
spreadRadius: 2,
|
|
||||||
blurRadius: 2,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(8),
|
||||||
|
|
||||||
child: Text(
|
child: Text(
|
||||||
"Route: ${route.routeNumber}",
|
"Route: ${route.routeNumber}",
|
||||||
@@ -186,17 +181,11 @@ class _Variant extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
spreadRadius: 2,
|
|
||||||
blurRadius: 2,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
color: Colors.grey.shade800,
|
color: Colors.grey.shade800,
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
|
|
||||||
padding: const EdgeInsets.all(5),
|
padding: const EdgeInsets.all(8),
|
||||||
|
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
||||||
@@ -213,6 +202,7 @@ class _Variant extends StatelessWidget {
|
|||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
height: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import 'package:bus_infotainment/utils/audio%20wrapper.dart';
|
|||||||
import 'package:bus_infotainment/utils/delegates.dart';
|
import 'package:bus_infotainment/utils/delegates.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:just_audio/just_audio.dart';
|
|
||||||
|
|
||||||
class LiveInformation {
|
class LiveInformation {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user