У меня есть BackButton() на панели приложений, я хочу изменить значок BackButton по умолчанию в FLUTTER.
вот код appBar:
appBar: AppBar(
leading: BackButton(
onPressed: () {
Get.off(exercisePage());
},
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30)),
),
automaticallyImplyLeading: false,
title: Padding(
padding: const EdgeInsets.only(left: 25),
child: Text(
'Regular exercise',
style: TextStyle(
fontFamily: 'FontMain', fontSize: 22, color: Colors.indigo),
),
),
backgroundColor: Color.fromARGB(255, 231, 235, 237),
),





appBar: AppBar(
automaticallyImplyLeading: false,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back, // This is icon for change for your side
color: Colors.black,
),
),
centerTitle: false,
backgroundColor: Colors.white,
elevation: 0,
title: const Text(
"Testing",
style: TextStyle(
color: Colors.black,
fontSize: 22,
fontWeight: FontWeight.w400),
),
),
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, //change the icon here
color: Colors.black),
onPressed: () => Navigator.of(context).pop(),
),
title: Text("Sample"),
centerTitle: true,
),
В BackButton нет прямого способа изменить значки.
Чтобы изменить значок, вам нужно добавить собственный виджет IconButton в интерлиньяж и отказаться от нажатия на функцию или использовать GestureDetector или виджет InkWell.