添加设备列表

hmxc
张萌 3 years ago
parent 7c197cdc07
commit 908024a870

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 MiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 42 KiB

@ -110,6 +110,20 @@ class $AssetsApplicationsGen {
AssetGenImage get wine => const AssetGenImage('assets/applications/wine.png'); AssetGenImage get wine => const AssetGenImage('assets/applications/wine.png');
} }
class $AssetsBraceletGen {
const $AssetsBraceletGen();
/// File path: assets/bracelet/x5.png
AssetGenImage get x5 => const AssetGenImage('assets/bracelet/x5.png');
/// File path: assets/bracelet/x8.png
AssetGenImage get x8 => const AssetGenImage('assets/bracelet/x8.png');
/// File path: assets/bracelet/xiaomi6.png
AssetGenImage get xiaomi6 =>
const AssetGenImage('assets/bracelet/xiaomi6.png');
}
class $AssetsIconsGen { class $AssetsIconsGen {
const $AssetsIconsGen(); const $AssetsIconsGen();
@ -1189,6 +1203,7 @@ class Assets {
Assets._(); Assets._();
static const $AssetsApplicationsGen applications = $AssetsApplicationsGen(); static const $AssetsApplicationsGen applications = $AssetsApplicationsGen();
static const $AssetsBraceletGen bracelet = $AssetsBraceletGen();
static const $AssetsIconsGen icons = $AssetsIconsGen(); static const $AssetsIconsGen icons = $AssetsIconsGen();
static const $AssetsImagesGen images = $AssetsImagesGen(); static const $AssetsImagesGen images = $AssetsImagesGen();
static const $AssetsJsonGen json = $AssetsJsonGen(); static const $AssetsJsonGen json = $AssetsJsonGen();

@ -0,0 +1,195 @@
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/services/old_age/submit_equipment_code_page.dart';
import 'package:aku_new_community/widget/bee_back_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class AddEquipmentPage extends StatefulWidget {
const AddEquipmentPage({Key? key}) : super(key: key);
@override
_AddEquipmentPageState createState() => _AddEquipmentPageState();
}
class _AddEquipmentPageState extends State<AddEquipmentPage> {
List<String> _tabs = ['手环手表', '睡眠仪', '居家报警器', '血压计'];
PageController _pageController = PageController(initialPage: 0);
int _currentIndex = 0;
@override
void initState() {
super.initState();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: BeeBackButton(),
backgroundColor: Colors.white,
leadingWidth: 104.w,
title: Container(
width: 614.w,
height: 64.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.black.withOpacity(0.06),
),
child: TextField(
decoration: InputDecoration(
hintText: '请输入设备,品牌名称',
border: InputBorder.none,
isDense: true,
contentPadding:
EdgeInsets.only(left: 32.w, bottom: 12.w, top: 12.w),
hintStyle: TextStyle(
color: Colors.black.withOpacity(0.25),
fontSize: 28.sp,
)),
),
),
),
body: SafeArea(
child: Column(
children: [
8.w.heightBox,
Expanded(
child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Row(
children: [
SizedBox(
width: 154.w,
child: ListView(
children: [
..._tabs
.mapIndexed((e, index) => _tabWidget(e, index))
.toList()
],
),
),
Expanded(
child: PageView(
controller: _pageController,
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
children: [
_braceletGid(),
Center(),
Center(),
Center(),
],
))
],
),
),
)
],
),
),
);
}
Widget _braceletGid() {
return ListView(
padding: EdgeInsets.symmetric(horizontal: 24.w),
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 40.w,
child: Row(
children: [
Flexible(
child: Container(
color: Colors.black.withOpacity(0.06),
height: 1.w,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: '爱牵挂'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Flexible(
child: Container(
color: Colors.black.withOpacity(0.06),
height: 1.w,
),
),
],
),
),
GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: [
GestureDetector(
onTap: () {
Get.to(() => SubmitEquipmentCodePage());
},
child: Material(
color: Colors.transparent,
child: Column(
children: [
Assets.bracelet.x5.image(width: 120.w, height: 120.w),
8.w.heightBox,
'x5手环'.text.size(24.sp).color(Colors.black).make(),
],
),
),
)
],
crossAxisCount: 3,
)
],
)
],
);
}
Widget _tabWidget(String title, int index) {
return GestureDetector(
onTap: () {
_currentIndex = index;
_pageController.animateToPage(index,
duration: Duration(milliseconds: 500), curve: Curves.easeInOut);
setState(() {});
},
child: index == _currentIndex
? Container(
width: double.infinity,
height: 56.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF5096F1),
borderRadius: BorderRadius.circular(40.w)),
child: title.text.size(24.sp).color(Colors.white).make(),
)
: Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 24.w),
alignment: Alignment.center,
child: title.text
.size(24.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
),
);
}
}

