Google Fonts
This commit is contained in:
parent
ad3e35d974
commit
075dbcd3ee
|
|
@ -0,0 +1,45 @@
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
class HelpLink extends StatelessWidget {
|
||||||
|
const HelpLink({
|
||||||
|
@required this.url,
|
||||||
|
@required this.message,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String url;
|
||||||
|
final String message;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final localization = AppLocalization.of(context);
|
||||||
|
final ThemeData themeData = Theme.of(context);
|
||||||
|
final TextStyle aboutTextStyle = themeData.textTheme.bodyText1;
|
||||||
|
final TextStyle linkStyle =
|
||||||
|
themeData.textTheme.bodyText1.copyWith(color: themeData.accentColor);
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20, bottom: 30),
|
||||||
|
child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
children: <TextSpan>[
|
||||||
|
TextSpan(
|
||||||
|
style: linkStyle,
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
launch(url, forceSafariVC: false);
|
||||||
|
},
|
||||||
|
text: localization.clickHereCapital + ' ',
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
style: aboutTextStyle,
|
||||||
|
text: message,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -343,17 +343,6 @@ class _DrawerTileState extends State<DrawerTile> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LinkTextSpan extends TextSpan {
|
|
||||||
_LinkTextSpan({TextStyle style, String url, String text})
|
|
||||||
: super(
|
|
||||||
style: style,
|
|
||||||
text: text ?? url,
|
|
||||||
recognizer: TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
launch(url, forceSafariVC: false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class SidebarFooter extends StatelessWidget {
|
class SidebarFooter extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -529,9 +518,12 @@ void _showAbout(BuildContext context) {
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
localization.ifYouLikeIt,
|
localization.ifYouLikeIt,
|
||||||
),
|
),
|
||||||
_LinkTextSpan(
|
TextSpan(
|
||||||
style: linkStyle,
|
style: linkStyle,
|
||||||
url: getAppURL(context),
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
launch(getAppURL(context), forceSafariVC: false);
|
||||||
|
},
|
||||||
text: ' ' + localization.clickHere + ' ',
|
text: ' ' + localization.clickHere + ' ',
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/color_picker.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/color_picker.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/help_link.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/invoice_design_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/invoice_design_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/fonts.dart';
|
import 'package:invoiceninja_flutter/utils/fonts.dart';
|
||||||
|
|
@ -137,6 +138,7 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormCard(
|
FormCard(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityDropdown(
|
EntityDropdown(
|
||||||
key: ValueKey('__primary_font_${settings.primaryFont}__'),
|
key: ValueKey('__primary_font_${settings.primaryFont}__'),
|
||||||
|
|
@ -158,6 +160,10 @@ class _InvoiceDesignState extends State<InvoiceDesign>
|
||||||
settings.rebuild((b) => b..secondaryFont = font?.id)),
|
settings.rebuild((b) => b..secondaryFont = font?.id)),
|
||||||
allowClearing: state.settingsUIState.isFiltered,
|
allowClearing: state.settingsUIState.isFiltered,
|
||||||
),
|
),
|
||||||
|
HelpLink(
|
||||||
|
url: 'https://fonts.google.com',
|
||||||
|
message: localization.toLearnAboutGoogleFonts,
|
||||||
|
),
|
||||||
FormColorPicker(
|
FormColorPicker(
|
||||||
labelText: localization.primaryColor,
|
labelText: localization.primaryColor,
|
||||||
onSelected: (value) => viewModel.onSettingsChanged(
|
onSelected: (value) => viewModel.onSettingsChanged(
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
|
'to_learn_about_gogle_fonts': 'to learn about Google Fonts',
|
||||||
'unpaid_invoice': 'Unpaid Invoice',
|
'unpaid_invoice': 'Unpaid Invoice',
|
||||||
'paid_invoice': 'Paid Invoice',
|
'paid_invoice': 'Paid Invoice',
|
||||||
'unapproved_quote': 'Unapproved Quote',
|
'unapproved_quote': 'Unapproved Quote',
|
||||||
|
|
@ -492,6 +493,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
'thank_you_for_using_our_app': 'Thank you for using our app!',
|
'thank_you_for_using_our_app': 'Thank you for using our app!',
|
||||||
'if_you_like_it': 'If you like it please',
|
'if_you_like_it': 'If you like it please',
|
||||||
'click_here': 'click here',
|
'click_here': 'click here',
|
||||||
|
'click_here_capital': 'Click here',
|
||||||
'to_rate_it': 'to rate it.',
|
'to_rate_it': 'to rate it.',
|
||||||
'average': 'Average',
|
'average': 'Average',
|
||||||
'unapproved': 'Unapproved',
|
'unapproved': 'Unapproved',
|
||||||
|
|
@ -14135,6 +14137,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get clickHere => _localizedValues[localeCode]['click_here'];
|
String get clickHere => _localizedValues[localeCode]['click_here'];
|
||||||
|
|
||||||
|
String get clickHereCapital => _localizedValues[localeCode]['click_here_capital'];
|
||||||
|
|
||||||
String get toRateIt => _localizedValues[localeCode]['to_rate_it'];
|
String get toRateIt => _localizedValues[localeCode]['to_rate_it'];
|
||||||
|
|
||||||
String get average => _localizedValues[localeCode]['average'];
|
String get average => _localizedValues[localeCode]['average'];
|
||||||
|
|
@ -15964,6 +15968,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
String get unapprovedQuote =>
|
String get unapprovedQuote =>
|
||||||
_localizedValues[localeCode]['unapproved_quote'];
|
_localizedValues[localeCode]['unapproved_quote'];
|
||||||
|
|
||||||
|
String get toLearnAboutGoogleFonts =>
|
||||||
|
_localizedValues[localeCode]['to_learn_about_gogle_fonts'];
|
||||||
|
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue