feat: 增加设备管理页
This commit is contained in:
parent
a0ae48243d
commit
496ac22528
@ -1,4 +1,5 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
assets/icon/icon_lockGroup_item.png
Normal file
BIN
assets/icon/icon_lockGroup_item.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/icon/lockType_doorLock.png
Normal file
BIN
assets/icon/lockType_doorLock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/icon/lockType_gatewayLock.png
Normal file
BIN
assets/icon/lockType_gatewayLock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
@ -54,7 +54,8 @@ class AppImages{
|
|||||||
static const String iconTableMenu = 'assets/icon/icon_table_menu.png';
|
static const String iconTableMenu = 'assets/icon/icon_table_menu.png';
|
||||||
static const String iconVip = 'assets/icon/icon_vip.png';
|
static const String iconVip = 'assets/icon/icon_vip.png';
|
||||||
static const String defaultAvatar = 'assets/images/default_avatar.png';
|
static const String defaultAvatar = 'assets/images/default_avatar.png';
|
||||||
|
static const String iconLockGroupItem = 'assets/icon/icon_lockGroup_item.png';
|
||||||
|
static const String iconLockTypeDoorLock = 'assets/icon/lockType_doorLock.png';
|
||||||
// 底部导航栏图标
|
// 底部导航栏图标
|
||||||
static const String iconHome = 'assets/icon/bar/home.png';
|
static const String iconHome = 'assets/icon/bar/home.png';
|
||||||
static const String iconHomeSelected = 'assets/icon/bar/home_selected.png';
|
static const String iconHomeSelected = 'assets/icon/bar/home_selected.png';
|
||||||
@ -62,4 +63,5 @@ class AppImages{
|
|||||||
static const String iconNotificationSelected = 'assets/icon/bar/notification_selected.png';
|
static const String iconNotificationSelected = 'assets/icon/bar/notification_selected.png';
|
||||||
static const String iconMine = 'assets/icon/bar/mine.png';
|
static const String iconMine = 'assets/icon/bar/mine.png';
|
||||||
static const String iconMineSelected = 'assets/icon/bar/mine_selected.png';
|
static const String iconMineSelected = 'assets/icon/bar/mine_selected.png';
|
||||||
|
|
||||||
}
|
}
|
||||||
45
lib/common/constant/app_support_device_type.dart
Normal file
45
lib/common/constant/app_support_device_type.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:starwork_flutter/common/constant/app_images.dart';
|
||||||
|
|
||||||
|
class AppSupportDeviceType {
|
||||||
|
static const all = AppSupportDeviceType('0', '所有设备');
|
||||||
|
static const lock = AppSupportDeviceType('1', '锁', iconImagePath: AppImages.iconLockTypeDoorLock);
|
||||||
|
static const gateway = AppSupportDeviceType('2', '网关');
|
||||||
|
static const attendanceMachine = AppSupportDeviceType('3', '考勤机');
|
||||||
|
|
||||||
|
// 获取所有类型
|
||||||
|
static List<AppSupportDeviceType> get allTypes => [
|
||||||
|
all,
|
||||||
|
lock,
|
||||||
|
gateway,
|
||||||
|
attendanceMachine,
|
||||||
|
];
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
final String label;
|
||||||
|
final String? iconImagePath;
|
||||||
|
|
||||||
|
const AppSupportDeviceType(this.value, this.label, {this.iconImagePath});
|
||||||
|
|
||||||
|
// 支持通过字符串值查找枚举实例
|
||||||
|
static AppSupportDeviceType? fromValue(String? value) {
|
||||||
|
return {
|
||||||
|
'0': all,
|
||||||
|
'1': lock,
|
||||||
|
'2': gateway,
|
||||||
|
'3': attendanceMachine,
|
||||||
|
}[value];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支持 toString() 直接输出 value
|
||||||
|
@override
|
||||||
|
String toString() => value;
|
||||||
|
|
||||||
|
// 可选:支持 == 比较
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is AppSupportDeviceType && runtimeType == other.runtimeType && value == other.value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => value.hashCode;
|
||||||
|
}
|
||||||
@ -1,35 +0,0 @@
|
|||||||
class DeviceType {
|
|
||||||
static const all = DeviceType('0', '所有');
|
|
||||||
static const lock = DeviceType('1', '锁');
|
|
||||||
static const gateway = DeviceType('2', '网关');
|
|
||||||
static const attendanceMachine = DeviceType('3', '考勤机');
|
|
||||||
final String value;
|
|
||||||
final String label;
|
|
||||||
|
|
||||||
const DeviceType(this.value, this.label);
|
|
||||||
|
|
||||||
// 支持通过字符串值查找枚举实例
|
|
||||||
static DeviceType? fromValue(String? value) {
|
|
||||||
return {
|
|
||||||
'0': all,
|
|
||||||
'1': lock,
|
|
||||||
'2': gateway,
|
|
||||||
'3': attendanceMachine,
|
|
||||||
}[value];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 支持 toString() 直接输出 value
|
|
||||||
@override
|
|
||||||
String toString() => value;
|
|
||||||
|
|
||||||
// 可选:支持 == 比较
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
other is DeviceType &&
|
|
||||||
runtimeType == other.runtimeType &&
|
|
||||||
value == other.value;
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => value.hashCode;
|
|
||||||
}
|
|
||||||
@ -6,11 +6,13 @@ class CustomCellWidget extends StatelessWidget {
|
|||||||
const CustomCellWidget({
|
const CustomCellWidget({
|
||||||
super.key,
|
super.key,
|
||||||
required this.leftText,
|
required this.leftText,
|
||||||
|
this.leftIcon,
|
||||||
this.rightWidget,
|
this.rightWidget,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String leftText;
|
final String leftText;
|
||||||
|
final Icon? leftIcon;
|
||||||
final Widget? rightWidget;
|
final Widget? rightWidget;
|
||||||
final GestureTapCallback? onTap;
|
final GestureTapCallback? onTap;
|
||||||
|
|
||||||
@ -29,13 +31,21 @@ class CustomCellWidget extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Row(
|
||||||
leftText,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
style: TextStyle(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
fontSize: 14.sp,
|
children: [
|
||||||
color: Colors.black87,
|
if (leftIcon != null) leftIcon!,
|
||||||
fontWeight: FontWeight.w400,
|
if (leftIcon != null) SizedBox(width: 4.w),
|
||||||
),
|
Text(
|
||||||
|
leftText,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.sp,
|
||||||
|
color: Colors.black87,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
rightWidget ??
|
rightWidget ??
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:starwork_flutter/routes/app_routes.dart';
|
import 'package:starwork_flutter/routes/app_routes.dart';
|
||||||
import 'package:starwork_flutter/views/device/confirmPairDevice/confirm_pair_device_binding.dart';
|
import 'package:starwork_flutter/views/device/confirmPairDevice/confirm_pair_device_binding.dart';
|
||||||
import 'package:starwork_flutter/views/device/confirmPairDevice/confirm_pair_device_view.dart';
|
import 'package:starwork_flutter/views/device/confirmPairDevice/confirm_pair_device_view.dart';
|
||||||
|
import 'package:starwork_flutter/views/device/deviceManage/device_manage_binding.dart';
|
||||||
|
import 'package:starwork_flutter/views/device/deviceManage/device_manage_view.dart';
|
||||||
import 'package:starwork_flutter/views/device/searchDevice/search_device_binding.dart';
|
import 'package:starwork_flutter/views/device/searchDevice/search_device_binding.dart';
|
||||||
import 'package:starwork_flutter/views/device/searchDevice/search_device_view.dart';
|
import 'package:starwork_flutter/views/device/searchDevice/search_device_view.dart';
|
||||||
import 'package:starwork_flutter/views/home/home_binding.dart';
|
import 'package:starwork_flutter/views/home/home_binding.dart';
|
||||||
@ -123,5 +125,10 @@ class AppPages {
|
|||||||
page: () => TeamInfoView(),
|
page: () => TeamInfoView(),
|
||||||
binding: TeamInfoBinding(),
|
binding: TeamInfoBinding(),
|
||||||
),
|
),
|
||||||
|
GetPage(
|
||||||
|
name: AppRoutes.deviceManage,
|
||||||
|
page: () => DeviceManageView(),
|
||||||
|
binding: DeviceManageBinding(),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,6 @@ class AppRoutes{
|
|||||||
static const String inputVerificationCode = '/inputVerificationCode';
|
static const String inputVerificationCode = '/inputVerificationCode';
|
||||||
static const String forgotPassword = '/forgotPassword';
|
static const String forgotPassword = '/forgotPassword';
|
||||||
static const String setNewPassword = '/setNewPassword';
|
static const String setNewPassword = '/setNewPassword';
|
||||||
static const String searchDevice = '/searchDevice';
|
|
||||||
static const String confirmPairDevice = '/confirmPairDevice';
|
|
||||||
static const String teamNotice = '/team/teamNotice';
|
static const String teamNotice = '/team/teamNotice';
|
||||||
static const String teamNoticeDetails = '/team/teamNoticeDetails';
|
static const String teamNoticeDetails = '/team/teamNoticeDetails';
|
||||||
static const String teamUseCaseSetting = '/team/useCaseSetting';
|
static const String teamUseCaseSetting = '/team/useCaseSetting';
|
||||||
@ -17,4 +15,7 @@ class AppRoutes{
|
|||||||
static const String teamJoinTeam = '/team/joinTeam';
|
static const String teamJoinTeam = '/team/joinTeam';
|
||||||
static const String teamManage = '/team/teamManage';
|
static const String teamManage = '/team/teamManage';
|
||||||
static const String teamInfo = '/team/teamInfo';
|
static const String teamInfo = '/team/teamInfo';
|
||||||
|
static const String deviceManage = '/device/deviceManage';
|
||||||
|
static const String searchDevice = '/device/searchDevice';
|
||||||
|
static const String confirmPairDevice = '/device/confirmPairDevice';
|
||||||
}
|
}
|
||||||
9
lib/views/device/deviceManage/device_manage_binding.dart
Normal file
9
lib/views/device/deviceManage/device_manage_binding.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:starwork_flutter/views/device/deviceManage/device_manage_controller.dart';
|
||||||
|
|
||||||
|
class DeviceManageBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => DeviceManageController());
|
||||||
|
}
|
||||||
|
}
|
||||||
12
lib/views/device/deviceManage/device_manage_controller.dart
Normal file
12
lib/views/device/deviceManage/device_manage_controller.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_rx/get_rx.dart';
|
||||||
|
import 'package:starwork_flutter/common/constant/app_support_device_type.dart';
|
||||||
|
|
||||||
|
class DeviceManageController extends GetxController with GetSingleTickerProviderStateMixin {
|
||||||
|
// 选中状态 0:全部状态 1:在线 2:离线
|
||||||
|
final RxInt selectedStatusIndex = 0.obs;
|
||||||
|
|
||||||
|
// 选中设备类型
|
||||||
|
final selectedDeviceType = AppSupportDeviceType.all.obs;
|
||||||
|
}
|
||||||
340
lib/views/device/deviceManage/device_manage_view.dart
Normal file
340
lib/views/device/deviceManage/device_manage_view.dart
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:starwork_flutter/common/constant/app_colors.dart';
|
||||||
|
import 'package:starwork_flutter/common/constant/app_support_device_type.dart';
|
||||||
|
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
||||||
|
import 'package:starwork_flutter/extension/function_extension.dart';
|
||||||
|
import 'package:starwork_flutter/views/device/deviceManage/device_manage_controller.dart';
|
||||||
|
|
||||||
|
class DeviceManageView extends GetView<DeviceManageController> {
|
||||||
|
const DeviceManageView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
backgroundColor: AppColors.scaffoldBackgroundColor,
|
||||||
|
appBar: CustomAppBarWidget(
|
||||||
|
title: '设备管理'.tr,
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 10.h,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.w,
|
||||||
|
vertical: 10.h,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildSearchBar(),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
_buildLabelRow(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 主区域:左侧菜单 + 右侧设备列表(占满剩余空间)
|
||||||
|
Expanded(
|
||||||
|
// ✅ 关键:让主内容区域占满剩余高度
|
||||||
|
child: _buildMainArea(),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
'添加设备',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 16.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
'删除设备',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 16.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
'更多管理',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 16.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildSearchBar() {
|
||||||
|
return TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: '请输入设备名称或编号'.tr,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14.sp,
|
||||||
|
color: const Color(0xFF999999),
|
||||||
|
),
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Color(0xFF999999),
|
||||||
|
),
|
||||||
|
filled: true,
|
||||||
|
// 启用背景填充
|
||||||
|
fillColor: const Color(0xFFf0f0f0),
|
||||||
|
// 灰色背景(可调整色值)
|
||||||
|
border: InputBorder.none,
|
||||||
|
// 设置内边距
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: const BorderSide(
|
||||||
|
color: Colors.blue,
|
||||||
|
width: 1.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0.r),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: const BorderSide(color: Colors.transparent),
|
||||||
|
borderRadius: BorderRadius.circular(8.0.r),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildLabelRow() {
|
||||||
|
return Obx(
|
||||||
|
() => Row(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectedStatusIndex.value = 0;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 4.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: controller.selectedStatusIndex == 0 ? Colors.black : Colors.grey[300],
|
||||||
|
borderRadius: BorderRadius.circular(4.r),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'全部状态'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
color: controller.selectedStatusIndex == 0 ? Colors.white : Colors.grey[500],
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectedStatusIndex.value = 1;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 4.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: controller.selectedStatusIndex == 1 ? Colors.black : Colors.grey[300],
|
||||||
|
borderRadius: BorderRadius.circular(4.r),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'在线(${1})'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
color: controller.selectedStatusIndex == 1 ? Colors.white : Colors.grey[500],
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectedStatusIndex.value = 2;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 4.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: controller.selectedStatusIndex == 2 ? Colors.black : Colors.grey[300],
|
||||||
|
borderRadius: BorderRadius.circular(4.r),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'离线(${1})'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
color: controller.selectedStatusIndex == 2 ? Colors.white : Colors.grey[500],
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildMainArea() {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: _buildLeftOptionsList(), // 左侧列表
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: _buildRightDeviceList(), // 右侧设备
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildLeftOptionsList() {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: AppSupportDeviceType.allTypes.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
var deviceType = AppSupportDeviceType.allTypes[index];
|
||||||
|
return Obx(
|
||||||
|
() => GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectedDeviceType.value = deviceType;
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: controller.selectedDeviceType.value == deviceType
|
||||||
|
? AppColors.scaffoldBackgroundColor
|
||||||
|
: Colors.white,
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'${deviceType.label}(${0})',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10.sp,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildRightDeviceList() {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2, // 每行两列
|
||||||
|
crossAxisSpacing: 6.w, // 列间距
|
||||||
|
mainAxisSpacing: 6.h, // 行间距
|
||||||
|
childAspectRatio: 1.6, // 宽高比,可根据需要调整
|
||||||
|
),
|
||||||
|
itemCount: 100,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(8.r)),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10.w,
|
||||||
|
),
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Obx(
|
||||||
|
() => Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (controller.selectedDeviceType.value.iconImagePath != null)
|
||||||
|
Image(
|
||||||
|
image: AssetImage(controller.selectedDeviceType.value.iconImagePath!),
|
||||||
|
width: 26.w,
|
||||||
|
height: 26.w,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
gaplessPlayback: true,
|
||||||
|
// 防止闪烁
|
||||||
|
filterQuality: FilterQuality.medium,
|
||||||
|
// 优化过滤质量
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return Icon(
|
||||||
|
Icons.image_not_supported,
|
||||||
|
size: 26.sp,
|
||||||
|
color: Colors.grey,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 6.h,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'TMH_5sdds5465a4sd5665$index',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10.sp,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 4.h,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'在线',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontSize: 10.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,14 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:starwork_flutter/api/model/team/response/team_info_response.dart';
|
import 'package:starwork_flutter/api/model/team/response/team_info_response.dart';
|
||||||
import 'package:starwork_flutter/base/app_logger.dart';
|
import 'package:starwork_flutter/base/app_logger.dart';
|
||||||
import 'package:starwork_flutter/common/constant/app_colors.dart';
|
import 'package:starwork_flutter/common/constant/app_colors.dart';
|
||||||
|
import 'package:starwork_flutter/common/widgets/custom_cell_list_widget.dart';
|
||||||
|
import 'package:starwork_flutter/common/widgets/custom_cell_widget.dart';
|
||||||
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
||||||
import 'package:starwork_flutter/extension/function_extension.dart';
|
import 'package:starwork_flutter/extension/function_extension.dart';
|
||||||
import 'package:starwork_flutter/routes/app_routes.dart';
|
import 'package:starwork_flutter/routes/app_routes.dart';
|
||||||
@ -50,7 +53,6 @@ class TeamManageView extends GetView<TeamManageController> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -59,7 +61,7 @@ class TeamManageView extends GetView<TeamManageController> {
|
|||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {}.debounce(),
|
onPressed: () {}.debounce(),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.grey[100],
|
backgroundColor: Colors.white,
|
||||||
padding: EdgeInsets.symmetric(vertical: 12.h),
|
padding: EdgeInsets.symmetric(vertical: 12.h),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
|
||||||
),
|
),
|
||||||
@ -205,122 +207,49 @@ class TeamManageView extends GetView<TeamManageController> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Container(
|
CustomCellListWidget(
|
||||||
width: double.infinity,
|
children: [
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
CustomCellWidget(
|
||||||
decoration: BoxDecoration(
|
onTap: () {},
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
leftText: '人员配置'.tr,
|
||||||
color: Colors.white,
|
leftIcon: Icon(
|
||||||
),
|
Icons.perm_contact_calendar_rounded,
|
||||||
child: Column(
|
color: Colors.blue.withOpacity(0.8),
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.perm_contact_calendar_rounded,
|
|
||||||
color: Colors.blue.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 8.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'人员配置',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
rightWidget: Icon(
|
||||||
SizedBox(height: 10.h),
|
Icons.arrow_forward_ios_rounded,
|
||||||
// 分割线
|
size: 16.sp,
|
||||||
Divider(
|
color: Colors.grey[300],
|
||||||
height: 1.h,
|
|
||||||
color: Colors.grey.withOpacity(0.2),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
),
|
||||||
Row(
|
CustomCellWidget(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
onTap: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
leftText: '权限分配'.tr,
|
||||||
children: [
|
leftIcon: Icon(
|
||||||
Row(
|
Icons.person,
|
||||||
children: [
|
color: Colors.blue.withOpacity(0.8),
|
||||||
Icon(
|
|
||||||
Icons.person,
|
|
||||||
color: Colors.blue.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 8.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'权限分配',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
rightWidget: Icon(
|
||||||
Divider(
|
Icons.arrow_forward_ios_rounded,
|
||||||
height: 1.h,
|
size: 16.sp,
|
||||||
color: Colors.grey.withOpacity(0.2),
|
color: Colors.grey[300],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
),
|
||||||
Row(
|
CustomCellWidget(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
onTap: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
leftText: '新用户审核'.tr,
|
||||||
children: [
|
leftIcon: Icon(
|
||||||
Row(
|
Icons.switch_account_rounded,
|
||||||
children: [
|
color: Colors.blue.withOpacity(0.8),
|
||||||
Icon(
|
),
|
||||||
Icons.switch_account_rounded,
|
rightWidget: Icon(
|
||||||
color: Colors.blue,
|
Icons.arrow_forward_ios_rounded,
|
||||||
),
|
size: 16.sp,
|
||||||
SizedBox(
|
color: Colors.grey[300],
|
||||||
width: 8.w,
|
),
|
||||||
),
|
),
|
||||||
Text(
|
],
|
||||||
'新用户审核',
|
),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -340,160 +269,64 @@ class TeamManageView extends GetView<TeamManageController> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Container(
|
CustomCellListWidget(
|
||||||
width: double.infinity,
|
children: [
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
|
CustomCellWidget(
|
||||||
decoration: BoxDecoration(
|
onTap: () {
|
||||||
borderRadius: BorderRadius.circular(8.r),
|
Get.toNamed(AppRoutes.deviceManage);
|
||||||
color: Colors.white,
|
},
|
||||||
),
|
leftText: '设备管理'.tr,
|
||||||
child: Column(
|
leftIcon: Icon(
|
||||||
children: [
|
Icons.storage_rounded,
|
||||||
Row(
|
color: Colors.blue.withOpacity(0.8),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.assessment_rounded,
|
|
||||||
color: Colors.blue.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 8.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'设备管理',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
rightWidget: Icon(
|
||||||
SizedBox(height: 10.h),
|
Icons.arrow_forward_ios_rounded,
|
||||||
// 分割线
|
size: 16.sp,
|
||||||
Divider(
|
color: Colors.grey[300],
|
||||||
height: 1.h,
|
|
||||||
color: Colors.grey.withOpacity(0.2),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
),
|
||||||
Row(
|
CustomCellWidget(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
onTap: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
leftText: '运维服务'.tr,
|
||||||
children: [
|
leftIcon: Icon(
|
||||||
Row(
|
Icons.assessment_rounded,
|
||||||
children: [
|
color: Colors.blue.withOpacity(0.8),
|
||||||
Icon(
|
|
||||||
Icons.assessment_rounded,
|
|
||||||
color: Colors.blue.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 8.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'运维服务',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
rightWidget: Icon(
|
||||||
SizedBox(height: 10.h),
|
Icons.arrow_forward_ios_rounded,
|
||||||
// 分割线
|
size: 16.sp,
|
||||||
Divider(
|
color: Colors.grey[300],
|
||||||
height: 1.h,
|
|
||||||
color: Colors.grey.withOpacity(0.2),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
),
|
||||||
Row(
|
CustomCellWidget(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
onTap: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
leftText: '操作日志'.tr,
|
||||||
children: [
|
leftIcon: Icon(
|
||||||
Row(
|
Icons.assignment,
|
||||||
children: [
|
color: Colors.blue.withOpacity(0.8),
|
||||||
Icon(
|
|
||||||
Icons.assignment,
|
|
||||||
color: Colors.blue.withOpacity(0.8),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 8.w,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'操作日志',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
rightWidget: Icon(
|
||||||
Divider(
|
Icons.arrow_forward_ios_rounded,
|
||||||
height: 1.h,
|
size: 16.sp,
|
||||||
color: Colors.grey.withOpacity(0.2),
|
color: Colors.grey[300],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
),
|
||||||
Row(
|
CustomCellWidget(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
onTap: () {},
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
leftText: '团队二维码'.tr,
|
||||||
children: [
|
leftIcon: Icon(
|
||||||
Row(
|
Icons.qr_code_2_outlined,
|
||||||
children: [
|
color: Colors.blue.withOpacity(0.8),
|
||||||
Icon(
|
),
|
||||||
Icons.qr_code_2_outlined,
|
rightWidget: Icon(
|
||||||
color: Colors.blue,
|
Icons.arrow_forward_ios_rounded,
|
||||||
),
|
size: 16.sp,
|
||||||
SizedBox(
|
color: Colors.grey[300],
|
||||||
width: 8.w,
|
),
|
||||||
),
|
),
|
||||||
Text(
|
],
|
||||||
'团队二维码',
|
),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios_rounded,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 14.sp,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:starwork_flutter/common/constant/app_colors.dart';
|
import 'package:starwork_flutter/common/constant/app_colors.dart';
|
||||||
|
import 'package:starwork_flutter/common/widgets/custome_app_bar_wdiget.dart';
|
||||||
import 'package:starwork_flutter/views/team/teamNotice/team_notice_controller.dart';
|
import 'package:starwork_flutter/views/team/teamNotice/team_notice_controller.dart';
|
||||||
|
|
||||||
class TeamNoticeView extends GetView<TeamNoticeController> {
|
class TeamNoticeView extends GetView<TeamNoticeController> {
|
||||||
@ -11,32 +12,7 @@ class TeamNoticeView extends GetView<TeamNoticeController> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: CustomAppBarWidget(title: '公告'.tr),
|
||||||
backgroundColor: Colors.white,
|
|
||||||
elevation: 0,
|
|
||||||
surfaceTintColor: Colors.transparent,
|
|
||||||
shadowColor: Colors.transparent,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_back_ios_new_rounded), // 替换为任意图标,如关闭、菜单等
|
|
||||||
onPressed: () {
|
|
||||||
// 自定义逻辑,例如:关闭页面、退出流程等
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'公告'.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
TabBar(
|
TabBar(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user