
如图所示,当我按下按钮时,我想要直接转到相应的列表视图。
您可以使用按钮左右移动,而不是在列表中滚动。
这是我当前的代码。
如下图所示,我正在运行一个名为body的页面视图(在使用listview之后,它会发生短暂的变化),我知道如何按顺序显示,但我不知道如何从一个特定的数字中提取出来。你有什么问题要问吗?
GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => Choice821()),);
},2
class Choice821 extends StatelessWidget {
@override
Widget build(BuildContext context) {
QuestionController _controller = Get.put(QuestionController());
return Scaffold(
appBar: AppBar(
title: Text('복습 시험', style: TextStyle(color: Colors.black, fontWeight:FontWeight.bold,fontSize: 20,),),
centerTitle: true,
elevation: 0,
),
body: Body(),
);
}
}2
child: PageView.builder(
physics: NeverScrollableScrollPhysics(),
controller: _questionController.pageController,
onPageChanged: _questionController.updateTheQnNum,
itemCount: _questionController.questions.length,
itemBuilder: (context, index) => ayotube(
question: _questionController.questions[index],
id: _questionController.questionNumber.value,
),
),发布于 2021-11-05 19:45:45
您可以简单地执行以下操作:
//带动画跳转到页面索引
_questionController.pageController.animateToPage(index);//或不带动画跳转到页面索引
_questionController.pageController.jumpToPage(index);https://stackoverflow.com/questions/69856511
复制相似问题