0

I made a custom app bar with the Container, but i need the title to be placed in the center of the row and the back button to be placed on the edge of left side. I did try it out by adding the spacer, mainaxisallignment everything but it is not properly getting placed as required. So is there any approach i could make use of? Thanks in advance.

Widget header() {
    return new Container(
      height: 140,
      decoration: BoxDecoration(
          color: Color(0xFFAFDCEC),
          borderRadius: BorderRadius.only(
              bottomLeft: Radius.circular(20),
              bottomRight: Radius.circular(20))),
      width: MediaQuery.of(context).size.width,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          SizedBox(
            height: 60,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: <Widget>[
              IconButton(icon: Icon(Icons.arrow_back_ios, color: Colors.white,),),
              Text(
                'To-Do List',
                style: TextStyle(color: Colors.white, fontSize: 25),
              )
            ],
          )
        ],
      ),
    );
  }
Niroop Nife
  • 356
  • 1
  • 5
  • 18

1 Answers1

0
Row(
    // mainAxisAlignment: MainAxisAlignment.spaceAround,

    children: <Widget>[

      SizedBox(width:10), //if you want to have some space (like 10px) from left edge for back button use this or wrapping IconButton with Padding with only left prameter

      IconButton(
          icon: Icon(
            Icons.arrow_back_ios,
            color: Colors.white,
          ),
          onPressed: () {}),

      Expanded(
        child: Center(
          child: Text(
            'To-Do List',
            style: TextStyle(color: Colors.white, fontSize: 25),
          ),
        ),
      ),

    ],
)
Nickan
  • 466
  • 5
  • 17