fix: dispose TextPainter after use (#1777)

This commit is contained in:
ggurdin 2025-02-12 16:00:38 -05:00 committed by GitHub
parent a218591805
commit cd0650f6b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View file

@ -48,7 +48,7 @@ class MorphInfoRepo {
set(request, response);
return response;
} catch (e, s) {
} catch (e) {
debugPrint('Error fetching morph info: $e');
return Future.error(e);
}

View file

@ -69,7 +69,8 @@ class MorphologicalFeature {
MorphologicalTag? getTagByCode(String code) {
return tags.firstWhereOrNull(
(tag) => tag.code.toLowerCase() == code.toLowerCase());
(tag) => tag.code.toLowerCase() == code.toLowerCase(),
);
}
}
@ -107,6 +108,7 @@ class MorphInfoResponse {
MorphologicalFeature? getFeatureByCode(String code) {
return features.firstWhereOrNull(
(feature) => feature.code.toLowerCase() == code.toLowerCase());
(feature) => feature.code.toLowerCase() == code.toLowerCase(),
);
}
}

View file

@ -105,6 +105,8 @@ class HiddenText extends StatelessWidget {
final textWidth = textPainter.size.width;
final textHeight = textPainter.size.height;
textPainter.dispose();
return SizedBox(
height: textHeight,
child: Stack(