Skip to content

[Impeller] Text foreground Paint()..shader glitch while scrolling inside scroll view #132972

@junaid1460

Description

@junaid1460

Is there an existing issue for this?

Steps to reproduce

  1. clone https://github.com/junaid1460/flutter_impeller_reported_bugs
  2. switch to first tab
  3. use fab to switch to scroll view
  4. Now scroll, text will disappear and appear like it's glitching
  5. Run it with flutter en --no-enable-impeller flag to verify actual result

Expected results

Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-08-21.at.23.20.43.mp4

Actual results

Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-08-21.at.23.19.24.mp4

Code sample

Code sample
class GradientTextTransform extends StatefulWidget {
  const GradientTextTransform({super.key});

  @override
  State<GradientTextTransform> createState() => _GradientTextTransformState();
}

class _GradientTextTransformState extends State<GradientTextTransform> {
  var _showRichText = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _showRichText ? SafeArea(child: _richText()) : _scrollView(),
      floatingActionButton: FloatingActionButton(
        onPressed: () => setState(() {
          _showRichText = !_showRichText;
        }),
        child: const Icon(Icons.swap_horiz_rounded),
      ),
    );
  }

  Widget _scrollView() => CustomScrollView(
        physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
        slivers: [
          const SliverAppBar(
            title: Text('Scroll View'),
          ),
          SliverToBoxAdapter(
              child: SingleChildScrollView(
            child: Row(
              children: [
                _richText(),
              ],
            ),
          )),
        ],
      );

  Widget _richText() => RichText(
        text: TextSpan(
          children: [
            const TextSpan(
              text: 'Hello, ',
            ),
            TextSpan(
              text: 'John',
              style: TextStyle(
                  fontWeight: FontWeight.bold,
                  foreground: Paint()
                    ..shader = const LinearGradient(
                      colors: [
                        Colors.red,
                        Colors.blue,
                      ],
                    ).createShader(
                        const Rect.fromLTWH(0.0, 0.0, 500.0, 800.0))),
            ),
          ],
          style: const TextStyle(
            fontSize: 44,
            color: Colors.black,
          ),
        ),
      );
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
flutter run 
flutter run --no-enable-impeller

Flutter Doctor output

Doctor output
___ git:(master) flutter doctor -v
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.5 22G74 darwin-arm64, locale en-IN)
    • Flutter version 3.13.0 on channel stable at ~/.asdf/installs/flutter/3.13.0-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (6 days ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/mj/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: ~/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Android Studio (version 2022.2)
    • Android Studio at ~/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] VS Code (version 1.80.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • iPhone 14 Pro Max (mobile) • 3F33BF82-DF19-4D65-BA2F-A28AC6CFD455 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4
      (simulator)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is nowe: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions