|
|
@ -10,13 +10,14 @@ import 'package:neon/src/settings/widgets/custom_settings_tile.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/dropdown_button_settings_tile.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/dropdown_button_settings_tile.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/settings_category.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/settings_category.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/settings_list.dart'; |
|
|
|
import 'package:neon/src/settings/widgets/settings_list.dart'; |
|
|
|
|
|
|
|
import 'package:neon/src/theme/dialog.dart'; |
|
|
|
import 'package:neon/src/utils/confirmation_dialog.dart'; |
|
|
|
import 'package:neon/src/utils/confirmation_dialog.dart'; |
|
|
|
import 'package:neon/src/widgets/exception.dart'; |
|
|
|
import 'package:neon/src/widgets/exception.dart'; |
|
|
|
import 'package:neon/src/widgets/linear_progress_indicator.dart'; |
|
|
|
import 'package:neon/src/widgets/linear_progress_indicator.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class AccountSettingsPage extends StatelessWidget { |
|
|
|
class AccountSettingsPage extends StatelessWidget { |
|
|
|
AccountSettingsPage({ |
|
|
|
const AccountSettingsPage({ |
|
|
|
required this.bloc, |
|
|
|
required this.bloc, |
|
|
|
required this.account, |
|
|
|
required this.account, |
|
|
|
super.key, |
|
|
|
super.key, |
|
|
@ -25,15 +26,14 @@ class AccountSettingsPage extends StatelessWidget { |
|
|
|
final AccountsBloc bloc; |
|
|
|
final AccountsBloc bloc; |
|
|
|
final Account account; |
|
|
|
final Account account; |
|
|
|
|
|
|
|
|
|
|
|
late final _options = bloc.getOptionsFor(account); |
|
|
|
|
|
|
|
late final _userDetailsBloc = bloc.getUserDetailsBlocFor(account); |
|
|
|
|
|
|
|
late final _name = account.client.humanReadableID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) => Scaffold( |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
final options = bloc.getOptionsFor(account); |
|
|
|
appBar: AppBar( |
|
|
|
final userDetailsBloc = bloc.getUserDetailsBlocFor(account); |
|
|
|
title: Text(_name), |
|
|
|
final name = account.client.humanReadableID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final appBar = AppBar( |
|
|
|
|
|
|
|
title: Text(name), |
|
|
|
actions: [ |
|
|
|
actions: [ |
|
|
|
IconButton( |
|
|
|
IconButton( |
|
|
|
onPressed: () async { |
|
|
|
onPressed: () async { |
|
|
@ -64,18 +64,19 @@ class AccountSettingsPage extends StatelessWidget { |
|
|
|
onPressed: () async { |
|
|
|
onPressed: () async { |
|
|
|
if (await showConfirmationDialog( |
|
|
|
if (await showConfirmationDialog( |
|
|
|
context, |
|
|
|
context, |
|
|
|
AppLocalizations.of(context).settingsResetForConfirmation(_name), |
|
|
|
AppLocalizations.of(context).settingsResetForConfirmation(name), |
|
|
|
)) { |
|
|
|
)) { |
|
|
|
await _options.reset(); |
|
|
|
await options.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
tooltip: AppLocalizations.of(context).settingsResetFor(_name), |
|
|
|
tooltip: AppLocalizations.of(context).settingsResetFor(name), |
|
|
|
icon: Icon(MdiIcons.cogRefresh), |
|
|
|
icon: Icon(MdiIcons.cogRefresh), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
body: ResultBuilder<ProvisioningApiUserDetails>.behaviorSubject( |
|
|
|
|
|
|
|
stream: _userDetailsBloc.userDetails, |
|
|
|
final body = ResultBuilder<ProvisioningApiUserDetails>.behaviorSubject( |
|
|
|
|
|
|
|
stream: userDetailsBloc.userDetails, |
|
|
|
builder: (final context, final userDetails) => SettingsList( |
|
|
|
builder: (final context, final userDetails) => SettingsList( |
|
|
|
categories: [ |
|
|
|
categories: [ |
|
|
|
SettingsCategory( |
|
|
|
SettingsCategory( |
|
|
@ -103,7 +104,7 @@ class AccountSettingsPage extends StatelessWidget { |
|
|
|
], |
|
|
|
], |
|
|
|
NeonException( |
|
|
|
NeonException( |
|
|
|
userDetails.error, |
|
|
|
userDetails.error, |
|
|
|
onRetry: _userDetailsBloc.refresh, |
|
|
|
onRetry: userDetailsBloc.refresh, |
|
|
|
), |
|
|
|
), |
|
|
|
NeonLinearProgressIndicator( |
|
|
|
NeonLinearProgressIndicator( |
|
|
|
visible: userDetails.isLoading, |
|
|
|
visible: userDetails.isLoading, |
|
|
@ -117,12 +118,23 @@ class AccountSettingsPage extends StatelessWidget { |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryGeneral), |
|
|
|
title: Text(AppLocalizations.of(context).optionsCategoryGeneral), |
|
|
|
tiles: [ |
|
|
|
tiles: [ |
|
|
|
DropdownButtonSettingsTile( |
|
|
|
DropdownButtonSettingsTile( |
|
|
|
option: _options.initialApp, |
|
|
|
option: options.initialApp, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
|
|
|
|
|
resizeToAvoidBottomInset: false, |
|
|
|
|
|
|
|
appBar: appBar, |
|
|
|
|
|
|
|
body: Center( |
|
|
|
|
|
|
|
child: ConstrainedBox( |
|
|
|
|
|
|
|
constraints: NeonDialogTheme.of(context).constraints, |
|
|
|
|
|
|
|
child: body, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|