format and fix

This commit is contained in:
2026-02-24 23:01:11 +01:00
parent 1bb9241116
commit 81a6daaa75
17 changed files with 133 additions and 59 deletions

View File

@@ -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) {

View File

@@ -75,6 +75,8 @@ class ZTimelineView extends StatelessWidget {
: ZTimelineConstants.minContentWidth;
return ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: groups.length,
itemBuilder: (context, index) {
final group = groups[index];
@@ -128,6 +130,7 @@ class _GroupHeader extends StatelessWidget {
final scheme = Theme.of(context).colorScheme;
return Container(
height: height,
padding: const EdgeInsets.only(left: 16.0),
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: scheme.surfaceContainerHighest,