I want to change the color using the ThemeData
, here is the code:
import 'package:flutter/material.dart';
ThemeData lightMode = ThemeData(
colorScheme: ColorScheme.light(
background: Colors.grey.shade300,
primary: Colors.grey.shade500,
secondary: Colors.grey.shade200,
tertiary: Colors.white,
inversePrimary: Colors.grey.shade900,
),
);
But the code from ThemeData is not applying,
My Main Page:
import 'package:flutter/material.dart';
class IntroPage extends StatelessWidget {
const IntroPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.trolley,
size: 72,
color: Theme.of(context).colorScheme.inversePrimary,
)
],
),
),
);
}
}
This is The Result:
1