Skip to content

Commit

Permalink
feat: [MDS-914] Modify filled and outlined versions of MoonAlert to a…
Browse files Browse the repository at this point in the history
…lign with design (#319)
  • Loading branch information
Kypsis authored Dec 21, 2023
1 parent 15ad1b8 commit 7cb4440
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 173 deletions.
60 changes: 52 additions & 8 deletions example/lib/src/storybook/stories/alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,24 @@ class _AlertStoryState extends State<AlertStory> {
],
),
const TextDivider(text: "Filled MoonAlert variant"),
MoonFilledAlert(
MoonAlert.filled(
show: true,
color: context.moonColors!.chichi,
backgroundColor: context.moonColors!.chichi10,
borderRadius: borderRadius,
leading: showLeadingKnob ? const Icon(MoonIcons.notifications_alert_24_light) : null,
title: const Text("Filled error MoonAlert"),
trailing: MoonButton.icon(
buttonSize: MoonButtonSize.xs,
borderRadius: borderRadius,
gap: 0,
onTap: () {},
icon: Icon(
MoonIcons.controls_close_small_24_light,
size: 24,
color: context.moonColors!.chichi,
),
),
body: showBodyKnob
? const SizedBox(
height: 24,
Expand All @@ -207,15 +219,26 @@ class _AlertStoryState extends State<AlertStory> {
),
)
: null,
onTrailingTap: () {},
),
const SizedBox(height: 16),
MoonFilledAlert(
MoonAlert.filled(
show: true,
color: context.moonColors!.krillin,
backgroundColor: context.moonColors!.krillin10,
borderRadius: borderRadius,
leading: showLeadingKnob ? const Icon(MoonIcons.generic_alarm_round_24_light) : null,
title: const Text("Filled warning MoonAlert"),
trailing: MoonButton.icon(
buttonSize: MoonButtonSize.xs,
borderRadius: borderRadius,
gap: 0,
onTap: () {},
icon: Icon(
MoonIcons.controls_close_small_24_light,
size: 24,
color: context.moonColors!.krillin,
),
),
body: showBodyKnob
? const SizedBox(
height: 24,
Expand All @@ -225,15 +248,26 @@ class _AlertStoryState extends State<AlertStory> {
),
)
: null,
onTrailingTap: () {},
),
const TextDivider(text: "Outlined MoonAlert variant"),
MoonOutlinedAlert(
MoonAlert.outlined(
show: true,
color: context.moonColors!.roshi,
borderColor: context.moonColors!.roshi,
borderRadius: borderRadius,
leading: showLeadingKnob ? const Icon(MoonIcons.generic_check_rounded_24_light) : null,
title: const Text("Outlined success MoonAlert"),
trailing: MoonButton.icon(
buttonSize: MoonButtonSize.xs,
borderRadius: borderRadius,
gap: 0,
onTap: () {},
icon: Icon(
MoonIcons.controls_close_small_24_light,
size: 24,
color: context.moonColors!.roshi,
),
),
body: showBodyKnob
? const SizedBox(
height: 24,
Expand All @@ -243,15 +277,26 @@ class _AlertStoryState extends State<AlertStory> {
),
)
: null,
onTrailingTap: () {},
),
const SizedBox(height: 16),
MoonOutlinedAlert(
MoonAlert.outlined(
show: true,
color: context.moonColors!.whis,
borderColor: context.moonColors!.whis,
borderRadius: borderRadius,
leading: showLeadingKnob ? const Icon(MoonIcons.notifications_alert_24_light) : null,
title: const Text('Outlined info MoonAlert'),
trailing: MoonButton.icon(
buttonSize: MoonButtonSize.xs,
borderRadius: borderRadius,
gap: 0,
onTap: () {},
icon: Icon(
MoonIcons.controls_close_small_24_light,
size: 24,
color: context.moonColors!.whis,
),
),
body: showBodyKnob
? const SizedBox(
height: 24,
Expand All @@ -261,7 +306,6 @@ class _AlertStoryState extends State<AlertStory> {
),
)
: null,
onTrailingTap: () {},
),
],
),
Expand Down
2 changes: 0 additions & 2 deletions lib/moon_design.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ export 'package:moon_design/src/utils/squircle/squircle_radius.dart';

export 'package:moon_design/src/widgets/accordion/accordion.dart';
export 'package:moon_design/src/widgets/alert/alert.dart';
export 'package:moon_design/src/widgets/alert/filled_alert.dart';
export 'package:moon_design/src/widgets/alert/outlined_alert.dart';
export 'package:moon_design/src/widgets/authcode/authcode.dart';
export 'package:moon_design/src/widgets/avatar/avatar.dart';
export 'package:moon_design/src/widgets/bottom_sheet/bottom_sheet.dart';
Expand Down
54 changes: 54 additions & 0 deletions lib/src/widgets/alert/alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,60 @@ class MoonAlert extends StatefulWidget {
this.body,
});

/// MDS filled alert variant.
///
/// See also:
///
/// * [MoonOutlinedAlert], MDS outlined button.
const MoonAlert.filled({
super.key,
this.show = false,
this.borderRadius,
this.color,
required this.backgroundColor,
this.semanticLabel,
this.leading,
required this.title,
this.trailing,
this.body,
}) : showBorder = false,
borderColor = null,
borderWidth = null,
decoration = null,
minimumHeight = null,
padding = null,
horizontalGap = null,
verticalGap = null,
transitionDuration = null,
transitionCurve = null;

/// MDS outlined alert variant.
///
/// See also:
///
/// * [MoonFilledAlert], MDS filled button.
const MoonAlert.outlined({
super.key,
this.show = false,
this.borderRadius,
this.borderWidth,
this.color,
required this.borderColor,
this.semanticLabel,
this.leading,
required this.title,
this.trailing,
this.body,
}) : showBorder = true,
backgroundColor = Colors.transparent,
decoration = null,
minimumHeight = null,
padding = null,
horizontalGap = null,
verticalGap = null,
transitionDuration = null,
transitionCurve = null;

@override
State<MoonAlert> createState() => _MoonAlertState();
}
Expand Down
79 changes: 0 additions & 79 deletions lib/src/widgets/alert/filled_alert.dart

This file was deleted.

84 changes: 0 additions & 84 deletions lib/src/widgets/alert/outlined_alert.dart

This file was deleted.

0 comments on commit 7cb4440

Please sign in to comment.