|
|
@ -1,29 +1,20 @@
|
|
|
|
|
|
|
|
import 'package:aku_new_community/constants/saas_api.dart';
|
|
|
|
|
|
|
|
import 'package:aku_new_community/models/bracelet/bracelet_list_model.dart';
|
|
|
|
|
|
|
|
import 'package:aku_new_community/utils/network/net_util.dart';
|
|
|
|
|
|
|
|
import 'package:aku_new_community/widget/others/user_tool.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.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:velocity_x/velocity_x.dart';
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:aku_new_community/extensions/widget_list_ext.dart';
|
|
|
|
import 'package:aku_new_community/extensions/widget_list_ext.dart';
|
|
|
|
import 'package:aku_new_community/gen/assets.gen.dart';
|
|
|
|
|
|
|
|
import 'package:aku_new_community/pages/services/old_age/add_equipment_page.dart';
|
|
|
|
|
|
|
|
import 'package:aku_new_community/widget/bee_divider.dart';
|
|
|
|
import 'package:aku_new_community/widget/bee_divider.dart';
|
|
|
|
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
|
|
|
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class bracelet {
|
|
|
|
import 'add_equipment_page.dart';
|
|
|
|
String title;
|
|
|
|
|
|
|
|
String describe;
|
|
|
|
|
|
|
|
bool open;
|
|
|
|
|
|
|
|
String path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bracelet({
|
|
|
|
|
|
|
|
required this.title,
|
|
|
|
|
|
|
|
required this.describe,
|
|
|
|
|
|
|
|
required this.open,
|
|
|
|
|
|
|
|
required this.path,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EquipmentListPage extends StatefulWidget {
|
|
|
|
class EquipmentListPage extends StatefulWidget {
|
|
|
|
const EquipmentListPage({Key? key}) : super(key: key);
|
|
|
|
const EquipmentListPage({Key? key}) : super(key: key);
|
|
|
@ -33,20 +24,8 @@ class EquipmentListPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
List<bracelet> _connects = [
|
|
|
|
BraceletListModel? _currentBracelet;
|
|
|
|
bracelet(
|
|
|
|
List<BraceletListModel> _bracelets = [];
|
|
|
|
title: 'x5手环',
|
|
|
|
|
|
|
|
describe: '爱牵挂',
|
|
|
|
|
|
|
|
open: true,
|
|
|
|
|
|
|
|
path: Assets.bracelet.x5.path),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
List<bracelet> _bracelets = [
|
|
|
|
|
|
|
|
bracelet(
|
|
|
|
|
|
|
|
title: 'x8手环 旗舰型',
|
|
|
|
|
|
|
|
describe: '爱牵挂',
|
|
|
|
|
|
|
|
open: false,
|
|
|
|
|
|
|
|
path: Assets.bracelet.x8.path),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
@ -82,49 +61,8 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
.bold
|
|
|
|
.bold
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
24.w.heightBox,
|
|
|
|
24.w.heightBox,
|
|
|
|
..._connects
|
|
|
|
if (_currentBracelet != null)
|
|
|
|
.map((e) => Container(
|
|
|
|
_braceletWidget(e: _currentBracelet!, bgColor: Color(0xFF6395D7))
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Color(0xFF6395D7),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(16.w)),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Image.asset(
|
|
|
|
|
|
|
|
e.path,
|
|
|
|
|
|
|
|
width: 100.w,
|
|
|
|
|
|
|
|
height: 100.w,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
12.w.widthBox,
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
'${e.title}'.text.size(24.sp).white.make(),
|
|
|
|
|
|
|
|
16.w.heightBox,
|
|
|
|
|
|
|
|
'${e.describe}'.text.size(24.sp).white.make(),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Spacer(),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: 15.w,
|
|
|
|
|
|
|
|
height: 16.w,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
24.w.widthBox,
|
|
|
|
|
|
|
|
'${e.open ? '已连接' : '未开启'}'
|
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
.size(24.sp)
|
|
|
|
|
|
|
|
.white
|
|
|
|
|
|
|
|
.make(),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.toList()
|
|
|
|
|
|
|
|
.sepWidget(separate: 24.w.heightBox),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -141,16 +79,81 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
24.w.heightBox,
|
|
|
|
24.w.heightBox,
|
|
|
|
..._bracelets
|
|
|
|
..._bracelets
|
|
|
|
.map((e) => Container(
|
|
|
|
.map((e) => _braceletWidget(
|
|
|
|
|
|
|
|
e: e,
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
_currentBracelet = e;
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
.toList()
|
|
|
|
|
|
|
|
.sepWidget(
|
|
|
|
|
|
|
|
separate: 24.w.heightBox,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
return BeeScaffold(
|
|
|
|
|
|
|
|
title: '设备列表',
|
|
|
|
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
|
|
|
child: EasyRefresh(
|
|
|
|
|
|
|
|
firstRefresh: true,
|
|
|
|
|
|
|
|
header: MaterialHeader(),
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
var base = await NetUtil().get(SAASAPI.bracelet.list);
|
|
|
|
|
|
|
|
if (base.success) {
|
|
|
|
|
|
|
|
_bracelets = (base.data as List)
|
|
|
|
|
|
|
|
.map((e) => BraceletListModel.fromJson(e))
|
|
|
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: ListView(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// user,
|
|
|
|
|
|
|
|
// BeeDivider.horizontal(),
|
|
|
|
|
|
|
|
connected,
|
|
|
|
|
|
|
|
24.w.heightBox,
|
|
|
|
|
|
|
|
bingding,
|
|
|
|
|
|
|
|
BeeDivider.horizontal(),
|
|
|
|
|
|
|
|
// 24.w.heightBox,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
bottomNavi: Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
|
|
|
|
|
|
|
child: MaterialButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Get.to(() => AddEquipmentPage());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
color: Color(0xFF5096F1),
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 24.w),
|
|
|
|
|
|
|
|
minWidth: 686.w,
|
|
|
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: '添加设备'.text.size(28.sp).white.make(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _braceletWidget(
|
|
|
|
|
|
|
|
{required BraceletListModel e, VoidCallback? onTap, Color? bgColor}) {
|
|
|
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.black.withOpacity(0.06),
|
|
|
|
color: bgColor ?? Colors.black.withOpacity(0.06),
|
|
|
|
borderRadius: BorderRadius.circular(16.w)),
|
|
|
|
borderRadius: BorderRadius.circular(16.w)),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
Image.asset(
|
|
|
|
e.path,
|
|
|
|
e.braceletBrand.imgPath,
|
|
|
|
width: 100.w,
|
|
|
|
width: 100.w,
|
|
|
|
height: 100.w,
|
|
|
|
height: 100.w,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -159,13 +162,13 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
'${e.title}'
|
|
|
|
'${e.deviceType} ${e.braceletBrand.name}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
16.w.heightBox,
|
|
|
|
16.w.heightBox,
|
|
|
|
'${e.describe}'
|
|
|
|
'设备码:${e.imei}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
@ -182,51 +185,14 @@ class _EquipmentListPageState extends State<EquipmentListPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
24.w.widthBox,
|
|
|
|
24.w.widthBox,
|
|
|
|
'${e.open ? '已连接' : '未开启'}'
|
|
|
|
'${UserTool.oldAgeProvider.imei == e.imei ? '已连接' : '未开启'}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
|
|
|
|
.toList()
|
|
|
|
|
|
|
|
.sepWidget(
|
|
|
|
|
|
|
|
separate: 24.w.heightBox,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return BeeScaffold(
|
|
|
|
|
|
|
|
title: '设备列表',
|
|
|
|
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
|
|
|
child: ListView(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// user,
|
|
|
|
|
|
|
|
// BeeDivider.horizontal(),
|
|
|
|
|
|
|
|
connected,
|
|
|
|
|
|
|
|
24.w.heightBox,
|
|
|
|
|
|
|
|
bingding,
|
|
|
|
|
|
|
|
BeeDivider.horizontal(),
|
|
|
|
|
|
|
|
// 24.w.heightBox,
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Get.to(() => AddEquipmentPage());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: '添加智能设备'
|
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
.size(28.sp)
|
|
|
|
|
|
|
|
.color(Color(0xFF6395D7))
|
|
|
|
|
|
|
|
.make()),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|