|
|
@ -18,17 +18,16 @@ import 'package:aku_new_community/utils/network/net_util.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 OldAgeSupportPageSimple extends StatefulWidget {
|
|
|
|
class OldAgeSupportListPage extends StatefulWidget {
|
|
|
|
const OldAgeSupportPageSimple({Key? key}) : super(key: key);
|
|
|
|
const OldAgeSupportListPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_OldAgeSupportPageSimpleState createState() =>
|
|
|
|
_OldAgeSupportListPageState createState() => _OldAgeSupportListPageState();
|
|
|
|
_OldAgeSupportPageSimpleState();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
class _OldAgeSupportListPageState extends State<OldAgeSupportListPage> {
|
|
|
|
BraceletListModel? _currentBracelet;
|
|
|
|
|
|
|
|
List<BraceletListModel> _bracelets = [];
|
|
|
|
List<BraceletListModel> _bracelets = [];
|
|
|
|
|
|
|
|
EasyRefreshController _refreshController = EasyRefreshController();
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
@ -37,6 +36,7 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
|
|
|
|
_refreshController.dispose();
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -74,10 +74,13 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
.bold
|
|
|
|
.bold
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
24.w.heightBox,
|
|
|
|
24.w.heightBox,
|
|
|
|
if (_currentBracelet != null)
|
|
|
|
if (UserTool.oldAgeProvider.bracelet != null)
|
|
|
|
_braceletWidget(e: _currentBracelet!, bgColor: Color(0xFF6395D7),onTap: ()async{
|
|
|
|
_braceletWidget(
|
|
|
|
Get.to(OldAgeShowDataPage(imei: _currentBracelet!.imei,));
|
|
|
|
e: UserTool.oldAgeProvider.bracelet!,
|
|
|
|
})
|
|
|
|
select: true,
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
Get.to(OldAgeShowDataPage());
|
|
|
|
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -96,8 +99,9 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
..._bracelets
|
|
|
|
..._bracelets
|
|
|
|
.map((e) => _braceletWidget(
|
|
|
|
.map((e) => _braceletWidget(
|
|
|
|
e: e,
|
|
|
|
e: e,
|
|
|
|
|
|
|
|
select: false,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
_currentBracelet = e;
|
|
|
|
UserTool.oldAgeProvider.changeImei(e);
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
.toList()
|
|
|
|
.toList()
|
|
|
@ -108,24 +112,25 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return BeeScaffold(
|
|
|
|
return BeeScaffold(
|
|
|
|
title: '设备列表',
|
|
|
|
title: '设备列表',
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
bodyColor: Colors.white,
|
|
|
|
body: SafeArea(
|
|
|
|
body: SafeArea(
|
|
|
|
child: EasyRefresh(
|
|
|
|
child: EasyRefresh(
|
|
|
|
firstRefresh: true,
|
|
|
|
controller: _refreshController,
|
|
|
|
header: MaterialHeader(),
|
|
|
|
firstRefresh: true,
|
|
|
|
onRefresh: () async {
|
|
|
|
header: MaterialHeader(),
|
|
|
|
var base = await NetUtil().get(SAASAPI.bracelet.list);
|
|
|
|
onRefresh: () async {
|
|
|
|
if (base.success) {
|
|
|
|
var base = await NetUtil().get(SAASAPI.bracelet.list);
|
|
|
|
_bracelets = (base.data as List)
|
|
|
|
if (base.success) {
|
|
|
|
.map((e) => BraceletListModel.fromJson(e))
|
|
|
|
_bracelets = (base.data as List)
|
|
|
|
.toList();
|
|
|
|
.map((e) => BraceletListModel.fromJson(e))
|
|
|
|
setState(() {});
|
|
|
|
.toList();
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
child: _bracelets.isEmpty
|
|
|
|
},
|
|
|
|
? _emptyWidgt()
|
|
|
|
child: _bracelets.isEmpty
|
|
|
|
: ListView(
|
|
|
|
? _emptyWidgt()
|
|
|
|
|
|
|
|
: ListView(
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// user,
|
|
|
|
// user,
|
|
|
@ -137,35 +142,38 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
// 24.w.heightBox,
|
|
|
|
// 24.w.heightBox,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomNavi: Padding(
|
|
|
|
bottomNavi: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
|
|
|
child: MaterialButton(
|
|
|
|
child: MaterialButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () async {
|
|
|
|
Get.to(() => AddEquipmentPage());
|
|
|
|
await Get.to(() => AddEquipmentPage());
|
|
|
|
},
|
|
|
|
_refreshController.callRefresh();
|
|
|
|
color: Color(0xFF5096F1),
|
|
|
|
},
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 24.w),
|
|
|
|
color: Color(0xFF5096F1),
|
|
|
|
minWidth: 686.w,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 24.w),
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
minWidth: 686.w,
|
|
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(8.w),
|
|
|
|
child: '添加设备'.text.size(28.sp).white.make(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: '添加设备'.text.size(28.sp).white.make(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget _braceletWidget(
|
|
|
|
Widget _braceletWidget(
|
|
|
|
{required BraceletListModel e, VoidCallback? onTap, Color? bgColor}) {
|
|
|
|
{required BraceletListModel e,
|
|
|
|
|
|
|
|
VoidCallback? onTap,
|
|
|
|
|
|
|
|
required bool select}) {
|
|
|
|
return GestureDetector(
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: onTap,
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: bgColor ?? Colors.black.withOpacity(0.06),
|
|
|
|
color: select ? Color(0xFF6395D7) : Colors.black.withOpacity(0.06),
|
|
|
|
borderRadius: BorderRadius.circular(16.w)),
|
|
|
|
borderRadius: BorderRadius.circular(16.w)),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -182,30 +190,32 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
|
|
|
|
'${e.deviceType} ${e.braceletBrand.name}'
|
|
|
|
'${e.deviceType} ${e.braceletBrand.name}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(
|
|
|
|
|
|
|
|
select ? Colors.white : Colors.black.withOpacity(0.65))
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
16.w.heightBox,
|
|
|
|
16.w.heightBox,
|
|
|
|
'设备码:${e.imei}'
|
|
|
|
'设备码:${e.imei}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(
|
|
|
|
|
|
|
|
select ? Colors.white : Colors.black.withOpacity(0.65))
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Spacer(),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width: 15.w,
|
|
|
|
width: 15.w,
|
|
|
|
height: 16.w,
|
|
|
|
height: 16.w,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.black.withOpacity(0.25),
|
|
|
|
color:select ? Colors.white : Colors.black.withOpacity(0.25),
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
borderRadius: BorderRadius.circular(16.w),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
24.w.widthBox,
|
|
|
|
24.w.widthBox,
|
|
|
|
'${UserTool.oldAgeProvider.imei == e.imei ? '已连接' : '未开启'}'
|
|
|
|
'${select ? '已连接' : '未开启'}'
|
|
|
|
.text
|
|
|
|
.text
|
|
|
|
.size(24.sp)
|
|
|
|
.size(24.sp)
|
|
|
|
.color(Colors.black.withOpacity(0.65))
|
|
|
|
.color(select ? Colors.white : Colors.black.withOpacity(0.65))
|
|
|
|
.make(),
|
|
|
|
.make(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|