组件优化

This commit is contained in:
2022-10-31 16:12:06 +08:00
parent b7f0fe3ac8
commit 5d8dca73d1
12 changed files with 252 additions and 262 deletions

View File

@@ -7,6 +7,9 @@ class ActionItem extends StatelessWidget {
final Widget? rightWidget;
final String? bottom;
final VoidCallback? onTap;
final bool isFirst;
final bool isLast;
final double indent;
const ActionItem(
this.title, {
@@ -14,6 +17,9 @@ class ActionItem extends StatelessWidget {
this.rightWidget,
this.bottom,
this.onTap,
this.isFirst = false,
this.isLast = false,
this.indent = 16,
Key? key,
}) : super(key: key);
@@ -24,52 +30,74 @@ class ActionItem extends StatelessWidget {
onTap: () {
onTap?.call();
},
child: Container(
color: AppColors.white,
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column(
children: [
if (isFirst)
const Divider(
height: 0.4,
color: AppColors.border,
),
Container(
padding: const EdgeInsets.all(16),
decoration: const BoxDecoration(
color: AppColors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: const TextStyle(
fontSize: 16,
),
),
Expanded(child: Container()),
if (extend != null)
Text(
extend!,
style: const TextStyle(
color: AppColors.unactive,
),
),
rightWidget ??
const Icon(
Icons.arrow_forward_ios,
size: 14,
color: AppColors.unactive,
),
],
),
Expanded(child: Container()),
if (extend != null)
Text(
extend!,
style: const TextStyle(
color: AppColors.unactive,
if (bottom != null && bottom!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
bottom!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: AppColors.unactive,
fontSize: 12,
),
),
),
rightWidget ??
const Icon(
Icons.arrow_forward_ios,
size: 14,
color: AppColors.unactive,
),
],
),
if (bottom != null && bottom!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
bottom!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: AppColors.unactive,
fontSize: 12,
),
),
),
],
),
),
if (isLast)
const Divider(
height: 0,
color: AppColors.border,
),
if (!isLast)
Divider(
height: 0,
color: AppColors.border,
indent: indent,
),
],
),
);
}