|
|
@ -72,271 +72,226 @@ class _SettingsPageState extends State<SettingsPage> { |
|
|
|
final context, |
|
|
|
final context, |
|
|
|
final pushNotificationsEnabledEnabledSnapshot, |
|
|
|
final pushNotificationsEnabledEnabledSnapshot, |
|
|
|
) => |
|
|
|
) => |
|
|
|
OptionBuilder<bool>( |
|
|
|
SettingsList( |
|
|
|
option: globalOptions.rememberLastUsedAccount, |
|
|
|
categories: [ |
|
|
|
builder: (final context, final rememberLastUsedAccount) => OptionBuilder<String?>( |
|
|
|
SettingsCategory( |
|
|
|
option: globalOptions.lastAccount, |
|
|
|
title: Text(AppLocalizations.of(context).settingsApps), |
|
|
|
builder: (final context, final lastAccount) => SettingsList( |
|
|
|
tiles: <SettingsTile>[ |
|
|
|
categories: [ |
|
|
|
for (final appImplementation in appImplementations) ...[ |
|
|
|
SettingsCategory( |
|
|
|
if (appImplementation.options.options.isNotEmpty) ...[ |
|
|
|
title: Text(AppLocalizations.of(context).settingsApps), |
|
|
|
CustomSettingsTile( |
|
|
|
tiles: <SettingsTile>[ |
|
|
|
leading: appImplementation.buildIcon(context), |
|
|
|
for (final appImplementation in appImplementations) ...[ |
|
|
|
title: Text(appImplementation.name(context)), |
|
|
|
if (appImplementation.options.options.isNotEmpty) ...[ |
|
|
|
onTap: () async { |
|
|
|
CustomSettingsTile( |
|
|
|
await Navigator.of(context).push( |
|
|
|
leading: appImplementation.buildIcon(context), |
|
|
|
MaterialPageRoute( |
|
|
|
title: Text(appImplementation.name(context)), |
|
|
|
builder: (final context) => NextcloudAppSpecificSettingsPage( |
|
|
|
onTap: () async { |
|
|
|
appImplementation: appImplementation, |
|
|
|
await Navigator.of(context).push( |
|
|
|
), |
|
|
|
MaterialPageRoute( |
|
|
|
), |
|
|
|
builder: (final context) => NextcloudAppSpecificSettingsPage( |
|
|
|
); |
|
|
|
appImplementation: appImplementation, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SettingsCategory( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryTheme), |
|
|
|
|
|
|
|
tiles: [ |
|
|
|
|
|
|
|
DropdownButtonSettingsTile( |
|
|
|
|
|
|
|
option: globalOptions.themeMode, |
|
|
|
), |
|
|
|
), |
|
|
|
SettingsCategory( |
|
|
|
CheckBoxSettingsTile( |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryTheme), |
|
|
|
option: globalOptions.themeOLEDAsDark, |
|
|
|
tiles: [ |
|
|
|
), |
|
|
|
DropdownButtonSettingsTile( |
|
|
|
], |
|
|
|
option: globalOptions.themeMode, |
|
|
|
), |
|
|
|
|
|
|
|
if (platform.canUsePushNotifications) ...[ |
|
|
|
|
|
|
|
SettingsCategory( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryPushNotifications), |
|
|
|
|
|
|
|
tiles: [ |
|
|
|
|
|
|
|
TextSettingsTile( |
|
|
|
|
|
|
|
text: AppLocalizations.of(context).globalOptionsPushNotificationsNotice, |
|
|
|
|
|
|
|
style: const TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.w300, |
|
|
|
|
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
), |
|
|
|
), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
), |
|
|
|
option: globalOptions.themeOLEDAsDark, |
|
|
|
if (pushNotificationsEnabledEnabledSnapshot.data != null && |
|
|
|
|
|
|
|
!pushNotificationsEnabledEnabledSnapshot.data!) ...[ |
|
|
|
|
|
|
|
TextSettingsTile( |
|
|
|
|
|
|
|
text: AppLocalizations.of(context).globalOptionsPushNotificationsEnabledDisabledNotice, |
|
|
|
|
|
|
|
style: const TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
|
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
|
|
|
|
color: Colors.red, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
if (platform.canUsePushNotifications) ...[ |
|
|
|
option: globalOptions.pushNotificationsEnabled, |
|
|
|
SettingsCategory( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryPushNotifications), |
|
|
|
|
|
|
|
tiles: [ |
|
|
|
|
|
|
|
TextSettingsTile( |
|
|
|
|
|
|
|
text: AppLocalizations.of(context).globalOptionsPushNotificationsNotice, |
|
|
|
|
|
|
|
style: const TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.w300, |
|
|
|
|
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (pushNotificationsEnabledEnabledSnapshot.data != null && |
|
|
|
|
|
|
|
!pushNotificationsEnabledEnabledSnapshot.data!) ...[ |
|
|
|
|
|
|
|
TextSettingsTile( |
|
|
|
|
|
|
|
text: AppLocalizations.of(context).globalOptionsPushNotificationsEnabledDisabledNotice, |
|
|
|
|
|
|
|
style: const TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
|
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
|
|
|
|
color: Colors.red, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
CheckBoxSettingsTile( |
|
|
|
|
|
|
|
option: globalOptions.pushNotificationsEnabled, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
DropdownButtonSettingsTile( |
|
|
|
|
|
|
|
option: globalOptions.pushNotificationsDistributor, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
DropdownButtonSettingsTile( |
|
|
|
if (platform.canUseWindowManager) ...[ |
|
|
|
option: globalOptions.pushNotificationsDistributor, |
|
|
|
SettingsCategory( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryStartup), |
|
|
|
|
|
|
|
tiles: [ |
|
|
|
|
|
|
|
CheckBoxSettingsTile( |
|
|
|
|
|
|
|
option: globalOptions.startupMinimized, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
CheckBoxSettingsTile( |
|
|
|
|
|
|
|
option: globalOptions.startupMinimizeInsteadOfExit, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
if (platform.canUseWindowManager && platform.canUseSystemTray) ...[ |
|
|
|
), |
|
|
|
SettingsCategory( |
|
|
|
], |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategorySystemTray), |
|
|
|
if (platform.canUseWindowManager) ...[ |
|
|
|
tiles: [ |
|
|
|
SettingsCategory( |
|
|
|
CheckBoxSettingsTile( |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryStartup), |
|
|
|
option: globalOptions.systemTrayEnabled, |
|
|
|
tiles: [ |
|
|
|
), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
CheckBoxSettingsTile( |
|
|
|
option: globalOptions.startupMinimized, |
|
|
|
option: globalOptions.systemTrayHideToTrayWhenMinimized, |
|
|
|
), |
|
|
|
), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
], |
|
|
|
option: globalOptions.startupMinimizeInsteadOfExit, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
if (accountsSnapshot.hasData) ...[ |
|
|
|
), |
|
|
|
SettingsCategory( |
|
|
|
], |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryAccounts), |
|
|
|
if (platform.canUseWindowManager && platform.canUseSystemTray) ...[ |
|
|
|
tiles: [ |
|
|
|
SettingsCategory( |
|
|
|
if (accountsSnapshot.data!.length > 1) ...[ |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategorySystemTray), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
tiles: [ |
|
|
|
option: globalOptions.rememberLastUsedAccount, |
|
|
|
CheckBoxSettingsTile( |
|
|
|
), |
|
|
|
option: globalOptions.systemTrayEnabled, |
|
|
|
], |
|
|
|
), |
|
|
|
for (final account in accountsSnapshot.data!) ...[ |
|
|
|
CheckBoxSettingsTile( |
|
|
|
AccountSettingsTile( |
|
|
|
option: globalOptions.systemTrayHideToTrayWhenMinimized, |
|
|
|
account: account, |
|
|
|
|
|
|
|
color: activeAccountSnapshot.data == account && accountsSnapshot.data!.length > 1 |
|
|
|
|
|
|
|
? Theme.of(context).colorScheme.primary |
|
|
|
|
|
|
|
: Theme.of(context).colorScheme.onBackground, |
|
|
|
|
|
|
|
trailing: Row( |
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
PopupMenuButton<SettingsAccountAction>( |
|
|
|
|
|
|
|
itemBuilder: (final context) => [ |
|
|
|
|
|
|
|
PopupMenuItem( |
|
|
|
|
|
|
|
value: SettingsAccountAction.settings, |
|
|
|
|
|
|
|
child: Text(AppLocalizations.of(context).settings), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
PopupMenuItem( |
|
|
|
|
|
|
|
value: SettingsAccountAction.delete, |
|
|
|
|
|
|
|
child: Text(AppLocalizations.of(context).delete), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
onSelected: (final action) async { |
|
|
|
|
|
|
|
switch (action) { |
|
|
|
|
|
|
|
case SettingsAccountAction.settings: |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => AccountSpecificSettingsPage( |
|
|
|
|
|
|
|
bloc: accountsBloc, |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case SettingsAccountAction.delete: |
|
|
|
|
|
|
|
if (await showConfirmationDialog( |
|
|
|
|
|
|
|
context, |
|
|
|
|
|
|
|
AppLocalizations.of(context).globalOptionsAccountsRemoveConfirm( |
|
|
|
|
|
|
|
account.username, |
|
|
|
|
|
|
|
account.serverURL, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
)) { |
|
|
|
|
|
|
|
accountsBloc.removeAccount(account); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (accountsSnapshot.data!.length > 1 && rememberLastUsedAccount != null) ...[ |
|
|
|
|
|
|
|
Radio<String>( |
|
|
|
|
|
|
|
groupValue: lastAccount, |
|
|
|
|
|
|
|
value: account.id, |
|
|
|
|
|
|
|
onChanged: !rememberLastUsedAccount ? globalOptions.lastAccount.set : null, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
CustomSettingsTile( |
|
|
|
|
|
|
|
title: ElevatedButton.icon( |
|
|
|
|
|
|
|
onPressed: () async { |
|
|
|
|
|
|
|
await Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => const LoginPage(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
icon: const Icon(MdiIcons.accountPlus), |
|
|
|
|
|
|
|
label: Text(AppLocalizations.of(context).globalOptionsAccountsAdd), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
SettingsCategory( |
|
|
|
), |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryOther), |
|
|
|
], |
|
|
|
tiles: <SettingsTile>[ |
|
|
|
if (accountsSnapshot.hasData) ...[ |
|
|
|
CustomSettingsTile( |
|
|
|
SettingsCategory( |
|
|
|
leading: Icon( |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryAccounts), |
|
|
|
MdiIcons.scriptText, |
|
|
|
tiles: [ |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
if (accountsSnapshot.data!.length > 1) ...[ |
|
|
|
), |
|
|
|
CheckBoxSettingsTile( |
|
|
|
title: Text(AppLocalizations.of(context).licenses), |
|
|
|
option: globalOptions.rememberLastUsedAccount, |
|
|
|
onTap: () async { |
|
|
|
), |
|
|
|
showLicensePage( |
|
|
|
DropdownButtonSettingsTile( |
|
|
|
context: context, |
|
|
|
option: globalOptions.initialAccount, |
|
|
|
applicationName: AppLocalizations.of(context).appName, |
|
|
|
), |
|
|
|
applicationIcon: const NeonLogo( |
|
|
|
], |
|
|
|
withoutText: true, |
|
|
|
for (final account in accountsSnapshot.data!) ...[ |
|
|
|
|
|
|
|
AccountSettingsTile( |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
onTap: () { |
|
|
|
|
|
|
|
Navigator.of(context).push( |
|
|
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
|
|
builder: (final context) => AccountSpecificSettingsPage( |
|
|
|
|
|
|
|
bloc: accountsBloc, |
|
|
|
|
|
|
|
account: account, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
applicationLegalese: await rootBundle.loadString('assets/LEGALESE.txt'), |
|
|
|
|
|
|
|
applicationVersion: Provider.of<PackageInfo>(context, listen: false).version, |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
CustomSettingsTile( |
|
|
|
], |
|
|
|
leading: Icon( |
|
|
|
CustomSettingsTile( |
|
|
|
MdiIcons.export, |
|
|
|
title: ElevatedButton.icon( |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
onPressed: () async { |
|
|
|
), |
|
|
|
await Navigator.of(context).push( |
|
|
|
title: Text(AppLocalizations.of(context).settingsExport), |
|
|
|
MaterialPageRoute( |
|
|
|
onTap: () async { |
|
|
|
builder: (final context) => const LoginPage(), |
|
|
|
try { |
|
|
|
), |
|
|
|
final fileName = |
|
|
|
); |
|
|
|
'nextcloud-neon-settings-${DateTime.now().millisecondsSinceEpoch ~/ 1000}.json.base64'; |
|
|
|
|
|
|
|
final data = base64.encode( |
|
|
|
|
|
|
|
utf8.encode( |
|
|
|
|
|
|
|
json.encode( |
|
|
|
|
|
|
|
settingsExportHelper.toJsonExport(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await saveFileWithPickDialog(fileName, Uint8List.fromList(utf8.encode(data))); |
|
|
|
|
|
|
|
} catch (e, s) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
debugPrintStack(stackTrace: s); |
|
|
|
|
|
|
|
ExceptionWidget.showSnackbar(context, e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
icon: const Icon(MdiIcons.accountPlus), |
|
|
|
|
|
|
|
label: Text(AppLocalizations.of(context).globalOptionsAccountsAdd), |
|
|
|
), |
|
|
|
), |
|
|
|
CustomSettingsTile( |
|
|
|
) |
|
|
|
leading: Icon( |
|
|
|
], |
|
|
|
MdiIcons.import, |
|
|
|
), |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
], |
|
|
|
|
|
|
|
SettingsCategory( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryOther), |
|
|
|
|
|
|
|
tiles: <SettingsTile>[ |
|
|
|
|
|
|
|
CustomSettingsTile( |
|
|
|
|
|
|
|
leading: Icon( |
|
|
|
|
|
|
|
MdiIcons.scriptText, |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).licenses), |
|
|
|
|
|
|
|
onTap: () async { |
|
|
|
|
|
|
|
showLicensePage( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
applicationName: AppLocalizations.of(context).appName, |
|
|
|
|
|
|
|
applicationIcon: const NeonLogo( |
|
|
|
|
|
|
|
withoutText: true, |
|
|
|
), |
|
|
|
), |
|
|
|
title: Text(AppLocalizations.of(context).settingsImport), |
|
|
|
applicationLegalese: await rootBundle.loadString('assets/LEGALESE.txt'), |
|
|
|
onTap: () async { |
|
|
|
applicationVersion: Provider.of<PackageInfo>(context, listen: false).version, |
|
|
|
try { |
|
|
|
); |
|
|
|
final result = await FilePicker.platform.pickFiles( |
|
|
|
}, |
|
|
|
withData: true, |
|
|
|
), |
|
|
|
); |
|
|
|
CustomSettingsTile( |
|
|
|
|
|
|
|
leading: Icon( |
|
|
|
if (result == null) { |
|
|
|
MdiIcons.export, |
|
|
|
return; |
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
} |
|
|
|
), |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).settingsExport), |
|
|
|
|
|
|
|
onTap: () async { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
final fileName = |
|
|
|
|
|
|
|
'nextcloud-neon-settings-${DateTime.now().millisecondsSinceEpoch ~/ 1000}.json.base64'; |
|
|
|
|
|
|
|
final data = base64.encode( |
|
|
|
|
|
|
|
utf8.encode( |
|
|
|
|
|
|
|
json.encode( |
|
|
|
|
|
|
|
settingsExportHelper.toJsonExport(), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await saveFileWithPickDialog(fileName, Uint8List.fromList(utf8.encode(data))); |
|
|
|
|
|
|
|
} catch (e, s) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
debugPrintStack(stackTrace: s); |
|
|
|
|
|
|
|
ExceptionWidget.showSnackbar(context, e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
CustomSettingsTile( |
|
|
|
|
|
|
|
leading: Icon( |
|
|
|
|
|
|
|
MdiIcons.import, |
|
|
|
|
|
|
|
color: Theme.of(context).colorScheme.primary, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).settingsImport), |
|
|
|
|
|
|
|
onTap: () async { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
final result = await FilePicker.platform.pickFiles( |
|
|
|
|
|
|
|
withData: true, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!result.files.single.path!.endsWith('.json.base64')) { |
|
|
|
if (result == null) { |
|
|
|
if (mounted) { |
|
|
|
return; |
|
|
|
ExceptionWidget.showSnackbar( |
|
|
|
} |
|
|
|
context, |
|
|
|
|
|
|
|
AppLocalizations.of(context).settingsImportWrongFileExtension, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final data = |
|
|
|
if (!result.files.single.path!.endsWith('.json.base64')) { |
|
|
|
json.decode(utf8.decode(base64.decode(utf8.decode(result.files.single.bytes!)))); |
|
|
|
if (mounted) { |
|
|
|
await settingsExportHelper.applyFromJson(data as Map<String, dynamic>); |
|
|
|
ExceptionWidget.showSnackbar( |
|
|
|
} catch (e, s) { |
|
|
|
context, |
|
|
|
debugPrint(e.toString()); |
|
|
|
AppLocalizations.of(context).settingsImportWrongFileExtension, |
|
|
|
debugPrintStack(stackTrace: s); |
|
|
|
); |
|
|
|
ExceptionWidget.showSnackbar(context, e); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
return; |
|
|
|
), |
|
|
|
} |
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
final data = |
|
|
|
|
|
|
|
json.decode(utf8.decode(base64.decode(utf8.decode(result.files.single.bytes!)))); |
|
|
|
|
|
|
|
await settingsExportHelper.applyFromJson(data as Map<String, dynamic>); |
|
|
|
|
|
|
|
} catch (e, s) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
debugPrintStack(stackTrace: s); |
|
|
|
|
|
|
|
ExceptionWidget.showSnackbar(context, e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|