Kgotso Phiri
Kgotso Phiri

Reputation: 1

flutter wont update widgets to material design 3

My flutter app wont use materal desing 3 after adding useMaterial3:true in theme

I added the flag according to the the blog and material design website(flutter)

Upvotes: 0

Views: 465

Answers (2)

Mohammad Hammad Ahmad
Mohammad Hammad Ahmad

Reputation: 139

This code should work, try it..

  class MyApp extends StatelessWidget {
          @override
          Widget build(BuildContext context) {
            return MaterialApp(
              theme: ThemeData.light(useMaterial3: true),
              body: MyHomePage(),
            );
          }
        }

Upvotes: 0

Ydev
Ydev

Reputation: 28

try this code it should work fine . `

void main() {
  runApp(
    const MyApp(),
  );
}
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        theme: ThemeData(useMaterial3: true),
        home: const HomePage(),
      );
    }
  }

`

Upvotes: 0

Related Questions