Hamou Ouyaba
Hamou Ouyaba

Reputation: 1495

Theme: ThemeData() Flutter

I'm trying to use Theme but don't know what i'm doing wrong the color didn't change.need help :

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.green),
    );
  }

Upvotes: 2

Views: 89

Answers (1)

Emre Faruk KOLAÇ
Emre Faruk KOLAÇ

Reputation: 532

You should use appBarTheme: AppBarTheme(), then do the changes as you like.

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
     theme: ThemeData(appBarTheme: AppBarTheme(color: Colors.green, elevation: 15)),
    );
  }

Upvotes: 1

Related Questions