i have problem to make responsive app bar using preferredSize in flutter

305 Views Asked by At

I have run y code on two different devices but it has problem to get responsive appBar height. I want to make responsive appBar using preferred size in flutter. how to make appBar like that have responsive height using preferred size in flutter? please i am new to flutter. Example code appBar: AppBar( backgroundColor: Colors.white,

        bottom: PreferredSize(
          preferredSize: Size.fromHeight(155.0.h),
          child: Container(
            width: double.infinity,
            child: Stack(
              clipBehavior: Clip.none,
              children: [
                Image.asset('assets/topBackground.png'),
                Positioned(
                  left: 8.w,
                  top: 20.h,
                  child: Container(
                    padding: EdgeInsets.symmetric(horizontal: 15),
                    width: MediaQuery.of(context).size.width,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Icon(
                          Icons.menu,
                          color: Colors.white,
                        ),
                        CircleAvatar(
                          child: Image.asset("assets/Emmanuel_Jerry.png"),
                        ),
                      ],
                    ),
                  ),
                ),
                Positioned(
                    top: 50.h,
                    left: 10.w,
                    child: Column(
                      children: [
                        SizedBox(
                          height: MediaQuery.of(context).size.height * 0.02,
                        ),
                        Text(
                          "Emmanuel Jerry",
                          style: GoogleFonts.poppins(
                              textStyle: TextStyle(
                            color: Colors.white,
                            fontSize: 20.sp,
                          )),
                        ),
                        Text(
                          "HI Welcome back",
                          style: GoogleFonts.poppins(
                              textStyle: TextStyle(
                            color: Colors.white,
                            fontSize: 14.sp,
                          )),
                        )
                      ],
                    )),
            
1

There are 1 best solutions below

0
Kaushik Chandru On

You can set the height like this

appBar: PreferredSize(
          preferredSize: Size.fromHeight(50.0),
          child: AppBar(
            // ...
          )