near final
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bus_infotainment/singletons/live_information.dart';
|
||||
import 'package:bus_infotainment/backend/live_information.dart';
|
||||
import 'package:bus_infotainment/utils/delegates.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
|
||||
class ibus_display extends StatefulWidget {
|
||||
@@ -21,13 +22,14 @@ class ibus_display extends StatefulWidget {
|
||||
class _ibus_displayState extends State<ibus_display> {
|
||||
|
||||
String topLine = "*** NO MESSAGE ***";
|
||||
String bottomLine = "";
|
||||
|
||||
late final ListenerReceipt<AnnouncementQueueEntry> _receipt;
|
||||
|
||||
_ibus_displayState(){
|
||||
|
||||
LiveInformation liveInformation = LiveInformation();
|
||||
_receipt = liveInformation.announcementDelegate.addListener((value) {
|
||||
_receipt = liveInformation.announcementModule.onAnnouncement.addListener((value) {
|
||||
|
||||
if (topLine == value.displayText){
|
||||
return;
|
||||
@@ -38,7 +40,7 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
|
||||
});
|
||||
});
|
||||
topLine = liveInformation.currentAnnouncement;
|
||||
topLine = liveInformation.announcementModule.currentAnnouncement?.displayText ?? liveInformation.announcementModule.defaultText;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +57,8 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
prefix += " ";
|
||||
}
|
||||
|
||||
input = input.replaceAll("©", "(c)");
|
||||
|
||||
return prefix + input + suffix;
|
||||
|
||||
}
|
||||
@@ -62,7 +66,7 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
@override
|
||||
void dispose() {
|
||||
|
||||
LiveInformation().announcementDelegate.removeListener(_receipt);
|
||||
LiveInformation().announcementModule.onAnnouncement.removeListener(_receipt);
|
||||
|
||||
super.dispose();
|
||||
|
||||
@@ -75,19 +79,45 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
return Container(
|
||||
|
||||
width: double.infinity,
|
||||
color: Colors.black,
|
||||
|
||||
child: FittedBox(
|
||||
alignment: Alignment.center,
|
||||
|
||||
child: Stack(
|
||||
children: [
|
||||
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
|
||||
alignment: Alignment.bottomCenter,
|
||||
|
||||
margin: EdgeInsets.all(1),
|
||||
|
||||
child: Text(
|
||||
"© ImBenji.net - all rights reserved | © Transport for London - all rights reserved",
|
||||
style: GoogleFonts.teko(
|
||||
fontSize: 10,
|
||||
color: Colors.white.withOpacity(0.01),
|
||||
height: 1,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
blurRadius: 5,
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
Container(
|
||||
|
||||
// width: double.infinity,
|
||||
// height: 100,
|
||||
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
border: widget.hasBorder ? Border.all(color: Colors.grey.shade900, width: 2) : null,
|
||||
),
|
||||
|
||||
@@ -127,17 +157,27 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
),
|
||||
|
||||
Transform.translate(
|
||||
offset: Offset(0, -7),
|
||||
child: Text(
|
||||
"",
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.orange,
|
||||
fontFamily: "ibus",
|
||||
height: 1.5
|
||||
offset: Offset(0, -6),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 32*4*3,
|
||||
child: TextScroll(
|
||||
_padString(bottomLine),
|
||||
velocity: Velocity(pixelsPerSecond: Offset(120, 0)),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.orange,
|
||||
fontFamily: "ibus",
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.orange,
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -145,6 +185,8 @@ class _ibus_displayState extends State<ibus_display> {
|
||||
|
||||
),
|
||||
|
||||
|
||||
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
|
||||
Reference in New Issue
Block a user