diff --git a/packages/fleather/lib/src/rendering/paragraph_proxy.dart b/packages/fleather/lib/src/rendering/paragraph_proxy.dart index 527ca7d6..f09f6cfb 100644 --- a/packages/fleather/lib/src/rendering/paragraph_proxy.dart +++ b/packages/fleather/lib/src/rendering/paragraph_proxy.dart @@ -1,5 +1,3 @@ -// ignore_for_file: deprecated_member_use - import 'dart:ui'; import 'package:flutter/rendering.dart'; @@ -12,7 +10,7 @@ class RenderParagraphProxy extends RenderProxyBox implements RenderContentProxyBox { RenderParagraphProxy({ required TextStyle textStyle, - required double textScaleFactor, + required TextScaler textScaler, required TextWidthBasis textWidthBasis, RenderParagraph? child, TextDirection? textDirection, @@ -23,7 +21,7 @@ class RenderParagraphProxy extends RenderProxyBox text: TextSpan(text: ' ', style: textStyle), textAlign: TextAlign.left, textDirection: textDirection, - textScaleFactor: textScaleFactor, + textScaler: textScaler, strutStyle: strutStyle, locale: locale, textWidthBasis: textWidthBasis, @@ -50,9 +48,9 @@ class RenderParagraphProxy extends RenderProxyBox markNeedsLayout(); } - set textScaleFactor(double value) { - if (_prototypePainter.textScaleFactor == value) return; - _prototypePainter.textScaleFactor = value; + set textScaler(TextScaler value) { + if (_prototypePainter.textScaler == value) return; + _prototypePainter.textScaler = value; markNeedsLayout(); } diff --git a/packages/fleather/lib/src/widgets/rich_text_proxy.dart b/packages/fleather/lib/src/widgets/rich_text_proxy.dart index 7a6c90dc..e91609b9 100644 --- a/packages/fleather/lib/src/widgets/rich_text_proxy.dart +++ b/packages/fleather/lib/src/widgets/rich_text_proxy.dart @@ -11,14 +11,14 @@ class RichTextProxy extends SingleChildRenderObjectWidget { required this.locale, required this.strutStyle, required this.textAlign, - this.textScaleFactor = 1.0, + this.textScaler = TextScaler.noScaling, this.textWidthBasis = TextWidthBasis.parent, this.textHeightBehavior, }) : super(key: key, child: child); final TextStyle textStyle; final TextAlign textAlign; - final double textScaleFactor; + final TextScaler textScaler; final Locale? locale; final StrutStyle strutStyle; final TextWidthBasis textWidthBasis; @@ -29,7 +29,7 @@ class RichTextProxy extends SingleChildRenderObjectWidget { return RenderParagraphProxy( textStyle: textStyle, textDirection: Directionality.of(context), - textScaleFactor: textScaleFactor, + textScaler: textScaler, locale: locale, strutStyle: strutStyle, textWidthBasis: textWidthBasis, @@ -43,7 +43,7 @@ class RichTextProxy extends SingleChildRenderObjectWidget { renderObject.textStyle = textStyle; renderObject.textDirection = Directionality.of(context); renderObject.textAlign = textAlign; - renderObject.textScaleFactor = textScaleFactor; + renderObject.textScaler = textScaler; renderObject.locale = locale; renderObject.strutStyle = strutStyle; renderObject.textWidthBasis = textWidthBasis; diff --git a/packages/fleather/lib/src/widgets/text_line.dart b/packages/fleather/lib/src/widgets/text_line.dart index 06cbe7b8..f758a6bf 100644 --- a/packages/fleather/lib/src/widgets/text_line.dart +++ b/packages/fleather/lib/src/widgets/text_line.dart @@ -136,8 +136,7 @@ class _TextLineState extends State { text: text, textAlign: textAlign, strutStyle: strutStyle, - // ignore: deprecated_member_use - textScaleFactor: MediaQuery.textScaleFactorOf(context), + textScaler: MediaQuery.textScalerOf(context), ), ); } diff --git a/packages/fleather/test/rendering/editable_text_line_test.dart b/packages/fleather/test/rendering/editable_text_line_test.dart index f561398c..b4fbfb54 100644 --- a/packages/fleather/test/rendering/editable_text_line_test.dart +++ b/packages/fleather/test/rendering/editable_text_line_test.dart @@ -42,7 +42,7 @@ void main() { inlineCodeTheme: InlineCodeThemeData(style: const TextStyle())); renderBox.body = RenderParagraphProxy( textStyle: const TextStyle(), - textScaleFactor: 1, + textScaler: TextScaler.noScaling, child: RenderParagraph( const TextSpan( text: 'A text with that will be broken into multiple lines'), @@ -82,7 +82,7 @@ void main() { renderBox.body = RenderParagraphProxy( child: renderParagraph, textStyle: const TextStyle(), - textScaleFactor: 1, + textScaler: TextScaler.noScaling, textDirection: TextDirection.ltr, textWidthBasis: TextWidthBasis.parent); layout(renderBox); @@ -118,7 +118,7 @@ void main() { renderBox.body = RenderParagraphProxy( child: renderParagraph, textStyle: const TextStyle(), - textScaleFactor: 1, + textScaler: TextScaler.noScaling, textDirection: TextDirection.ltr, textWidthBasis: TextWidthBasis.parent); layout(renderBox);