gpt4 book ai didi

flutter - 在 Flutter 中使 DataTable 双向滚动

转载 作者:IT王子 更新时间:2023-10-29 06:34:16 26 4
gpt4 key购买 nike

如何使 DataTable 双向滚动。我使数据表水平滚动,但我的列表很大,无法向下滚动。

@override 
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Bills Receivable"),),
body:SingleChildScrollView(
scrollDirection: Axis.horizontal,
child:
DataTable(
columns: <DataColumn>[
DataColumn(label:Text("BNm",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BDt",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BPrty",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BdueDt",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("Dys",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BAmt",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BPAmt",style: TextStyle(fontWeight: FontWeight.bold),)),
DataColumn(label:Text("BBAmt",style: TextStyle(fontWeight: FontWeight.bold),))
], rows: widget.rdata.bRecDtl.map((e)=>
DataRow(
cells:<DataCell>[
DataCell(Text(e.bNm.toString())),
DataCell(Text(e.bDt.toString())),
DataCell(Text(e.bPrty.toString())),
DataCell(Text(e.bdueDt.toString())),
DataCell(Text(e.dys.toString())),
DataCell(Text(e.bAmt.toString())),
DataCell(Text(e.bPAmt.toString())),
DataCell(Text(e.bBAmt.toString())),
])).toList()
),
),
);
}

最佳答案

只需添加两个 SingleChildScrollView:

child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable()

关于flutter - 在 Flutter 中使 DataTable 双向滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55299332/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com