Skip to content Skip to sidebar Skip to footer

How To Solve Zero Argument Constructor Error In Preferredsize Flutter?

I am working on a project where I am using a custom AppBar and hence using PreferredSize but I am getting a error stating that: The superclass 'PreferredSize' doesn't have a zero a

Solution 1:

You may not even have to extend PreferredSize you may just wrap an appBar or any other widget inside a PreferredSize and just specify its height.

PreferredSize(
            preferredSize: Size.fromHeight(72),
            child: AppBar(
              title: Text(title, style: TextStyles.h1),
              centerTitle: false,
              elevation: 0,
              brightness: Brightness.light,
              backwardsCompatibility: false,
              bottom: bottomAppBarWidget,
            ))

Post a Comment for "How To Solve Zero Argument Constructor Error In Preferredsize Flutter?"