Skip to content

Commit

Permalink
led线路图功能完成
Browse files Browse the repository at this point in the history
  • Loading branch information
coldshineb committed Nov 17, 2024
1 parent 15797ed commit 4de1a56
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 77 deletions.
135 changes: 81 additions & 54 deletions lib/Pages/ImageMaker/RailwayTransit/LEDRouteMap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class LEDRouteMapState extends State<LEDRouteMap>
//是否显示背景色
bool showBackground = false;

//间隔点数
int iconsBetween = 3;

//默认导出宽度
int exportWidthValue = 3840;

Expand Down Expand Up @@ -109,7 +112,68 @@ class LEDRouteMapState extends State<LEDRouteMap>
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [importAndExportMenubar()],
children: [
importAndExportMenubar(),
MenuBar(style: menuStyle(context), children: [
Container(
padding: const EdgeInsets.only(top: 14, left: 7),
child: const Text("间隔点数"),
),
DropdownButton(
items: [
DropdownMenuItem(
value: 1,
child: const Text("1"),
),
DropdownMenuItem(
value: 2,
child: const Text("2"),
),
DropdownMenuItem(
value: 3,
child: const Text("3(默认)"),
),
DropdownMenuItem(
value: 4,
child: const Text("4"),
),
DropdownMenuItem(
value: 5,
child: const Text("5"),
),
DropdownMenuItem(
value: 6,
child: const Text("6"),
),
DropdownMenuItem(
value: 7,
child: const Text("7"),
),
DropdownMenuItem(
value: 8,
child: const Text("8"),
),
DropdownMenuItem(
value: 9,
child: const Text("9"),
),
DropdownMenuItem(
value: 10,
child: const Text("10"),
),
],
onChanged: (value) {
try {
iconsBetween = value as int;
setState(() {});
} catch (e) {
print(e);
}
},
value: iconsBetween,
),
])
],
),
Expanded(
child: generalIsScaleEnabled
Expand Down Expand Up @@ -138,6 +202,7 @@ class LEDRouteMapState extends State<LEDRouteMap>
lineColor = Colors.transparent;
lineNumber = "";
lineNumberEN = "";
iconsBetween = 3;
setState(() {});
},
tooltip: '重置',
Expand Down Expand Up @@ -282,59 +347,15 @@ class LEDRouteMapState extends State<LEDRouteMap>
@override
MenuBar importAndExportMenubar() {
return MenuBar(style: menuStyle(context), children: [
generalIsDevMode
? Container(
height: 48,
child: MenuItemButton(
onPressed: _importImage,
child: const Text("导入图片"),
),
)
: Container(),
Container(
height: 48,
child: MenuItemButton(
onPressed: importLineJson,
child: const Text("导入线路"),
),
),
generalIsDevMode ? importImageMenuItemButton(_importImage) : Container(),
importLineJsonMenuItemButton(importLineJson),
const VerticalDivider(thickness: 2),
Container(
height: 48,
child: MenuItemButton(
onPressed: exportAllImage,
child: const Text("导出全部图"),
),
),
exportAllImageMenuItemButton(exportAllImage),
const VerticalDivider(),
Container(
height: 48,
child: MenuItemButton(
onPressed: exportMainImage,
child: const Text("导出主线路图"),
),
),
Container(
height: 48,
child: MenuItemButton(
onPressed: exportDirectionImage,
child: const Text("导出方向指示图"),
),
),
Container(
height: 48,
child: MenuItemButton(
onPressed: exportPassingImage,
child: const Text("导出下一站图"),
),
),
Container(
height: 48,
child: MenuItemButton(
onPressed: exportPassedImage,
child: const Text("导出已过站图"),
),
),
exportMenuItemButton(exportMainImage, "导出主线路图"),
exportMenuItemButton(exportDirectionImage, "导出方向指示图"),
exportMenuItemButton(exportPassingImage, "导出下一站图"),
exportMenuItemButton(exportPassedImage, "导出已过站图"),
Container(
padding: const EdgeInsets.only(top: 14),
child: const Text("导出分辨率"),
Expand Down Expand Up @@ -402,10 +423,16 @@ class LEDRouteMapState extends State<LEDRouteMap>
: Util.hexToColor(
CustomColors.railwayTransitLEDRouteMapNotPassingStation);

for (int i = 0; i < 4 * (stationList.length - 1); i++) {
for (int i = 0; i < (iconsBetween + 1) * (stationList.length - 1); i++) {
iconList.add(Container(
padding: EdgeInsets.fromLTRB(
10 + (lineLength / (4 * (stationList.length - 1))) * i, 0, 0, 0),
10 +
(lineLength /
((iconsBetween + 1) * (stationList.length - 1))) *
i,
0,
0,
0),
child: CustomPaint(
painter: LEDRouteMapStationIconPainter(iconColor, lineColor, 5, 1),
)));
Expand Down
4 changes: 2 additions & 2 deletions lib/Pages/ImageMaker/RailwayTransit/Roots.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class _RailwayTransitRootState extends State<RailwayTransitRoot> {
label: Text('LCD 显示屏', style: TextStyle(fontSize: 15)),
),
NavigationRailDestination(
icon: Icon(Icons.splitscreen_outlined),
selectedIcon: Icon(Icons.splitscreen),
icon: Icon(Icons.hdr_weak_outlined),
selectedIcon: Icon(Icons.hdr_weak),
label: Text('LED 线路图', style: TextStyle(fontSize: 15)),
),
NavigationRailDestination(
Expand Down
78 changes: 59 additions & 19 deletions lib/Parent/ImageMaker/ImageMaker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: importImage,
child:
const Row(children: [Icon(Icons.image_outlined), SizedBox(width: 5),Text("导入图片")])),
child: const Row(children: [
Icon(Icons.image_outlined),
SizedBox(width: 5),
Text("导入图片")
])),
);
}

Expand All @@ -163,7 +166,8 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: importLineJson,
child: const Row(children: [Icon(Icons.code), SizedBox(width: 5),Text("导入线路")])),
child: const Row(
children: [Icon(Icons.code), SizedBox(width: 5), Text("导入线路")])),
);
}

Expand All @@ -172,7 +176,8 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: importStationJson,
child: const Row(children: [Icon(Icons.code), SizedBox(width: 5),Text("导入站名")])),
child: const Row(
children: [Icon(Icons.code), SizedBox(width: 5), Text("导入站名")])),
);
}

Expand All @@ -181,8 +186,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportAllImage,
child:
const Row(children: [Icon(Icons.save_outlined), SizedBox(width: 5),Text("导出全部图")])),
child: const Row(children: [
Icon(Icons.save_outlined),
SizedBox(width: 5),
Text("导出全部图")
])),
);
}

Expand All @@ -191,8 +199,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportMainImage,
child:
const Row(children: [Icon(Icons.save_outlined), SizedBox(width: 5),Text("导出当前图")])),
child: const Row(children: [
Icon(Icons.save_outlined),
SizedBox(width: 5),
Text("导出当前图")
])),
);
}

Expand All @@ -202,8 +213,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportThisStationImage,
child: const Row(
children: [Icon(Icons.save_outlined), SizedBox(width: 5),Text("导出当前站全部图")])),
child: const Row(children: [
Icon(Icons.save_outlined),
SizedBox(width: 5),
Text("导出当前站全部图")
])),
);
}

Expand All @@ -212,8 +226,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportRouteUpImage,
child: const Row(
children: [Icon(Icons.arrow_circle_up), SizedBox(width: 5),Text("导出上行主线路图")])),
child: const Row(children: [
Icon(Icons.arrow_circle_up),
SizedBox(width: 5),
Text("导出上行主线路图")
])),
);
}

Expand All @@ -223,8 +240,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportRouteDownImage,
child: const Row(
children: [Icon(Icons.arrow_circle_down), SizedBox(width: 5),Text("导出下行主线路图")])),
child: const Row(children: [
Icon(Icons.arrow_circle_down),
SizedBox(width: 5),
Text("导出下行主线路图")
])),
);
}

Expand All @@ -233,7 +253,8 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportStationImage,
child: const Row(children: [Icon(Icons.abc), SizedBox(width: 5),Text("导出站名图")])),
child: const Row(
children: [Icon(Icons.abc), SizedBox(width: 5), Text("导出站名图")])),
);
}

Expand All @@ -243,8 +264,11 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportDirectionUpImage,
child: const Row(
children: [Icon(Icons.arrow_upward), SizedBox(width: 5),Text("导出上行运行方向图")])),
child: const Row(children: [
Icon(Icons.arrow_upward),
SizedBox(width: 5),
Text("导出上行运行方向图")
])),
);
}

Expand All @@ -254,8 +278,24 @@ mixin class ImageMaker {
height: 48,
child: MenuItemButton(
onPressed: exportDirectionDownImage,
child: const Row(
children: [Icon(Icons.arrow_downward), SizedBox(width: 5),Text("导出下行运行方向图")])),
child: const Row(children: [
Icon(Icons.arrow_downward),
SizedBox(width: 5),
Text("导出下行运行方向图")
])),
);
}

Container exportMenuItemButton(method, text) {
return Container(
height: 48,
child: MenuItemButton(
onPressed: method,
child: Row(children: [
Icon(Icons.save_outlined),
SizedBox(width: 5),
Text(text)
])),
);
}
}
2 changes: 1 addition & 1 deletion lib/Util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'main.dart';
class Util {
static int currentYear =
DateTime.now().month > 10 ? DateTime.now().year + 1 : DateTime.now().year;
static const String appVersion = '1.5.1';
static const String appVersion = '1.6';
static String copyright =
'版权所有 © Calicy LLC 2022-$currentYear Gennokioku 原忆 2022-$currentYear Coldshine 2020-$currentYear,由 Flutter 强力驱动';

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.5.1
version: 1.6.0

environment:
sdk: '>=3.3.1 <4.0.0'
Expand Down

0 comments on commit 4de1a56

Please sign in to comment.