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

View File

@@ -7,14 +7,15 @@ import 'package:flutter/widgets.dart';
//s3 Routes //s3 Routes
//s3 Services //s3 Services
//s3 Models & Widgets //s3 Models & Widgets
import '../sheet_store.model.dart' show SheetStore;
import 'template_base.dart'; import 'template_base.dart';
import '../models.exports.dart'; import '../models.exports.dart';
//s1 Exports //s1 Exports
class AstromicFlexSheetTemplate<T> extends AstromicSheetTemplate<T> { class AstromicFlexSheetTemplate<T> extends AstromicSheetTemplate<T> {
final Widget? headSection; final Widget Function(SheetStore store)? headSection;
final Widget contentSection; final Widget Function(SheetStore store) contentSection;
final Widget? footerSection; final Widget Function(SheetStore store)? footerSection;
// //
final AstromicSheetConfiguration? configuration; final AstromicSheetConfiguration? configuration;
final AstromicSheetStyle? style; final AstromicSheetStyle? style;
@@ -28,9 +29,9 @@ class AstromicFlexSheetTemplate<T> extends AstromicSheetTemplate<T> {
}); });
AstromicFlexSheetTemplate<T> copyWith({ AstromicFlexSheetTemplate<T> copyWith({
Widget? headSection, Widget Function(SheetStore store)? headSection,
Widget? contentSection, Widget Function(SheetStore store)? contentSection,
Widget? footerSection, Widget Function(SheetStore store)? footerSection,
AstromicSheetConfiguration? configuration, AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style, AstromicSheetStyle? style,
}) { }) {

View File

@@ -7,15 +7,16 @@ import 'package:flutter/widgets.dart';
//s3 Routes //s3 Routes
//s3 Services //s3 Services
//s3 Models //s3 Models
import '../sheet_store.model.dart' show SheetStore;
import 'template_base.dart'; import 'template_base.dart';
import '../models.exports.dart'; import '../models.exports.dart';
import '../../../../form/form_helper.astromic.dart'; import '../../../../form/form_helper.astromic.dart';
//s1 Exports //s1 Exports
class AstromicFormSheetTemplate<T> extends AstromicSheetTemplate<T> { class AstromicFormSheetTemplate<T> extends AstromicSheetTemplate<T> {
final Widget Function(AstromicFormController)? headSectionBuilder; final Widget Function(AstromicFormController, SheetStore store)? headSectionBuilder;
final Widget Function(AstromicFormController) contentSectionBuilder; final Widget Function(AstromicFormController, SheetStore store) contentSectionBuilder;
final Widget Function(AstromicFormController)? footerSectionBuilder; final Widget Function(AstromicFormController, SheetStore store)? footerSectionBuilder;
// //
final AstromicSheetConfiguration? configuration; final AstromicSheetConfiguration? configuration;
final AstromicSheetStyle? style; final AstromicSheetStyle? style;
@@ -29,9 +30,9 @@ class AstromicFormSheetTemplate<T> extends AstromicSheetTemplate<T> {
}); });
AstromicFormSheetTemplate<T> copyWith({ AstromicFormSheetTemplate<T> copyWith({
Widget Function(AstromicFormController)? headSectionBuilder, Widget Function(AstromicFormController, SheetStore store)? headSectionBuilder,
Widget Function(AstromicFormController)? contentSectionBuilder, Widget Function(AstromicFormController, SheetStore store)? contentSectionBuilder,
Widget Function(AstromicFormController)? footerSectionBuilder, Widget Function(AstromicFormController, SheetStore store)? footerSectionBuilder,
AstromicSheetConfiguration? configuration, AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style, AstromicSheetStyle? style,
}) { }) {

View File

@@ -7,14 +7,15 @@ import 'package:flutter/widgets.dart';
//s3 Routes //s3 Routes
//s3 Services //s3 Services
//s3 Models //s3 Models
import '../sheet_store.model.dart' show SheetStore;
import 'template_base.dart'; import 'template_base.dart';
import '../models.exports.dart'; import '../models.exports.dart';
//s1 Exports //s1 Exports
class AstromicScrollerSheetTemplate<T> extends AstromicSheetTemplate<T> { class AstromicScrollerSheetTemplate<T> extends AstromicSheetTemplate<T> {
final Widget Function(ScrollController)? headSectionBuilder; final Widget Function(ScrollController, SheetStore store)? headSectionBuilder;
final Widget Function(ScrollController, ScrollPhysics) contentSectionBuilder; final Widget Function(ScrollController, ScrollPhysics,SheetStore store) contentSectionBuilder;
final Widget Function(ScrollController)? footerSectionBuilder; final Widget Function(ScrollController,SheetStore store)? footerSectionBuilder;
// //
final AstromicSheetConfiguration? configuration; final AstromicSheetConfiguration? configuration;
final AstromicSheetStyle? style; final AstromicSheetStyle? style;
@@ -28,9 +29,9 @@ class AstromicScrollerSheetTemplate<T> extends AstromicSheetTemplate<T> {
}); });
AstromicScrollerSheetTemplate<T> copyWith({ AstromicScrollerSheetTemplate<T> copyWith({
Widget Function(ScrollController)? headSection, Widget Function(ScrollController,SheetStore store)? headSection,
Widget Function(ScrollController, ScrollPhysics)? contentSectionBuilder, Widget Function(ScrollController, ScrollPhysics,SheetStore store)? contentSectionBuilder,
Widget Function(ScrollController)? footerSection, Widget Function(ScrollController,SheetStore store)? footerSection,
AstromicSheetConfiguration? configuration, AstromicSheetConfiguration? configuration,
AstromicSheetStyle? style, AstromicSheetStyle? style,
}) { }) {