forked from eva/focus-flow
91 lines
2.9 KiB
Dart
91 lines
2.9 KiB
Dart
// SPDX-FileCopyrightText: 2026 FocusFlow contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
/// Renders the Top Bar widget for the FocusFlow Flutter UI.
|
|
library;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/focus_flow_tokens.dart';
|
|
|
|
part 'top_bar/top_bar_icon_button.dart';
|
|
part 'top_bar/top_bar_metrics.dart';
|
|
part 'top_bar/top_bar_mode_toggle.dart';
|
|
part 'top_bar/top_bar_settings_button.dart';
|
|
|
|
/// Header bar for the compact Today view.
|
|
class TopBar extends StatelessWidget {
|
|
/// Creates a top bar with a display-ready [dateLabel].
|
|
const TopBar({required this.dateLabel, super.key});
|
|
|
|
/// Date label shown beside the date navigation controls.
|
|
final String dateLabel;
|
|
|
|
/// Builds the widget subtree for this component.
|
|
/// The method translates the current widget configuration and state into Flutter UI without mutating scheduler domain data.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
final metrics = _TopBarMetrics.fromWidth(constraints.maxWidth);
|
|
return SizedBox(
|
|
height: _TopBarMetrics.referenceHeight,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: metrics.titleWidth,
|
|
height: _TopBarMetrics.referenceHeight,
|
|
child: FittedBox(
|
|
alignment: Alignment.centerLeft,
|
|
fit: BoxFit.scaleDown,
|
|
child: Text(
|
|
'Today',
|
|
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
|
|
fontSize: metrics.titleSize,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: metrics.titleGap),
|
|
_IconButton(
|
|
icon: Icons.calendar_today,
|
|
metrics: metrics,
|
|
onPressed: () {},
|
|
),
|
|
_IconButton(
|
|
icon: Icons.chevron_left,
|
|
metrics: metrics,
|
|
onPressed: () {},
|
|
),
|
|
SizedBox(
|
|
width: metrics.dateWidth,
|
|
height: metrics.controlHeight,
|
|
child: Center(
|
|
child: FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
child: Text(
|
|
dateLabel,
|
|
style: TextStyle(
|
|
color: FocusFlowTokens.textPrimary,
|
|
fontSize: metrics.dateSize,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
_IconButton(
|
|
icon: Icons.chevron_right,
|
|
metrics: metrics,
|
|
onPressed: () {},
|
|
),
|
|
const Spacer(),
|
|
_ModeToggle(metrics: metrics),
|
|
SizedBox(width: metrics.settingsGap),
|
|
_SettingsButton(metrics: metrics),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|