This commit is contained in:
2025-03-04 13:28:58 +02:00
parent 029e5dfe81
commit f7026e53df
4 changed files with 45 additions and 37 deletions

View File

@@ -1,5 +1,7 @@
//s1 Imports
//s2 Core Package Imports
import 'dart:nativewrappers/_internal/vm/lib/ffi_allocation_patch.dart';
import 'package:flutter/material.dart';
//s2 1st-party Package Imports
//s2 3rd-party Package Imports
@@ -35,9 +37,9 @@ class AstromicSheetHelper {
static Future<T?> flex<T extends Object?>(
BuildContext context, {
//
Widget? headSection,
required Widget contentSection,
Widget? footerSection,
Widget Function(SheetStore store)? headSection,
required Widget Function(SheetStore store) contentSection,
Widget Function(SheetStore store)? footerSection,
//
AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style,
@@ -49,6 +51,7 @@ class AstromicSheetHelper {
AstromicSheetConfiguration sheetConfigs = configuration ?? const AstromicSheetConfiguration();
AstromicSheetStyle sheetStyle = style ?? const AstromicSheetStyle();
SheetStore store = SheetStore();
return await BasicSheet.show<T>(
context: context,
@@ -66,14 +69,14 @@ class AstromicSheetHelper {
radius: sheetStyle.radius,
//
child: ChangeNotifierProvider<SheetStore>(
create: (BuildContext c) => SheetStore(),
create: (BuildContext c) => store,
child: BaseSheetWidget<T?>(
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSection: headSection,
contentSection: contentSection,
footerSection: footerSection,
headSection: headSection?.call(store),
contentSection: contentSection(store),
footerSection: footerSection?.call(store),
)),
);
}
@@ -93,9 +96,9 @@ class AstromicSheetHelper {
static Future<T?> form<T extends Object?>(
BuildContext context, {
//
Widget Function(AstromicFormController)? headSectionBuilder,
required Widget Function(AstromicFormController) contentSectionBuilder,
Widget Function(AstromicFormController)? footerSectionBuilder,
Widget Function(AstromicFormController, SheetStore store)? headSectionBuilder,
required Widget Function(AstromicFormController, SheetStore store) contentSectionBuilder,
Widget Function(AstromicFormController, SheetStore store)? footerSectionBuilder,
//
AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style,
@@ -106,6 +109,7 @@ class AstromicSheetHelper {
AstromicSheetConfiguration sheetConfigs = configuration ?? const AstromicSheetConfiguration();
AstromicSheetStyle sheetStyle = style ?? const AstromicSheetStyle();
SheetStore store = SheetStore();
return await BasicSheet.show<T>(
context: context,
@@ -130,9 +134,9 @@ class AstromicSheetHelper {
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSectionFormBuilder: headSectionBuilder,
contentSectionFormBuilder: contentSectionBuilder,
footerSectionFormBuilder: footerSectionBuilder,
headSectionFormBuilder: headSectionBuilder == null ? null : (AstromicFormController controller) => headSectionBuilder.call(controller, store),
contentSectionFormBuilder: (AstromicFormController controller) => contentSectionBuilder(controller, store),
footerSectionFormBuilder: footerSectionBuilder == null ? null : (AstromicFormController controller) => footerSectionBuilder.call(controller, store),
),
),
);
@@ -154,9 +158,9 @@ class AstromicSheetHelper {
static Future<T?> scroller<T extends Object?>(
BuildContext context, {
//
Widget Function(ScrollController)? headSectionBuilder,
required Widget Function(ScrollController, ScrollPhysics) contentSectionBuilder,
Widget Function(ScrollController)? footerSectionBuilder,
Widget Function(ScrollController, SheetStore store)? headSectionBuilder,
required Widget Function(ScrollController, ScrollPhysics, SheetStore store) contentSectionBuilder,
Widget Function(ScrollController, SheetStore store)? footerSectionBuilder,
//
AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style,
@@ -167,6 +171,7 @@ class AstromicSheetHelper {
AstromicSheetConfiguration sheetConfigs = configuration ?? const AstromicSheetConfiguration();
AstromicSheetStyle sheetStyle = style ?? const AstromicSheetStyle();
SheetStore store = SheetStore();
return await ScrollerSheet.show<T>(
context: context,
@@ -205,9 +210,9 @@ class AstromicSheetHelper {
sheetType: SheetType.scroller,
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
headSectionScrollerBuilder: headSectionBuilder,
contentSectionScrollBuilder: contentSectionBuilder,
footerSectionScrollerBuilder: footerSectionBuilder,
headSectionScrollerBuilder: headSectionBuilder == null ? null : (ScrollController controller) => headSectionBuilder.call(controller, store),
contentSectionScrollBuilder: (ScrollController controller, ScrollPhysics physics) => contentSectionBuilder(controller,physics, store),
footerSectionScrollerBuilder: footerSectionBuilder == null ? null : (ScrollController controller) => footerSectionBuilder.call(controller, store),
scrollController: scrollController,
scrollPhysics: scrollPhysics,
),