Home > Net >  How to put two IconButtons in the same Column (AppBar and Body)?
How to put two IconButtons in the same Column (AppBar and Body)?

Time:09-15

Is there any way how to have an IconButton in the AppBar and an IconButton in the Body the same column width? The splash radius should be default. Please have a look on a screenshot at the following link for an overview.

enter image description here

CodePudding user response:

You can use SilverAppbar medium or large depend on you. This widget is new in flutter 3.3 so just update SDK to using it. In MaterialApp you need to specify:

theme: ThemeData(useMaterial3: true)

And then in Scaffold body:

return Scaffold(
  body: CustomScrollView(
    slivers: [
      SliverAppBar.medium(
        title: const Text('Your tittle of page'),
        actions: [
          IconButton(onPressed: () {}, icon: const Icon(Icons.abc)),
          IconButton(
              onPressed: () {}, icon: const Icon(Icons.abc_outlined)),
        ],
      ),
      SliverToBoxAdapter(
        child: Text('Content of page'),
      ),
    ],
  ),
);
  • Related