17 lines
460 B
Dart
Raw Normal View History

import 'package:app_flowy/plugins/grid/application/field/field_controller.dart';
2022-03-04 08:22:49 +08:00
import 'sizes.dart';
2022-03-03 10:51:52 +08:00
class GridLayout {
2022-09-03 17:16:48 +08:00
static double headerWidth(List<GridFieldContext> fields) {
2022-03-03 22:17:07 +08:00
if (fields.isEmpty) return 0;
2022-03-03 10:51:52 +08:00
final fieldsWidth = fields
.map((field) => field.width.toDouble())
.reduce((value, element) => value + element);
2022-03-03 10:51:52 +08:00
return fieldsWidth +
GridSize.leadingHeaderPadding +
GridSize.trailHeaderPadding;
2022-03-03 10:51:52 +08:00
}
}