Skip to content

Commit

Permalink
Remove use of deprecated member textScaleFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Nov 30, 2023
1 parent 7d03469 commit 4d652ec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
12 changes: 5 additions & 7 deletions packages/fleather/lib/src/rendering/paragraph_proxy.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: deprecated_member_use

import 'dart:ui';

import 'package:flutter/rendering.dart';
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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;

Check warning on line 53 in packages/fleather/lib/src/rendering/paragraph_proxy.dart

View check run for this annotation

Codecov / codecov/patch

packages/fleather/lib/src/rendering/paragraph_proxy.dart#L53

Added line #L53 was not covered by tests
markNeedsLayout();
}

Expand Down
8 changes: 4 additions & 4 deletions packages/fleather/lib/src/widgets/rich_text_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions packages/fleather/lib/src/widgets/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ class _TextLineState extends State<TextLine> {
text: text,
textAlign: textAlign,
strutStyle: strutStyle,
// ignore: deprecated_member_use
textScaleFactor: MediaQuery.textScaleFactorOf(context),
textScaler: MediaQuery.textScalerOf(context),
),
);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/fleather/test/rendering/editable_text_line_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4d652ec

Please sign in to comment.