format and fix
This commit is contained in:
@@ -59,6 +59,8 @@ class _MainAppState extends State<MainApp> {
|
||||
end: domain.end,
|
||||
);
|
||||
});
|
||||
|
||||
_emitContentHeight();
|
||||
}
|
||||
|
||||
List<TimelineGroup> _convertGroups(List<TimelineGroupData> groups) {
|
||||
@@ -168,6 +170,25 @@ class _MainAppState extends State<MainApp> {
|
||||
e,
|
||||
];
|
||||
});
|
||||
|
||||
_emitContentHeight();
|
||||
}
|
||||
|
||||
void _emitContentHeight() {
|
||||
var totalHeight = 0.0;
|
||||
for (final group in _groups) {
|
||||
totalHeight += ZTimelineConstants.groupHeaderHeight;
|
||||
final groupEntries = _entries.where((e) => e.groupId == group.id);
|
||||
var maxLane = 0;
|
||||
for (final e in groupEntries) {
|
||||
if (e.lane > maxLane) maxLane = e.lane;
|
||||
}
|
||||
final lanesCount = maxLane.clamp(0, 1000);
|
||||
totalHeight += lanesCount * ZTimelineConstants.laneHeight
|
||||
+ (lanesCount > 0 ? (lanesCount - 1) * ZTimelineConstants.laneVerticalSpacing : 0)
|
||||
+ ZTimelineConstants.verticalOuterPadding * 2;
|
||||
}
|
||||
emitEvent('content_height', {'height': totalHeight});
|
||||
}
|
||||
|
||||
String _labelForEntry(TimelineEntry entry) {
|
||||
|
||||
Reference in New Issue
Block a user