我希望使用 flutter 更改分页数据表的颜色,
我使用深色主题,分页数据表采用这种颜色,我也从颤振网站 enter link description here
使用这个 CardTheme,但是如何使用它.. 这是我的分页数据表的简单代码..
class DataTableDemo extends StatelessWidget {
Widget build(BuildContext context) {
print("tesat");
MySource mySource = new MySource(
// ["test1##test2", "test3##test4", "test5##test6", "test7##test8"],
// ["test1##test2", "test3##test4", "test5##test6", "test7##test8"]
test2,
test3,
);
return Container(
// appBar: AppBar(
// title: Text('Data Tables'),
// ),
//backgroundColor: Color(0xff232d37),
color: Color(0xff232d37),
child: ListView(
padding: const EdgeInsets.all(2),
children: [
PaginatedDataTable(
//header: Text('Header Text'),
rowsPerPage: 10,
columns: [
DataColumn(label: Text('Header A')),
DataColumn(label: Text('Header B')),
DataColumn(label: Text('Header C')),
],
//source: _DataSource(context),
source: mySource,
),
],
),
);
}
}
class MySource extends DataTableSource {
List<String> value;
List<String> test1;
String a;
String b;
MySource(this.value, this.test1) {
print(value);
}
@override
DataRow getRow(int index) {
// TODO: implement getRow
// print('test');
//test1 = value[index].split("");
return DataRow.byIndex(
//color: MaterialStateColor.resolveWith((states) => Colors.blue),
index: index,
cells: [
DataCell(Text(value[index].toString())),
DataCell(Text(test1[index].toString())),
DataCell(
InkWell(
onTap: () {
print((value[index]));
},
child: Text("Click"),
),
),
],
);
}
@override
// TODO: implement isRowCountApproximate
bool get isRowCountApproximate => false;
@override
// TODO: implement rowCount
int get rowCount => value.length;
@override
// TODO: implement selectedRowCount
int get selectedRowCount => 0;
}
我需要将颜色设置为 color: Color(0xff232d37),
任何帮助都是免费的>>
问候
答案 0 :(得分:1)
找到了,
Theme(
data: Theme.of(context)
.copyWith(cardColor: Color(0xff232d37), dividerColor: Colors.green),
child: ListView(
这解决了我的问题
问候