基本完成APP的所有页面中的语言切换支持的开发和设计
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
|
||||
class RouteDirectionPanel extends StatefulWidget {
|
||||
// 接收外部传入的初始值
|
||||
@@ -8,6 +9,10 @@ class RouteDirectionPanel extends StatefulWidget {
|
||||
final ValueChanged<Map<String, dynamic>>? onValueChanged;
|
||||
// 取消/关闭面板回调(保留)
|
||||
final VoidCallback? onCancel;
|
||||
// 多语言支持
|
||||
final String? titleText;
|
||||
final String? optimalHeadingText;
|
||||
final String? routeDirectionText;
|
||||
|
||||
const RouteDirectionPanel({
|
||||
super.key,
|
||||
@@ -15,6 +20,9 @@ class RouteDirectionPanel extends StatefulWidget {
|
||||
this.initialDirection = 0.0, // 默认方向0度
|
||||
this.onValueChanged, // 实时值变更回调
|
||||
this.onCancel,
|
||||
this.titleText,
|
||||
this.optimalHeadingText,
|
||||
this.routeDirectionText,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -65,9 +73,9 @@ class _RouteDirectionPanelState extends State<RouteDirectionPanel> {
|
||||
},
|
||||
child: const Icon(Icons.arrow_back_ios, color: Colors.black87, size: 20),
|
||||
),
|
||||
const Text(
|
||||
'航线方向',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.black87),
|
||||
Text(
|
||||
widget.titleText ?? '航线方向',
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.black87),
|
||||
),
|
||||
const SizedBox(width: 24), // 占位保持标题居中
|
||||
],
|
||||
@@ -78,7 +86,7 @@ class _RouteDirectionPanelState extends State<RouteDirectionPanel> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('最优航向', style: TextStyle(fontSize: 16, color: Colors.black87)),
|
||||
Text(widget.optimalHeadingText ?? '最优航向', style: const TextStyle(fontSize: 16, color: Colors.black87)),
|
||||
Switch(
|
||||
value: _optimalHeading,
|
||||
activeColor: const Color(0xFF00C853),
|
||||
@@ -101,7 +109,7 @@ class _RouteDirectionPanelState extends State<RouteDirectionPanel> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('航线方向', style: TextStyle(fontSize: 16, color: Colors.black87)),
|
||||
Text(widget.routeDirectionText ?? '航线方向', style: const TextStyle(fontSize: 16, color: Colors.black87)),
|
||||
Text(
|
||||
'${_direction.toStringAsFixed(0)}°',
|
||||
style: TextStyle(fontSize: 16, color: _optimalHeading ? Colors.grey : Colors.black87, fontWeight: FontWeight.w500),
|
||||
|
||||
Reference in New Issue
Block a user