app-starlock/lib/main/lockMian/lockList/lockListGroup_view.dart
2025-10-16 14:31:19 +08:00

107 lines
3.1 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:star_lock/flavors.dart';
import '../../../app_settings/app_colors.dart';
import '../entity/lockListInfo_entity.dart';
class LockListGroupView extends StatefulWidget {
const LockListGroupView(
{Key? key,
this.child,
this.onTap,
this.backgroundColor,
this.textStyle,
required this.groupItem,
required this.typeImgList})
: super(key: key);
final Widget? child;
final List typeImgList;
final Function()? onTap;
final GroupList groupItem;
final Color? backgroundColor;
final TextStyle? textStyle;
@override
State<LockListGroupView> createState() => _LockListGroupViewState();
}
class _LockListGroupViewState extends State<LockListGroupView> {
bool _isExpanded = true;
final Duration _animationDuration = const Duration(milliseconds: 200);
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
// Container(
// color: widget.backgroundColor ?? 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() {
final List<Widget> widgetList = <Widget>[];
widgetList.add(GestureDetector(
child: Container(
width: ScreenUtil().screenWidth,
color: widget.backgroundColor ?? Colors.white,
child: Row(
children: <Widget>[
SizedBox(width: 40.w),
F.sw(
skyCall: () => Text(
widget.groupItem.groupName ?? '',
style: widget.textStyle ??
TextStyle(
color: AppColors.blackColor, fontSize: 22.sp),
),
xhjCall: () => Expanded(
child: Text(
widget.groupItem.groupName ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: widget.textStyle ??
TextStyle(
color: AppColors.blackColor, fontSize: 22.sp),
),
)),
SizedBox(
width: 10.w,
),
AnimatedRotation(
turns: _isExpanded ? -0.5 : 0,
duration: _animationDuration,
child: const Icon(Icons.keyboard_arrow_down),
),
SizedBox(
width: 30.w,
)
],
),
),
onTap: () {
//点击右侧上拉下拉按钮
setState(() {
_isExpanded = !_isExpanded;
});
},
));
return widgetList;
}
}