Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1f0730e6
Unverified
Commit
1f0730e6
authored
Sep 06, 2023
by
Polina Cherkasova
Committed by
GitHub
Sep 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DraggableScrollableActuator should dispose notifier. (#133917)
parent
41ebf282
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+16
-4
floating_action_button_location_test.dart
...r/test/material/floating_action_button_location_test.dart
+2
-2
No files found.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
1f0730e6
...
@@ -1015,12 +1015,12 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
...
@@ -1015,12 +1015,12 @@ class _DraggableScrollableSheetScrollPosition extends ScrollPositionWithSingleCo
/// in library users' code). Generally, it's easier to control the sheet
/// in library users' code). Generally, it's easier to control the sheet
/// directly by creating a controller and passing the controller to the sheet in
/// directly by creating a controller and passing the controller to the sheet in
/// its constructor (see [DraggableScrollableSheet.controller]).
/// its constructor (see [DraggableScrollableSheet.controller]).
class
DraggableScrollableActuator
extends
State
less
Widget
{
class
DraggableScrollableActuator
extends
State
ful
Widget
{
/// Creates a widget that can notify descendent [DraggableScrollableSheet]s
/// Creates a widget that can notify descendent [DraggableScrollableSheet]s
/// to reset to their initial position.
/// to reset to their initial position.
///
///
/// The [child] parameter is required.
/// The [child] parameter is required.
DraggableScrollableActuator
({
const
DraggableScrollableActuator
({
super
.
key
,
super
.
key
,
required
this
.
child
,
required
this
.
child
,
});
});
...
@@ -1031,7 +1031,6 @@ class DraggableScrollableActuator extends StatelessWidget {
...
@@ -1031,7 +1031,6 @@ class DraggableScrollableActuator extends StatelessWidget {
/// Must not be null.
/// Must not be null.
final
Widget
child
;
final
Widget
child
;
final
_ResetNotifier
_notifier
=
_ResetNotifier
();
/// Notifies any descendant [DraggableScrollableSheet] that it should reset
/// Notifies any descendant [DraggableScrollableSheet] that it should reset
/// to its initial position.
/// to its initial position.
...
@@ -1047,9 +1046,22 @@ class DraggableScrollableActuator extends StatelessWidget {
...
@@ -1047,9 +1046,22 @@ class DraggableScrollableActuator extends StatelessWidget {
return
notifier
.
_sendReset
();
return
notifier
.
_sendReset
();
}
}
@override
State
<
DraggableScrollableActuator
>
createState
()
=>
_DraggableScrollableActuatorState
();
}
class
_DraggableScrollableActuatorState
extends
State
<
DraggableScrollableActuator
>
{
final
_ResetNotifier
_notifier
=
_ResetNotifier
();
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
_InheritedResetNotifier
(
notifier:
_notifier
,
child:
child
);
return
_InheritedResetNotifier
(
notifier:
_notifier
,
child:
widget
.
child
);
}
@override
void
dispose
()
{
_notifier
.
dispose
();
super
.
dispose
();
}
}
}
}
...
...
packages/flutter/test/material/floating_action_button_location_test.dart
View file @
1f0730e6
...
@@ -415,7 +415,7 @@ void main() {
...
@@ -415,7 +415,7 @@ void main() {
expect
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)),
const
Offset
(
_leftOffsetX
,
_floatOffsetY
));
expect
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)),
const
Offset
(
_leftOffsetX
,
_floatOffsetY
));
});
});
testWidgets
(
'centerFloat'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'centerFloat'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_singleFabScaffold
(
FloatingActionButtonLocation
.
centerFloat
));
await
tester
.
pumpWidget
(
_singleFabScaffold
(
FloatingActionButtonLocation
.
centerFloat
));
expect
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)),
const
Offset
(
_centerOffsetX
,
_floatOffsetY
));
expect
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)),
const
Offset
(
_centerOffsetX
,
_floatOffsetY
));
...
@@ -1037,7 +1037,7 @@ void main() {
...
@@ -1037,7 +1037,7 @@ void main() {
);
);
});
});
testWidgets
(
'centerFloat'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'centerFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
372.0
,
478.0
,
428.0
,
534.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
372.0
,
478.0
,
428.0
,
534.0
);
// Positioned relative to BottomNavigationBar
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
372.0
,
422.0
,
428.0
,
478.0
);
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
372.0
,
422.0
,
428.0
,
478.0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment