Skip to content

Commit

Permalink
chore: bundle fonts and add license page
Browse files Browse the repository at this point in the history
  • Loading branch information
borgoat authored and inpt333 committed Dec 10, 2024
1 parent 33a9ec5 commit c935977
Show file tree
Hide file tree
Showing 40 changed files with 214 additions and 2 deletions.
Binary file added assets/google_fonts/Cabin-Bold.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-BoldItalic.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-Italic.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-Medium.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-MediumItalic.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-Regular.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-SemiBold.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin-SemiBoldItalic.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin_Condensed-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added assets/google_fonts/Cabin_Condensed-Italic.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin_Condensed-Medium.ttf
Binary file not shown.
Binary file not shown.
Binary file added assets/google_fonts/Cabin_Condensed-Regular.ttf
Binary file not shown.
Binary file added assets/google_fonts/Cabin_Condensed-SemiBold.ttf
Binary file not shown.
Binary file not shown.
Binary file added assets/google_fonts/Cabin_SemiCondensed-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
94 changes: 94 additions & 0 deletions assets/google_fonts/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Copyright 2018 The Cabin Project Authors (https://github.com/impallari/Cabin.git)
Copyright (c) 2008, Haley Fiege ([email protected]), Copyright (c) 2012, Brenda Gallo ([email protected]), Copyright (c) 2013, Pablo Impallari (www.impallari.com|[email protected])

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added assets/google_fonts/Sniglet-ExtraBold.ttf
Binary file not shown.
Binary file added assets/google_fonts/Sniglet-Regular.ttf
Binary file not shown.
16 changes: 16 additions & 0 deletions lib/go_router_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ part 'go_router_builder.g.dart';
path: 'settings',
routes: [
TypedGoRoute<LocaleRoute>(path: 'locale'),
TypedGoRoute<SettingsMoreRoute>(path: 'more'),
TypedGoRoute<LicensesRoute>(path: 'licenses'),
],
),
],
Expand Down Expand Up @@ -57,6 +59,20 @@ class LocaleRoute extends GoRouteData with AuthenticationGuard {
const LocaleContainer();
}

@immutable
class SettingsMoreRoute extends GoRouteData with AuthenticationGuard {
@override
Widget build(BuildContext context, GoRouterState state) =>
const SettingsMoreScreen();
}

@immutable
class LicensesRoute extends GoRouteData with AuthenticationGuard {
@override
Widget build(BuildContext context, GoRouterState state) =>
const LicensePage();
}

@immutable
class ProfileRoute extends GoRouteData with AuthenticationGuard {
@override
Expand Down
43 changes: 43 additions & 0 deletions lib/go_router_builder.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"save": "Speichern",
"selectContacts": "Wähl Kontakte aus",
"settings": "Einstellungen",
"settingsMoreInfo": "Mehr Informationen",
"signOut": "Abmelden",
"signOutConfirmation": "Bist du sicher, dass du dich abmelden möchtest?",
"systemLanguage": "Systemsprache",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"save": "Save",
"selectContacts": "Select contacts",
"settings": "Settings",
"settingsMoreInfo": "More info",
"signOut": "Sign out",
"signOutConfirmation": "Are you sure you want to sign out?",
"systemLanguage": "System language",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"save": "Guarda",
"selectContacts": "Elige contactos",
"settings": "Configuraciones",
"settingsMoreInfo": "Más información",
"signOut": "Cierra sesión",
"signOutConfirmation": "¿Seguro que quieres cerrar sesión?",
"systemLanguage": "Idioma del sistema",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"save": "Sauvegarde",
"selectContacts": "Choisis des contacts",
"settings": "Paramètres",
"settingsMoreInfo": "Plus d'infos",
"signOut": "Déconnecte-toi",
"signOutConfirmation": "Tu es sûr de vouloir te déconnecter?",
"systemLanguage": "Langue du système",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_it.arb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"save": "Salva",
"selectContacts": "Seleziona i contatti",
"settings": "Impostazioni",
"settingsMoreInfo": "Altre informazioni",
"signOut": "Esci",
"signOutConfirmation": "Sei sicuro di voler uscire?",
"systemLanguage": "Lingua del sistema",
Expand Down
13 changes: 13 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:app_links/app_links.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:parousia/actions/actions.dart';
import 'package:parousia/app.dart';
import 'package:parousia/epics/epics.dart';
Expand All @@ -23,6 +24,18 @@ import 'router.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

// Disable runtime fetching of Google Fonts to avoid network requests
// They must be bundled with assets
// https://pub.dev/packages/google_fonts#bundling-fonts-when-releasing
GoogleFonts.config.allowRuntimeFetching = false;

// Add the Google Fonts license to the LicenseRegistry
// https://pub.dev/packages/google_fonts#licensing-fonts
LicenseRegistry.addLicense(() async* {
final license = await rootBundle.loadString('assets/google_fonts/OFL.txt');
yield LicenseEntryWithLineBreaks(['google_fonts'], license);
});

final configService = ConfigService();
await configService.initialize();

Expand Down
1 change: 1 addition & 0 deletions lib/presentation/screens/screens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export 'profile.dart';
export 'schedule_create.dart';
export 'select_contacts.dart';
export 'settings.dart';
export 'settings_more.dart';
7 changes: 5 additions & 2 deletions lib/presentation/screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:parousia/presentation/presentation.dart';

/// A screen that allows the user to configure app settings.
class SettingsScreen extends StatelessWidget {
/// Creates a [SettingsScreen].
const SettingsScreen({super.key});

@override
Expand All @@ -23,7 +22,11 @@ class SettingsScreen extends StatelessWidget {
onTap: () => LocaleRoute().push(context),
),
const ThemeSwitcherContainer(),
const DeleteProfileTile(),
ListTile(
title: Text(l10n.settingsMoreInfo),
leading: const Icon(Icons.info_outline),
onTap: () => SettingsMoreRoute().push(context),
),
const SignOutTile(),
],
),
Expand Down
29 changes: 29 additions & 0 deletions lib/presentation/screens/settings_more.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:parousia/go_router_builder.dart';
import 'package:parousia/presentation/presentation.dart';

/// Screen for less common settings.
class SettingsMoreScreen extends StatelessWidget {
const SettingsMoreScreen({super.key});

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Scaffold(
appBar: AppBar(
title: Text(l10n.settingsMoreInfo),
),
body: ListView(
children: [
ListTile(
title: Text('Licenses'),
leading: const Icon(Icons.copyright),
onTap: () => LicensesRoute().push(context),
),
const DeleteProfileTile(),
],
),
);
}
}
7 changes: 7 additions & 0 deletions lib/presentation/widgets/delete_profile_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ class DeleteProfileTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final theme = Theme.of(context);

return ListTile(
title: Text(l10n.deleteProfile),
leading: const Icon(Icons.delete),
// Show in red to indicate danger.
iconColor: theme.colorScheme.error,
splashColor: theme.colorScheme.error.withOpacity(0.2),
hoverColor: theme.colorScheme.error.withOpacity(0.1),
focusColor: theme.colorScheme.error.withOpacity(0.1),
textColor: theme.colorScheme.error,
onTap: () => _confirmDelete(context),
);
}
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ flutter:
assets:
- assets/images/
- assets/env/
- assets/google_fonts/
- supabase/config/

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down

0 comments on commit c935977

Please sign in to comment.