|
|
@ -221,89 +221,108 @@ Widget navigationCard( |
|
|
// 底部:目的地信息和操作按钮 |
|
|
// 底部:目的地信息和操作按钮 |
|
|
Container( |
|
|
Container( |
|
|
padding: EdgeInsets.fromLTRB(20.w, 8.h, 20.w, 16.h), |
|
|
padding: EdgeInsets.fromLTRB(20.w, 8.h, 20.w, 16.h), |
|
|
child: Stack( |
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
// 目的地和距离时间信息 |
|
|
// 第一层:起点 → 目的地信息(独占整个宽度) |
|
|
Padding( |
|
|
Row( |
|
|
padding: EdgeInsets.only(right: 70.w), // 为右下角按钮留出空间 |
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 |
|
|
child: Column( |
|
|
children: [ |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
// 起点图标 - 统一图标容器宽度,确保对齐 |
|
|
children: [ |
|
|
SizedBox( |
|
|
// 路径显示:当前位置 → 目的地 |
|
|
width: 16.sp, // 固定图标容器宽度 |
|
|
Row( |
|
|
child: Icon( |
|
|
children: [ |
|
|
Icons.my_location, |
|
|
// 起点图标 |
|
|
size: 15.sp, // 统一图标大小 |
|
|
Icon( |
|
|
color: Theme.of(context).primaryColor, |
|
|
Icons.my_location, |
|
|
), |
|
|
size: 16.sp, |
|
|
), |
|
|
color: Theme.of(context).primaryColor, |
|
|
SizedBox(width: 6.w), // 统一间距 |
|
|
), |
|
|
// 当前位置文本 |
|
|
// SizedBox(width: 6.w), |
|
|
Text( |
|
|
// // 当前位置文本 |
|
|
'currentLocation'.tr, // 当前位置 |
|
|
// Text( |
|
|
style: TextStyle( |
|
|
// 'currentLocation'.tr, // 当前位置 |
|
|
fontSize: 14.sp, |
|
|
// style: TextStyle( |
|
|
fontWeight: FontWeight.w500, |
|
|
// fontSize: 14.sp, |
|
|
color: isDarkMode |
|
|
// fontWeight: FontWeight.w500, |
|
|
? Colors.white70 |
|
|
// color: isDarkMode |
|
|
: Colors.black54, |
|
|
// ? Colors.white70 |
|
|
height: 1.3, // 设置行高,提升多行文本可读性 |
|
|
// : Colors.black54, |
|
|
|
|
|
// ), |
|
|
|
|
|
// ), |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
// 箭头图标 |
|
|
|
|
|
Icon( |
|
|
|
|
|
Icons.arrow_forward, |
|
|
|
|
|
size: 16.sp, |
|
|
|
|
|
color: |
|
|
|
|
|
isDarkMode ? Colors.white54 : Colors.black45, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
// 目的地图标 |
|
|
|
|
|
Icon( |
|
|
|
|
|
Icons.location_on, |
|
|
|
|
|
size: 16.sp, |
|
|
|
|
|
color: Colors.red, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 6.w), |
|
|
|
|
|
// 目的地名称 |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
destination, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.white |
|
|
|
|
|
: Colors.black87, |
|
|
|
|
|
), |
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
), |
|
|
SizedBox(height: 4.h), |
|
|
softWrap: true, // 启用软换行 |
|
|
// 距离和时间信息 |
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
Column( |
|
|
), |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
// 箭头图标 |
|
|
|
|
|
Icon( |
|
|
|
|
|
Icons.arrow_forward, |
|
|
|
|
|
size: 15.sp, // 统一图标大小 |
|
|
|
|
|
color: isDarkMode ? Colors.white54 : Colors.black45, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
// 目的地图标 |
|
|
|
|
|
Icon( |
|
|
|
|
|
Icons.location_on, |
|
|
|
|
|
size: 15.sp, // 统一图标大小 |
|
|
|
|
|
color: Colors.red, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 6.w), // 统一间距 |
|
|
|
|
|
// 目的地名称 - 使用Expanded确保自动换行 |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
destination, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
|
|
color: isDarkMode |
|
|
|
|
|
? Colors.white |
|
|
|
|
|
: Colors.black87, |
|
|
|
|
|
height: 1.2, // 设置行高,提升多行文本可读性 |
|
|
|
|
|
), |
|
|
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 4.h), // 第一层和第二层之间的间距 |
|
|
|
|
|
|
|
|
|
|
|
// 第二层:距离时间信息(左侧)+ 导航按钮(右侧) |
|
|
|
|
|
Row( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, // 底部对齐 |
|
|
|
|
|
children: [ |
|
|
|
|
|
// 左侧:距离和时间信息 |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Column( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
// 距离信息 |
|
|
// 距离信息 |
|
|
Row( |
|
|
Row( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 |
|
|
children: [ |
|
|
children: [ |
|
|
Icon( |
|
|
// 距离图标 - 统一图标容器宽度,确保与第一层对齐 |
|
|
Icons.straighten, |
|
|
SizedBox( |
|
|
size: 14.sp, |
|
|
width: 16.sp, // 与第一层图标容器宽度一致 |
|
|
color: Theme.of(context).primaryColor, |
|
|
child: Icon( |
|
|
), |
|
|
Icons.straighten, |
|
|
SizedBox(width: 4.w), |
|
|
size: 15.sp, // 统一图标大小 |
|
|
Text( |
|
|
|
|
|
formatDistance( |
|
|
|
|
|
modes[currentIndex]["distance"]), |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: Theme.of(context).primaryColor, |
|
|
color: Theme.of(context).primaryColor, |
|
|
fontWeight: FontWeight.w500, |
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 6.w), // 与第一层间距一致 |
|
|
|
|
|
Flexible( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
formatDistance( |
|
|
|
|
|
modes[currentIndex]["distance"]), |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: Theme.of(context).primaryColor, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
height: 1.3, // 设置行高,提升多行文本可读性 |
|
|
|
|
|
), |
|
|
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -311,95 +330,106 @@ Widget navigationCard( |
|
|
SizedBox(height: 4.h), |
|
|
SizedBox(height: 4.h), |
|
|
// 时间信息 |
|
|
// 时间信息 |
|
|
Row( |
|
|
Row( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 |
|
|
children: [ |
|
|
children: [ |
|
|
Icon( |
|
|
// 时间图标 - 统一图标容器宽度,确保与第一层对齐 |
|
|
Icons.access_time, |
|
|
SizedBox( |
|
|
size: 14.sp, |
|
|
width: 16.sp, // 与第一层图标容器宽度一致 |
|
|
color: Theme.of(context).primaryColor, |
|
|
child: Icon( |
|
|
|
|
|
Icons.access_time, |
|
|
|
|
|
size: 15.sp, // 统一图标大小 |
|
|
|
|
|
color: Theme.of(context).primaryColor, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(width: 4.w), |
|
|
SizedBox(width: 6.w), // 与第一层间距一致 |
|
|
Text( |
|
|
Flexible( |
|
|
'${'approximate'.tr}${formatDuration(modes[currentIndex]["duration"])}', // 约 |
|
|
child: Text( |
|
|
|
|
|
'${'approximate'.tr}${formatDuration(modes[currentIndex]["duration"])}', // 约 |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
color: Theme.of(context).primaryColor, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
height: 1.3, // 设置行高,提升多行文本可读性 |
|
|
|
|
|
), |
|
|
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
// 导航状态信息 |
|
|
|
|
|
if (navigation != null) ...[ |
|
|
|
|
|
SizedBox(height: 6.h), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
|
horizontal: 8.w, vertical: 4.h), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Theme.of(context) |
|
|
|
|
|
.primaryColor |
|
|
|
|
|
.withOpacity(0.1), |
|
|
|
|
|
borderRadius: BorderRadius.circular(6.r), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
"${navigation["distanceText"]}${'enterRoad'.tr}${navigation["nextRoad"]}", // 进入 |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 12.sp, |
|
|
color: Theme.of(context).primaryColor, |
|
|
color: Theme.of(context).primaryColor, |
|
|
fontWeight: FontWeight.w500, |
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
height: 1.3, // 设置行高,提升多行文本可读性 |
|
|
), |
|
|
), |
|
|
|
|
|
softWrap: true, // 启用软换行 |
|
|
|
|
|
overflow: TextOverflow.visible, // 确保文本完全显示 |
|
|
), |
|
|
), |
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
// 导航状态信息 |
|
|
|
|
|
if (navigation != null) ...[ |
|
|
|
|
|
SizedBox(height: 6.h), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
|
horizontal: 8.w, vertical: 4.h), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Theme.of(context) |
|
|
|
|
|
.primaryColor |
|
|
|
|
|
.withOpacity(0.1), |
|
|
|
|
|
borderRadius: BorderRadius.circular(6.r), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
"${navigation["distanceText"]}${'enterRoad'.tr}${navigation["nextRoad"]}", // 进入 |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
color: Theme.of(context).primaryColor, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// 开始导航按钮 - 绝对定位到右下角 |
|
|
|
|
|
Positioned( |
|
|
|
|
|
right: 0, |
|
|
|
|
|
bottom: 0, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
gradient: LinearGradient( |
|
|
|
|
|
colors: [ |
|
|
|
|
|
Theme.of(context).primaryColor, |
|
|
|
|
|
Theme.of(context).primaryColor.withOpacity(0.8), |
|
|
|
|
|
], |
|
|
], |
|
|
begin: Alignment.topLeft, |
|
|
|
|
|
end: Alignment.bottomRight, |
|
|
|
|
|
), |
|
|
), |
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
|
|
boxShadow: [ |
|
|
|
|
|
BoxShadow( |
|
|
|
|
|
color: |
|
|
|
|
|
Theme.of(context).primaryColor.withOpacity(0.3), |
|
|
|
|
|
blurRadius: 8, |
|
|
|
|
|
offset: const Offset(0, 2), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
), |
|
|
child: Material( |
|
|
|
|
|
color: Colors.transparent, |
|
|
SizedBox(width: 16.w), // 左右内容之间的间距 |
|
|
child: InkWell( |
|
|
|
|
|
|
|
|
// 右侧:开始导航按钮 |
|
|
|
|
|
Container( |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
gradient: LinearGradient( |
|
|
|
|
|
colors: [ |
|
|
|
|
|
Theme.of(context).primaryColor, |
|
|
|
|
|
Theme.of(context).primaryColor.withOpacity(0.8), |
|
|
|
|
|
], |
|
|
|
|
|
begin: Alignment.topLeft, |
|
|
|
|
|
end: Alignment.bottomRight, |
|
|
|
|
|
), |
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
onTap: () { |
|
|
boxShadow: [ |
|
|
controller.openNavigation(start, end, ""); |
|
|
BoxShadow( |
|
|
}, |
|
|
color: Theme.of(context).primaryColor.withOpacity(0.3), |
|
|
child: Container( |
|
|
blurRadius: 8, |
|
|
padding: EdgeInsets.symmetric( |
|
|
offset: const Offset(0, 2), |
|
|
horizontal: 16.w, |
|
|
|
|
|
vertical: 12.h, |
|
|
|
|
|
), |
|
|
), |
|
|
child: Icon( |
|
|
], |
|
|
Icons.navigation, |
|
|
), |
|
|
color: Colors.white, |
|
|
child: Material( |
|
|
size: 20.sp, |
|
|
color: Colors.transparent, |
|
|
|
|
|
child: InkWell( |
|
|
|
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
controller.openNavigation(start, end, ""); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
|
horizontal: 16.w, |
|
|
|
|
|
vertical: 12.h, |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.navigation, |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
size: 20.sp, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
|