1,权限管理模块调整为多级联动

2,添加设备-新增“可视对讲门锁”
3,新增分享到第三方页面--未接入
This commit is contained in:
Daisy 2023-08-02 10:23:18 +08:00
parent 83b2b7159d
commit 24089f59b9
10 changed files with 426 additions and 51 deletions

View File

@ -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",

View File

@ -191,6 +191,8 @@
"lanChinese":"lanChinese",
"multilingual":"multilingual",
"addLock":"addLock",
"selectLockType":"selectLockType",
"videoIntercomDoorLock":"videoIntercomDoorLock",
"addDevice":"addDevice",
"gateway":"gateway",
"message":"message",

View File

@ -191,6 +191,8 @@
"lanChinese":"中文",
"multilingual":"多语言",
"addLock":"添加锁",
"selectLockType":"选择锁类型",
"videoIntercomDoorLock":"可视对讲门锁",
"addDevice":"添加设备",
"gateway":"网关",
"message":"消息",

View File

@ -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';

View File

@ -21,7 +21,7 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> 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<SeletLockTypePage> 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);

View File

@ -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<AuthorityManagementPage>
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<AuthorityManagementPage>
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<AuthorityManagementPage>
);
}
//
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<AuthorityManagementPage>
width: 30.w,
),
Image.asset(
imageName,
'images/controls_user.png',
width: 36.w,
height: 36.w,
),
@ -193,18 +259,8 @@ class _AuthorityManagementPageState extends State<AuthorityManagementPage>
),
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<AuthorityManagementPage>
);
}
//
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<AuthorityManagementPage>
),
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,

View File

@ -54,16 +54,16 @@ class _GetNameListPageState extends State<GetNameListPage> {
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;
},

View File

@ -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<ExpandedListTile> {
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<Widget> _buildExpandRowList() {
List<Widget> 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;
}
}

View File

@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
class SharePopup extends StatelessWidget {
List<String> nameItems = <String>[
'微信',
'朋友圈',
'QQ',
'QQ空间',
'微博',
'FaceBook',
'邮件',
'链接'
];
List<String> urlItems = <String>[
'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: <Widget>[
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: <Widget>[
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),
)),
)
],
),
);
}
}

View File

@ -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;