我正在嘗試一種方法來擴展表中的行,但似乎沒有任何效果。

我想單擊表中我的一行并使其可擴展以顯示有關 ROW 的更多資料,然后第二次按下會將其關閉回表。
我嘗試使用 Expanded 小部件,但沒有用:
import 'package:flutter/material.dart';
class StagePage extends StatelessWidget {
const StagePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: Table(
defaultColumnWidth: FixedColumnWidth(120.0),
border: TableBorder.all(
color: Colors.black,
style: BorderStyle.solid,
width: 2),
children: [
TableRow( children: [
Column(children:[Text('Website', style: TextStyle(fontSize: 20.0))]),
Column(children:[Text('Tutorial', style: TextStyle(fontSize: 20.0))]),
Column(children:[Text('Review', style: TextStyle(fontSize: 20.0))]),
Card(
child: ExpansionTile(
title: Text(
'Website',
style: TextStyle(fontSize: 20.0),
),
children: <Widget>[
Text('About Website'),
Text('Add more data'),
Text('add more more data'),
// add more data that you want like this
],
),
)],
),]
)
);
}
}
任何幫助或建議都會很棒!謝謝!
這是我的代碼的結果:但我想打開沒有線條和表格邊框的所有行。

uj5u.com熱心網友回復:
您可以為此使用ExpansionPanelList小部件或可擴展依賴項。
uj5u.com熱心網友回復:
包裝您需要用 展開的每個小部件Card,并在ExpansionTile內部添加一個Card
例子 -
Card(
child: ExpansionTile(
title: Text(
'Website',
style: TextStyle(fontSize: 20.0),
),
children: <Widget>[
Text('About Website'),
Text('Add more data'),
Text('add more more data'),
// add more data that you want like this
],
),
);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/400064.html
下一篇:使用擴展小部件時什么都看不到
