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>
This commit is contained in:
commit
80fa7b9628
1 changed files with 6762 additions and 0 deletions
75
packages/halkyon_ui/example/lib/main.dart
Normal file
75
packages/halkyon_ui/example/lib/main.dart
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
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'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue