Skip to content

Commit

Permalink
feat(*): use error color on delete action in notice card menu
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Dec 28, 2024
1 parent 1c658ef commit 020ff29
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions lib/utils/show_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Future<bool?> showQuestionDialog({
required String title,
String? message,
TextSpan? richMessage,
bool dangerous = false,
}) async {
assert(
message != null || richMessage != null,
Expand All @@ -64,9 +65,17 @@ Future<bool?> showQuestionDialog({
},
),
TextButton(
child: Text(context.t.general.ok),
child: Text(
context.t.general.ok,
style: dangerous
? TextStyle(color: Theme.of(context).colorScheme.error)
: null,
),
onPressed: () {
Navigator.pop(context, true);
Navigator.pop(
context,
true,
);
},
),
],
Expand Down
13 changes: 11 additions & 2 deletions lib/widgets/card/notice_card_v2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,17 @@ class _NoticeCardV2State extends State<NoticeCardV2> {
value: _Actions.deleteItem,
child: Row(
children: [
const Icon(Icons.delete_forever_outlined),
Icon(
Icons.delete_forever_outlined,
color: Theme.of(context).colorScheme.error,
),
sizedBoxPopupMenuItemIconSpacing,
Text(tr.delete.title),
Text(
tr.delete.title,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
),
),
],
),
),
Expand All @@ -147,6 +155,7 @@ class _NoticeCardV2State extends State<NoticeCardV2> {
context: context,
title: tr.title,
message: tr.detail,
dangerous: true,
);
if (!context.mounted || result == null || !result) {
return;
Expand Down

0 comments on commit 020ff29

Please sign in to comment.