Cannot apply AppBar titleTextStyle on the title Text Widget Cannot apply AppBar titleTextStyle on the title Text Widget dart dart

Cannot apply AppBar titleTextStyle on the title Text Widget


i know this question is for 1 month ago, but answer to this question is :

using backwardsCompatibility: false, for AppBarTheme

appBarTheme: AppBarTheme(  backwardsCompatibility: false,  titleTextStyle: TextStyle(    color: Colors.red,  ),),

or antother way :

appBarTheme: AppBarTheme(  textTheme: TextTheme(    headline6: TextStyle(      color: Colors.red,    )  )),


I think you need to remove const for the title

@override  Widget build(BuildContext context) {    return Scaffold(      appBar: AppBar(        foregroundColor: Colors.black,        titleTextStyle: TextStyle(color: Colors.black),        title: Text('AppBar Color'),      ),      body: const Center(        child: Text('sample'),      ),    );  }


If you only want to change the AppBar title Text color, then this might help you:

appBar: AppBar(        title: Text(          'To Do List',          style: TextStyle(color: Colors.black),        ),      ),

enter image description here