diff --git a/assets/images/equipment_empty.png b/assets/images/equipment_empty.png new file mode 100644 index 00000000..b79a0c69 Binary files /dev/null and b/assets/images/equipment_empty.png differ diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index b6490c3a..33869804 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -1039,6 +1039,10 @@ class $AssetsImagesGen { AssetGenImage get drawings => const AssetGenImage('assets/images/drawings.png'); + /// File path: assets/images/equipment_empty.png + AssetGenImage get equipmentEmpty => + const AssetGenImage('assets/images/equipment_empty.png'); + /// File path: assets/images/house_attestation.png AssetGenImage get houseAttestation => const AssetGenImage('assets/images/house_attestation.png'); 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 57dc49c7..f49a0642 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/add_equipment_page.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'; @@ -60,63 +61,68 @@ class _OldAgeSupportPageSimpleState extends State { .make(), ], ); - 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, - decoration: BoxDecoration( - image: DecorationImage( - alignment: Alignment.topCenter, - image: AssetImage(Assets.static.braceletHeader.path)), - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Colors.white, Color(0xFFC0E5DC).withOpacity(0.355)]), - ), - child: _model == null - ? Container() - : SafeArea( - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 32.w), - children: [ - 400.w.heightBox, - open, - 16.w.heightBox, - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - '数据更新自 ${DateUtil.formatDate(_date!, format: DateFormats.full)}' - .text - .size(22.sp) - .color(Colors.black.withOpacity(0.25)) - .make(), - 40.w.heightBox, - ], - ), - 40.w.heightBox, - overview(), - 24.w.heightBox, - statusCard(), - 40.w.heightBox, - bottomCard(), - 40.w.heightBox, - ], - ), + return _model == null + ? _emptyScaffold() + : 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, + decoration: BoxDecoration( + image: DecorationImage( + alignment: Alignment.topCenter, + image: AssetImage(Assets.static.braceletHeader.path)), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Colors.white, + Color(0xFFC0E5DC).withOpacity(0.355) + ]), ), - ), - ); + child: _model == null + ? Container() + : SafeArea( + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w), + children: [ + 400.w.heightBox, + open, + 16.w.heightBox, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + '数据更新自 ${DateUtil.formatDate(_date!, format: DateFormats.full)}' + .text + .size(22.sp) + .color(Colors.black.withOpacity(0.25)) + .make(), + 40.w.heightBox, + ], + ), + 40.w.heightBox, + overview(), + 24.w.heightBox, + statusCard(), + 40.w.heightBox, + bottomCard(), + 40.w.heightBox, + ], + ), + ), + ), + ); } Future getData() async { @@ -517,4 +523,39 @@ class _OldAgeSupportPageSimpleState extends State { ), ); } + + Widget _emptyScaffold() { + return BeeScaffold( + title: '智慧养老', + body: SafeArea( + child: Center( + child: Column( + children: [ + Assets.images.equipmentEmpty.image(width: 480.w, height: 480.w), + '当前没有绑定任何设备' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.25)) + .make(), + ], + ), + ), + ), + 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(), + ), + ), + ); + } }