@@ -2,6 +2,7 @@ import 'dart:math';
2
2
3
3
import 'package:flutter/material.dart' ;
4
4
import 'package:flutter_svg/flutter_svg.dart' ;
5
+ import 'package:logging/logging.dart' ;
5
6
import 'package:saber/components/misc/faq.dart' ;
6
7
import 'package:saber/data/extensions/string_extensions.dart' ;
7
8
import 'package:saber/data/nextcloud/nextcloud_client_extension.dart' ;
@@ -22,6 +23,8 @@ class DoneLoginStep extends StatefulWidget {
22
23
class _DoneLoginStepState extends State <DoneLoginStep > {
23
24
static const width = 400.0 ;
24
25
26
+ late final log = Logger ('DoneLoginStep' );
27
+
25
28
void _logout () {
26
29
Prefs .url.value = '' ;
27
30
Prefs .username.value = '' ;
@@ -41,8 +44,11 @@ class _DoneLoginStepState extends State<DoneLoginStep> {
41
44
final screenWidth = MediaQuery .sizeOf (context).width;
42
45
final screenHeight = MediaQuery .sizeOf (context).height;
43
46
final quota = Prefs .lastStorageQuota.value;
44
- final server =
47
+ final serverName =
45
48
Prefs .url.value.ifNotEmpty ?? t.login.ncLoginStep.saberNcServer;
49
+ late final serverUri = Prefs .url.value.isEmpty
50
+ ? NextcloudClientExtension .defaultNextcloudUri
51
+ : Uri .parse (Prefs .url.value);
46
52
return ListView (
47
53
padding: EdgeInsets .symmetric (
48
54
horizontal: screenWidth > width ? (screenWidth - width) / 2 : 16 ,
@@ -86,7 +92,7 @@ class _DoneLoginStepState extends State<DoneLoginStep> {
86
92
const SizedBox (height: 2 ),
87
93
LinearProgressIndicator (
88
94
// At least 4% so the rounded corners render properly
89
- value: max (( quota? .relative ?? 0 ) / 100 , 0.04 ) ,
95
+ value: ( quota? .relative ?? 0 ). clamp ( 4 , 100 ) / 100 ,
90
96
minHeight: 32 ,
91
97
borderRadius: BorderRadius .circular (6 ),
92
98
),
@@ -97,27 +103,29 @@ class _DoneLoginStepState extends State<DoneLoginStep> {
97
103
),
98
104
const SizedBox (height: 32 ),
99
105
Text (t.profile.connectedTo, style: const TextStyle (height: 0.8 )),
100
- Text (server , style: textTheme.headlineSmall),
106
+ Text (serverName , style: textTheme.headlineSmall),
101
107
const SizedBox (height: 4 ),
102
108
Row (
103
109
children: [
104
110
Flexible (
105
111
fit: FlexFit .tight,
106
112
child: ElevatedButton (
107
- onPressed: () => launchUrl (
108
- Prefs .url.value.isEmpty
109
- ? NextcloudClientExtension .defaultNextcloudUri
110
- : Uri .parse (Prefs .url.value),
111
- ),
113
+ onPressed: () {
114
+ log.info ('Opening URL: $serverUri ' );
115
+ launchUrl (serverUri);
116
+ },
112
117
child: Text (t.profile.quickLinks.serverHomepage),
113
118
),
114
119
),
115
120
const SizedBox (width: 8 ),
116
121
Flexible (
117
122
fit: FlexFit .tight,
118
123
child: ElevatedButton (
119
- onPressed: () => launchUrl (
120
- Uri .parse ('$server /index.php/settings/user/drop_account' )),
124
+ onPressed: () {
125
+ final url = '$serverUri /index.php/settings/user/drop_account' ;
126
+ log.info ('Opening URL: $url ' );
127
+ launchUrl (Uri .parse (url));
128
+ },
121
129
child: Text (t.profile.quickLinks.deleteAccount),
122
130
),
123
131
),
0 commit comments