diff --git a/lib/ui/settings/settings_wizard.dart b/lib/ui/settings/settings_wizard.dart index 27b800ac7..5a4bdb833 100644 --- a/lib/ui/settings/settings_wizard.dart +++ b/lib/ui/settings/settings_wizard.dart @@ -49,6 +49,7 @@ class _SettingsWizardState extends State { final _debouncer = Debouncer(milliseconds: kMillisecondsToDebounceSave); bool _isSaving = false; + bool _showLogo = false; bool _isSubdomainUnique = false; bool _isCheckingSubdomain = false; bool _hasCheckedSubdomain = false; @@ -143,7 +144,6 @@ class _SettingsWizardState extends State { } final store = StoreProvider.of(context); - final navigator = Navigator.of(context); final state = store.state; passwordCallback( @@ -154,10 +154,15 @@ class _SettingsWizardState extends State { completer.future.then((value) { final toastCompleter = snackBarCompleter(context, localization.savedSettings); - toastCompleter.future - .then((value) => navigator.pop()) - .catchError((Object error) { - setState(() => _isSaving = false); + toastCompleter.future.then((value) { + setState(() { + _isSaving = false; + _showLogo = true; + }); + }).catchError((Object error) { + setState(() { + _isSaving = false; + }); }); store.dispatch( SaveCompanyRequest( @@ -326,80 +331,91 @@ class _SettingsWizardState extends State { ? LoadingIndicator( height: 200, ) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: isMobile(context) - ? [ - Padding( - padding: const EdgeInsets.only(bottom: 8), - child: Text( - localization.welcomeToInvoiceNinja, - style: Theme.of(context).textTheme.headline6, - ), - ), - companyName, - if (state.isHosted) subdomain, - if (showNameFields) ...[ - firstName, - lastName, - ], - language, - currency, - SizedBox(height: 16), - darkMode, - if (state.isHosted) - Padding( - padding: const EdgeInsets.only(top: 32), - child: Text(localization.subdomainGuide), - ) - ] - : [ - Row( - children: [ - Expanded( - child: Text( - localization.welcomeToInvoiceNinja, - style: Theme.of(context).textTheme.headline6, - )), - if (state.isHosted) ...[ - SizedBox(width: kTableColumnGap), - Flexible(child: darkMode), - ] - ], - ), - SizedBox(height: 16), - Row( - children: [ - Expanded(child: companyName), - SizedBox(width: kTableColumnGap), - Expanded( - child: - state.isHosted ? subdomain : darkMode), - ], - ), - if (showNameFields) - Row( - children: [ - Expanded(child: firstName), - SizedBox(width: kTableColumnGap), - Expanded(child: lastName), + : _showLogo + ? Center( + child: Text( + localization.setupWizardLogo, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headline6, + ), + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: isMobile(context) + ? [ + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Text( + localization.welcomeToInvoiceNinja, + style: + Theme.of(context).textTheme.headline6, + ), + ), + companyName, + if (state.isHosted) subdomain, + if (showNameFields) ...[ + firstName, + lastName, ], - ), - Row( - children: [ - Expanded(child: language), - SizedBox(width: kTableColumnGap), - Expanded(child: currency), + language, + currency, + SizedBox(height: 16), + darkMode, + if (state.isHosted) + Padding( + padding: const EdgeInsets.only(top: 32), + child: Text(localization.subdomainGuide), + ) + ] + : [ + Row( + children: [ + Expanded( + child: Text( + localization.welcomeToInvoiceNinja, + style: + Theme.of(context).textTheme.headline6, + )), + if (state.isHosted) ...[ + SizedBox(width: kTableColumnGap), + Flexible(child: darkMode), + ] + ], + ), + SizedBox(height: 16), + Row( + children: [ + Expanded(child: companyName), + SizedBox(width: kTableColumnGap), + Expanded( + child: state.isHosted + ? subdomain + : darkMode), + ], + ), + if (showNameFields) + Row( + children: [ + Expanded(child: firstName), + SizedBox(width: kTableColumnGap), + Expanded(child: lastName), + ], + ), + Row( + children: [ + Expanded(child: language), + SizedBox(width: kTableColumnGap), + Expanded(child: currency), + ], + ), + if (state.isHosted) + Padding( + padding: const EdgeInsets.only(top: 32), + child: Text(localization.subdomainGuide), + ), ], - ), - if (state.isHosted) - Padding( - padding: const EdgeInsets.only(top: 32), - child: Text(localization.subdomainGuide), - ), - ], - ), + ), ), ), ), @@ -409,10 +425,21 @@ class _SettingsWizardState extends State { onPressed: () => Navigator.of(context).pop(), child: Text(localization.close.toUpperCase()), ), - TextButton( - onPressed: _onSavePressed, - child: Text(localization.save.toUpperCase()), - ), + if (_showLogo) + TextButton( + onPressed: () { + store.dispatch(ViewSettings( + section: kSettingsCompanyDetails, + tabIndex: 2, + )); + Navigator.of(context).pop(); + }, + child: Text(localization.upload.toUpperCase())) + else + TextButton( + onPressed: _onSavePressed, + child: Text(localization.save.toUpperCase()), + ), ] ], ); diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index c96ceb644..36b15fa0a 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -16,6 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'setup_wizard_logo': 'Would you like to upload your logo?', + 'upload': 'Upload', 'installed_version': 'Installed Version', 'notify_vendor_when_paid': 'Notify Vendor When Paid', 'notify_vendor_when_paid_help': @@ -92949,6 +92951,15 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['installed_version'] ?? _localizedValues['en']['installed_version']; + String get setupWizardLogo => + _localizedValues[localeCode]['setup_wizard_logo'] ?? + _localizedValues['en']['setup_wizard_logo']; + + String get upload => + _localizedValues[localeCode]['upload'] ?? + _localizedValues['en']['upload']; + + // STARTER: lang field - do not remove comment String lookup(String key) {