[SYNC]
This commit is contained in:
@@ -125,9 +125,7 @@ class AstromicSheetHelper {
|
|||||||
//
|
//
|
||||||
child: ChangeNotifierProvider<SheetStore>(
|
child: ChangeNotifierProvider<SheetStore>(
|
||||||
create: (BuildContext c) => store,
|
create: (BuildContext c) => store,
|
||||||
child: ListenableBuilder(
|
child: BaseSheetWidget<T?>(
|
||||||
listenable: store,
|
|
||||||
builder: (_, __) => BaseSheetWidget<T?>(
|
|
||||||
sheetType: SheetType.form,
|
sheetType: SheetType.form,
|
||||||
//
|
//
|
||||||
sheetConfiguration: sheetConfigs,
|
sheetConfiguration: sheetConfigs,
|
||||||
@@ -138,7 +136,6 @@ class AstromicSheetHelper {
|
|||||||
footerSectionFormBuilder: footerSectionBuilder == null ? null : (AstromicFormController controller) => footerSectionBuilder.call(controller, store),
|
footerSectionFormBuilder: footerSectionBuilder == null ? null : (AstromicFormController controller) => footerSectionBuilder.call(controller, store),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +202,7 @@ class AstromicSheetHelper {
|
|||||||
// s2 -- Child
|
// s2 -- Child
|
||||||
builder: (BuildContext context, ScrollController scrollController, ScrollPhysics scrollPhysics, int stop) {
|
builder: (BuildContext context, ScrollController scrollController, ScrollPhysics scrollPhysics, int stop) {
|
||||||
return ChangeNotifierProvider<SheetStore>(
|
return ChangeNotifierProvider<SheetStore>(
|
||||||
create: (BuildContext c) => SheetStore(),
|
create: (BuildContext c) => store,
|
||||||
child: BaseSheetWidget<T?>(
|
child: BaseSheetWidget<T?>(
|
||||||
sheetType: SheetType.scroller,
|
sheetType: SheetType.scroller,
|
||||||
sheetConfiguration: sheetConfigs,
|
sheetConfiguration: sheetConfigs,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class SheetStore extends ChangeNotifier {
|
|||||||
|
|
||||||
static final StreamController<UnmodifiableMapView<String, dynamic>> _stateStreamController = StreamController<UnmodifiableMapView<String, dynamic>>.broadcast();
|
static final StreamController<UnmodifiableMapView<String, dynamic>> _stateStreamController = StreamController<UnmodifiableMapView<String, dynamic>>.broadcast();
|
||||||
final Stream<UnmodifiableMapView<String, dynamic>> stateStream = _stateStreamController.stream;
|
final Stream<UnmodifiableMapView<String, dynamic>> stateStream = _stateStreamController.stream;
|
||||||
|
|
||||||
/// Adds [item] to store.
|
/// Adds [item] to store.
|
||||||
void add(String itemID, dynamic value) {
|
void add(String itemID, dynamic value) {
|
||||||
_items.addEntries(<MapEntry<String, dynamic>>[MapEntry<String, dynamic>(itemID, value)]);
|
_items.addEntries(<MapEntry<String, dynamic>>[MapEntry<String, dynamic>(itemID, value)]);
|
||||||
@@ -45,4 +46,9 @@ class SheetStore extends ChangeNotifier {
|
|||||||
// This call tells the widgets that are listening to this store to rebuild.
|
// This call tells the widgets that are listening to this store to rebuild.
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return a stream builder for real-time value updates.
|
||||||
|
Widget builder(Widget child) {
|
||||||
|
return ListenableBuilder(listenable: this, builder: (_,__) => child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user