Skip to content

Commit

Permalink
Add light theme, legal note
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Mar 14, 2024
1 parent 40e8f1c commit 64b7976
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 10 deletions.
5 changes: 5 additions & 0 deletions lib/build_context_x.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';

extension BuildContextX on BuildContext {
bool get isLight => theme.brightness == Brightness.light;
ThemeData get theme => Theme.of(this);
MediaQueryData get mq => MediaQuery.of(this);
Color get baseColor => theme.colorScheme.onSurface;
Color get highlightColor =>
theme.colorScheme.onSurface.scale(lightness: isLight ? 0.6 : -0.4);
}
15 changes: 10 additions & 5 deletions lib/foot_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ class FootNote extends StatelessWidget {
@override
Widget build(BuildContext context) {
final style = context.theme.textTheme.labelSmall
?.copyWith(color: Colors.white.withOpacity(0.7));
?.copyWith(color: context.theme.colorScheme.onSurface);
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text(
'$kAppTitle · 2024 · ',
style: style,
overflow: TextOverflow.fade,
child: InkWell(
borderRadius: BorderRadius.circular(2),
onTap: () => Navigator.of(context).pushNamed('/legal'),
child: Text(
'Legal note',
style: style,
overflow: TextOverflow.fade,
),
),
),
const Text(' · '),
Flexible(
child: InkWell(
borderRadius: BorderRadius.circular(2),
Expand Down
29 changes: 29 additions & 0 deletions lib/legal_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';

import 'sub_page.dart';

class LegalPage extends StatelessWidget {
const LegalPage({super.key});

@override
Widget build(BuildContext context) {
return SubPage(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text('Ubuntu is a registered trademark of Canonical Ltd'),
const Text('Ubuntu Flutter Community is not Canonical Ltd'),
]
.map(
(e) => Padding(
padding: const EdgeInsets.only(bottom: 10),
child: e,
),
)
.toList(),
),
),
);
}
}
4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'home_page.dart';
import 'contributors_page.dart';
import 'package:yaru/yaru.dart';

import 'legal_page.dart';
import 'projects_page.dart';

Future<void> main() async {
Expand Down Expand Up @@ -38,14 +39,15 @@ class _MainAppState extends State<MainApp> {
title: kAppTitle,
navigatorKey: navigatorKey,
debugShowCheckedModeBanner: false,
themeMode: ThemeMode.dark,
theme: yaruLight,
darkTheme: yaruDark.copyWith(
pageTransitionsTheme: pTT,
),
routes: {
'/': (context) => const HomePage(),
'/contributors': (context) => const ContributorsPage(),
'/projects': (context) => const ProjectsPage(),
'/legal': (context) => const LegalPage(),
},
);
}
Expand Down
15 changes: 11 additions & 4 deletions lib/scaffold_gradient.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';

import 'build_context_x.dart';

BoxDecoration scaffoldGradient(BuildContext context) {
return BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF77216F).scale(lightness: -0.8),
YaruColors.orange.scale(lightness: -0.8),
],
colors: context.isLight
? [
Colors.white,
Colors.white.scale(lightness: -0.2),
]
: [
const Color(0xFF77216F).scale(lightness: -0.8),
YaruColors.orange.scale(lightness: -0.8),
],
),
);
}

0 comments on commit 64b7976

Please sign in to comment.