From 24089f59b91517752a7db7dd4e03571835b54be8 Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Wed, 2 Aug 2023 10:23:18 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=B0=83=E6=95=B4=E4=B8=BA=E5=A4=9A=E7=BA=A7?= =?UTF-8?q?=E8=81=94=E5=8A=A8=202=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87-=E6=96=B0=E5=A2=9E=E2=80=9C=E5=8F=AF=E8=A7=86?= =?UTF-8?q?=E5=AF=B9=E8=AE=B2=E9=97=A8=E9=94=81=E2=80=9D=203=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E4=BA=AB=E5=88=B0=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E9=A1=B5=E9=9D=A2--=E6=9C=AA=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/images/lan/lan_en.json | 2 + star_lock/images/lan/lan_keys.json | 2 + star_lock/images/lan/lan_zh.json | 2 + .../passwordKeyDetail_page.dart | 1 + .../seletLockType/seletLockType_page.dart | 6 +- .../authorityManagement_page.dart | 139 ++++++++---- .../authorityManagement/getNameList_page.dart | 8 +- star_lock/lib/tools/ExpandedListView.dart | 204 ++++++++++++++++++ .../lib/tools/shareModule/sharePopup.dart | 105 +++++++++ star_lock/lib/translations/lanKeyEntity.dart | 8 + 10 files changed, 426 insertions(+), 51 deletions(-) create mode 100644 star_lock/lib/tools/ExpandedListView.dart create mode 100644 star_lock/lib/tools/shareModule/sharePopup.dart diff --git a/star_lock/images/lan/lan_en.json b/star_lock/images/lan/lan_en.json index b089d2a4..68566d46 100644 --- a/star_lock/images/lan/lan_en.json +++ b/star_lock/images/lan/lan_en.json @@ -191,6 +191,8 @@ "lanChinese":"Chinese", "multilingual":"Multilingual", "addLock":"Add Lock", + "selectLockType":"Select lock type", + "videoIntercomDoorLock":"Video intercom door lock", "addDevice":"Add device", "gateway":"Gateway", "message":"Message", diff --git a/star_lock/images/lan/lan_keys.json b/star_lock/images/lan/lan_keys.json index 22f3f9d0..42a2b92a 100644 --- a/star_lock/images/lan/lan_keys.json +++ b/star_lock/images/lan/lan_keys.json @@ -191,6 +191,8 @@ "lanChinese":"lanChinese", "multilingual":"multilingual", "addLock":"addLock", + "selectLockType":"selectLockType", + "videoIntercomDoorLock":"videoIntercomDoorLock", "addDevice":"addDevice", "gateway":"gateway", "message":"message", diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index 05cf5f74..1ea2a7f0 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -191,6 +191,8 @@ "lanChinese":"中文", "multilingual":"多语言", "addLock":"添加锁", + "selectLockType":"选择锁类型", + "videoIntercomDoorLock":"可视对讲门锁", "addDevice":"添加设备", "gateway":"网关", "message":"消息", diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart index 5e267bf9..d8ff30b2 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:star_lock/tools/shareModule/sharePopup.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; diff --git a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart index 632e205f..550a2b61 100644 --- a/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart +++ b/star_lock/lib/mine/addLock/seletLockType/seletLockType_page.dart @@ -21,7 +21,7 @@ class _SeletLockTypePageState extends State with BaseWidget { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: TranslationLoader.lanKeys!.addLock!.tr, + barTitle: TranslationLoader.lanKeys!.selectLockType!.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( @@ -40,6 +40,10 @@ class _SeletLockTypePageState extends State with BaseWidget { TranslationLoader.lanKeys!.doorLock!.tr, () { Navigator.pushNamed(context, Routers.addLockPage); }), + lockTypeItem('images/lockType/lockType_doorLock.png', + TranslationLoader.lanKeys!.videoIntercomDoorLock!.tr, () { + Navigator.pushNamed(context, Routers.addLockPage); + }), lockTypeItem('images/lockType/lockType_padlock.png', TranslationLoader.lanKeys!.padlock!.tr, () { Navigator.pushNamed(context, Routers.addLockPage); diff --git a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart index 7e82d7f3..62403282 100644 --- a/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart +++ b/star_lock/lib/mine/mineSet/authorityManagement/authorityManagement_page.dart @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_utils/get_utils.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/tools/ExpandedListView.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -97,20 +98,14 @@ class _AuthorityManagementPageState extends State child: ListView.separated( itemBuilder: (context, index) { if (index == 0) { - return _buildNameWidget( - context, index, 'images/icon_password.png', '密码1'); + return _buildNameExpandedList(context, index, "张三"); } else if (index == 1) { - return _buildNameWidget( - context, index, 'images/icon_card.png', '卡1'); + return _buildNameExpandedList(context, index, "李四"); } else if (index == 2) { - return _buildNameWidget( - context, index, 'images/icon_fingerprint.png', '指纹1'); - } else if (index == 3) { - return _buildNameWidget( - context, index, 'images/icon_card.png', '遥控1'); + return _buildNameExpandedList(context, index, "王二"); + } else { + return _buildNameExpandedList(context, index, "麻子"); } - return null; - // return _buildNameWidget(context, index); }, separatorBuilder: (context, index) { return const Divider( @@ -141,17 +136,13 @@ class _AuthorityManagementPageState extends State child: ListView.separated( itemBuilder: (context, index) { if (index == 0) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "大门锁"); + return _buildDeviceExpandedList(context, index, "大门锁"); } else if (index == 1) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "办公室锁"); + return _buildDeviceExpandedList(context, index, "办公室锁"); } else if (index == 2) { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "会议室锁"); + return _buildDeviceExpandedList(context, index, "会议室锁"); } else { - return _buildDeviceWidget( - context, index, 'images/icon_lock.png', "宴会厅锁"); + return _buildDeviceExpandedList(context, index, "宴会厅锁"); } }, separatorBuilder: (context, index) { @@ -172,10 +163,85 @@ class _AuthorityManagementPageState extends State ); } + //设备多层级列表 + Widget _buildDeviceExpandedList(context, index, deviceName) { + return ExpandedListTile( + onTap: () => print("onTap."), + title: deviceName, + imgName: 'images/icon_lock.png', + typeImgList: const [], + child: ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: 10, + itemBuilder: (_, index) { + if (index == 0) { + return _buildNameWidget( + context, index, 'images/icon_password.png', '张三'); + } else if (index == 1) { + return _buildNameWidget( + context, index, 'images/icon_card.png', '李四'); + } else if (index == 2) { + return _buildNameWidget( + context, index, 'images/icon_fingerprint.png', '王二'); + } else if (index == 3) { + return _buildNameWidget( + context, index, 'images/icon_card.png', '麻子'); + } else { + return null; + } + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ), + ); + } + + //姓名多层级列表 + Widget _buildNameExpandedList(context, index, deviceName) { + return ExpandedListTile( + onTap: () => print("onTap."), + title: deviceName, + imgName: 'images/controls_user.png', + typeImgList: const ['images/icon_password.png', 'images/icon_card.png'], + child: ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: 5, + itemBuilder: (_, index) { + if (index == 0) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "大门锁"); + } else if (index == 1) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "办公室锁"); + } else if (index == 2) { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "会议室锁"); + } else { + return _buildDeviceWidget( + context, index, 'images/icon_lock.png', "宴会厅锁"); + } + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ), + ); + } + +//单个姓名行 Widget _buildNameWidget(context, index, imageName, getName) { return GestureDetector( child: Container( - height: 90.h, + height: 60.h, color: Colors.white, width: ScreenUtil().screenWidth, child: Row( @@ -184,7 +250,7 @@ class _AuthorityManagementPageState extends State width: 30.w, ), Image.asset( - imageName, + 'images/controls_user.png', width: 36.w, height: 36.w, ), @@ -193,18 +259,8 @@ class _AuthorityManagementPageState extends State ), Text( getName, - style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor), - ), - Expanded( - child: SizedBox( - width: 20.w, - )), - Image.asset( - isNameSelect == false - ? 'images/icon_round_unSelet.png' - : 'images/icon_round_selet.png', - width: 30.sp, - height: 30.sp, + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), ), SizedBox( width: 30.w, @@ -223,10 +279,11 @@ class _AuthorityManagementPageState extends State ); } +//单个设备行 Widget _buildDeviceWidget(context, index, imageName, deviceName) { return GestureDetector( child: Container( - height: 90.h, + height: 60.h, color: Colors.white, width: ScreenUtil().screenWidth, child: Row( @@ -244,18 +301,8 @@ class _AuthorityManagementPageState extends State ), Text( deviceName, - style: TextStyle(fontSize: 22.sp, color: AppColors.blackColor), - ), - Expanded( - child: SizedBox( - width: 20.w, - )), - Image.asset( - isDeviceSelect == false - ? 'images/icon_round_unSelet.png' - : 'images/icon_round_selet.png', - width: 30.sp, - height: 30.sp, + style: TextStyle( + fontSize: 20.sp, color: AppColors.darkGrayTextColor), ), SizedBox( width: 30.w, diff --git a/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart b/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart index 2761e59e..8dd83f30 100644 --- a/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart +++ b/star_lock/lib/mine/mineSet/authorityManagement/getNameList_page.dart @@ -54,16 +54,16 @@ class _GetNameListPageState extends State { itemBuilder: (context, index) { if (index == 0) { return _buildNameWidget( - context, index, 'images/icon_password.png', '密码1'); + context, index, 'images/controls_user.png', '张三'); } else if (index == 1) { return _buildNameWidget( - context, index, 'images/icon_card.png', '卡1'); + context, index, 'images/controls_user.png', '李四'); } else if (index == 2) { return _buildNameWidget( - context, index, 'images/icon_fingerprint.png', '指纹1'); + context, index, 'images/controls_user.png', '王二'); } else if (index == 3) { return _buildNameWidget( - context, index, 'images/icon_card.png', '遥控1'); + context, index, 'images/controls_user.png', '麻子'); } return null; }, diff --git a/star_lock/lib/tools/ExpandedListView.dart b/star_lock/lib/tools/ExpandedListView.dart new file mode 100644 index 00000000..ee3fce8c --- /dev/null +++ b/star_lock/lib/tools/ExpandedListView.dart @@ -0,0 +1,204 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:star_lock/app_settings/app_colors.dart'; + +class ExpandedListTile extends StatefulWidget { + const ExpandedListTile( + {Key? key, + required this.title, + this.child, + this.onTap, + required this.typeImgList, + required this.imgName}) + : super(key: key); + + final String title; + final String imgName; + final Widget? child; + final List typeImgList; + final Function()? onTap; + + @override + _ExpandedListTileState createState() => _ExpandedListTileState(); +} + +class _ExpandedListTileState extends State { + bool _isExpanded = false; + final Duration _animationDuration = const Duration(milliseconds: 200); + bool _isCheck = false; + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + color: Colors.white, + height: 80.h, + child: Row( + children: _buildExpandRowList(), + ), + ), + // InkWell( + // onTap: () { + // setState(() { + // _isExpanded = !_isExpanded; + // }); + // widget.onTap?.call(); + // }, + // child: Container( + // color: Colors.white, + // height: 80.h, + // child: Row( + // children: _buildExpandRowList(), + // ), + // ), + // ), + ClipRect( + child: AnimatedAlign( + heightFactor: _isExpanded ? 1.0 : 0.0, + alignment: Alignment.center, + duration: _animationDuration, + child: widget.child), + ), + ], + ); + } + + List _buildExpandRowList() { + List widgetList = []; + widgetList.add(GestureDetector( + child: Container( + color: Colors.white, + width: 80.w, + child: Row( + children: [ + SizedBox( + width: 30.w, + ), + Image.asset( + _isCheck + ? "images/icon_round_selet.png" + : "images/icon_round_unSelet.png", + width: 30.w, + height: 30.w, + ), + SizedBox( + width: 20.w, + ) + ], + ), + ), + onTap: () { + //点击左侧是否勾选按钮 + setState(() { + _isCheck = !_isCheck; + }); + }, + )); + widgetList.add(GestureDetector( + child: Container( + width: ScreenUtil().screenWidth - 80.w, + color: Colors.white, + child: Row( + children: [ + Image.asset( + widget.imgName, + width: 36.w, + height: 36.w, + ), + SizedBox( + width: 10.w, + ), + Text( + widget.title, + style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + Expanded( + child: SizedBox( + width: 10.w, + )), + AnimatedRotation( + turns: _isExpanded ? 0 : -0.5, + duration: _animationDuration, + child: const Icon(Icons.keyboard_arrow_down), + ), + SizedBox( + width: 30.w, + ) + ], + ), + ), + onTap: () { + //点击右侧上拉下拉按钮 + setState(() { + _isExpanded = !_isExpanded; + }); + widget.onTap?.call(); + }, + )); + // widgetList.add(SizedBox( + // width: 30.w, + // )); + // widgetList.add(GestureDetector( + // child: Image.asset( + // _isCheck + // ? "images/icon_round_selet.png" + // : "images/icon_round_unSelet.png", + // width: 30.w, + // height: 30.w, + // ), + // onTap: () { + // _isCheck = !_isCheck; + // }, + // )); + + // widgetList.add(SizedBox( + // width: 20.w, + // )); + /* + widgetList.add(Image.asset( + widget.imgName, + width: 36.w, + height: 36.w, + )); + widgetList.add(SizedBox( + width: 10.w, + )); + widgetList.add( + Text( + widget.title, + style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp), + ), + ); + if (widget.typeImgList.isNotEmpty) { + for (var item in widget.typeImgList) { + widgetList.add(SizedBox( + width: 16.w, + )); + widgetList.add(Image.asset( + item, + width: 28.w, + height: 28.w, + )); + } + } + + widgetList.add(Expanded( + child: SizedBox( + width: 10.w, + ))); + + widgetList.add(AnimatedRotation( + turns: _isExpanded ? 0 : -0.5, + duration: _animationDuration, + child: const Icon(Icons.keyboard_arrow_down), + )); + widgetList.add(SizedBox( + width: 20.w, + )); + */ + return widgetList; + } +} diff --git a/star_lock/lib/tools/shareModule/sharePopup.dart b/star_lock/lib/tools/shareModule/sharePopup.dart new file mode 100644 index 00000000..d0f43b67 --- /dev/null +++ b/star_lock/lib/tools/shareModule/sharePopup.dart @@ -0,0 +1,105 @@ +import 'package:flutter/material.dart'; + +class SharePopup extends StatelessWidget { + List nameItems = [ + '微信', + '朋友圈', + 'QQ', + 'QQ空间', + '微博', + 'FaceBook', + '邮件', + '链接' + ]; + List urlItems = [ + 'icon_wechat.png', + 'icon_wechat_moments.png', + 'icon_qq.png', + 'icon_qzone.png', + 'icon_sina.png', + 'icon_facebook.png', + 'icon_email.png', + 'icon_copylink.png' + ]; + + SharePopup({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return _shareWidget(context); + // Scaffold( + // appBar: AppBar( + // title: const Text("分享页面"), + // ), + // body: _shareWidget(context) + /* + Center( + child: Builder(builder: (BuildContext context) { + return ElevatedButton( + onPressed: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return _shareWidget(context); + }); + }, + child: const Text("我要分享"), + // color: Colors.blue + ); + }), + ) + */ + // ); + } + + Widget _shareWidget(BuildContext context) { + return SizedBox( + height: 250.0, + child: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0), + child: SizedBox( + height: 190.0, + child: GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + mainAxisSpacing: 5.0, + childAspectRatio: 1.0), + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Padding( + padding: + const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0), + child: Image.asset( + 'images/${urlItems[index]}', + width: 50.0, + height: 50.0, + fit: BoxFit.fill, + )), + Text(nameItems[index]) + ], + ); + }, + itemCount: nameItems.length, + ), + ), + ), + Container( + height: 0.5, + color: Colors.blueGrey, + ), + const Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0), + child: Text( + '取 消', + style: TextStyle(fontSize: 18.0, color: Colors.blueGrey), + )), + ) + ], + ), + ); + } +} diff --git a/star_lock/lib/translations/lanKeyEntity.dart b/star_lock/lib/translations/lanKeyEntity.dart index 7713fa1f..c2f4e1b7 100644 --- a/star_lock/lib/translations/lanKeyEntity.dart +++ b/star_lock/lib/translations/lanKeyEntity.dart @@ -188,6 +188,8 @@ class LanKeyEntity { this.lanChinese, this.multilingual, this.addLock, + this.selectLockType, + this.videoIntercomDoorLock, this.addDevice, this.gateway, this.message, @@ -570,6 +572,8 @@ class LanKeyEntity { lanChinese = json['lanChinese']; multilingual = json['multilingual']; addLock = json['addLock']; + selectLockType = json['selectLockType']; + videoIntercomDoorLock = json['videoIntercomDoorLock']; addDevice = json['addDevice']; gateway = json['gateway']; message = json['message']; @@ -969,6 +973,8 @@ class LanKeyEntity { String? lanChinese; String? multilingual; String? addLock; + String? selectLockType; + String? videoIntercomDoorLock; String? addDevice; String? gateway; String? message; @@ -1365,6 +1371,8 @@ class LanKeyEntity { map['lanChinese'] = lanChinese; map['multilingual'] = multilingual; map['addLock'] = addLock; + map['selectLockType'] = selectLockType; + map['videoIntercomDoorLock'] = videoIntercomDoorLock; map['addDevice'] = addDevice; map['gateway'] = gateway; map['message'] = message;