
如圖,我想按按鈕直接進入對應的串列視圖。
您可以使用按鈕左右移動,而不是滾動串列。
這是我目前的代碼。
如下所示,我正在運行一個名為 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,
),
),
uj5u.com熱心網友回復:
你可以簡單地這樣做:
// 跳轉到帶影片的頁面索引
_questionController.pageController.animateToPage(index);
// 或者跳轉到沒有影片的頁面索引
_questionController.pageController.jumpToPage(index);
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/350638.html
