簡體   English   中英

Flutter 如何在第二個屏幕中過濾我的 LISTTILEVIEW 並在第一個屏幕中恢復 ID

[英]Flutter how to filter my LISTTILEVIEW in the second screen with the ID recovered in the first screen

我得到身份證。 但我不知道如何在第二個屏幕上使用它。 我想使用在第一個屏幕中恢復的 ID 過濾我的新列表

 @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Chapitres'),
        backgroundColor: Colors.orange[600],
      ),
      drawer: DrawerNavigation(),
      body: ListView.builder(
          itemCount: _chapitreList.length,
          itemBuilder: (context, index){
        return Card(
          child: Padding(
            padding: const EdgeInsets.all(12.0),
            child: ListTile(
              leading: IconButton(icon: Icon(Icons.gavel),onPressed:(){} ),
              title: Row(
                children: <Widget>[
                  Text(_chapitreList[index].chapitre, style: new TextStyle(fontSize: 15),),
                ],
              ),
              onTap: (){},
              subtitle: Text(_chapitreList[index].titre, style: new TextStyle(fontSize: 10),),
            ),
          ),
        );
      }),

導航時可以通過 arguments :

Navigator.of(context).pushNamed(YourRoute, arguments: //Here you can pass the id)

在第二個屏幕中:

final String YOURID = ModalRoute.of(context).settings.arguments;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM