@@ -14,14 +14,18 @@ class AsyncContentBlock<T> extends StatelessWidget {
14
14
final kAsyncContentBlockType type;
15
15
/// {@macro AsyncDataLoader.dataKey}
16
16
final String ? dataKey;
17
+ final EdgeInsets internalWidgetsPadding;
17
18
final AsyncDataLoaderCallback <T > onLoad;
18
- final Widget ? noDataKeyWidget;
19
+ final Widget ? noDataRequestedWidget;
20
+ final void Function (kAsyncDataState state)? onStateChange;
19
21
final AsyncContentBuilder <T > builder;
20
22
21
23
const AsyncContentBlock ({
22
24
super .key,
23
25
this .type = kAsyncContentBlockType.smallBrick,
24
- this .noDataKeyWidget,
26
+ this .noDataRequestedWidget,
27
+ this .onStateChange,
28
+ this .internalWidgetsPadding = EdgeInsets .zero,
25
29
required this .dataKey,
26
30
required this .onLoad,
27
31
required this .builder,
@@ -33,20 +37,24 @@ class AsyncContentBlock<T> extends StatelessWidget {
33
37
return AsyncDataLoader <T >(
34
38
dataKey: dataKey,
35
39
onLoad: onLoad,
40
+ onStateChange: onStateChange,
36
41
builder: (context, data, errorMessage, isLoading, retry)
37
42
{
38
43
if (isLoading)
39
44
{
40
45
return Center (
41
- child: ArchLoadingIndicator (
42
- size: type == kAsyncContentBlockType.smallBrick ? kSize3.S : kSize3.M ,
46
+ child: Padding (
47
+ padding: internalWidgetsPadding,
48
+ child: ArchLoadingIndicator (
49
+ size: type == kAsyncContentBlockType.smallBrick ? kSize3.S : kSize3.M ,
50
+ ),
43
51
)
44
52
);
45
53
}
46
54
47
55
if (dataKey == null )
48
56
{
49
- return noDataKeyWidget ?? EmptyWidget ();
57
+ return noDataRequestedWidget ?? EmptyWidget ();
50
58
}
51
59
52
60
if (errorMessage != null )
@@ -69,13 +77,16 @@ class AsyncContentBlock<T> extends StatelessWidget {
69
77
{
70
78
return Center (
71
79
child: Padding (
72
- padding: type == kAsyncContentBlockType.hugeSection ? context.paddingXXL : EdgeInsets .zero,
73
- child: ArchInfoBox .error (
74
- variant: type == kAsyncContentBlockType.hugeSection ? kInfoBoxVariant.contentPlaceholder : kInfoBoxVariant.smallBrick,
75
- icon: Symbols .warning_rounded,
76
- title: LibStrings .lib_general_titleError.tr (),
77
- message: errorMessage,
78
- onAction: retry,
80
+ padding: internalWidgetsPadding,
81
+ child: Padding (
82
+ padding: type == kAsyncContentBlockType.hugeSection ? context.paddingXXL : EdgeInsets .zero,
83
+ child: ArchInfoBox .error (
84
+ variant: type == kAsyncContentBlockType.hugeSection ? kInfoBoxVariant.contentPlaceholder : kInfoBoxVariant.smallBrick,
85
+ icon: Symbols .warning_rounded,
86
+ title: LibStrings .lib_general_titleError.tr (),
87
+ message: errorMessage,
88
+ onAction: retry,
89
+ ),
79
90
),
80
91
)
81
92
);
@@ -85,13 +96,16 @@ class AsyncContentBlock<T> extends StatelessWidget {
85
96
{
86
97
return Center (
87
98
child: Padding (
88
- padding: type == kAsyncContentBlockType.hugeSection ? context.paddingXXL : EdgeInsets .zero,
89
- child: ArchInfoBox .info (
90
- variant: type == kAsyncContentBlockType.hugeSection ? kInfoBoxVariant.contentPlaceholder : kInfoBoxVariant.smallBrick,
91
- icon: Symbols .info_rounded,
92
- title: LibStrings .lib_warning_resourceNotFound_title.tr (),
93
- message: LibStrings .lib_warning_resourceNotFound_message.tr (),
94
- onAction: retry,
99
+ padding: internalWidgetsPadding,
100
+ child: Padding (
101
+ padding: type == kAsyncContentBlockType.hugeSection ? context.paddingXXL : EdgeInsets .zero,
102
+ child: ArchInfoBox .info (
103
+ variant: type == kAsyncContentBlockType.hugeSection ? kInfoBoxVariant.contentPlaceholder : kInfoBoxVariant.smallBrick,
104
+ icon: Symbols .info_rounded,
105
+ title: LibStrings .lib_warning_resourceNotFound_title.tr (),
106
+ message: LibStrings .lib_warning_resourceNotFound_message.tr (),
107
+ onAction: retry,
108
+ ),
95
109
),
96
110
)
97
111
);
0 commit comments