diff --git a/lib/ui/app/forms/help_link.dart b/lib/ui/app/forms/help_link.dart new file mode 100644 index 000000000..a1c837428 --- /dev/null +++ b/lib/ui/app/forms/help_link.dart @@ -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( + style: linkStyle, + recognizer: TapGestureRecognizer() + ..onTap = () { + launch(url, forceSafariVC: false); + }, + text: localization.clickHereCapital + ' ', + ), + TextSpan( + style: aboutTextStyle, + text: message, + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui/app/menu_drawer.dart b/lib/ui/app/menu_drawer.dart index 90863197f..a8bfed23c 100644 --- a/lib/ui/app/menu_drawer.dart +++ b/lib/ui/app/menu_drawer.dart @@ -343,17 +343,6 @@ class _DrawerTileState extends State { } } -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 { @override Widget build(BuildContext context) { @@ -529,9 +518,12 @@ void _showAbout(BuildContext context) { '\n\n' + localization.ifYouLikeIt, ), - _LinkTextSpan( + TextSpan( style: linkStyle, - url: getAppURL(context), + recognizer: TapGestureRecognizer() + ..onTap = () { + launch(getAppURL(context), forceSafariVC: false); + }, text: ' ' + localization.clickHere + ' ', ), TextSpan( diff --git a/lib/ui/settings/invoice_design.dart b/lib/ui/settings/invoice_design.dart index 70168c2e6..b4b2d8671 100644 --- a/lib/ui/settings/invoice_design.dart +++ b/lib/ui/settings/invoice_design.dart @@ -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/bool_dropdown_button.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/app/edit_scaffold.dart'; import 'package:invoiceninja_flutter/utils/fonts.dart'; @@ -137,6 +138,7 @@ class _InvoiceDesignState extends State ], ), FormCard( + crossAxisAlignment: CrossAxisAlignment.start, children: [ EntityDropdown( key: ValueKey('__primary_font_${settings.primaryFont}__'), @@ -158,6 +160,10 @@ class _InvoiceDesignState extends State settings.rebuild((b) => b..secondaryFont = font?.id)), allowClearing: state.settingsUIState.isFiltered, ), + HelpLink( + url: 'https://fonts.google.com', + message: localization.toLearnAboutGoogleFonts, + ), FormColorPicker( labelText: localization.primaryColor, onSelected: (value) => viewModel.onSettingsChanged( diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index b194e9194..e89a1cda0 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -14,6 +14,7 @@ abstract class LocaleCodeAware { mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { + 'to_learn_about_gogle_fonts': 'to learn about Google Fonts', 'unpaid_invoice': 'Unpaid Invoice', 'paid_invoice': 'Paid Invoice', 'unapproved_quote': 'Unapproved Quote', @@ -492,6 +493,7 @@ mixin LocalizationsProvider on LocaleCodeAware { 'thank_you_for_using_our_app': 'Thank you for using our app!', 'if_you_like_it': 'If you like it please', 'click_here': 'click here', + 'click_here_capital': 'Click here', 'to_rate_it': 'to rate it.', 'average': 'Average', 'unapproved': 'Unapproved', @@ -14135,6 +14137,8 @@ mixin LocalizationsProvider on LocaleCodeAware { 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 average => _localizedValues[localeCode]['average']; @@ -15964,6 +15968,10 @@ mixin LocalizationsProvider on LocaleCodeAware { String get unapprovedQuote => _localizedValues[localeCode]['unapproved_quote']; + String get toLearnAboutGoogleFonts => + _localizedValues[localeCode]['to_learn_about_gogle_fonts']; + + String lookup(String key) { final lookupKey = toSnakeCase(key); return _localizedValues[localeCode][lookupKey] ??