Anyone please give some information why this is happening?
When I try to add a class AppBarDesign which implements appBar flutter is gi
Scaffold requires as appbar a class that implements PreferredSizeWidget
Either wrap your custom appbar into a PreferredSize
Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(100),
child: Container(color: Colors.red),
),
)
or implement PreferredSizeWidget:
Scaffold(
appBar: MyAppBar(),
)
...
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Size get preferredSize => const Size.fromHeight(100);
@override
Widget build(BuildContext context) {
return Container(color: Colors.red);
}
}