【发布时间】:2023-02-25 18:53:35
【问题描述】:
我的应用程序中有多个屏幕,但是当我单击电话后退按钮时,它会转到第一页而不是堆栈中的最后一页。将流行不工作
@overrideWidget build(BuildContext context) { // double _width = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.white,
leading: IconButton(
onPressed: (){
Navigator.pop(context);
},
icon: const Icon(Icons.arrow_back_ios , color: Colors.black,),
),
title: const Text('Now Playing',style: TextStyle(color: Colors.black,fontWeight: FontWeight.w800),),
),
body: SafeArea(
child: Container(
padding: const EdgeInsets.all(30),
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height * 0.2,
padding: const EdgeInsets.all(20),
alignment: Alignment.center,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Color.fromRGBO(10, 91, 144, 1),
boxShadow: [
BoxShadow(
blurRadius: 1,
offset: Offset(0,2),
color: Colors.black12
),
]
),
【问题讨论】:
-
你如何导航,请在这里分享你的代码。
-
我编辑我的问题请看
-
您看到的代码是我应用程序的最后一页,但是当我按下电话后退按钮时,它导航到第一个屏幕而不是内存堆栈中的最后一个屏幕