From 5416abf2e8e600d4a044b32c5ae3ba3bf41c714d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 11:46:37 +0200 Subject: [PATCH 1/8] pushed fading_edge_scrollview to version 4 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 62f10f6..127e739 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: '>=2.17.0 <3.0.0' dependencies: - fading_edge_scrollview: ^3.0.0 + fading_edge_scrollview: ^4.0.0 flutter: sdk: flutter From d7a5830a9722d569ffd3d1419c2a5255abdecc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 11:56:19 +0200 Subject: [PATCH 2/8] static analysis correction --- lib/marquee.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index f35261b..6ab348d 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -39,7 +39,10 @@ class _IntegralCurve extends Curve { values[1.0] = integral; // Normalize. - for (final double t in values.keys) values[t] = values[t]! / integral; + for (final double t in values.keys) { + values[t] = values[t]! / integral; + } + ; return _IntegralCurve._(original, integral, values); } @@ -48,7 +51,13 @@ class _IntegralCurve extends Curve { /// curve. double transform(double t) { if (t < 0) return 0.0; - for (final key in _values.keys) if (key > t) return _values[key]!; + for (final key in _values.keys) { + if (key > t) { + return _values[key]!; + } + ; + } + ; return 1.0; } } From 6ad3dd4d49f55377818f4061835a0b53c4abf03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 12:14:19 +0200 Subject: [PATCH 3/8] updated textScaleFactor in text widget to use new textScaler --- lib/marquee.dart | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index 6ab348d..a8d3a29 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -103,7 +103,8 @@ class Marquee extends StatefulWidget { super.key, required this.text, this.style, - this.textScaleFactor, + this.textScaleFactor = 1.0, + // this.textScaler, this.textDirection = TextDirection.ltr, this.scrollAxis = Axis.horizontal, this.crossAxisAlignment = CrossAxisAlignment.center, @@ -154,7 +155,8 @@ class Marquee extends StatefulWidget { "isn't invented yet.", ), this.accelerationCurve = _IntegralCurve(accelerationCurve), - this.decelerationCurve = _IntegralCurve(decelerationCurve); + this.decelerationCurve = _IntegralCurve(decelerationCurve), + this.textScaler = TextScaler.linear(textScaleFactor); /// The text to be displayed. /// @@ -197,7 +199,8 @@ class Marquee extends StatefulWidget { /// See also: /// /// * [text] to provide the text itself. - final double? textScaleFactor; + final double textScaleFactor; + final TextScaler textScaler; /// The text direction of the text to be displayed. /// @@ -739,8 +742,12 @@ class _MarqueeState extends State with SingleTickerProviderStateMixin { physics: NeverScrollableScrollPhysics(), itemBuilder: (_, i) { final text = i.isEven - ? Text(widget.text, - style: widget.style, textScaleFactor: widget.textScaleFactor) + ? Text( + widget.text, + style: widget.style, + // textScaleFactor: widget.textScaleFactor, + textScaler: widget.textScaler, + ) : _buildBlankSpace(); return alignment == null ? text From 1de92df8237e0235b373149af50ed44115c8320b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 12:15:26 +0200 Subject: [PATCH 4/8] changed flutter version number due to dropped support for textScaleFactor in text widget --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 127e739..da794af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ version: 2.2.3 repository: https://github.com/MarcelGarus/marquee environment: - flutter: '>=3.0.0' + flutter: '>=3.12.0' sdk: '>=2.17.0 <3.0.0' dependencies: From 8d54fa13015c748a62ee3fb9494da47d4495c6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 12:18:13 +0200 Subject: [PATCH 5/8] removed unnecessary semicolons --- lib/marquee.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index a8d3a29..997f037 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -42,7 +42,6 @@ class _IntegralCurve extends Curve { for (final double t in values.keys) { values[t] = values[t]! / integral; } - ; return _IntegralCurve._(original, integral, values); } @@ -57,7 +56,7 @@ class _IntegralCurve extends Curve { } ; } - ; + return 1.0; } } From 731249aa0d54b27556c85d0ebf11a1c69429585a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 12:19:57 +0200 Subject: [PATCH 6/8] cleanup --- lib/marquee.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index 997f037..393a164 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -103,7 +103,6 @@ class Marquee extends StatefulWidget { required this.text, this.style, this.textScaleFactor = 1.0, - // this.textScaler, this.textDirection = TextDirection.ltr, this.scrollAxis = Axis.horizontal, this.crossAxisAlignment = CrossAxisAlignment.center, @@ -744,7 +743,6 @@ class _MarqueeState extends State with SingleTickerProviderStateMixin { ? Text( widget.text, style: widget.style, - // textScaleFactor: widget.textScaleFactor, textScaler: widget.textScaler, ) : _buildBlankSpace(); From 0e47b2cd593ab3c6709ddc690ef1976890ee885f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 12:21:03 +0200 Subject: [PATCH 7/8] further cleanup --- lib/marquee.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index 393a164..79abcd9 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -54,7 +54,6 @@ class _IntegralCurve extends Curve { if (key > t) { return _values[key]!; } - ; } return 1.0; From e2c7690f45bb6c4c6f07500a3d1ed92972359d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCcke?= Date: Sun, 21 Apr 2024 21:20:35 +0200 Subject: [PATCH 8/8] implemented fix from ninoreiter: customized textScaleFactor causes jumping text #93 --- lib/marquee.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/marquee.dart b/lib/marquee.dart index 79abcd9..7eba221 100644 --- a/lib/marquee.dart +++ b/lib/marquee.dart @@ -696,7 +696,10 @@ class _MarqueeState extends State with SingleTickerProviderStateMixin { final constraints = BoxConstraints(maxWidth: double.infinity); - final richTextWidget = Text.rich(span).build(context) as RichText; + final richTextWidget = Text.rich( + span, + textScaler: TextScaler.linear(widget.textScaleFactor), + ).build(context) as RichText; final renderObject = richTextWidget.createRenderObject(context); renderObject.layout(constraints);