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