@@ -1015,12 +1015,12 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
1015
1015
/// in library users' code). Generally, it's easier to control the sheet
1016
1016
/// directly by creating a controller and passing the controller to the sheet in
1017
1017
/// its constructor (see [DraggableScrollableSheet.controller] ).
1018
- class DraggableScrollableActuator extends StatelessWidget {
1018
+ class DraggableScrollableActuator extends StatefulWidget {
1019
1019
/// Creates a widget that can notify descendent [DraggableScrollableSheet] s
1020
1020
/// to reset to their initial position.
1021
1021
///
1022
1022
/// The [child] parameter is required.
1023
- DraggableScrollableActuator ({
1023
+ const DraggableScrollableActuator ({
1024
1024
super .key,
1025
1025
required this .child,
1026
1026
});
@@ -1031,7 +1031,6 @@ class DraggableScrollableActuator extends StatelessWidget {
1031
1031
/// Must not be null.
1032
1032
final Widget child;
1033
1033
1034
- final _ResetNotifier _notifier = _ResetNotifier ();
1035
1034
1036
1035
/// Notifies any descendant [DraggableScrollableSheet] that it should reset
1037
1036
/// to its initial position.
@@ -1047,9 +1046,22 @@ class DraggableScrollableActuator extends StatelessWidget {
1047
1046
return notifier._sendReset ();
1048
1047
}
1049
1048
1049
+ @override
1050
+ State <DraggableScrollableActuator > createState () => _DraggableScrollableActuatorState ();
1051
+ }
1052
+
1053
+ class _DraggableScrollableActuatorState extends State <DraggableScrollableActuator > {
1054
+ final _ResetNotifier _notifier = _ResetNotifier ();
1055
+
1050
1056
@override
1051
1057
Widget build (BuildContext context) {
1052
- return _InheritedResetNotifier (notifier: _notifier, child: child);
1058
+ return _InheritedResetNotifier (notifier: _notifier, child: widget.child);
1059
+ }
1060
+
1061
+ @override
1062
+ void dispose () {
1063
+ _notifier.dispose ();
1064
+ super .dispose ();
1053
1065
}
1054
1066
}
1055
1067
0 commit comments