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

Flutter samples contains the default useMaterial3 = true #2214

Closed
37 tasks
gerfalcon opened this issue Mar 19, 2024 · 10 comments
Closed
37 tasks

Flutter samples contains the default useMaterial3 = true #2214

gerfalcon opened this issue Mar 19, 2024 · 10 comments

Comments

@gerfalcon
Copy link

gerfalcon commented Mar 19, 2024

Problem

As of version v3.16, ThemeData.useMaterial3 is set true by default.

"We may not need this anymore" - @khanhnwin at the Observable Flutter #38 Google AI Dart SDK session

Steps to reproduce

  1. Visiting samples where
  2. Some of the ThemeData in theMaterialApp() contains the useMaterial3: true flag in its constructor.
Expected results
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // (...)
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
Actual results
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // (...)
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
        useMaterial3: true, /// <-- TODO: Needs to be removed
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );

flutter/samples that need to be updated:

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.2, on macOS 12.6.2 21G320 darwin-arm64, locale en-AE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    ✗ Flutter requires Xcode 14 or higher.
      Download the latest version or update via the Mac App Store.
    ! CocoaPods 1.11.3 out of date (1.13.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.4)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

Related issues:

@gerfalcon gerfalcon changed the title Flutter samples unnecessarily contains the default useMaterial3 = true Flutter samples contains the default useMaterial3 = true Mar 19, 2024
@sasanktumpati
Copy link
Contributor

Hey, can I take up this issue?

@gerfalcon
Copy link
Author

Ofc @sasanktumpati, every help is appreciated! 🚀

@domesticmouse
Copy link
Contributor

I've landed @sasanktumpati'a PR, but I was holding off until the useMaterial3 parameter was deleted in master. It was a useful reminder to developers when reading the source that the rules had changed.

@gerfalcon
Copy link
Author

gerfalcon commented Mar 20, 2024

@domesticmouse Speaking about master, I've raised a change related to the main flutter create template. Could you help me by reviewing it?

@domesticmouse
Copy link
Contributor

I'd hold off on removing it from the template until the attribute is removed from MaterialApp itself.

@gerfalcon
Copy link
Author

I understand your point, @domesticmouse. Additionally, it would be nice to know how many projects are using Material 3 and how many of them disable it.

My only concern is that this will increase the amount of cleanup required for the additional projects and samples.

@domesticmouse
Copy link
Contributor

I understand your point, @domesticmouse. Additionally, it would be nice to know how many projects are using Material 3 and how many of them disable it.

My only concern is that this will increase the amount of cleanup required for the additional projects and samples.

Flutter has a Deprecation Policy policy for handling this situation.

Given Material3 was made the default in 3.16 about three months ago, I'd be expecting it to be removed from Flutter in Q1 2025.

Teams that haven't migrated at that point will have to either migrate, or stay on the last build of Flutter that supports reverting to Material2.

@domesticmouse
Copy link
Contributor

On the cleanup front, dart fix will do the vast majority of the work for us.

@gerfalcon
Copy link
Author

It was a great learning for me to be familiarized with the definition of the grace period.
Thanks for the detailed explanation, @domesticmouse! 🙌

@gerfalcon
Copy link
Author

This issue was closed.
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

3 participants