I have this AppBarWidget and I need to change the arrow back logo to my custom svg icon. I'm new in flutter and I can't find how to change it.
Here is code for AppBar
return AppBar(
elevation: 0,
backgroundColor: white,
foregroundColor: black,
shadowColor: Colors.transparent,
toolbarHeight: 80,
titleTextStyle: getCustomeStyle(
fontSize: 25, fontWeight: FontWeight.w700, color: black),
title: FittedBox(
fit: BoxFit.fill,
child: SizedBox(
width: _width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title),
SvgPicture.asset("assets/images//logo/ShopIO.svg",
semanticsLabel: "ShopIO")
],
),
)),
bottom: PreferredSize(
child: Container(
color: lightGray,
height: 1.0,
width: _width - 30,
),
preferredSize: const Size.fromHeight(0)),
);
1 Answer 1
The easiest way is to override the deafult leading widget of AppBar and add your custom:
AppBar(
leading: IconButton(
icon: <whatever you like>,
// this is the default behaviour, you can change it
onPressed: () => Navigator.of(context).pop()
),
answered Apr 23, 2022 at 20:24
Peter Koltai
10k2 gold badges16 silver badges27 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-dart