From 705eb205cf4f0068bc7792f43a510dd910f14770 Mon Sep 17 00:00:00 2001 From: coldshineb Date: Sat, 6 Apr 2024 19:49:13 -0400 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E4=B8=80=E7=AB=99?= =?UTF-8?q?=20=E4=B8=8B=E4=B8=80=E7=AB=99=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Pages/LCD/ArrivalFiveStations.dart | 54 +++++++++++++++++++++-- lib/Pages/LCD/ArrivalLinearRoute.dart | 47 +++++++++++++++++++- lib/Pages/LCD/ArrivalStationInfo.dart | 60 +++++++++++++++++++++++--- lib/Pages/LCD/RunningLinearRoute.dart | 48 ++++++++++++++++++++- 4 files changed, 198 insertions(+), 11 deletions(-) diff --git a/lib/Pages/LCD/ArrivalFiveStations.dart b/lib/Pages/LCD/ArrivalFiveStations.dart index 57f4c50..120b591 100644 --- a/lib/Pages/LCD/ArrivalFiveStations.dart +++ b/lib/Pages/LCD/ArrivalFiveStations.dart @@ -62,6 +62,7 @@ class ArrivalFiveStationsState extends State with LCD { //背景图片字节数据 Uint8List? _imageBytes; + //背景纹理 Uint8List? pattern; @@ -85,6 +86,7 @@ class ArrivalFiveStationsState extends State with LCD { //运行方向,用于处理已到站与终点站为中间某一站时的线条显示,0为向左行,1为向右行 int trainDirectionValue = 1; + //是否显示原忆轨道交通品牌图标 bool showLogo = true; @@ -206,6 +208,26 @@ class ArrivalFiveStationsState extends State with LCD { }, value: terminusListValue, ), + Container( + height: 48, + child: MenuItemButton( + onPressed: previousStation, + child: const Text( + "上一站", + style: TextStyle(color: Colors.black), + ), + ), + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: nextStation, + child: const Text( + "下一站", + style: TextStyle(color: Colors.black), + ), + ), + ), Container( padding: const EdgeInsets.only(top: 14), child: const Text( @@ -403,9 +425,9 @@ class ArrivalFiveStationsState extends State with LCD { Container backgroundPattern() { return pattern != null ? Container( - height: imageHeight, - width: imageWidth, - child: Image.memory(pattern!, repeat: ImageRepeat.repeat)) + height: imageHeight, + width: imageWidth, + child: Image.memory(pattern!, repeat: ImageRepeat.repeat)) : Container(); } @@ -1741,6 +1763,7 @@ class ArrivalFiveStationsState extends State with LCD { }); } } + //导入线路文件 @override void importLineJson() async { @@ -1954,4 +1977,29 @@ class ArrivalFiveStationsState extends State with LCD { } } } + + void nextStation() { + if (currentStationListIndex == stationList.length - 1 || + currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! + 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } + + void previousStation() { + if (currentStationListIndex == 0 || currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! - 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } } diff --git a/lib/Pages/LCD/ArrivalLinearRoute.dart b/lib/Pages/LCD/ArrivalLinearRoute.dart index 168249d..71f26fc 100644 --- a/lib/Pages/LCD/ArrivalLinearRoute.dart +++ b/lib/Pages/LCD/ArrivalLinearRoute.dart @@ -156,7 +156,27 @@ class ArrivalLinearRouteState extends State with LCD { } }, value: terminusListValue, - ) + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: previousStation, + child: const Text( + "上一站", + style: TextStyle(color: Colors.black), + ), + ), + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: nextStation, + child: const Text( + "下一站", + style: TextStyle(color: Colors.black), + ), + ), + ), ]) ], ), @@ -949,4 +969,29 @@ class ArrivalLinearRouteState extends State with LCD { } } } + + void nextStation() { + if (currentStationListIndex == stationList.length - 1 || + currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! + 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } + + void previousStation() { + if (currentStationListIndex == 0 || currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! - 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } } diff --git a/lib/Pages/LCD/ArrivalStationInfo.dart b/lib/Pages/LCD/ArrivalStationInfo.dart index 844392f..2020f90 100644 --- a/lib/Pages/LCD/ArrivalStationInfo.dart +++ b/lib/Pages/LCD/ArrivalStationInfo.dart @@ -61,6 +61,7 @@ class ArrivalStationInfoState extends State with LCD { //背景图片字节数据 Uint8List? _imageBytes; + //背景纹理 Uint8List? pattern; @@ -90,10 +91,10 @@ class ArrivalStationInfoState extends State with LCD { //运行方向,用于处理已到站与终点站为中间某一站时的线条显示,0为向左行,1为向右行 int trainDirectionValue = 1; + //是否显示原忆轨道交通品牌图标 bool showLogo = true; - //默认导出宽度 int exportWidthValue = 2560; @@ -214,6 +215,26 @@ class ArrivalStationInfoState extends State with LCD { }, value: terminusListValue, ), + Container( + height: 48, + child: MenuItemButton( + onPressed: previousStation, + child: const Text( + "上一站", + style: TextStyle(color: Colors.black), + ), + ), + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: nextStation, + child: const Text( + "下一站", + style: TextStyle(color: Colors.black), + ), + ), + ), ]) ], ), @@ -594,14 +615,16 @@ class ArrivalStationInfoState extends State with LCD { return container; } } + Container backgroundPattern() { return pattern != null ? Container( - height: imageHeight, - width: imageWidth, - child: Image.memory(pattern!, repeat: ImageRepeat.repeat)) + height: imageHeight, + width: imageWidth, + child: Image.memory(pattern!, repeat: ImageRepeat.repeat)) : Container(); } + MenuBar importAndExportMenubar() { return MenuBar(children: [ // Container( @@ -623,7 +646,8 @@ class ArrivalStationInfoState extends State with LCD { style: TextStyle(color: Colors.black), ), ), - ), Container( + ), + Container( height: 48, child: MenuItemButton( onPressed: importPattern, @@ -717,6 +741,7 @@ class ArrivalStationInfoState extends State with LCD { }); } } + //导入线路文件 @override void importLineJson() async { @@ -919,4 +944,29 @@ class ArrivalStationInfoState extends State with LCD { } } } + + void nextStation() { + if (currentStationListIndex == stationList.length - 1 || + currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! + 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } + + void previousStation() { + if (currentStationListIndex == 0 || currentStationListIndex == null) { + return; + } else { + setState(() { + currentStationListIndex = currentStationListIndex! - 1; + currentStationListValue = + stationList[currentStationListIndex!].stationNameCN; + }); + } + } } diff --git a/lib/Pages/LCD/RunningLinearRoute.dart b/lib/Pages/LCD/RunningLinearRoute.dart index c00b047..8870013 100644 --- a/lib/Pages/LCD/RunningLinearRoute.dart +++ b/lib/Pages/LCD/RunningLinearRoute.dart @@ -205,7 +205,27 @@ class RunningLinearRouteState extends State with LCD { } }, value: terminusListValue, - ) + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: previousStation, + child: const Text( + "上一站", + style: TextStyle(color: Colors.black), + ), + ), + ), + Container( + height: 48, + child: MenuItemButton( + onPressed: nextStation, + child: const Text( + "下一站", + style: TextStyle(color: Colors.black), + ), + ), + ), ]) ], ), @@ -804,7 +824,8 @@ class RunningLinearRouteState extends State with LCD { child: Stack( children: [ Widgets.transferLineIcon(transferLine), - Widgets.transferLineTextTwoCharactersStartsWithM(transferLine) + Widgets.transferLineTextTwoCharactersStartsWithM( + transferLine) ], ))); } @@ -1145,4 +1166,27 @@ class RunningLinearRouteState extends State with LCD { } } } + + void nextStation() { + if (nextStationListIndex == stationList.length - 1 || + nextStationListIndex == null) { + return; + } else { + setState(() { + nextStationListIndex = nextStationListIndex! + 1; + nextStationListValue = stationList[nextStationListIndex!].stationNameCN; + }); + } + } + + void previousStation() { + if (nextStationListIndex == 0 || nextStationListIndex == null) { + return; + } else { + setState(() { + nextStationListIndex = nextStationListIndex! - 1; + nextStationListValue = stationList[nextStationListIndex!].stationNameCN; + }); + } + } }