halkyon/packages/halkyon_ui/example/lib/main.dart
Tizian 「ティツィアーン」 80fa7b9628
Halkyon's shared packages
A pub workspace of the Dart packages Halkyon's apps share: halkyon_ui,
Halkyon's look (the theme, fonts, layout and shared widgets, with texts
in English and German), halkyon_core's low-level primitives and
halkyon_interop's cross-app contracts. Dart 3.13 with LeanCode's lints,
configured once at the root; apps take a package by git, pinned to a
signed commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-18 21:50:15 +02:00

75 lines
2.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:halkyon_ui/halkyon_ui.dart';
import 'package:material_ui/material_ui.dart';
void main() {
registerFontLicenses();
runApp(const ExampleApp());
}
/// An app set up as Halkyon's are: the shared theme in both brightnesses,
/// the package's texts beside Material's (from material_ui, whose own
/// delegates serve its widgets), and snack bars fitted to the window.
class const ExampleApp({
/// The language, the device's when null.
final Locale? locale,
super.key,
}) extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Halkyon Example',
theme: appTheme(Brightness.light),
darkTheme: appTheme(Brightness.dark),
locale: locale,
localizationsDelegates: const [
HalkyonUiLocalizations.delegate,
...GlobalMaterialLocalizations.delegates,
],
supportedLocales: HalkyonUiLocalizations.supportedLocales,
builder: (context, child) => FittedSnackBars(child: child!),
home: const _Home(),
);
}
class const _Home() extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return TopGradient(
background: scheme.surface,
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(backgroundColor: Colors.transparent),
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: readableContentMaxWidth,
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const BrandWordmark(product: 'Example'),
const SizedBox(height: 24),
SectionCard(
child: Builder(
builder: (context) => FilledButton.tonal(
onPressed: () => confirmDestructiveAction(
context,
title: 'Delete everything?',
message: 'It can’t be undone.',
confirmLabel: 'Delete',
),
child: const Text('Delete'),
),
),
),
],
),
),
),
),
),
);
}
}