Error message:
- The named parameter 'child' is required, but there's no corresponding argument
- The named parameter 'title' isn't defined.
@override
Widget build(BuildContext context) {
double _w = MediaQuery.of(context).size.width;
return Scaffold(
appBar: PreferredSize(title: Text('hi'); //the problem. How should it be used here?
preferredSize: const Size.fromHeight(100),
child: Container(color: Colors.blueGrey),
),
The
PreferredSizewidget does not have a property calledtitle. You have to use thechildproperty to display the title.Example:
In the child, you can pass any type of widget i.e. Container, Row, Sizedbox, InputField