FlutterChatAppTutorial
FlutterChatAppTutorial copied to clipboard
app bar
when i call appBar: appBarMain(context) it gives me this error
The argument type 'Widget' can't be assigned to the parameter type 'PreferredSizeWidget?'.
how do I fix this, thank you
Wrap a custom widget inside PreferredSize If you’re building a custom widget instead of AppBar, you need to wrap it:
PreferredSizeWidget appBarMain(BuildContext context) { return PreferredSize( preferredSize: const Size.fromHeight(60), // height of appbar child: Container( color: Colors.blue, alignment: Alignment.center, child: const Text( "Custom AppBar", style: TextStyle(color: Colors.white, fontSize: 20), ), ), ); }