[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
|
## 0.1.1
|
||||||
- **FIX**: Adding export for `AstromicFieldState`.
|
- **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';
|
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
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
//s2 Dependancies Imports
|
//s2 Dependancies Imports
|
||||||
//s3 Routes
|
//s3 Routes
|
||||||
//s3 Services
|
//s3 Services
|
||||||
@@ -12,6 +13,7 @@ import '../form/form_helper.astromic.dart';
|
|||||||
import '../sheet/src/models/models.exports.dart';
|
import '../sheet/src/models/models.exports.dart';
|
||||||
import '../sheet/src/enums/enums.exports.dart';
|
import '../sheet/src/enums/enums.exports.dart';
|
||||||
import '../sheet/src/widgets/widgets.exports.dart';
|
import '../sheet/src/widgets/widgets.exports.dart';
|
||||||
|
import 'src/models/sheet_store.model.dart';
|
||||||
//s1 Exports
|
//s1 Exports
|
||||||
export '../sheet/src/models/models.exports.dart';
|
export '../sheet/src/models/models.exports.dart';
|
||||||
export '../form/form_helper.astromic.dart' show AstromicFormController;
|
export '../form/form_helper.astromic.dart' show AstromicFormController;
|
||||||
@@ -63,6 +65,8 @@ class AstromicSheetHelper {
|
|||||||
barrierColor: sheetStyle.maskColor,
|
barrierColor: sheetStyle.maskColor,
|
||||||
radius: sheetStyle.radius,
|
radius: sheetStyle.radius,
|
||||||
//
|
//
|
||||||
|
child: ChangeNotifierProvider<SheetStore>(
|
||||||
|
create: (BuildContext c) => SheetStore(),
|
||||||
child: BaseSheetWidget<T?>(
|
child: BaseSheetWidget<T?>(
|
||||||
sheetConfiguration: sheetConfigs,
|
sheetConfiguration: sheetConfigs,
|
||||||
sheetStyle: sheetStyle,
|
sheetStyle: sheetStyle,
|
||||||
@@ -70,7 +74,7 @@ class AstromicSheetHelper {
|
|||||||
headSection: headSection,
|
headSection: headSection,
|
||||||
contentSection: contentSection,
|
contentSection: contentSection,
|
||||||
footerSection: footerSection,
|
footerSection: footerSection,
|
||||||
),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +122,8 @@ class AstromicSheetHelper {
|
|||||||
barrierColor: sheetStyle.maskColor,
|
barrierColor: sheetStyle.maskColor,
|
||||||
radius: sheetStyle.radius,
|
radius: sheetStyle.radius,
|
||||||
//
|
//
|
||||||
|
child: ChangeNotifierProvider<SheetStore>(
|
||||||
|
create: (BuildContext c) => SheetStore(),
|
||||||
child: BaseSheetWidget<T?>(
|
child: BaseSheetWidget<T?>(
|
||||||
sheetType: SheetType.form,
|
sheetType: SheetType.form,
|
||||||
//
|
//
|
||||||
@@ -128,6 +134,7 @@ class AstromicSheetHelper {
|
|||||||
contentSectionFormBuilder: contentSectionBuilder,
|
contentSectionFormBuilder: contentSectionBuilder,
|
||||||
footerSectionFormBuilder: footerSectionBuilder,
|
footerSectionFormBuilder: footerSectionBuilder,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +199,9 @@ class AstromicSheetHelper {
|
|||||||
topInset: sheetStyle.topInset,
|
topInset: sheetStyle.topInset,
|
||||||
// s2 -- Child
|
// s2 -- Child
|
||||||
builder: (BuildContext context, ScrollController scrollController, ScrollPhysics scrollPhysics, int stop) {
|
builder: (BuildContext context, ScrollController scrollController, ScrollPhysics scrollPhysics, int stop) {
|
||||||
return BaseSheetWidget<T?>(
|
return ChangeNotifierProvider<SheetStore>(
|
||||||
|
create: (BuildContext c) => SheetStore(),
|
||||||
|
child: BaseSheetWidget<T?>(
|
||||||
sheetType: SheetType.scroller,
|
sheetType: SheetType.scroller,
|
||||||
sheetConfiguration: sheetConfigs,
|
sheetConfiguration: sheetConfigs,
|
||||||
sheetStyle: sheetStyle,
|
sheetStyle: sheetStyle,
|
||||||
@@ -201,6 +210,7 @@ class AstromicSheetHelper {
|
|||||||
footerSectionScrollerBuilder: footerSectionBuilder,
|
footerSectionScrollerBuilder: footerSectionBuilder,
|
||||||
scrollController: scrollController,
|
scrollController: scrollController,
|
||||||
scrollPhysics: scrollPhysics,
|
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"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.16.0"
|
version: "1.16.0"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
octo_image:
|
octo_image:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -320,6 +328,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
|
provider:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: provider
|
||||||
|
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.2"
|
||||||
rxdart:
|
rxdart:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: astromic_helpers
|
name: astromic_helpers
|
||||||
description: The helpers module of the Astromic Presentation System
|
description: The helpers module of the Astromic Presentation System
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 0.1.1+2
|
version: 0.1.2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.6.0"
|
sdk: ">=3.6.0"
|
||||||
@@ -19,6 +19,8 @@ dependencies:
|
|||||||
url: https://git.micazi.dev/micazi/astromic_elements.git
|
url: https://git.micazi.dev/micazi/astromic_elements.git
|
||||||
ref: master
|
ref: master
|
||||||
##S1 ~ 3rd-party
|
##S1 ~ 3rd-party
|
||||||
|
## Needed for the sheet helper.
|
||||||
|
provider: ^6.1.2
|
||||||
## Needed for the form helper.
|
## Needed for the form helper.
|
||||||
form_controller: ^0.8.8+2
|
form_controller: ^0.8.8+2
|
||||||
## Needed for the loading helper.
|
## Needed for the loading helper.
|
||||||
|
|||||||
Reference in New Issue
Block a user