@ -0,0 +1,231 @@
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_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class bracelet {
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 {
const EquipmentListPage({Key? key}) : super(key: key);
@override
_EquipmentListPageState createState() => _EquipmentListPageState();
}
class _EquipmentListPageState extends State<EquipmentListPage> {
List<bracelet> _connects = [
bracelet(
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
Widget build(BuildContext context) {
var user = Padding(
padding: EdgeInsets.only(left: 24.w, bottom: 24.w, right: 24.w),
child: Row(
children: [
CircleAvatar(
child: Image.network(
UserTool.userProvider.userInfoModel?.imgUrls.first.url ?? ''),
),
24.w.widthBox,
'陈东强'.text.size(28.sp).color(Colors.black).make(),
Spacer(),
'切换用户'.text.size(24.sp).color(Colors.black.withOpacity(0.65)).make(),
24.w.widthBox,
Icon(
CupertinoIcons.chevron_right,
size: 20.w,
),
],
),
);
var connected = Container(
padding: EdgeInsets.all(24.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'当前连接'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.bold
.make(),
24.w.heightBox,
..._connects
.map((e) => Container(
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),
],
),
);
var bingding = Container(
padding: EdgeInsets.all(24.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'已绑定设备'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.bold
.make(),
24.w.heightBox,
..._bracelets
.map((e) => Container(
width: double.infinity,
padding: EdgeInsets.all(24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
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,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${e.title}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
16.w.heightBox,
'${e.describe}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
Spacer(),
Container(
width: 15.w,
height: 16.w,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.25),
borderRadius: BorderRadius.circular(16.w),
),
),
24.w.widthBox,
'${e.open ? '已连接' : '未开启'}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.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()),
],
)
],
)),
);
}
}

@ -119,9 +119,17 @@ class _OldAgeSupportPageState extends State<OldAgeSupportPage> {
); );
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: '智慧养老'.text.size(32.sp).black.make(), title: 'x5手环'.text.size(32.sp).black.make(),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
leading: BeeBackButton(), leading: BeeBackButton(),
actions: [
IconButton(
icon: Icon(CupertinoIcons.repeat),
iconSize: 24.w,
color: Colors.black,
onPressed: () {},
),
],
), ),
extendBody: true, extendBody: true,
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,

@ -1,6 +1,7 @@
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/bracelet/bracelet_model.dart'; import 'package:aku_new_community/models/bracelet/bracelet_model.dart';
import 'package:aku_new_community/pages/services/old_age/equipment_list_page.dart';
import 'package:aku_new_community/utils/network/net_util.dart'; 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';
@ -10,6 +11,7 @@ import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart' hide Response;
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class OldAgeSupportPageSimple extends StatefulWidget { class OldAgeSupportPageSimple extends StatefulWidget {
@ -61,6 +63,16 @@ class _OldAgeSupportPageSimpleState extends State<OldAgeSupportPageSimple> {
return BeeScaffold( return BeeScaffold(
title: 'X5手环', title: 'X5手环',
extendBody: true, extendBody: true,
actions: [
IconButton(
icon: Icon(CupertinoIcons.repeat),
iconSize: 30.w,
color: Colors.black,
onPressed: () {
Get.to(() => EquipmentListPage());
},
)
],
body: Container( body: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,

@ -0,0 +1,86 @@
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class SubmitEquipmentCodePage extends StatefulWidget {
const SubmitEquipmentCodePage({Key? key}) : super(key: key);
@override
_SubmitEquipmentCodePageState createState() =>
_SubmitEquipmentCodePageState();
}
class _SubmitEquipmentCodePageState extends State<SubmitEquipmentCodePage> {
TextEditingController _editingController = TextEditingController();
@override
void dispose() {
_editingController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: 'x5手环',
bodyColor: Colors.white,
body: SafeArea(
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w),
children: [
96.w.heightBox,
Assets.bracelet.xiaomi6.image(width: 520.w, height: 520.w),
80.w.heightBox,
Container(
width: 686.w,
height: 100.w,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(50.w),
),
child: TextField(
controller: _editingController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入设备码/设备ID',
contentPadding:
EdgeInsets.symmetric(horizontal: 40.w, vertical: 30.w),
hintStyle: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.25)),
),
),
),
28.w.heightBox,
'设备码一般在包装底部或两侧条形码附近,以纯数字或数字+字母的形式排列。'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make()
],
),
),
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: MaterialButton(
onPressed: () {
if (_editingController.text.isEmpty) {
BotToast.showText(text: '设备码不能为空');
return;
}
BotToast.showText(text: '请输入正确的设备码');
},
elevation: 0,
color: Color(0xFF6395D7),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(54.w),
),
minWidth: 686.w,
height: 94.w,
child: '提交'.text.size(28.sp).color(Colors.white).make(),
),
));
}
}

@ -139,6 +139,7 @@ flutter:
- assets/applications/ - assets/applications/
- assets/static/ - assets/static/
- assets/json/ - assets/json/
- assets/bracelet/
import_sorter: import_sorter:
emojis: true emojis: true

Loading…
Cancel
Save