refactor: 重构弹窗组件支持自定义图标组件
This commit is contained in:
@@ -23,11 +23,13 @@ class AppModalDialog extends StatelessWidget {
|
||||
required this.message,
|
||||
required this.actions,
|
||||
this.icon,
|
||||
this.iconWidget,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String message;
|
||||
final IconData? icon;
|
||||
final Widget? iconWidget;
|
||||
final List<AppModalDialogAction> actions;
|
||||
|
||||
@override
|
||||
@@ -59,9 +61,9 @@ class AppModalDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (icon != null)
|
||||
if (iconWidget != null || icon != null)
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
@@ -70,9 +72,12 @@ class AppModalDialog extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(icon, color: colors.primary, size: 20),
|
||||
child:
|
||||
iconWidget ??
|
||||
Icon(icon, color: colors.primary, size: 20),
|
||||
),
|
||||
if (icon != null) const SizedBox(width: AppSpacing.sm),
|
||||
if (iconWidget != null || icon != null)
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
|
||||
Reference in New Issue
Block a user