app-starlock/star_lock/lib/tools/ExpandedListView.dart
Daisy c888f27142 1,新增自定义密码接口
2,新增修改密码详情各项信息接口
3,新增设置锁分组接口
4,新增获取锁分组下的锁列表接口
5,新增锁用户列表接口调试
6,新增群发锁分组列表页面
7,新增群发接收人页面
8,新增锁用户列表页面
2023-09-07 18:32:56 +08:00

128 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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(),
),
),
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();
},
));
return widgetList;
}
}