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
fdde2419
Unverified
Commit
fdde2419
authored
Sep 30, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Sep 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DraggableScrollableController should dispatch creation in constructor. (#135423)
parent
0f5cc2c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+7
-0
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+3
-0
draggable_scrollable_sheet_test.dart
...flutter/test/widgets/draggable_scrollable_sheet_test.dart
+9
-0
No files found.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
fdde2419
...
...
@@ -52,6 +52,13 @@ typedef ScrollableWidgetBuilder = Widget Function(
/// fire when [pixels] changes without [size] changing. For example, if the
/// constraints provided to an attached sheet change.
class
DraggableScrollableController
extends
ChangeNotifier
{
/// Creates a controller for [DraggableScrollableSheet].
DraggableScrollableController
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
_DraggableScrollableSheetScrollController
?
_attachedController
;
final
Set
<
AnimationController
>
_animationControllers
=
<
AnimationController
>{};
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
fdde2419
...
...
@@ -273,6 +273,7 @@ void main() {
testWidgetsWithLeakTracking
(
'Floating action button shrinks when bottom sheet becomes dominant'
,
(
WidgetTester
tester
)
async
{
final
DraggableScrollableController
draggableController
=
DraggableScrollableController
();
addTearDown
(
draggableController
.
dispose
);
const
double
kBottomSheetDominatesPercentage
=
0.3
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -312,6 +313,7 @@ void main() {
testWidgetsWithLeakTracking
(
'Scaffold shows scrim when bottom sheet becomes dominant'
,
(
WidgetTester
tester
)
async
{
final
DraggableScrollableController
draggableController
=
DraggableScrollableController
();
addTearDown
(
draggableController
.
dispose
);
const
double
kBottomSheetDominatesPercentage
=
0.3
;
const
double
kMinBottomSheetScrimOpacity
=
0.1
;
const
double
kMaxBottomSheetScrimOpacity
=
0.6
;
...
...
@@ -2762,6 +2764,7 @@ void main() {
testWidgetsWithLeakTracking
(
'showBottomSheet removes scrim when draggable sheet is dismissed'
,
(
WidgetTester
tester
)
async
{
final
DraggableScrollableController
draggableController
=
DraggableScrollableController
();
addTearDown
(
draggableController
.
dispose
);
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
();
PersistentBottomSheetController
<
void
>?
sheetController
;
...
...
packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
View file @
fdde2419
...
...
@@ -1681,7 +1681,9 @@ void main() {
testWidgetsWithLeakTracking
(
'DraggableScrollableSheet controller can be changed while animating'
,
(
WidgetTester
tester
)
async
{
final
DraggableScrollableController
controller1
=
DraggableScrollableController
();
addTearDown
(
controller1
.
dispose
);
final
DraggableScrollableController
controller2
=
DraggableScrollableController
();
addTearDown
(
controller2
.
dispose
);
DraggableScrollableController
controller
=
controller1
;
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -1733,4 +1735,11 @@ void main() {
expect
(
controller1
.
isAttached
,
false
);
expect
(
controller2
.
isAttached
,
false
);
});
testWidgetsWithLeakTracking
(
'
$DraggableScrollableController
dispatches creation in constructor.'
,
(
WidgetTester
widgetTester
)
async
{
await
expectLater
(
await
memoryEvents
(()
async
=>
DraggableScrollableController
().
dispose
(),
DraggableScrollableController
),
areCreateAndDispose
,
);
});
}
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