Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stable 3.3+] Rendering issues (Artefacting / Half-rendered widgets) #111376

Closed
hm122 opened this issue Sep 11, 2022 · 39 comments
Closed

[Stable 3.3+] Rendering issues (Artefacting / Half-rendered widgets) #111376

hm122 opened this issue Sep 11, 2022 · 39 comments
Assignees
Labels
c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version

Comments

@hm122
Copy link

hm122 commented Sep 11, 2022

Since the upgrade to Flutter 3.3.0, I'm getting different feedback from users that they are experiencing weird rendering issues.

Steps to Reproduce

  1. Unfortunately, the issues are not easily reproducible, but started after the upgrade to 3.3.0.

Expected results: No flickering/rendering errors

Actual results: Flickering borders, half rendered views. Most of the time, the rendering issues seem to disappear when changing the view or tapping into the screen.

Code sample

Sometimes the border of text input fields flickers. Could be related to very thin borders.

border: Border.all(width: 0.5)

Sometimes views get half rendered when changing screen with a BottomNavigationBar.

Logs I have downgraded to Flutter 3.0.5 for now, therefore I can not provide `flutter analyze/doctor` info
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Sep 12, 2022
@danagbemava-nc
Copy link
Member

Hi @hm122, what platforms are your users experiencing this issue on?

Can you also share some screen recordings so that we can see what the issue looks like?

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 12, 2022
@onurkagan
Copy link

onurkagan commented Sep 13, 2022

I'm having the same problems with Android devices. The problematic flutter version is 3.3.1. Dart version 2.18.0. Android API level 32. There is no error log on debug mode.

@TatsuUkraine
Copy link

@hm122 I'm curious if you have similar rendering issues to this one? #110885 (comment)

@danagbemava-nc
Copy link
Member

Hi @onurkagan, can you share some recordings along with a minimal reproducible code sample so that we can investigate this?

@hm122
Copy link
Author

hm122 commented Sep 14, 2022

It was on Android and iOS. I was able to reproduce some of the issues locally, even in the emulator. Will try to provide code & screencasts asap.

@TatsuUkraine One of them looked similar, not exactly the same though. Part of the lower screen was the correct view, while part of the upper screen was the view that has been rendered before. Interestingly this issue was not visible when making a screencast. In the screencast it looked correct.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 14, 2022
@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 14, 2022
@TatsuUkraine
Copy link

@hm122 yeah, I also have different render issues each time. On a video I recorded just an example how it looks like

@TatsuUkraine
Copy link

TatsuUkraine commented Sep 14, 2022

@danagbemava-nc I found most simple code to reproduce it) but it may take time before you actually can see the issue since it happens from time to time. The video shows just most simple render issue, in the real app I'm experiencing worse UI render issues in various part of the screen. Same as before - when I'm trying to make a screen record it doesn't show what is actually going on on a screen

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('App Example'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            showLicensePage(
              context: context,
              applicationIcon: Image.asset(
                'assets/flutter_icon.png',
                height: 50,
              ),
              applicationName: 'Some App Name',
              applicationVersion: '1.0.0',
            );
          },
          child: const Text('SHOW LICENCES'),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
Video
screen-20220914-110050.2.mp4

@TatsuUkraine
Copy link

@danagbemava-nc it seems @hm122 replied on your question, but this issue still has waiting for response tag

@TatsuUkraine
Copy link

Copy steps to reproduce with code sample from another ticket per @exaby73 request

Steps to Reproduce

Try to use code sample. Scroll down and up until you see the issue with rendering. The issue can be seen from time to time. Also it can't be captured with a screen record. On a screen record UI looks good and it doesn't show what is actually going on on the screen

  1. Build the app from the code sample
  2. Open the Licenses page
  3. scroll down and up multiple times until you see the issue

Another example

  1. Build the app from the code sample
  2. Open bottom sheet all the way up
  3. swipe down to snap bottom sheet to .5 possition
  4. swipe up to expand bottom sheet fully
  5. repeat 3 and 4 until you see the issue

Expected results: UI should render without artifacts

Actual results: some of UI parts aren't repainted correctly

Additional info

Device: Pixel 5
OS: Android 13
Build mode: any

All works fine with flutter 3.0. Also scroll in 3.0 is much smoother than in 3.3

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final DraggableScrollableController _controller = DraggableScrollableController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomScrollView(
        slivers: [
          const SliverAppBar(
            automaticallyImplyLeading: false,
            title: Text('App Example'),
          ),
          SliverFillRemaining(
            hasScrollBody: false,
            child: Center(
              child: ElevatedButton(
                onPressed: () {
                  showLicensePage(
                    context: context,
                    applicationIcon: Image.asset(
                      'assets/flutter_icon.png',
                      height: 50,
                    ),
                    applicationName: 'Some App Name',
                    applicationVersion: '1.0.0',
                  );
                },
                child: const Text('SHOW LICENCES'),
              ),
            ),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
      bottomSheet: MediaQuery.fromWindow(
        child: LayoutBuilder(
          builder: (context, constraints) {
            final EdgeInsets safePadding = MediaQuery.of(context).padding;
            final double minExtent = (kToolbarHeight + 8) / constraints.biggest.height;

            return DraggableScrollableSheet(
              controller: _controller,
              snapSizes: [
                minExtent,
                .5,
              ],
              snap: true,
              initialChildSize: minExtent,
              minChildSize: minExtent,
              maxChildSize: 1,
              expand: false,
              builder: (context, controller) {
                final double currentExtent = _extent ?? minExtent;
                final bool expanded = currentExtent > .9;

                return DecoratedBox(
                  decoration: const BoxDecoration(
                    boxShadow: [
                      BoxShadow(
                        blurRadius: 8.0,
                        color: Colors.black54,
                        offset: Offset(0, 4),
                      ),
                    ],
                  ),
                  child: ClipRRect(
                    borderRadius: BorderRadius.vertical(
                      top: Radius.circular(
                        Tween<double>(begin: 10.0, end: 0.0)
                            .chain(_curve)
                            .transform(currentExtent)
                      ),
                    ),
                    child: Material(
                      color: Theme.of(context).colorScheme.surface,
                      child: CustomScrollView(
                        controller: controller,
                        physics: const ClampingScrollPhysics(),
                        slivers: [
                          SliverPadding(
                            padding: EdgeInsets.only(
                              top: Tween(begin: 8.0, end: safePadding.top - 4)
                                  .chain(_curve)
                                  .transform(currentExtent),
                            ),
                            sliver: SliverAppBar(
                              centerTitle: true,
                              pinned: true,
                              primary: false,
                              elevation: 0,
                              leading: AnimatedSwitcher(
                                duration: const Duration(milliseconds: 300),
                                child: expanded
                                    ? const CloseButton()
                                    : null,
                              ),
                              title: const Text('Bottom sheet'),
                              backgroundColor: Theme.of(context).colorScheme.surface,
                              foregroundColor: Theme.of(context).colorScheme.onSurface,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                );
              }
            );
          }
        ),
      ),// This trailing comma makes auto-formatting nicer for build methods.
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  Animatable<double> get _curve => CurveTween(
    curve: const Interval(.75, 1, curve: Curves.easeIn)
  );

  double? get _extent => _controller.isAttached ? _controller.size : null;
}

Logs
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.2.1 21D62 darwin-arm, locale en)
    • Flutter version 3.3.2 on channel stable at <some path>
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (5 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at <some path>
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = <some path>
    • Java binary at: <some path>
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at <some path>
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Android Studio (version 2021.3)
    • Android Studio at <some path>
    • 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 11.0.13+0-b1751.21-8125866)

[✓] Connected device (3 available)
    • Pixel 5 (mobile)            • ******* • android-arm64 • Android 13 (API 33)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64  • macOS 12.2.1 21D62 darwin-arm

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Videos
screen-20220914-110050.2.mp4
screen-20220919-112530.2.mp4

@danagbemava-nc
Copy link
Member

Hi @TatsuUkraine, I'm curious, are you only facing this issue on a Pixel 5?
There was a similar issue reported recently about artifacting on Pixel 5 reported in #111551. Is that similar to your case?

@TatsuUkraine
Copy link

TatsuUkraine commented Sep 20, 2022

hi @danagbemava-nc . it looks similar but I can't confirm that it's exactly the same, I didn't see the render issue recorded in #111551 in our real app.

As for devices so far I tried Pixel 2xl, Pixel 4, Pixel 5, Pixel 6 (all real devices).

Was able to reproduce this issue only on Pixel 5 and Pixel 4 so far.

P.S as for pixle 4 - can't confirm it on 100% since this device is not mine, and it's impossible to make a screen record since this issue doesn't capture there, but according to feedback from friend of mine, he said that he can reproduce this bug on his device

@danagbemava-nc
Copy link
Member

Hi @TatsuUkraine, can you share the asset you used in your code sample?

@TatsuUkraine
Copy link

@danagbemava-nc you can use any, I used ic_launcher.png file from regular flutter template project
flutter_icon

@danagbemava-nc
Copy link
Member

Hi @TatsuUkraine, I can't seem to reproduce the issue on my Poco X3 NFC.

Can you check if this still reproduces for you on the master channel?

@TatsuUkraine
Copy link

TatsuUkraine commented Sep 20, 2022

@danagbemava-nc I tried stable master and beta, everywhere I can reproduce it. Only on pixel 4 and 5 (only real devices), on pixel 6 and pixel 2xl - all works fine

it seems it may be related to dpr but I can't say for sure

@TatsuUkraine
Copy link

@danagbemava-nc also I tried 3.0.5 (prev stable version) and I wasn't been able to reproduce this bug on any device there, also scroll looks much smoother on 3.0 as well

@TatsuUkraine
Copy link

overall it's somehow similar to what was reported in Gallery app - also from time to time, also on certain devices, and also can't be captured with a screen record (screen record captures not what is actually happening on a screen)

@semog
Copy link

semog commented Sep 20, 2022

There are lots of severe rendering issues on Linux desktop. This is not just a mobile issue. It's like the anti-aliasing algorithm is broken. Just hovering the mouse across window frame borders can cause the app to re-render into an awful mess. Move it some more, and then it renders correctly. I've had to downgrade back to 3.0.5, which is very stable in its rendering.

@danagbemava-nc
Copy link
Member

danagbemava-nc commented Sep 21, 2022

@TatsuUkraine, thanks for the report. Since I can't reproduce this issue locally, I will label it for further investigation by the team.

This seems to be a regression as all the comments in this issue state that it happened after the upgrade to 3.3

This doesn't seem to be limited to mobile only, as noted in #111376 (comment) or any specific mobile platform as reported in #111376 (comment)

Could be related to #111551

Some of the issues can be found in #111376 (comment).

@danagbemava-nc danagbemava-nc added c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels Sep 21, 2022
@WingCH
Copy link

WingCH commented Sep 23, 2022

similar issues 🙏

#112151

@danagbemava-nc danagbemava-nc changed the title [3.3] Rendering issues [3.3] Rendering issues (Artefacting / Half-rendered widgets) Sep 23, 2022
@danagbemava-nc danagbemava-nc changed the title [3.3] Rendering issues (Artefacting / Half-rendered widgets) [Stable 3.3+] Rendering issues (Artefacting / Half-rendered widgets) Sep 23, 2022
@athul-ain
Copy link

Hi @hm122, what platforms are your users experiencing this issue on?
Android
Can you also share some screen recordings so that we can see what the issue looks like?

VID_2022-09-23-23-59-04-405.2.mp4

Device: SAMSUNG S22 Ultra
Android Version: 13
Flutter Version: 3.3.2

@chinmaygarde
Copy link
Member

From Triage: @HansMuller Can you add the context for why @jonahwilliams was assigned? I am not sure he is currently looking into this. I'll try to get this and the linked issue reproduced.

@chinmaygarde chinmaygarde added the P2 Important issues not at the top of the work list label Sep 26, 2022
@jonahwilliams
Copy link
Member

I asked to be assig

@jonahwilliams
Copy link
Member

Oops. I asked to be assigned last week, but that was Friday afternoon so I haven't investigated yet

@jonahwilliams jonahwilliams reopened this Sep 26, 2022
@uzumaki258
Copy link

uzumaki258 commented Sep 27, 2022

I can reproduce it as well, it happened when I upgrade to 3.3+

IMG_2293.mov

Device:
Samsung Galaxy S8, android 9

@TatsuUkraine
Copy link

TatsuUkraine commented Sep 27, 2022

@danagbemava-nc I just tried to turn off smooth display (to keep 60hz refresh rate) on my pixel 5 and render issues disappeared

@aarajput
Copy link

aarajput commented Oct 4, 2022

Is anyone from flutter team looking at this issue? I am facing exact same issue on flutter 3.3+. I had to downgrade flutter version to 2.8 because of that. I am using pixel 4XL.

@jonahwilliams
Copy link
Member

We believe that this is related to the CP we have scheduled in #112603, however we have been unable to reproduce this particular issue. If you are experiencing this and you have a reliable reproduction, it would be helpful if you could temporarily switch to the master channel where the revert has already landed and confirm.

@TatsuUkraine
Copy link

@jonahwilliams if it helps, I put code sample with steps to reproduce + video here #111376 (comment)

I was able to easily reproduce it on devices with refresh rate > 60hz, switching off smooth display fixes the issue

@jonahwilliams
Copy link
Member

I've tried that example and I can't reproduce it locally unforunately

@TatsuUkraine
Copy link

Hm, ok, I will try master channel and check if it still there

@TatsuUkraine
Copy link

TatsuUkraine commented Oct 4, 2022

@jonahwilliams it looks to me that on master channel all works fine, and the scroll also feels smoother

@aarajput
Copy link

aarajput commented Oct 4, 2022

For me, it only happens on release builds. I'll check master branch as well.

@jonahwilliams
Copy link
Member

We've published a new stable hotfix that contains a fix for similar issues. Please let me know if you're still experiencing this issue after upgrading to 3.3.4

@TatsuUkraine
Copy link

TatsuUkraine commented Oct 5, 2022

Need to play more with the app, but so far I don't see any render issues after updating to 3.3.4

@athul-ain
Copy link

We've published a new stable hotfix that contains a fix for similar issues. Please let me know if you're still experiencing this issue after upgrading to 3.3.4

It seems like the issue is resolved on 3.3.4.
Thanks for the update, the issue was really ruining the customer experience.

@jonahwilliams
Copy link
Member

Great! Closing this as fixed then

@exaby73 exaby73 added the r: fixed Issue is closed as already fixed in a newer version label Oct 5, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now c: rendering UI glitches reported at the engine/skia rendering level engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

No branches or pull requests