mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-26 22:57:12 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,free-days-interop) (push) Waiting to run
Tests / test (push) Waiting to run
Tests / free-days-interop (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Flutter 3.50 deprecates package:flutter/material.dart, so the app moves to material_ui 1.11.0 together with sync_settings_ui 0.8.0 and github_device_auth 0.5.0 (crdt_sync 0.13.1 rides along). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
107 lines
3.0 KiB
Dart
107 lines
3.0 KiB
Dart
import 'package:material_ui/material_ui.dart';
|
|
import 'package:wake_alarm_sync/screens/home_history_card.dart';
|
|
import 'package:wake_alarm_sync/screens/stakes_card.dart';
|
|
|
|
/// The two detail tiles under the alarm time: today's stakes and the last
|
|
/// week of mornings.
|
|
///
|
|
/// The home screen fits one phone screen with no scrolling, so these cards
|
|
/// moved behind a tap instead of stacking under the control. Each opens its
|
|
/// full card in a bottom sheet; nothing was dropped.
|
|
class HomeTiles extends StatelessWidget {
|
|
/// Creates the tiles; [syncEpoch] and [busy] reach the cards they open.
|
|
const HomeTiles({
|
|
required this.syncEpoch,
|
|
required this.busy,
|
|
this.onEscaped,
|
|
super.key,
|
|
});
|
|
|
|
/// Bumped after every sync; a sheet opened afterwards loads fresh data.
|
|
final int syncEpoch;
|
|
|
|
/// Disables the escape hatch while the screen is syncing.
|
|
final bool busy;
|
|
|
|
/// Called after the escape hatch was used, so the screen publishes it.
|
|
final VoidCallback? onEscaped;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: _Tile(
|
|
key: const Key('home-tile-stakes'),
|
|
icon: Icons.gavel_outlined,
|
|
semanticLabel: "Today's stakes",
|
|
sheet: StakesCard(
|
|
key: ValueKey<String>('stakes-$syncEpoch'),
|
|
busy: busy,
|
|
onEscaped: onEscaped,
|
|
emptyText: 'No stakes to show: the native side has not answered.',
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: _Tile(
|
|
key: const Key('home-tile-history'),
|
|
icon: Icons.history,
|
|
semanticLabel: 'Last mornings',
|
|
sheet: HomeHistoryCard(
|
|
key: ValueKey<String>('history-$syncEpoch'),
|
|
emptyText: 'No finished morning yet.',
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Tile extends StatelessWidget {
|
|
const _Tile({
|
|
required this.icon,
|
|
required this.semanticLabel,
|
|
required this.sheet,
|
|
super.key,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String semanticLabel;
|
|
final Widget sheet;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return Card(
|
|
color: theme.colorScheme.surfaceContainerHigh,
|
|
margin: EdgeInsets.zero,
|
|
clipBehavior: Clip.antiAlias,
|
|
child: InkWell(
|
|
onTap: () => showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
builder: (_) => SafeArea(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24),
|
|
child: sheet,
|
|
),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 12),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
Icon(icon, size: 32, semanticLabel: semanticLabel),
|
|
const SizedBox(height: 8),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|