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
a52f030c
Unverified
Commit
a52f030c
authored
Nov 03, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Nov 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InkFeature should dispatch creation and disposal events. (#137793)
parent
2369897f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
material.dart
packages/flutter/lib/src/material/material.dart
+16
-1
material_test.dart
packages/flutter/test/material/material_test.dart
+37
-0
No files found.
packages/flutter/lib/src/material/material.dart
View file @
a52f030c
...
...
@@ -709,7 +709,17 @@ abstract class InkFeature {
required
MaterialInkController
controller
,
required
this
.
referenceBox
,
this
.
onRemoved
,
})
:
_controller
=
controller
as
_RenderInkFeatures
;
})
:
_controller
=
controller
as
_RenderInkFeatures
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/material.dart'
,
className:
'
$InkFeature
'
,
object:
this
,
);
}
}
/// The [MaterialInkController] associated with this [InkFeature].
///
...
...
@@ -734,6 +744,11 @@ abstract class InkFeature {
_debugDisposed
=
true
;
return
true
;
}());
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
_controller
.
_removeFeature
(
this
);
onRemoved
?.
call
();
}
...
...
packages/flutter/test/material/material_test.dart
View file @
a52f030c
...
...
@@ -1120,6 +1120,31 @@ void main() {
// Force a repaint again. This time, it gets repainted because it is onstage.
materialKey
.
currentContext
!.
findRenderObject
()!.
paint
(
PaintingContext
(
layer2
,
Rect
.
largest
),
Offset
.
zero
);
expect
(
tracker
.
paintCount
,
2
);
tracker
.
dispose
();
});
testWidgetsWithLeakTracking
(
'
$InkFeature
dispatches memory events'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Material
(
child:
SizedBox
(
width:
20
,
height:
20
),
),
);
final
Element
element
=
tester
.
element
(
find
.
byType
(
SizedBox
));
final
MaterialInkController
controller
=
Material
.
of
(
element
);
final
RenderBox
referenceBox
=
element
.
findRenderObject
()!
as
RenderBox
;
await
expectLater
(
await
memoryEvents
(
()
=>
_InkFeature
(
controller:
controller
,
referenceBox:
referenceBox
,
).
dispose
(),
_InkFeature
,
),
areCreateAndDispose
,
);
});
group
(
'LookupBoundary'
,
()
{
...
...
@@ -1227,3 +1252,15 @@ class TrackPaintInkFeature extends InkFeature {
paintCount
+=
1
;
}
}
class
_InkFeature
extends
InkFeature
{
_InkFeature
({
required
super
.
controller
,
required
super
.
referenceBox
,
})
{
controller
.
addInkFeature
(
this
);
}
@override
void
paintFeature
(
Canvas
canvas
,
Matrix4
transform
)
{}
}
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