How can I make a custom color for App Bar with ThemeData?
accentColor is deprecated while colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.indigo)) expects type MaterialColor.
I know that I can make it this way
Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF0A0E21),
title: Text('CAPTION'),
),
But I want to specify it in ThemeData
>Solution :
Rather than overriding everything, it often makes sense to extend the parent theme. You can handle this by using the copyWith() method.
More about extending-the-parent-theme.
return MaterialApp(
home: const T1(),
theme: Theme.of(context).copyWith(
appBarTheme: Theme.of(context).appBarTheme.copyWith(
backgroundColor: const Color(0xFF0A0E21),
),
),