@@ -14,14 +14,18 @@ class AsyncContentBlock<T> extends StatelessWidget {
1414 final kAsyncContentBlockType type;
1515 /// {@macro AsyncDataLoader.dataKey}
1616 final String ? dataKey;
17+ final EdgeInsets internalWidgetsPadding;
1718 final AsyncDataLoaderCallback <T > onLoad;
18- final Widget ? noDataKeyWidget;
19+ final Widget ? noDataRequestedWidget;
20+ final void Function (kAsyncDataState state)? onStateChange;
1921 final AsyncContentBuilder <T > builder;
2022
2123 const AsyncContentBlock ({
2224 super .key,
2325 this .type = kAsyncContentBlockType.smallBrick,
24- this .noDataKeyWidget,
26+ this .noDataRequestedWidget,
27+ this .onStateChange,
28+ this .internalWidgetsPadding = EdgeInsets .zero,
2529 required this .dataKey,
2630 required this .onLoad,
2731 required this .builder,
@@ -33,20 +37,24 @@ class AsyncContentBlock<T> extends StatelessWidget {
3337 return AsyncDataLoader <T >(
3438 dataKey: dataKey,
3539 onLoad: onLoad,
40+ onStateChange: onStateChange,
3641 builder: (context, data, errorMessage, isLoading, retry)
3742 {
3843 if (isLoading)
3944 {
4045 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+ ),
4351 )
4452 );
4553 }
4654
4755 if (dataKey == null )
4856 {
49- return noDataKeyWidget ?? EmptyWidget ();
57+ return noDataRequestedWidget ?? EmptyWidget ();
5058 }
5159
5260 if (errorMessage != null )
@@ -69,13 +77,16 @@ class AsyncContentBlock<T> extends StatelessWidget {
6977 {
7078 return Center (
7179 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+ ),
7990 ),
8091 )
8192 );
@@ -85,13 +96,16 @@ class AsyncContentBlock<T> extends StatelessWidget {
8596 {
8697 return Center (
8798 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+ ),
95109 ),
96110 )
97111 );
0 commit comments