@@ -1015,12 +1015,12 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
10151015/// in library users' code). Generally, it's easier to control the sheet
10161016/// directly by creating a controller and passing the controller to the sheet in
10171017/// its constructor (see [DraggableScrollableSheet.controller] ).
1018- class DraggableScrollableActuator extends StatelessWidget {
1018+ class DraggableScrollableActuator extends StatefulWidget {
10191019 /// Creates a widget that can notify descendent [DraggableScrollableSheet] s
10201020 /// to reset to their initial position.
10211021 ///
10221022 /// The [child] parameter is required.
1023- DraggableScrollableActuator ({
1023+ const DraggableScrollableActuator ({
10241024 super .key,
10251025 required this .child,
10261026 });
@@ -1031,7 +1031,6 @@ class DraggableScrollableActuator extends StatelessWidget {
10311031 /// Must not be null.
10321032 final Widget child;
10331033
1034- final _ResetNotifier _notifier = _ResetNotifier ();
10351034
10361035 /// Notifies any descendant [DraggableScrollableSheet] that it should reset
10371036 /// to its initial position.
@@ -1047,9 +1046,22 @@ class DraggableScrollableActuator extends StatelessWidget {
10471046 return notifier._sendReset ();
10481047 }
10491048
1049+ @override
1050+ State <DraggableScrollableActuator > createState () => _DraggableScrollableActuatorState ();
1051+ }
1052+
1053+ class _DraggableScrollableActuatorState extends State <DraggableScrollableActuator > {
1054+ final _ResetNotifier _notifier = _ResetNotifier ();
1055+
10501056 @override
10511057 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 ();
10531065 }
10541066}
10551067
0 commit comments