diff --git a/lib/src/sheet/sheet_helper.astromic.dart b/lib/src/sheet/sheet_helper.astromic.dart index 6c9978a..538cf0c 100644 --- a/lib/src/sheet/sheet_helper.astromic.dart +++ b/lib/src/sheet/sheet_helper.astromic.dart @@ -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 flex( 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( context: context, @@ -66,14 +69,14 @@ class AstromicSheetHelper { radius: sheetStyle.radius, // child: ChangeNotifierProvider( - create: (BuildContext c) => SheetStore(), + create: (BuildContext c) => store, child: BaseSheetWidget( 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 form( 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( 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 scroller( 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( 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, ), diff --git a/lib/src/sheet/src/models/Templates/flex_sheet.template.dart b/lib/src/sheet/src/models/Templates/flex_sheet.template.dart index 4310b80..0c9e7ba 100644 --- a/lib/src/sheet/src/models/Templates/flex_sheet.template.dart +++ b/lib/src/sheet/src/models/Templates/flex_sheet.template.dart @@ -7,14 +7,15 @@ import 'package:flutter/widgets.dart'; //s3 Routes //s3 Services //s3 Models & Widgets +import '../sheet_store.model.dart' show SheetStore; import 'template_base.dart'; import '../models.exports.dart'; //s1 Exports class AstromicFlexSheetTemplate extends AstromicSheetTemplate { - final Widget? headSection; - final Widget contentSection; - final Widget? footerSection; + final Widget Function(SheetStore store)? headSection; + final Widget Function(SheetStore store) contentSection; + final Widget Function(SheetStore store)? footerSection; // final AstromicSheetConfiguration? configuration; final AstromicSheetStyle? style; @@ -28,9 +29,9 @@ class AstromicFlexSheetTemplate extends AstromicSheetTemplate { }); AstromicFlexSheetTemplate copyWith({ - Widget? headSection, - Widget? contentSection, - Widget? footerSection, + Widget Function(SheetStore store)? headSection, + Widget Function(SheetStore store)? contentSection, + Widget Function(SheetStore store)? footerSection, AstromicSheetConfiguration? configuration, AstromicSheetStyle? style, }) { diff --git a/lib/src/sheet/src/models/Templates/form_sheet.template.dart b/lib/src/sheet/src/models/Templates/form_sheet.template.dart index dbf005f..bd5f460 100644 --- a/lib/src/sheet/src/models/Templates/form_sheet.template.dart +++ b/lib/src/sheet/src/models/Templates/form_sheet.template.dart @@ -7,15 +7,16 @@ import 'package:flutter/widgets.dart'; //s3 Routes //s3 Services //s3 Models +import '../sheet_store.model.dart' show SheetStore; import 'template_base.dart'; import '../models.exports.dart'; import '../../../../form/form_helper.astromic.dart'; //s1 Exports class AstromicFormSheetTemplate extends AstromicSheetTemplate { - final Widget Function(AstromicFormController)? headSectionBuilder; - final Widget Function(AstromicFormController) contentSectionBuilder; - final Widget Function(AstromicFormController)? footerSectionBuilder; + final Widget Function(AstromicFormController, SheetStore store)? headSectionBuilder; + final Widget Function(AstromicFormController, SheetStore store) contentSectionBuilder; + final Widget Function(AstromicFormController, SheetStore store)? footerSectionBuilder; // final AstromicSheetConfiguration? configuration; final AstromicSheetStyle? style; @@ -29,9 +30,9 @@ class AstromicFormSheetTemplate extends AstromicSheetTemplate { }); AstromicFormSheetTemplate copyWith({ - Widget Function(AstromicFormController)? headSectionBuilder, - Widget Function(AstromicFormController)? contentSectionBuilder, - Widget Function(AstromicFormController)? footerSectionBuilder, + Widget Function(AstromicFormController, SheetStore store)? headSectionBuilder, + Widget Function(AstromicFormController, SheetStore store)? contentSectionBuilder, + Widget Function(AstromicFormController, SheetStore store)? footerSectionBuilder, AstromicSheetConfiguration? configuration, AstromicSheetStyle? style, }) { diff --git a/lib/src/sheet/src/models/Templates/scroller_sheet.template.dart b/lib/src/sheet/src/models/Templates/scroller_sheet.template.dart index dd2c3ba..9150b11 100644 --- a/lib/src/sheet/src/models/Templates/scroller_sheet.template.dart +++ b/lib/src/sheet/src/models/Templates/scroller_sheet.template.dart @@ -7,14 +7,15 @@ import 'package:flutter/widgets.dart'; //s3 Routes //s3 Services //s3 Models +import '../sheet_store.model.dart' show SheetStore; import 'template_base.dart'; import '../models.exports.dart'; //s1 Exports class AstromicScrollerSheetTemplate extends AstromicSheetTemplate { - final Widget Function(ScrollController)? headSectionBuilder; - final Widget Function(ScrollController, ScrollPhysics) contentSectionBuilder; - final Widget Function(ScrollController)? footerSectionBuilder; + final Widget Function(ScrollController, SheetStore store)? headSectionBuilder; + final Widget Function(ScrollController, ScrollPhysics,SheetStore store) contentSectionBuilder; + final Widget Function(ScrollController,SheetStore store)? footerSectionBuilder; // final AstromicSheetConfiguration? configuration; final AstromicSheetStyle? style; @@ -28,9 +29,9 @@ class AstromicScrollerSheetTemplate extends AstromicSheetTemplate { }); AstromicScrollerSheetTemplate copyWith({ - Widget Function(ScrollController)? headSection, - Widget Function(ScrollController, ScrollPhysics)? contentSectionBuilder, - Widget Function(ScrollController)? footerSection, + Widget Function(ScrollController,SheetStore store)? headSection, + Widget Function(ScrollController, ScrollPhysics,SheetStore store)? contentSectionBuilder, + Widget Function(ScrollController,SheetStore store)? footerSection, AstromicSheetConfiguration? configuration, AstromicSheetStyle? style, }) {