颤抖如何在展开的列表视图中

时间:2020-11-05 06:30:37

标签: mysql flutter

大家好,我想将列表视图扩展为列表视图,我使用mysql提取数据 我想先显示交易ID和船只名称,然后在它旁边显示mut并有一个箭头,当您单击它时它将显示其他信息详细信息。

  Widget build(BuildContext context) {
        return Scaffold(
            body: RefreshIndicator(
          onRefresh: getData,
          key: _refresh,
          child: loading
              ? Center(child: CircularProgressIndicator())
              : ListView.builder(
                  itemCount: list.length,
                  itemBuilder: (context, i) {
                    final x = list[i];
                    debugPrint(x.toString());
                    return Container(
                      padding: EdgeInsets.all(20.0),
                      child: Row(
                        children: <Widget>[
                          Expanded(
                            child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: <Widget>[
                            the data will be shown first is transaction id and vessel name a arrow icon on the side when it is click it will show the other information
                          Text(
                              'Transaction ID:\t' + x.transaction_id,
                              style: TextStyle(
                                  fontSize: 20.0, fontWeight: FontWeight.bold),
                            ),
                            Text('Vessel Name:\t' + x.vesselname,
                                style: TextStyle(fontSize: 20.0)),

//这是单击侧箭头后显示的信息

     Text('Type of Port :\t' + x.typeofport.capitalize(),
                            style: TextStyle(fontSize: 20.0)),
                        Text('Vessel Number:\t' + x.voyageno,
                            style: TextStyle(fontSize: 20.0)),
                        Text('Ship Call #:\t' + x.scn,
                            style: TextStyle(fontSize: 20.0)),
                        Text('OR #:\t' + x.ornum,
                            style: TextStyle(fontSize: 20.0)),
                        Text(
                            'Amount:\t ' +
                                money.format(int.parse(x.payment)),
                            style: TextStyle(fontSize: 20.0)),
                        Text('Status:\t' + x.status.toUpperCase(),
                            style: TextStyle(
                                fontSize: 25.0,
                                fontWeight: FontWeight.bold,
                                color: x.status == 'pending'
                                    ? Colors.red
                                    : Colors.green)),
                        Divider()
                      ],
                    ),
                  ),
                ],
              ),
            );
          },
        ),
));

} }

2 个答案:

答案 0 :(得分:0)

颤抖地探索ExpansionTile,我认为它符合您的要求。

答案 1 :(得分:0)

首先,当您在DTO中获取数据时,可以将bool变量放入其中,也可以重新映射DTO并将变量bool放入 因此您的变量内部可能是这样的:

(?:)

(?:<.*>)(?:[\s\S]*?)(?:<\/.*>)

然后在创建构建器时在代码中

(?:<.*>)([\s\S]*?)(?:<\/.*>)

这只是将内部列表更改为可折叠listView的逻辑