The AppBarDesign can't be assigned to the parameter type 'PreferredSizeWidget'

前端 未结 5 1532
刺人心
刺人心 2021-02-02 06:42

Anyone please give some information why this is happening?

When I try to add a class AppBarDesign which implements appBar flutter is gi

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 06:46

    You can also use following way to design your appbar in separate file and then use it in your whole app.

    Widget Custom_Appbar(){
      return AppBar(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.vertical(bottom: Radius.circular(20))),
            title: Text(
              'Decimal to Binary & Vice Versa',
              style: TextStyle(fontWeight: FontWeight.w400, fontSize: 19),
            ));
    }
    

    And then use it like this

    return Scaffold(
          appBar: Custom_Appbar(),
    )
    

提交回复
热议问题