gpt4 book ai didi

flutter - Flutter Scaffold Appbar不显示后退按钮

转载 作者:行者123 更新时间:2023-12-03 03:37:09 29 4
gpt4 key购买 nike

我的类(class)没有在AppBar中显示后退按钮,

已经尝试将this.automaticallyImplyLeading = true,

import 'package:carros/pages/carro/carro.dart';
import 'package:flutter/material.dart';

class CarroPage extends StatelessWidget {
Carro carro;
CarroPage(this.carro);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(carro.nome),
),
body: _body(),
);
}

_body() {
return Image.network(carro.urlFoto);
}
}

最佳答案

尝试制作自己的后退按钮:

     appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
iconSize: 20.0,
onPressed: () {
_goBack(context);
},
),
centerTitle: true,
title: Text('carro.nome')),

And the _goBack method :


 _goBack(BuildContext context) {
Navigator.pop(context);

}

关于flutter - Flutter Scaffold Appbar不显示后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60097559/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com