本文介绍了有没有办法在电子表格上创建可编辑网格等电子表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果没有飞镖包怎么办
推荐答案
您可以在
下复制粘贴运行完整代码您可以使用软件包 https://pub.dev/packages/table_sticky_headers
You can copy paste run full code below
You can use package https://pub.dev/packages/table_sticky_headers
代码段
StickyHeadersTable(
columnsLength: titleColumn.length,
rowsLength: titleRow.length,
columnsTitleBuilder: (i) => Text(titleColumn[i]),
rowsTitleBuilder: (i) => Text(titleRow[i]),
contentCellBuilder: (i, j) =>
Container(height: 50, width: 50, child: TextField()),
legendCell: Text('Sticky Legend'),
),
工作演示
完整代码
import 'package:flutter/material.dart';
import 'package:table_sticky_headers/table_sticky_headers.dart';
void main() {
final columns = 10;
final rows = 20;
List<List<String>> _makeData() {
final List<List<String>> output = [];
for (int i = 0; i < columns; i++) {
final List<String> row = [];
for (int j = 0; j < rows; j++) {
row.add('T$i : L$j');
}
output.add(row);
}
return output;
}
/// Simple generator for column title
List<String> _makeTitleColumn() => List.generate(columns, (i) => 'Top $i');
/// Simple generator for row title
List<String> _makeTitleRow() => List.generate(rows, (i) => 'Left $i');
runApp(
TableSimple(
titleColumn: _makeTitleColumn(),
titleRow: _makeTitleRow(),
data: _makeData(),
),
);
}
class TableSimple extends StatelessWidget {
TableSimple(
{@required this.data,
@required this.titleColumn,
@required this.titleRow});
final List<List<String>> data;
final List<String> titleColumn;
final List<String> titleRow;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Sticky Headers Two-Dimension Table'),
backgroundColor: Colors.amber,
),
body: StickyHeadersTable(
columnsLength: titleColumn.length,
rowsLength: titleRow.length,
columnsTitleBuilder: (i) => Text(titleColumn[i]),
rowsTitleBuilder: (i) => Text(titleRow[i]),
contentCellBuilder: (i, j) =>
Container(height: 50, width: 50, child: TextField()),
legendCell: Text('Sticky Legend'),
),
),
);
}
}
这篇关于有没有办法在电子表格上创建可编辑网格等电子表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!