diff --git a/lib/modules/agent/views/navigation_card.dart b/lib/modules/agent/views/navigation_card.dart index 2d2d0e2a4..0db554a6f 100644 --- a/lib/modules/agent/views/navigation_card.dart +++ b/lib/modules/agent/views/navigation_card.dart @@ -221,89 +221,108 @@ Widget navigationCard( // 底部:目的地信息和操作按钮 Container( padding: EdgeInsets.fromLTRB(20.w, 8.h, 20.w, 16.h), - child: Stack( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - // 目的地和距离时间信息 - Padding( - padding: EdgeInsets.only(right: 70.w), // 为右下角按钮留出空间 - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // 路径显示:当前位置 → 目的地 - Row( - children: [ - // 起点图标 - Icon( - Icons.my_location, - size: 16.sp, - color: Theme.of(context).primaryColor, - ), - // SizedBox(width: 6.w), - // // 当前位置文本 - // Text( - // 'currentLocation'.tr, // 当前位置 - // style: TextStyle( - // fontSize: 14.sp, - // fontWeight: FontWeight.w500, - // color: isDarkMode - // ? Colors.white70 - // : 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, - ), - ), - ], + // 第一层:起点 → 目的地信息(独占整个宽度) + Row( + crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 + children: [ + // 起点图标 - 统一图标容器宽度,确保对齐 + SizedBox( + width: 16.sp, // 固定图标容器宽度 + child: Icon( + Icons.my_location, + size: 15.sp, // 统一图标大小 + color: Theme.of(context).primaryColor, + ), + ), + SizedBox(width: 6.w), // 统一间距 + // 当前位置文本 + Text( + 'currentLocation'.tr, // 当前位置 + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w500, + color: isDarkMode + ? Colors.white70 + : Colors.black54, + height: 1.3, // 设置行高,提升多行文本可读性 ), - SizedBox(height: 4.h), - // 距离和时间信息 - Column( + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 + ), + 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, children: [ // 距离信息 Row( + crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 children: [ - Icon( - Icons.straighten, - size: 14.sp, - color: Theme.of(context).primaryColor, - ), - SizedBox(width: 4.w), - Text( - formatDistance( - modes[currentIndex]["distance"]), - style: TextStyle( - fontSize: 14.sp, + // 距离图标 - 统一图标容器宽度,确保与第一层对齐 + SizedBox( + width: 16.sp, // 与第一层图标容器宽度一致 + child: Icon( + Icons.straighten, + size: 15.sp, // 统一图标大小 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), // 时间信息 Row( + crossAxisAlignment: CrossAxisAlignment.center, // 确保垂直居中对齐 children: [ - Icon( - Icons.access_time, - size: 14.sp, - color: Theme.of(context).primaryColor, + // 时间图标 - 统一图标容器宽度,确保与第一层对齐 + SizedBox( + width: 16.sp, // 与第一层图标容器宽度一致 + child: Icon( + Icons.access_time, + size: 15.sp, // 统一图标大小 + color: Theme.of(context).primaryColor, + ), ), - SizedBox(width: 4.w), - Text( - '${'approximate'.tr}${formatDuration(modes[currentIndex]["duration"])}', // 约 + SizedBox(width: 6.w), // 与第一层间距一致 + Flexible( + 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( - fontSize: 14.sp, + fontSize: 12.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( - 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, - child: InkWell( + + SizedBox(width: 16.w), // 左右内容之间的间距 + + // 右侧:开始导航按钮 + 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), - onTap: () { - controller.openNavigation(start, end, ""); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 16.w, - vertical: 12.h, + boxShadow: [ + BoxShadow( + color: Theme.of(context).primaryColor.withOpacity(0.3), + blurRadius: 8, + offset: const Offset(0, 2), ), - child: Icon( - Icons.navigation, - color: Colors.white, - size: 20.sp, + ], + ), + child: Material( + 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, + ), ), ), ), ), - ), + ], ), ], ), diff --git a/lib/modules/explore/views/explore_view.dart b/lib/modules/explore/views/explore_view.dart index e487c7fbb..9f5250a69 100644 --- a/lib/modules/explore/views/explore_view.dart +++ b/lib/modules/explore/views/explore_view.dart @@ -208,29 +208,42 @@ class ExploreView extends GetView { ), // 文本内容 - Padding( - padding: EdgeInsets.all(24.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: TextStyle( - fontSize: 22.sp, - fontWeight: FontWeight.bold, - color: Colors.white, + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Padding( + padding: EdgeInsets.all(24.w), + child: Column( + mainAxisSize: MainAxisSize.min, // 使用最小尺寸,避免占用过多空间 + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 标题文本 - 支持多行显示 + Text( + title, + style: TextStyle( + fontSize: 22.sp, + fontWeight: FontWeight.bold, + color: Colors.white, + height: 1.2, // 设置行高,提升多行文本可读性 + ), + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), - ), - SizedBox(height: 4.h), - Text( - description, - style: TextStyle( - fontSize: 14.sp, - color: Colors.white.withOpacity(0.8), + SizedBox(height: 6.h), // 稍微增加间距,适应多行布局 + // 描述文本 - 支持多行显示 + Text( + description, + style: TextStyle( + fontSize: 14.sp, + color: Colors.white.withOpacity(0.8), + height: 1.3, // 设置行高,提升多行文本可读性 + ), + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), - ), - ], + ], + ), ), ), ], @@ -341,7 +354,7 @@ class ExploreView extends GetView { fontSize: 12.sp, color: isDarkMode ? Colors.grey[400] : Colors.grey[600], ), - maxLines: 1, + maxLines: 2, overflow: TextOverflow.ellipsis, ), ], diff --git a/lib/modules/home/views/home_view.dart b/lib/modules/home/views/home_view.dart index c24af6607..4cd3c0eaa 100644 --- a/lib/modules/home/views/home_view.dart +++ b/lib/modules/home/views/home_view.dart @@ -519,7 +519,6 @@ class HomeView extends GetView { Widget _buildDisconnectedInfo(bool isDarkMode) { return Container( padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w), - alignment: Alignment.center, decoration: BoxDecoration( color: isDarkMode ? Colors.grey[900] : Colors.grey[100], borderRadius: BorderRadius.circular(10.r), @@ -528,26 +527,37 @@ class HomeView extends GetView { width: 1, ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.bluetooth_disabled, - size: 14.sp, - color: isDarkMode ? Colors.grey[400] : Colors.grey[700], - ), - SizedBox(height: 12.h), - Text( - 'disconnectedDevice'.tr, // 未连接设备,点击下方按钮连接 - style: TextStyle( - fontSize: 12.sp, - color: isDarkMode ? Colors.grey[400] : Colors.grey[700], - // height: 1.4, - // fontWeight: FontWeight.w500, + child: IntrinsicHeight( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, // 整体居中对齐 + crossAxisAlignment: CrossAxisAlignment.start, // 顶部对齐,适应多行文本 + children: [ + // 图标容器,与文本第一行基线对齐 + Padding( + padding: EdgeInsets.only(top: 1.h), // 微调图标位置,与文本第一行基线对齐 + child: Icon( + Icons.bluetooth_disabled, + size: 14.sp, + color: isDarkMode ? Colors.grey[400] : Colors.grey[700], + ), ), - //textAlign: TextAlign.center, - ), - ], + SizedBox(width: 6.w), // 图标和文本间距 + // 文本容器,使用Flexible确保自动换行且保持居中效果 + Flexible( + child: Text( + 'disconnectedDevice'.tr, // 未连接设备,点击下方按钮连接 + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.grey[400] : Colors.grey[700], + height: 1.4, // 启用行高,提升多行文本可读性 + ), + textAlign: TextAlign.center, // 文本居中对齐 + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 + ), + ), + ], + ), ), ); } diff --git a/lib/modules/login/controllers/login_controller.dart b/lib/modules/login/controllers/login_controller.dart index 1aa42acf1..078033325 100644 --- a/lib/modules/login/controllers/login_controller.dart +++ b/lib/modules/login/controllers/login_controller.dart @@ -211,9 +211,9 @@ class LoginController extends GetxController { if (!_hasAcceptedPrivacy.value) { _showPrivacyDialog(); } else { - _initDeviceInfo(); - _initAppInfo(); // 新增:初始化APP信息 - _checkGuestLoginConfig(); // 检查游客登录配置 + _initDeviceInfo(); + _initAppInfo(); // 新增:初始化APP信息 + _checkGuestLoginConfig(); // 检查游客登录配置 } }); } @@ -731,7 +731,7 @@ class LoginController extends GetxController { if (!isVerificationCodeComplete()) { Get.snackbar( 'tip'.tr, - 'pleaseEnterVerificationCode'.tr, + 'pleaseEnterCompleteCode'.tr, snackPosition: SnackPosition.TOP, backgroundColor: Colors.red.withOpacity(0.1), colorText: Colors.red, diff --git a/lib/modules/settings/views/settings_view.dart b/lib/modules/settings/views/settings_view.dart index a7d241f80..7f72efe65 100644 --- a/lib/modules/settings/views/settings_view.dart +++ b/lib/modules/settings/views/settings_view.dart @@ -715,8 +715,8 @@ class SettingsView extends GetView { ? ImageFilter.blur(sigmaX: 5, sigmaY: 5) : ImageFilter.blur(sigmaX: 0, sigmaY: 0), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + // 左侧应用信息区域 - 使用固定宽度 Row( children: [ Container( @@ -770,36 +770,46 @@ class SettingsView extends GetView { ), ], ), - InkWell( - onTap: () { - // 调用检查更新方法 - controller.checkForUpdate(); - }, - child: Container( - constraints: BoxConstraints( - minWidth: 100.w, - maxWidth: 180.w, - ), - padding: EdgeInsets.symmetric( - horizontal: 16.w, - vertical: 8.h, - ), - decoration: BoxDecoration( - color: isDarkMode - ? Colors.blue[900]!.withOpacity(0.3) - : Colors.blue[100], - borderRadius: BorderRadius.circular(16.r), - ), - child: Text( - 'checkUpdates'.tr, // 检查更新 - style: TextStyle( - fontSize: 12.sp, - color: - isDarkMode ? Colors.blue[300] : Colors.blue[600], + + // 间距 + SizedBox(width: 16.w), + + // 右侧检查更新按钮 - 使用Expanded确保充分利用剩余空间 + Expanded( + child: InkWell( + onTap: () { + // 调用检查更新方法 + controller.checkForUpdate(); + }, + child: Container( + constraints: BoxConstraints( + minHeight: 36.h, // 设置最小高度而不是宽度约束 + ), + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 8.h, + ), + decoration: BoxDecoration( + color: isDarkMode + ? Colors.blue[900]!.withOpacity(0.3) + : Colors.blue[100], + borderRadius: BorderRadius.circular(16.r), + ), + child: Center( + child: FittedBox( + fit: BoxFit.scaleDown, // 如果文本过长,自动缩小字体 + child: Text( + 'checkUpdates'.tr, // 检查更新 + style: TextStyle( + fontSize: 12.sp, + color: isDarkMode ? Colors.blue[300] : Colors.blue[600], + height: 1.2, // 稍微减少行高,适应FittedBox + ), + textAlign: TextAlign.center, + maxLines: 2, // 最多显示2行,配合FittedBox使用 + ), + ), ), - overflow: TextOverflow.ellipsis, // 添加省略号 - maxLines: 1, // 限制为单行 - textAlign: TextAlign.center, // 保持居中 ), ), ), @@ -905,8 +915,10 @@ class SettingsView extends GetView { fontSize: 16.sp, fontWeight: FontWeight.w500, color: isDarkMode ? Colors.white : Colors.black87, + height: 1.2, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), if (subtitle != null) SizedBox(height: 2.h), if (subtitle != null) @@ -915,8 +927,10 @@ class SettingsView extends GetView { style: TextStyle( fontSize: 12.sp, color: isDarkMode ? Colors.white70 : Colors.black54, + height: 1.3, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), ], ), @@ -980,8 +994,10 @@ class SettingsView extends GetView { fontSize: 16.sp, fontWeight: FontWeight.w500, color: isDarkMode ? Colors.white : Colors.black87, + height: 1.2, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), if (subtitle != null) SizedBox(height: 2.h), if (subtitle != null) @@ -991,8 +1007,10 @@ class SettingsView extends GetView { fontSize: 12.sp, color: isDarkMode ? Colors.white70 : Colors.black54, + height: 1.3, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), ], ), @@ -1085,8 +1103,10 @@ class SettingsView extends GetView { fontWeight: FontWeight.w500, color: titleColor ?? (isDarkMode ? Colors.white : Colors.black87), + height: 1.2, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), if (subtitle != null) SizedBox(height: 2.h), if (subtitle != null) @@ -1098,8 +1118,10 @@ class SettingsView extends GetView { (isDarkMode ? Colors.white70 : Colors.black54), + height: 1.3, // 设置行高,提升多行文本可读性 ), - overflow: TextOverflow.ellipsis, + softWrap: true, // 启用软换行 + overflow: TextOverflow.visible, // 确保文本完全显示 ), ], ),