@@ -23,6 +23,8 @@ const TextStyle _kTextStyle = TextStyle(
23
23
height: 1.0 ,
24
24
);
25
25
26
+ const String _flutterWidgetsLibrary = 'package:flutter/widgets.dart' ;
27
+
26
28
/// Where to show a [Banner] .
27
29
///
28
30
/// The start and end locations are relative to the ambient [Directionality]
@@ -61,7 +63,17 @@ class BannerPainter extends CustomPainter {
61
63
required this .layoutDirection,
62
64
this .color = _kColor,
63
65
this .textStyle = _kTextStyle,
64
- }) : super (repaint: PaintingBinding .instance.systemFonts);
66
+ }) : super (repaint: PaintingBinding .instance.systemFonts) {
67
+ // TODO(polina-c): stop duplicating code across disposables
68
+ // https://github.com/flutter/flutter/issues/137435
69
+ if (kFlutterMemoryAllocationsEnabled) {
70
+ MemoryAllocations .instance.dispatchObjectCreated (
71
+ library: _flutterWidgetsLibrary,
72
+ className: '$BannerPainter ' ,
73
+ object: this ,
74
+ );
75
+ }
76
+ }
65
77
66
78
/// The message to show in the banner.
67
79
final String message;
@@ -117,6 +129,11 @@ class BannerPainter extends CustomPainter {
117
129
///
118
130
/// After calling this method, this object is no longer usable.
119
131
void dispose () {
132
+ // TODO(polina-c): stop duplicating code across disposables
133
+ // https://github.com/flutter/flutter/issues/137435
134
+ if (kFlutterMemoryAllocationsEnabled) {
135
+ MemoryAllocations .instance.dispatchObjectDisposed (object: this );
136
+ }
120
137
_textPainter? .dispose ();
121
138
_textPainter = null ;
122
139
}
0 commit comments