@@ -8,13 +8,13 @@ import 'package:neon/src/blocs/accounts.dart';
8
8
import 'package:neon/src/models/account.dart' ;
9
9
import 'package:neon/src/router.dart' ;
10
10
import 'package:neon/src/settings/widgets/custom_settings_tile.dart' ;
11
- import 'package:neon/src/settings/widgets/select_settings_tile .dart' ;
11
+ import 'package:neon/src/settings/widgets/option_settings_tile .dart' ;
12
12
import 'package:neon/src/settings/widgets/settings_category.dart' ;
13
13
import 'package:neon/src/settings/widgets/settings_list.dart' ;
14
14
import 'package:neon/src/theme/dialog.dart' ;
15
+ import 'package:neon/src/utils/adaptive.dart' ;
15
16
import 'package:neon/src/utils/confirmation_dialog.dart' ;
16
17
import 'package:neon/src/widgets/error.dart' ;
17
- import 'package:neon/src/widgets/linear_progress_indicator.dart' ;
18
18
import 'package:nextcloud/provisioning_api.dart' as provisioning_api;
19
19
20
20
/// Account settings page.
@@ -84,61 +84,62 @@ class AccountSettingsPage extends StatelessWidget {
84
84
],
85
85
);
86
86
87
- final body = ResultBuilder <provisioning_api.UserDetails >.behaviorSubject (
88
- subject: userDetailsBloc.userDetails,
89
- builder: (final context, final userDetails) {
90
- final quotaRelative = userDetails.data? .quota.relative? .$int ?? userDetails.data? .quota.relative? .$double ?? 0 ;
91
- final quotaTotal = userDetails.data? .quota.total? .$int ?? userDetails.data? .quota.total? .$double ?? 0 ;
92
- final quotaUsed = userDetails.data? .quota.used? .$int ?? userDetails.data? .quota.used? .$double ?? 0 ;
87
+ final body = SettingsList (
88
+ categories: [
89
+ SettingsCategory (
90
+ title: Text (NeonLocalizations .of (context).accountOptionsCategoryStorageInfo),
91
+ tiles: [
92
+ ResultBuilder <provisioning_api.UserDetails >.behaviorSubject (
93
+ subject: userDetailsBloc.userDetails,
94
+ builder: (final context, final userDetails) {
95
+ if (userDetails.hasError) {
96
+ return NeonError (
97
+ userDetails.error ?? 'Something went wrong' ,
98
+ type: NeonErrorType .listTile,
99
+ onRetry: userDetailsBloc.refresh,
100
+ );
101
+ }
93
102
94
- return SettingsList (
95
- categories: [
96
- SettingsCategory (
97
- title: Text (NeonLocalizations .of (context).accountOptionsCategoryStorageInfo),
98
- tiles: [
99
- CustomSettingsTile (
100
- title: Column (
101
- crossAxisAlignment: CrossAxisAlignment .start,
102
- children: [
103
- if (userDetails.hasData) ...[
104
- LinearProgressIndicator (
105
- value: quotaRelative / 100 ,
106
- backgroundColor: Theme .of (context).colorScheme.primary.withOpacity (0.3 ),
107
- ),
108
- const SizedBox (
109
- height: 10 ,
110
- ),
111
- Text (
112
- NeonLocalizations .of (context).accountOptionsQuotaUsedOf (
113
- filesize (quotaUsed, 1 ),
114
- filesize (quotaTotal, 1 ),
115
- quotaRelative.toString (),
116
- ),
117
- ),
118
- ],
119
- NeonError (
120
- userDetails.error,
121
- onRetry: userDetailsBloc.refresh,
122
- ),
123
- NeonLinearProgressIndicator (
124
- visible: userDetails.isLoading,
125
- ),
126
- ],
103
+ double ? value;
104
+ Widget ? subtitle;
105
+ if (userDetails.hasData) {
106
+ final quotaRelative =
107
+ userDetails.data? .quota.relative? .$int ?? userDetails.data? .quota.relative? .$double ?? 0 ;
108
+ final quotaTotal = userDetails.data? .quota.total? .$int ?? userDetails.data? .quota.total? .$double ?? 0 ;
109
+ final quotaUsed = userDetails.data? .quota.used? .$int ?? userDetails.data? .quota.used? .$double ?? 0 ;
110
+
111
+ value = quotaRelative / 100 ;
112
+ subtitle = Text (
113
+ NeonLocalizations .of (context).accountOptionsQuotaUsedOf (
114
+ filesize (quotaUsed, 1 ),
115
+ filesize (quotaTotal, 1 ),
116
+ quotaRelative.toString (),
117
+ ),
118
+ );
119
+ }
120
+
121
+ return CustomSettingsTile (
122
+ title: LinearProgressIndicator (
123
+ value: value,
124
+ minHeight: isCupertino (context) ? 15 : null ,
125
+ borderRadius: BorderRadius .circular (isCupertino (context) ? 5 : 3 ),
126
+ backgroundColor: Theme .of (context).colorScheme.primary.withOpacity (0.3 ),
127
127
),
128
- ),
129
- ],
128
+ subtitle: subtitle,
129
+ );
130
+ },
130
131
),
131
- SettingsCategory (
132
- title : Text ( NeonLocalizations . of (context).optionsCategoryGeneral ),
133
- tiles : [
134
- SelectSettingsTile (
135
- option : options.initialApp,
136
- ),
137
- ] ,
132
+ ],
133
+ ),
134
+ SettingsCategory (
135
+ title : Text ( NeonLocalizations . of (context).optionsCategoryGeneral),
136
+ tiles : [
137
+ SelectSettingsTile (
138
+ option : options.initialApp ,
138
139
),
139
140
],
140
- );
141
- } ,
141
+ ),
142
+ ] ,
142
143
);
143
144
144
145
return Scaffold (
0 commit comments