Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Implement DialogActionButton on DiscardDraftDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
eightgran committed Jun 16, 2021
1 parent 37e1cef commit 15784de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Alter button styling on `LitDatePicker`.
- Alter `LitCreditsScreen`'s back button color.
- Add `resizeToAvoidBottomInset` member on `LitTabView` to enforce overlapping according to [Material Design's guidelines](https://material.io/components/app-bars-bottom#behavior).
- Implement `DialogActionButton` on `DiscardDraftDialog`.

## 1.0.4

Expand Down
4 changes: 4 additions & 0 deletions lib/src/widgets/buttons/dialog_action_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DialogActionButton extends StatelessWidget {
final Color accentColor;
final Color backgroundColor;
final TextStyle style;
final bool disabled;
final void Function() onPressed;

/// Creates a [DialogActionButton].
Expand All @@ -35,6 +36,7 @@ class DialogActionButton extends StatelessWidget {
this.accentColor = Colors.grey,
this.backgroundColor = Colors.white,
this.style = LitSansSerifStyles.button,
this.disabled = false,
required this.onPressed,
}) : super(key: key);

Expand All @@ -44,11 +46,13 @@ class DialogActionButton extends StatelessWidget {
padding: padding,
child: LitPushedThroughButton(
onPressed: onPressed,
disabled: disabled,
accentColor: accentColor,
backgroundColor: backgroundColor,
child: ClippedText(
label,
upperCase: true,
textAlign: TextAlign.center,
style: style,
),
),
Expand Down
33 changes: 10 additions & 23 deletions lib/src/widgets/dialogs/discard_draft_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,18 @@ class _DiscardDraftDialogState extends State<DiscardDraftDialog>
titleText: widget.titleText,
margin: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
actionButtons: [
LitGradientButton(
boxShadow: [],
color: Color.lerp(
LitColors.mediumGrey,
LitColors.lightGrey,
0.34,
)!,
accentColor: LitColors.mediumGrey,
child: ClippedText(
widget.discardButtonLabel,
upperCase: true,
style: LitSansSerifStyles.button.copyWith(
color: Colors.white,
),
),
onPressed: widget.onDiscard,
DialogActionButton(
label: widget.cancelButtonLabel,
onPressed: _onCancel,
),
LitGradientButton(
boxShadow: [],
child: ClippedText(
widget.cancelButtonLabel,
upperCase: true,
style: LitSansSerifStyles.button,
DialogActionButton(
label: widget.discardButtonLabel,
onPressed: widget.onDiscard,
accentColor: LitColors.lightGrey,
backgroundColor: LitColors.mediumGrey,
style: LitSansSerifStyles.button.copyWith(
color: Colors.white,
),
onPressed: _onCancel,
),
],
child: AnimatedBuilder(
Expand Down

0 comments on commit 15784de

Please sign in to comment.