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,
),

View File

@@ -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<T> extends AstromicSheetTemplate<T> {
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<T> extends AstromicSheetTemplate<T> {
});
AstromicFlexSheetTemplate<T> 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,
}) {

View File

@@ -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<T> extends AstromicSheetTemplate<T> {
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<T> extends AstromicSheetTemplate<T> {
});
AstromicFormSheetTemplate<T> 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,
}) {

View File

@@ -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<T> extends AstromicSheetTemplate<T> {
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<T> extends AstromicSheetTemplate<T> {
});
AstromicScrollerSheetTemplate<T> 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,
}) {