You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.0 KiB
Dart
75 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'table_cell.dart';
|
|
|
|
class TableHead extends StatelessWidget {
|
|
final ScrollController scrollController;
|
|
|
|
TableHead({
|
|
@required this.scrollController,
|
|
});
|
|
|
|
Widget getHeadText(String text, {double height = 30}) {
|
|
return Container(
|
|
alignment: Alignment.center,
|
|
height: height,
|
|
child: Text(text, style: TextStyle(fontWeight: FontWeight.bold)),
|
|
);
|
|
}
|
|
|
|
List listHead = [
|
|
'统计时间',
|
|
'车流量',
|
|
'早高峰',
|
|
'晚高峰',
|
|
];
|
|
|
|
List listWidth = [
|
|
100.0,
|
|
80.0,
|
|
80.0,
|
|
80.0,
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
alignment: Alignment(0, 0),
|
|
height: headHeight,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: List.generate(listHead.length, (index) {
|
|
return MultiplicationTableCell(
|
|
color: Colors.yellow.withOpacity(0.3),
|
|
text: listHead[index],
|
|
width: listWidth[index],
|
|
);
|
|
}),
|
|
|
|
// children: [
|
|
// // getHeadText('统计时间'),
|
|
// // getHeadText('车流量'),
|
|
// // getHeadText('早高峰'),
|
|
// // getHeadText('晚高峰'),
|
|
// // MultiplicationTableCell(
|
|
// // color: Colors.yellow.withOpacity(0.3),
|
|
// // value: 1,
|
|
// // ),
|
|
// // Expanded(
|
|
// // child: ListView(
|
|
// // //controller: scrollController, //注释掉该行,便只能上下滚动
|
|
// // physics: ClampingScrollPhysics(),
|
|
// // scrollDirection: Axis.horizontal,
|
|
// // children: List.generate(maxNumber - 1, (index) {
|
|
// // return MultiplicationTableCell(
|
|
// // color: Colors.yellow.withOpacity(0.3),
|
|
// // value: index + 2,
|
|
// // );
|
|
// // }),
|
|
// // ),
|
|
// // ),
|
|
// ],
|
|
),
|
|
);
|
|
}
|
|
}
|