Reputation: 1
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
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
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