组件优化

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

@@ -5,10 +5,14 @@ class ActionButton extends StatelessWidget {
final String text;
final Color color;
final VoidCallback? onTap;
final bool hasTop;
final bool hasBottom;
const ActionButton(
this.text, {
this.color = AppColors.red,
this.color = AppColors.primary,
this.onTap,
this.hasTop = false,
this.hasBottom = false,
Key? key,
}) : super(key: key);
@@ -19,20 +23,35 @@ class ActionButton extends StatelessWidget {
onTap: () {
onTap?.call();
},
child: Container(
color: AppColors.white,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Text(
text,
style: TextStyle(
fontWeight: FontWeight.w500,
color: color,
child: Column(
children: [
if (hasTop)
const Divider(
height: 0,
color: AppColors.border,
),
Container(
color: AppColors.white,
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Center(
child: Text(
text,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: color,
),
),
),
),
),
),
if (hasBottom)
const Divider(
height: 0,
color: AppColors.border,
),
],
),
);
}

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,
),
],
),
);
}