File tree 5 files changed +54
-0
lines changed
5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+
3
+ part of devspace;
4
+
5
+
6
+ class NewBadge extends StatelessWidget {
7
+
8
+ final Widget child;
9
+
10
+ const NewBadge ({
11
+ super .key,
12
+ required this .child,
13
+ });
14
+
15
+ @override
16
+ Widget build (BuildContext context)
17
+ {
18
+ return Stack (
19
+ fit: StackFit .passthrough,
20
+ children: [
21
+ child,
22
+ Positioned (
23
+ top: 0 ,
24
+ right: 0 ,
25
+ child: Container (
26
+ margin: context.paddingS,
27
+ padding: context.paddingS_XXS,
28
+ decoration: BoxDecoration (
29
+ color: context.colors.error,
30
+ borderRadius: BorderRadius .circular (100 ),
31
+ boxShadow: [context.highlights.boxShadowS]
32
+ ),
33
+ child: TextBody .small (LibStrings .lib_general_flagNew.tr (), color: context.colors.onError),
34
+ ),
35
+ ),
36
+ ],
37
+ );
38
+ }
39
+ }
Original file line number Diff line number Diff line change @@ -48,6 +48,13 @@ class DefaultDialog extends StatelessWidget {
48
48
button = RepaintBoundary (child: button.glassShimmerRepeated (delay: 500. asDuration));
49
49
}
50
50
51
+ if (action.markAsNewUntil != null && action.markAsNewUntil! .isAfter (DateTime .now ()))
52
+ {
53
+ button = NewBadge (
54
+ child: button,
55
+ );
56
+ }
57
+
51
58
button = ConstrainedBox (
52
59
constraints: BoxConstraints (
53
60
minWidth: context.dimensions.reasonableButtonWidth (context)
Original file line number Diff line number Diff line change @@ -11,13 +11,15 @@ class DialogAction {
11
11
final kButtonType type;
12
12
/// If set, overrides the icon for this action type
13
13
final IconData ? iconOverride;
14
+ final DateTime ? markAsNewUntil;
14
15
15
16
DialogAction ({
16
17
this .enabled = true ,
17
18
required this .title,
18
19
this .onPressed,
19
20
this .type = kButtonType.regular,
20
21
this .iconOverride,
22
+ this .markAsNewUntil,
21
23
});
22
24
23
25
bool get isCustom => this is CustomDialogAction ;
@@ -27,13 +29,15 @@ class DialogAction {
27
29
VoidCallback ? onPressed,
28
30
kButtonType? type,
29
31
IconData ? iconOverride,
32
+ DateTime ? markAsNewUntil,
30
33
})
31
34
{
32
35
return DialogAction (
33
36
title: title ?? this .title,
34
37
onPressed: onPressed ?? this .onPressed,
35
38
type: type ?? this .type,
36
39
iconOverride: iconOverride ?? this .iconOverride,
40
+ markAsNewUntil: markAsNewUntil ?? this .markAsNewUntil,
37
41
);
38
42
}
39
43
@@ -78,6 +82,7 @@ class CustomDialogAction extends DialogAction {
78
82
VoidCallback ? onPressed,
79
83
kButtonType? type,
80
84
IconData ? iconOverride,
85
+ DateTime ? markAsNewUntil,
81
86
})
82
87
{
83
88
return CustomDialogAction (
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ part 'brixies/intrinsic_height_page_view.dart';
175
175
part 'brixies/layout_builder.dart' ;
176
176
part 'brixies/line_divider.dart' ;
177
177
part 'brixies/multi_transform.dart' ;
178
+ part 'brixies/new_badge.dart' ;
178
179
part 'brixies/search_delay.dart' ;
179
180
part 'brixies/smooth_swap.dart' ;
180
181
part 'brixies/spaced_flex.dart' ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ abstract class LibStrings {
9
9
10
10
LibStrings ._();
11
11
12
+ static const String lib_general_flagNew = 'lib_general_flagNew' ;
12
13
static const String lib_general_valueNotSet = 'lib_general_valueNotSet' ;
13
14
static const String lib_general_valueNotYetSet = 'lib_general_valueNotYetSet' ;
14
15
static const String lib_general_valueNotAvailable = 'lib_general_valueNotAvailable' ;
@@ -111,6 +112,7 @@ abstract class LibStrings {
111
112
static const String lib_exception_UnexpectedError = 'lib_exception_UnexpectedError' ;
112
113
113
114
static const List <String > allKeys = [
115
+ 'lib_general_flagNew' ,
114
116
'lib_general_valueNotSet' ,
115
117
'lib_general_valueNotYetSet' ,
116
118
'lib_general_valueNotAvailable' ,
You can’t perform that action at this time.
0 commit comments