Skip to content

Commit

Permalink
style(settings): Apply NotoSansJP font to settings text
Browse files Browse the repository at this point in the history
  • Loading branch information
yorifuji committed Apr 14, 2024
1 parent f1e231b commit 988b44a
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 24 deletions.
11 changes: 9 additions & 2 deletions lib/ui/settings/color/color_setting_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:buzz_recipe_viewer/gen/fonts.gen.dart';
import 'package:buzz_recipe_viewer/i18n/strings.g.dart';
import 'package:buzz_recipe_viewer/model/app_color.dart';
import 'package:buzz_recipe_viewer/provider/app_color_preference_provider.dart';
Expand All @@ -22,10 +23,16 @@ class ColorSettingPage extends ConsumerWidget {
body: CustomSettingsList(
sections: [
SettingsSection(
title: Text(t.settings.general.row.color.color.header),
title: Text(
t.settings.general.row.color.color.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: AppColor.values.map((e) {
return SettingsTile(
title: Text(e.title),
title: Text(
e.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
leading: Icon(
Icons.circle,
color: e.color,
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/settings/locale/locale_setting_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:buzz_recipe_viewer/gen/fonts.gen.dart';
import 'package:buzz_recipe_viewer/i18n/strings.g.dart';
import 'package:buzz_recipe_viewer/model/locale_preference.dart';
import 'package:buzz_recipe_viewer/provider/locale_preference_provider.dart';
Expand Down Expand Up @@ -26,12 +27,14 @@ class LocaleSettingPage extends ConsumerWidget {
SettingsSection(
title: Text(
t.settings.general.row.language.language.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: LocalePreference.values
.mapIndexed(
(index, e) => SettingsTile(
title: Text(
t.settings.general.row.language.language.row[index],
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
trailing:
locale == e.toLocale ? const Icon(Icons.check) : null,
Expand Down
107 changes: 86 additions & 21 deletions lib/ui/settings/settings_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io' show Platform;
import 'package:buzz_recipe_viewer/gen/fonts.gen.dart';
import 'package:buzz_recipe_viewer/i18n/strings.g.dart';
import 'package:buzz_recipe_viewer/provider/database_provider.dart';
import 'package:buzz_recipe_viewer/provider/package_info_provider.dart';
Expand Down Expand Up @@ -37,10 +38,16 @@ class SettingsPage extends ConsumerWidget {
body: CustomSettingsList(
sections: [
SettingsSection(
title: Text(t.settings.general.header),
title: Text(
t.settings.general.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: [
SettingsTile.navigation(
title: Text(t.settings.general.row.theme.title),
title: Text(
t.settings.general.row.theme.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) {
Navigator.push(
context,
Expand All @@ -53,7 +60,10 @@ class SettingsPage extends ConsumerWidget {
},
),
SettingsTile.navigation(
title: Text(t.settings.general.row.color.title),
title: Text(
t.settings.general.row.color.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) {
Navigator.push(
context,
Expand All @@ -66,7 +76,10 @@ class SettingsPage extends ConsumerWidget {
},
),
SettingsTile.navigation(
title: Text(t.settings.general.row.language.title),
title: Text(
t.settings.general.row.language.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) {
Navigator.push(
context,
Expand All @@ -81,14 +94,24 @@ class SettingsPage extends ConsumerWidget {
],
),
SettingsSection(
title: Text(t.settings.video.header),
title: Text(
t.settings.video.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: [
SettingsTile.switchTile(
title: Text(t.settings.video.row.playWithinApp.title),
title: Text(
t.settings.video.row.playWithinApp.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
initialValue: useInternalPlayer,
// web or macos
description: kIsWeb || Platform.isMacOS
? Text(t.settings.video.row.playWithinApp.description)
? Text(
t.settings.video.row.playWithinApp.description,
style:
const TextStyle(fontFamily: FontFamily.notoSansJP),
)
: null,
enabled: !kIsWeb,
onToggle: (value) =>
Expand All @@ -97,26 +120,41 @@ class SettingsPage extends ConsumerWidget {
],
),
SettingsSection(
title: Text(t.settings.support.header),
title: Text(
t.settings.support.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: [
SettingsTile.navigation(
title: Text(t.settings.support.row.help.title),
title: Text(
t.settings.support.row.help.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) =>
_openBrowser(url: 'https://flutter.dev/'),
),
SettingsTile.navigation(
title: Text(t.settings.support.row.contact.title),
title: Text(
t.settings.support.row.contact.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) =>
_openBrowser(url: 'https://flutter.dev/'),
),
SettingsTile.navigation(
title: Text(t.settings.support.row.feedback.title),
title: Text(
t.settings.support.row.feedback.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) =>
_openBrowser(url: 'https://flutter.dev/'),
),
if (!kIsWeb)
SettingsTile(
title: Text(t.settings.support.row.review.title),
title: Text(
t.settings.support.row.review.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) async {
final inAppReview = InAppReview.instance;
if (await inAppReview.isAvailable()) {
Expand All @@ -125,7 +163,10 @@ class SettingsPage extends ConsumerWidget {
},
),
SettingsTile(
title: Text(t.settings.support.row.share.title),
title: Text(
t.settings.support.row.share.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Not implemented')),
Expand All @@ -135,35 +176,56 @@ class SettingsPage extends ConsumerWidget {
],
),
SettingsSection(
title: Text(t.settings.about.header),
title: Text(
t.settings.about.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: [
SettingsTile.navigation(
title: Text(t.settings.about.row.terms.title),
title: Text(
t.settings.about.row.terms.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) =>
_openBrowser(url: 'https://flutter.dev/'),
),
SettingsTile.navigation(
title: Text(t.settings.about.row.privacy.title),
title: Text(
t.settings.about.row.privacy.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) =>
_openBrowser(url: 'https://flutter.dev/'),
),
SettingsTile.navigation(
title: Text(t.settings.about.row.license.title),
title: Text(
t.settings.about.row.license.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (context) => showLicensePage(context: context),
),
SettingsTile(
title: Text(t.settings.about.row.version.title),
title: Text(
t.settings.about.row.version.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
value:
Text('${packageInfo.version}(${packageInfo.buildNumber})'),
),
],
),
if (kDebugMode)
SettingsSection(
title: Text(t.settings.debug.header),
title: Text(
t.settings.debug.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: [
SettingsTile(
title: Text(t.settings.debug.row.dummyRecipe.title),
title: Text(
t.settings.debug.row.dummyRecipe.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (_) async {
await ref
.read(recipeNoteServiceProvider)
Expand All @@ -180,7 +242,10 @@ class SettingsPage extends ConsumerWidget {
},
),
SettingsTile(
title: Text(t.settings.debug.row.deleteLocalData.title),
title: Text(
t.settings.debug.row.deleteLocalData.title,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
onPressed: (_) async {
ref.read(databaseProvider).clearAll();
await ref.read(sharedPreferencesRepositoryProvider).clear();
Expand Down
7 changes: 6 additions & 1 deletion lib/ui/settings/theme/theme_setting_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:buzz_recipe_viewer/gen/fonts.gen.dart';
import 'package:buzz_recipe_viewer/i18n/strings.g.dart';
import 'package:buzz_recipe_viewer/provider/theme_mode_preference_provider.dart';
import 'package:buzz_recipe_viewer/repository/shared_preferences_repository.dart';
Expand All @@ -23,12 +24,16 @@ class ThemeSettingPage extends ConsumerWidget {
body: CustomSettingsList(
sections: [
SettingsSection(
title: Text(t.settings.general.row.theme.theme.header),
title: Text(
t.settings.general.row.theme.theme.header,
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
tiles: ThemeModePreference.values
.mapIndexed(
(index, e) => SettingsTile(
title: Text(
t.settings.general.row.theme.theme.row[index],
style: const TextStyle(fontFamily: FontFamily.notoSansJP),
),
trailing:
theme == e.themeMode ? const Icon(Icons.check) : null,
Expand Down

0 comments on commit 988b44a

Please sign in to comment.