|
|
@ -271,7 +271,7 @@ class HomeView extends GetView<HomeController> { |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
padding: EdgeInsets.all(16.w), |
|
|
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
|
|
child: Column( |
|
|
child: Column( |
|
|
children: [ |
|
|
children: [ |
|
|
// 状态标题行 |
|
|
// 状态标题行 |
|
|
@ -294,7 +294,7 @@ class HomeView extends GetView<HomeController> { |
|
|
if (!controller.isFullyConnectedRx.value) { |
|
|
if (!controller.isFullyConnectedRx.value) { |
|
|
return _buildConnectButton(); |
|
|
return _buildConnectButton(); |
|
|
} else { |
|
|
} else { |
|
|
return const SizedBox(); |
|
|
return _buildDeviceButton(isDarkMode); |
|
|
} |
|
|
} |
|
|
}), |
|
|
}), |
|
|
], |
|
|
], |
|
|
@ -417,12 +417,42 @@ class HomeView extends GetView<HomeController> { |
|
|
), |
|
|
), |
|
|
SizedBox(height: 12.h), |
|
|
SizedBox(height: 12.h), |
|
|
_buildBatteryInfoGrid(isDarkMode), |
|
|
_buildBatteryInfoGrid(isDarkMode), |
|
|
// SizedBox(height: 16.h), |
|
|
|
|
|
// _buildDeviceDetailsCard(isDarkMode), |
|
|
|
|
|
], |
|
|
], |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 设备管理按钮 |
|
|
|
|
|
Widget _buildDeviceButton(bool isDarkMode) { |
|
|
|
|
|
return ElevatedButton( |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
Get.toNamed(Routes.devices); // 跳转到设备管理页面 |
|
|
|
|
|
}, |
|
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
|
|
backgroundColor: Colors.blue, |
|
|
|
|
|
foregroundColor: Colors.white, |
|
|
|
|
|
minimumSize: Size(double.infinity, 44.h), |
|
|
|
|
|
elevation: 2, |
|
|
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
|
|
borderRadius: BorderRadius.circular(10.r), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.device_hub, size: 16.sp), // 设备图标 |
|
|
|
|
|
SizedBox(width: 8.w), |
|
|
|
|
|
Text( |
|
|
|
|
|
'deviceManagement'.tr, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 电池信息网格布局 |
|
|
// 电池信息网格布局 |
|
|
Widget _buildBatteryInfoGrid(bool isDarkMode) { |
|
|
Widget _buildBatteryInfoGrid(bool isDarkMode) { |
|
|
return Obx(() { |
|
|
return Obx(() { |
|
|
@ -522,6 +552,8 @@ class HomeView extends GetView<HomeController> { |
|
|
batteryColor = Colors.red[600]!; |
|
|
batteryColor = Colors.red[600]!; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool isBatteryZero = batteryLevel == 0; |
|
|
|
|
|
|
|
|
return Expanded( |
|
|
return Expanded( |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
padding: EdgeInsets.symmetric(vertical: 6.h), |
|
|
padding: EdgeInsets.symmetric(vertical: 6.h), |
|
|
@ -540,32 +572,45 @@ class HomeView extends GetView<HomeController> { |
|
|
), |
|
|
), |
|
|
SizedBox(height: 4.h), |
|
|
SizedBox(height: 4.h), |
|
|
|
|
|
|
|
|
// 电池指示器 |
|
|
// 电池指示器 - 当电量为0时,显示横线 |
|
|
Row( |
|
|
isBatteryZero |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
? Container( |
|
|
children: [ |
|
|
width: 20.w, // 横线宽度 |
|
|
Icon( |
|
|
height: 12.sp, // 设置与图标相同的高度,确保对齐 |
|
|
batteryIcon, |
|
|
alignment: Alignment.center, // 居中对齐 |
|
|
size: 12.sp, |
|
|
child: Container( |
|
|
color: batteryColor, |
|
|
width: 10.w, |
|
|
), |
|
|
height: 1.5.h, // 实际横线高度 |
|
|
SizedBox(width: 2.w), |
|
|
color: isDarkMode |
|
|
Text( |
|
|
? Colors.grey[600] |
|
|
'$batteryLevel%', |
|
|
: Colors.grey[400], // 横线颜色 |
|
|
style: TextStyle( |
|
|
), |
|
|
fontSize: 11.sp, |
|
|
) |
|
|
fontWeight: FontWeight.w500, |
|
|
: Row( |
|
|
color: batteryColor, |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
), |
|
|
children: [ |
|
|
), |
|
|
Icon( |
|
|
if (isCharging) |
|
|
batteryIcon, |
|
|
Icon( |
|
|
size: 12.sp, |
|
|
Icons.bolt, |
|
|
color: batteryColor, |
|
|
size: 10.sp, |
|
|
), |
|
|
color: Colors.green[600], |
|
|
SizedBox(width: 2.w), |
|
|
|
|
|
Text( |
|
|
|
|
|
'$batteryLevel%', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
color: batteryColor, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
if (isCharging) |
|
|
|
|
|
Icon( |
|
|
|
|
|
Icons.bolt, |
|
|
|
|
|
size: 10.sp, |
|
|
|
|
|
color: Colors.green[600], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
), |
|
|
), |
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
|