diff --git a/assets/bracelet/x5.png b/assets/bracelet/x5.png new file mode 100644 index 00000000..d017d5fb Binary files /dev/null and b/assets/bracelet/x5.png differ diff --git a/assets/bracelet/x8.png b/assets/bracelet/x8.png new file mode 100644 index 00000000..857bd5e8 Binary files /dev/null and b/assets/bracelet/x8.png differ diff --git a/assets/bracelet/xiaomi6.png b/assets/bracelet/xiaomi6.png new file mode 100644 index 00000000..ea3e420a Binary files /dev/null and b/assets/bracelet/xiaomi6.png differ diff --git a/assets/static/bracelet_header.png b/assets/static/bracelet_header.png index fe483aec..bb9865e8 100644 Binary files a/assets/static/bracelet_header.png and b/assets/static/bracelet_header.png differ diff --git a/assets/static/integral_background.png b/assets/static/integral_background.png index 4a00917b..ed926133 100644 Binary files a/assets/static/integral_background.png and b/assets/static/integral_background.png differ diff --git a/assets/static/sign_in_background.png b/assets/static/sign_in_background.png index 6c9241e7..2aa2e8e0 100644 Binary files a/assets/static/sign_in_background.png and b/assets/static/sign_in_background.png differ diff --git a/assets/static/vip_background.png b/assets/static/vip_background.png index 268c4f99..a02f945f 100644 Binary files a/assets/static/vip_background.png and b/assets/static/vip_background.png differ diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index 5979cfdc..b464c62b 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -110,6 +110,20 @@ class $AssetsApplicationsGen { 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 { const $AssetsIconsGen(); @@ -1200,6 +1214,7 @@ class Assets { Assets._(); static const $AssetsApplicationsGen applications = $AssetsApplicationsGen(); + static const $AssetsBraceletGen bracelet = $AssetsBraceletGen(); static const $AssetsIconsGen icons = $AssetsIconsGen(); static const $AssetsImagesGen images = $AssetsImagesGen(); static const $AssetsJsonGen json = $AssetsJsonGen(); diff --git a/lib/pages/services/old_age/add_equipment_page.dart b/lib/pages/services/old_age/add_equipment_page.dart new file mode 100644 index 00000000..2654d42b --- /dev/null +++ b/lib/pages/services/old_age/add_equipment_page.dart @@ -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 { + List _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(), + ), + ); + } +} diff --git a/lib/pages/services/old_age/equipment_list_page.dart b/lib/pages/services/old_age/equipment_list_page.dart new file mode 100644 index 00000000..9f445ced --- /dev/null +++ b/lib/pages/services/old_age/equipment_list_page.dart @@ -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 { + List _connects = [ + bracelet( + title: 'x5手环', + describe: '爱牵挂', + open: true, + path: Assets.bracelet.x5.path), + ]; + List _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()), + ], + ) + ], + )), + ); + } +} diff --git a/lib/pages/services/old_age/old_age_support_page.dart b/lib/pages/services/old_age/old_age_support_page.dart index eb54601b..e21c060a 100644 --- a/lib/pages/services/old_age/old_age_support_page.dart +++ b/lib/pages/services/old_age/old_age_support_page.dart @@ -119,9 +119,17 @@ class _OldAgeSupportPageState extends State { ); return Scaffold( appBar: AppBar( - title: '智慧养老'.text.size(32.sp).black.make(), + title: 'x5手环'.text.size(32.sp).black.make(), backgroundColor: Colors.transparent, leading: BeeBackButton(), + actions: [ + IconButton( + icon: Icon(CupertinoIcons.repeat), + iconSize: 24.w, + color: Colors.black, + onPressed: () {}, + ), + ], ), extendBody: true, extendBodyBehindAppBar: true, diff --git a/lib/pages/services/old_age/old_age_support_page_simple.dart b/lib/pages/services/old_age/old_age_support_page_simple.dart index 64de95d6..57dc49c7 100644 --- a/lib/pages/services/old_age/old_age_support_page_simple.dart +++ b/lib/pages/services/old_age/old_age_support_page_simple.dart @@ -1,6 +1,7 @@ import 'package:aku_new_community/constants/api.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/pages/services/old_age/equipment_list_page.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_scaffold.dart'; @@ -10,6 +11,7 @@ import 'package:flustars/flustars.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart' hide Response; import 'package:velocity_x/velocity_x.dart'; class OldAgeSupportPageSimple extends StatefulWidget { @@ -61,6 +63,16 @@ class _OldAgeSupportPageSimpleState extends State { return BeeScaffold( title: 'X5手环', extendBody: true, + actions: [ + IconButton( + icon: Icon(CupertinoIcons.repeat), + iconSize: 30.w, + color: Colors.black, + onPressed: () { + Get.to(() => EquipmentListPage()); + }, + ) + ], body: Container( width: double.infinity, height: double.infinity, diff --git a/lib/pages/services/old_age/submit_equipment_code_page.dart b/lib/pages/services/old_age/submit_equipment_code_page.dart new file mode 100644 index 00000000..4b6ff1a9 --- /dev/null +++ b/lib/pages/services/old_age/submit_equipment_code_page.dart @@ -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 { + 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(), + ), + )); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 3bd567bc..ef1ae1d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -141,6 +141,7 @@ flutter: - assets/applications/ - assets/static/ - assets/json/ + - assets/bracelet/ import_sorter: emojis: true