diff --git a/lib/src/sheet/sheet_helper.astromic.dart b/lib/src/sheet/sheet_helper.astromic.dart index 9a274b3..0ef5977 100644 --- a/lib/src/sheet/sheet_helper.astromic.dart +++ b/lib/src/sheet/sheet_helper.astromic.dart @@ -124,16 +124,19 @@ class AstromicSheetHelper { radius: sheetStyle.radius, // child: ChangeNotifierProvider( - create: (BuildContext c) => SheetStore(), - child: BaseSheetWidget( - sheetType: SheetType.form, - // - sheetConfiguration: sheetConfigs, - sheetStyle: sheetStyle, - // - headSectionFormBuilder: headSectionBuilder == null ? null : (AstromicFormController controller) => headSectionBuilder.call(controller, store), - contentSectionFormBuilder: (AstromicFormController controller) => contentSectionBuilder(controller, store), - footerSectionFormBuilder: footerSectionBuilder == null ? null : (AstromicFormController controller) => footerSectionBuilder.call(controller, store), + create: (BuildContext c) => store, + child: ListenableBuilder( + listenable: store, + builder: (_, __) => BaseSheetWidget( + sheetType: SheetType.form, + // + sheetConfiguration: sheetConfigs, + sheetStyle: sheetStyle, + // + headSectionFormBuilder: headSectionBuilder == null ? null : (AstromicFormController controller) => headSectionBuilder.call(controller, store), + contentSectionFormBuilder: (AstromicFormController controller) => contentSectionBuilder(controller, store), + footerSectionFormBuilder: footerSectionBuilder == null ? null : (AstromicFormController controller) => footerSectionBuilder.call(controller, store), + ), ), ), ); @@ -208,7 +211,7 @@ class AstromicSheetHelper { sheetConfiguration: sheetConfigs, sheetStyle: sheetStyle, headSectionScrollerBuilder: headSectionBuilder == null ? null : (ScrollController controller) => headSectionBuilder.call(controller, store), - contentSectionScrollBuilder: (ScrollController controller, ScrollPhysics physics) => contentSectionBuilder(controller,physics, store), + contentSectionScrollBuilder: (ScrollController controller, ScrollPhysics physics) => contentSectionBuilder(controller, physics, store), footerSectionScrollerBuilder: footerSectionBuilder == null ? null : (ScrollController controller) => footerSectionBuilder.call(controller, store), scrollController: scrollController, scrollPhysics: scrollPhysics, diff --git a/lib/src/sheet/src/models/sheet_store.model.dart b/lib/src/sheet/src/models/sheet_store.model.dart index 5a21bdb..e671b76 100644 --- a/lib/src/sheet/src/models/sheet_store.model.dart +++ b/lib/src/sheet/src/models/sheet_store.model.dart @@ -1,3 +1,6 @@ +// ignore_for_file: close_sinks + +import 'dart:async'; import 'dart:collection'; import 'package:flutter/widgets.dart'; @@ -9,6 +12,8 @@ class SheetStore extends ChangeNotifier { /// An unmodifiable view of the items in the store. UnmodifiableMapView get items => UnmodifiableMapView(_items); + static final StreamController> _stateStreamController = StreamController>.broadcast(); + final Stream> stateStream = _stateStreamController.stream; /// Adds [item] to store. void add(String itemID, dynamic value) { _items.addEntries(>[MapEntry(itemID, value)]);