This commit is contained in:
2025-03-04 13:15:11 +02:00
parent 6543a4db38
commit 029e5dfe81
7 changed files with 201 additions and 28 deletions

104
lib/src/form/src/form.dart Normal file
View File

@@ -0,0 +1,104 @@
//s1 Imports
//s2 Core Package Imports
import 'package:flutter/material.dart';
//s2 1st-party Package Imports
//s2 3rd-party Package Imports
//s2 Dependancies Imports
//s3 Routes
//s3 Services
//s3 Models & Widgets
//s1 Exports
class AstromicForm extends StatefulWidget {
//SECTION - Widget Arguments
//!SECTION
//
const AstromicForm({
super.key,
});
@override
State<AstromicForm> createState() => _AstromicFormState();
}
class _AstromicFormState extends State<AstromicForm> {
//
//SECTION - State Variables
//s1 --State
//s1 --State
//
//s1 --Controllers
//late AstromicFormController _formController;
//s1 --Controllers
//
//s1 --Constants
//s1 --Constants
//!SECTION
@override
void initState() {
super.initState();
//
//SECTION - State Variables initializations & Listeners
//s1 --State
//s1 --State
//
//s1 --Controllers & Listeners
// _formController = AstromicFormController();
//s1 --Controllers & Listeners
//
//s1 --Late & Async Initializers
//s1 --Late & Async Initializers
//!SECTION
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
//
//SECTION - State Variables initializations & Listeners
//s1 --State
//s1 --State
//
//s1 --Controllers & Listeners
//s1 --Controllers & Listeners
//
//!SECTION
}
//SECTION - Dumb Widgets
//!SECTION
//SECTION - Stateless functions
//!SECTION
//SECTION - Action Callbacks
//!SECTION
@override
Widget build(BuildContext context) {
//SECTION - Build Setup
//s1 --Values
//double w = MediaQuery.of(context).size.width;
//double h = MediaQuery.of(context).size.height;
//s1 --Values
//
//s1 --Contexted Widgets
//s1 --Contexted Widgets
//!SECTION
//SECTION - Build Return
return Scaffold(
body: Container(),
);
//!SECTION
}
@override
void dispose() {
//SECTION - Disposable variables
//!SECTION
super.dispose();
}
}

View File

@@ -3,6 +3,7 @@
import 'package:flutter/material.dart';
//s2 1st-party Package Imports
//s2 3rd-party Package Imports
import 'package:provider/provider.dart';
//s2 Dependancies Imports
//s3 Routes
//s3 Services
@@ -12,6 +13,7 @@ import '../form/form_helper.astromic.dart';
import '../sheet/src/models/models.exports.dart';
import '../sheet/src/enums/enums.exports.dart';
import '../sheet/src/widgets/widgets.exports.dart';
import 'src/models/sheet_store.model.dart';
//s1 Exports
export '../sheet/src/models/models.exports.dart';
export '../form/form_helper.astromic.dart' show AstromicFormController;
@@ -60,17 +62,19 @@ class AstromicSheetHelper {
reverseAnimationDuration: sheetConfigs.reverseAnimationDuration ?? const Duration(milliseconds: 250),
animationCurve: sheetConfigs.animationCurve ?? Curves.easeOut,
//
barrierColor: sheetStyle.maskColor ,
barrierColor: sheetStyle.maskColor,
radius: sheetStyle.radius,
//
child: BaseSheetWidget<T?>(
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSection: headSection,
contentSection: contentSection,
footerSection: footerSection,
),
child: ChangeNotifierProvider<SheetStore>(
create: (BuildContext c) => SheetStore(),
child: BaseSheetWidget<T?>(
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSection: headSection,
contentSection: contentSection,
footerSection: footerSection,
)),
);
}
@@ -118,15 +122,18 @@ class AstromicSheetHelper {
barrierColor: sheetStyle.maskColor,
radius: sheetStyle.radius,
//
child: BaseSheetWidget<T?>(
sheetType: SheetType.form,
//
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSectionFormBuilder: headSectionBuilder,
contentSectionFormBuilder: contentSectionBuilder,
footerSectionFormBuilder: footerSectionBuilder,
child: ChangeNotifierProvider<SheetStore>(
create: (BuildContext c) => SheetStore(),
child: BaseSheetWidget<T?>(
sheetType: SheetType.form,
//
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
//
headSectionFormBuilder: headSectionBuilder,
contentSectionFormBuilder: contentSectionBuilder,
footerSectionFormBuilder: footerSectionBuilder,
),
),
);
}
@@ -192,15 +199,18 @@ class AstromicSheetHelper {
topInset: sheetStyle.topInset,
// s2 -- Child
builder: (BuildContext context, ScrollController scrollController, ScrollPhysics scrollPhysics, int stop) {
return BaseSheetWidget<T?>(
sheetType: SheetType.scroller,
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
headSectionScrollerBuilder: headSectionBuilder,
contentSectionScrollBuilder: contentSectionBuilder,
footerSectionScrollerBuilder: footerSectionBuilder,
scrollController: scrollController,
scrollPhysics: scrollPhysics,
return ChangeNotifierProvider<SheetStore>(
create: (BuildContext c) => SheetStore(),
child: BaseSheetWidget<T?>(
sheetType: SheetType.scroller,
sheetConfiguration: sheetConfigs,
sheetStyle: sheetStyle,
headSectionScrollerBuilder: headSectionBuilder,
contentSectionScrollBuilder: contentSectionBuilder,
footerSectionScrollerBuilder: footerSectionBuilder,
scrollController: scrollController,
scrollPhysics: scrollPhysics,
),
);
},
);

View File

@@ -0,0 +1,38 @@
import 'dart:collection';
import 'package:flutter/widgets.dart';
class SheetStore extends ChangeNotifier {
/// Internal, private state of the store.
final Map<String, dynamic> _items = <String, dynamic>{};
/// An unmodifiable view of the items in the store.
UnmodifiableMapView<String, dynamic> get items => UnmodifiableMapView<String, dynamic>(_items);
/// Adds [item] to store.
void add(String itemID, dynamic value) {
_items.addEntries(<MapEntry<String, dynamic>>[MapEntry<String, dynamic>(itemID, value)]);
// This call tells the widgets that are listening to this store to rebuild.
notifyListeners();
}
/// Updates [item] in the store.
void update(String itemID, dynamic value) {
if (!_items.containsKey(itemID)) {
throw Exception('No item with the ID $itemID exist in the SheetStore, Are you sure you added it?');
}
_items[itemID] = value;
// This call tells the widgets that are listening to this store to rebuild.
notifyListeners();
}
/// Removes [item] from the store.
void remove(String itemID, dynamic value) {
if (!_items.containsKey(itemID)) {
throw Exception('No item with the ID $itemID exist in the SheetStore, Are you sure you added it?');
}
_items.remove(itemID);
// This call tells the widgets that are listening to this store to rebuild.
notifyListeners();
}
}