Home > Software engineering >  Flutter custom appbar
Flutter custom appbar

Time:10-16

I'm trying to achieve the following appbar. I'm new to flutter and couldn't figure it out. enter image description here

Appbar has back button on left and info icon and share button positioned at right.

CodePudding user response:

for right icons add actions to AppBar, arrow button is default

example

return Scaffold(
  appBar: AppBar(
    title: const Text('AppBar Demo'),
    actions: [
      IconButton(
        icon: const Icon(Icons.info),
        onPressed: () {},
      ),
      IconButton(
        icon: const Icon(Icons.share),
        onPressed: () {},
      ),
    ],
  ),
  body: Widget()...
);

CodePudding user response:

Try below code hope its helpful to you

return Scaffold(
      appBar: AppBar( 
        leading: Icon(Icons.arrow_back),
        title:  Text('Your Title Here'),
    actions: [
      IconButton(
        icon: const Icon(Icons.info),
        onPressed: () {},
      ),
      IconButton(
        icon: const Icon(Icons.arrow_upward ),
        onPressed: () {},
      ),
    ],),
     
      body: Text('Ok'),
    );

Your Result Screen-> enter image description here

  • Related