Skip to content

Commit cd0650f

Browse files
authored
fix: dispose TextPainter after use (#1777)
1 parent a218591 commit cd0650f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/pangea/morphs/morph_meaning/morph_info_repo.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class MorphInfoRepo {
4848
set(request, response);
4949

5050
return response;
51-
} catch (e, s) {
51+
} catch (e) {
5252
debugPrint('Error fetching morph info: $e');
5353
return Future.error(e);
5454
}

lib/pangea/morphs/morph_meaning/morph_info_response.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class MorphologicalFeature {
6969

7070
MorphologicalTag? getTagByCode(String code) {
7171
return tags.firstWhereOrNull(
72-
(tag) => tag.code.toLowerCase() == code.toLowerCase());
72+
(tag) => tag.code.toLowerCase() == code.toLowerCase(),
73+
);
7374
}
7475
}
7576

@@ -107,6 +108,7 @@ class MorphInfoResponse {
107108

108109
MorphologicalFeature? getFeatureByCode(String code) {
109110
return features.firstWhereOrNull(
110-
(feature) => feature.code.toLowerCase() == code.toLowerCase());
111+
(feature) => feature.code.toLowerCase() == code.toLowerCase(),
112+
);
111113
}
112114
}

lib/pangea/toolbar/widgets/message_token_text.dart

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class HiddenText extends StatelessWidget {
105105
final textWidth = textPainter.size.width;
106106
final textHeight = textPainter.size.height;
107107

108+
textPainter.dispose();
109+
108110
return SizedBox(
109111
height: textHeight,
110112
child: Stack(

0 commit comments

Comments
 (0)