[0.1.2]
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
## 0.1.1
|
||||
- **FEAT**: Added a shared storage between sheet parts with a provider.
|
||||
|
||||
## 0.1.1
|
||||
- **FIX**: Adding export for `AstromicFieldState`.
|
||||
|
||||
|
||||
104
lib/src/form/src/form.dart
Normal file
104
lib/src/form/src/form.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
0
lib/src/form/src/models/form_row.model.dart
Normal file
0
lib/src/form/src/models/form_row.model.dart
Normal 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,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
38
lib/src/sheet/src/models/sheet_store.model.dart
Normal file
38
lib/src/sheet/src/models/sheet_store.model.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -224,6 +224,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -320,6 +328,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: provider
|
||||
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: astromic_helpers
|
||||
description: The helpers module of the Astromic Presentation System
|
||||
publish_to: "none"
|
||||
version: 0.1.1+2
|
||||
version: 0.1.2
|
||||
|
||||
environment:
|
||||
sdk: ">=3.6.0"
|
||||
@@ -19,6 +19,8 @@ dependencies:
|
||||
url: https://git.micazi.dev/micazi/astromic_elements.git
|
||||
ref: master
|
||||
##S1 ~ 3rd-party
|
||||
## Needed for the sheet helper.
|
||||
provider: ^6.1.2
|
||||
## Needed for the form helper.
|
||||
form_controller: ^0.8.8+2
|
||||
## Needed for the loading helper.
|
||||
|
||||
Reference in New Issue
Block a user