简体   繁体   English

Flutter 如何在第二个屏幕中过滤我的 LISTTILEVIEW 并在第一个屏幕中恢复 ID

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

I get the ID.我得到身份证。 but I don't know how to use it on the second screen.但我不知道如何在第二个屏幕上使用它。 I want to filter my new list 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),),
            ),
          ),
        );
      }),

You can pass arguments when Navigate:导航时可以通过 arguments :

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

And in the second screen:在第二个屏幕中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM