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

Ios Simulator List View Jank #1149

Closed
BraydenKlemens opened this issue Aug 13, 2024 · 12 comments
Closed

Ios Simulator List View Jank #1149

BraydenKlemens opened this issue Aug 13, 2024 · 12 comments

Comments

@BraydenKlemens
Copy link

BraydenKlemens commented Aug 13, 2024

When adding this package to any flutter project it causes jank frames on the ios simulator. This occurs when performing any animation such as switching between tab-bar tabs or scrolling a list view. Current device is apple m1.

@BraydenKlemens BraydenKlemens changed the title Ios Simulator List View Jank. Ios Simulator List View Jank Aug 13, 2024
@navaronbracke
Copy link
Collaborator

navaronbracke commented Aug 14, 2024

Could you provide a minimal reproducible sample? Scrolling jank can have multiple reasons. I doubt that the inclusion of a PlatformView for the camera preview would cause scrolling jank in this case.

What version of the library are you using? What Flutter version are you using? (There was a recent bugfix in Flutter for rendering artifacts when using Impeller on the iOS Simulator)

@BraydenKlemens
Copy link
Author

BraydenKlemens commented Aug 14, 2024

Here is a Video of the list view jank before and after adding mobile_scanner
https://github.com/user-attachments/assets/6b2329ae-38c6-4e1f-843c-ff5ecd01bb7f

Versions:

  • Flutter 3.24.0
  • Tools • Dart 3.5.0 • DevTools 2.37.2
  • mobile_scanner: 5.1.1
  • IOS iphone 15 pro max 17.5

Steps to Reproduce

  • Create new flutter project
  • add listview.builder with List Tiles
  • pub add mobile_scanner
  • pub get
  • debug - > jank

Code:

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: ListView.builder(
        itemCount: 15,
        itemBuilder: (context, index) {
          return Padding(
            padding: const EdgeInsets.all(8.0),
            child: ListTile(
              tileColor: Colors.deepPurple.shade100,
              title: Text('Item $index'),
            ),
          );
        },
      ),
    );
  }
}

@haven-git
Copy link

same issue

@fmaerkl-sw
Copy link

This is due to #1018 when the app is run through Rosetta automatically.

@navaronbracke
Copy link
Collaborator

This is due to #1018 when the app is run through Rosetta automatically.

Interesting finding! I'm not sure if MLKit supports arm64 Simulators, so we would have to look into that.

But then the list view jank is just because the app is ran through Rosetta?

What Flutter version are you using?

@BraydenKlemens I'll have to ask again, what Flutter version are you on? Earlier Flutter versions used Rosetta when running on arm64 (and I believe that was also the case for the iOS Simulator)

Could you try to see if this also happens with the latest Flutter version? (or maybe one of the last three stable releases)

@fmaerkl-sw
Copy link

But then the list view jank is just because the app is ran through Rosetta?

Yes. Likely the JIT used by Flutter in Debug mode does not play well with the translation.

@BraydenKlemens
Copy link
Author

BraydenKlemens commented Aug 24, 2024

@navaronbracke flutter version is 3.24. Please refer to previous post for a list of versions.

I will try some earlier stable versions as well, to see if the issue persists.

@navaronbracke
Copy link
Collaborator

Ah, yes sorry I missed that. Could still be something with arm64 iOS Simulators though

@navaronbracke
Copy link
Collaborator

Does this reproduce with Impeller off?

@theSharpestTool
Copy link

Hi @navaronbracke @BraydenKlemens I've also faced with it. Looks like the issue doesn't occur with Impeller off:

Impeller without the package
Screenshot 2024-08-29 at 12 47 02

Impeller with the package
Screenshot 2024-08-29 at 12 44 06

Skia with/without package
Screenshot 2024-08-29 at 12 56 16

@vital-edu
Copy link

This is fixed in the version 7.0.0-beta.3 #1225

@navaronbracke
Copy link
Collaborator

Per the above comment, I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants