【发布时间】:2021-08-08 00:23:20
【问题描述】:
我已经开始在 Flutter 中使用表格进行开发,但我遇到了一些表格问题。
我使用 DataTable 来表示表格中的数据。我面临一个问题(未定义命名参数“列”。 尝试将名称更正为现有命名参数的名称,或使用名称“列”定义命名参数)。它不识别 DataTable 小部件中的列和行属性。这是我的代码:
import 'package:flutter/material.dart';
class DataTable extends StatelessWidget {
@override
enter code heWidget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: DataTable(
columns: <DataColumn>[
DataColumn(
label: Text(
'Name',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
DataColumn(
label: Text(
'Age',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
DataColumn(
label: Text(
'Designation',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
],
rows: const <DataRow>[
DataRow(
cells: <DataCell>[
DataCell(Text('Mohit')),
DataCell(Text('23')),
DataCell(Text('Associate Software Developer')),
],
),
DataRow(
cells: <DataCell>[
DataCell(Text('Akshay')),
DataCell(Text('25')),
DataCell(Text('Software Developer')),
],
),
DataRow(
cells: <DataCell>[
DataCell(Text('Deepak')),
DataCell(Text('29')),
DataCell(Text('Team Lead ')),
],
),
],
),
),
);
【问题讨论】:
标签: flutter material-ui flutter-layout