没有设置返回箭头的icon,仍然显示返回箭头
来源:9-5 基于shared_preferences本地存储操作【本地存储】
慕粉4252596
2019-07-22
class PhotoHero extends StatelessWidget {
const PhotoHero({ Key key, this.photo, this.onTap, this.width }) : super(key: key);
final String photo;
final VoidCallback onTap;
final double width;
Widget build(BuildContext context) {
return SizedBox(
width: width,
child: Hero(
tag: photo,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
child: Image.network(
photo,
fit: BoxFit.contain,
),
),
),
),
);
}
}
class HeroAnimation extends StatelessWidget {
Widget build(BuildContext context) {
timeDilation = 10.0; // 1.0 means normal animation speed.
return Scaffold(
appBar: AppBar(
title: const Text('Basic Hero Animation'),
),
body: Center(
child: PhotoHero(
photo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1563533973929&di=fbb782a96db3404efef440eb8155c3de&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20160223%2Fmp60173169_1456232942601_2.jpeg',
width: 300.0,
onTap: () {
Navigator.of(context).push(MaterialPageRoute<void>(
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flippers Page'),
),
body: Container(
// Set background to blue to emphasize that it's a new route.
color: Colors.lightBlueAccent,
padding: const EdgeInsets.all(16.0),
alignment: Alignment.topLeft,
child: PhotoHero(
photo: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1563533973929&di=fbb782a96db3404efef440eb8155c3de&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20160223%2Fmp60173169_1456232942601_2.jpeg',
width: 100.0,
onTap: () {
Navigator.of(context).pop();
},
),
),
);
}
));
},
),
),
);
}
}
在4-9动画点击图片跳转到图片变小的页面,后者页面并没有在appBar中,添加GestureDetector,并设置icon,即Icon.arrow_back的返回箭头实现,为何还是会显示返回箭头呢?
1回答
-
慕娘9302613
2019-07-22
automaticallyImplyLeading: false,取消返回箭,默认显示
00
相似问题