Skip to content

Commit 5be6c2a

Browse files
committed
Migrate the UI to SolidUI
1 parent 9c0efec commit 5be6c2a

28 files changed

+159
-1501
lines changed

example/.metadata

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "d693b4b9dbac2acd4477aea4555ca6dcbea44ba2"
7+
revision: "6fba2447e95c451518584c35e25f5433f14d888c"
88
channel: "stable"
99

1010
project_type: app
@@ -13,11 +13,26 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
17-
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
16+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
17+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
18+
- platform: android
19+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
20+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
21+
- platform: ios
22+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
23+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
24+
- platform: linux
25+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
26+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
27+
- platform: macos
28+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
29+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
30+
- platform: web
31+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
32+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
1833
- platform: windows
19-
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
20-
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
34+
create_revision: 6fba2447e95c451518584c35e25f5433f14d888c
35+
base_revision: 6fba2447e95c451518584c35e25f5433f14d888c
2136

2237
# User provided section
2338

example/lib/dialogs/alert.dart

Lines changed: 0 additions & 44 deletions
This file was deleted.

example/lib/features/edit_keyvalue.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import 'package:solidpod/solidpod.dart'
3232
show SolidFunctionCallStatus, loginIfRequired, writePod;
3333

3434
import 'package:demopod/constants/app.dart';
35-
import 'package:demopod/dialogs/alert.dart';
35+
import 'package:solidui/solidui.dart' show showSolidAlert;
3636
import 'package:demopod/utils/rdf.dart';
3737

3838
class KeyValueEdit extends StatefulWidget {
@@ -116,7 +116,7 @@ class _KeyValueEditState extends State<KeyValueEdit> {
116116
}
117117
}
118118

119-
Future<void> _alert(String msg) async => alert(context, msg);
119+
Future<void> _alert(String msg) async => showSolidAlert(context, msg);
120120

121121
// Get key value pairs
122122
Future<List<({String key, dynamic value})>?> _getKeyValuePairs() async {

example/lib/features/file_service.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import 'package:flutter/material.dart';
2828
import 'package:file_picker/file_picker.dart';
2929
import 'package:solidpod/solidpod.dart';
3030

31-
import 'package:demopod/dialogs/alert.dart';
31+
import 'package:solidui/solidui.dart' show showSolidAlert;
3232

3333
class FileService extends StatefulWidget {
3434
const FileService({required this.child, super.key});
@@ -146,7 +146,7 @@ class _FileServiceState extends State<FileService> {
146146
uploadInProgress = false;
147147
});
148148
if (context.mounted) {
149-
await alert(context, 'Failed to send file. $e', 'Error');
149+
await showSolidAlert(context, 'Failed to send file. $e', title: 'Error');
150150
}
151151
debugPrint('$e');
152152
}
@@ -198,8 +198,8 @@ class _FileServiceState extends State<FileService> {
198198
downloadInProgress = false;
199199
});
200200
if (context.mounted) {
201-
await alert(
202-
context, 'Failed to download file. $e', 'Error');
201+
await showSolidAlert(
202+
context, 'Failed to download file. $e', title: 'Error');
203203
}
204204
debugPrint('$e');
205205
}
@@ -237,7 +237,7 @@ class _FileServiceState extends State<FileService> {
237237
deleteInProgress = false;
238238
});
239239
if (context.mounted) {
240-
await alert(context, 'Failed to delete file. $e', 'Error');
240+
await showSolidAlert(context, 'Failed to delete file. $e', title: 'Error');
241241
}
242242
debugPrint('$e');
243243
}

example/lib/home.dart

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import 'package:solidpod/solidpod.dart';
3737

3838
import 'package:demopod/constants/app.dart';
3939
import 'package:demopod/dialogs/about.dart';
40-
import 'package:demopod/dialogs/alert.dart';
40+
import 'package:solidui/solidui.dart' show showSolidAlert;
4141
import 'package:demopod/features/edit_keyvalue.dart';
4242
import 'package:demopod/features/file_service.dart';
4343
import 'package:demopod/features/permission_callback_demo.dart';
@@ -168,7 +168,7 @@ class HomeState extends State<Home> with SingleTickerProviderStateMixin {
168168

169169
final loggedIn = await loginIfRequired(context);
170170
if (!loggedIn) {
171-
await alert(context, 'Please login to continue');
171+
await showSolidAlert(context, 'Please login to continue');
172172
return;
173173
}
174174

@@ -178,7 +178,7 @@ class HomeState extends State<Home> with SingleTickerProviderStateMixin {
178178

179179
// Inform user about what will happen next.
180180

181-
await alert(context,
181+
await showSolidAlert(context,
182182
'The security key has been forgotten locally. The next step will show the security key prompt which you would normally see when accessing secured data after logging in.');
183183

184184
// Directly show the security key prompt with WebID.
@@ -190,11 +190,11 @@ class HomeState extends State<Home> with SingleTickerProviderStateMixin {
190190

191191
// Only show this if the user enters the correct key.
192192

193-
await alert(context,
193+
await showSolidAlert(context,
194194
'Your security key was entered correctly and has been saved for this session.');
195195
} catch (e) {
196196
debugPrint('Error: $e');
197-
await alert(context, 'Error or cancelled: $e');
197+
await showSolidAlert(context, 'Error or cancelled: $e');
198198
}
199199
}
200200

@@ -281,7 +281,7 @@ class HomeState extends State<Home> with SingleTickerProviderStateMixin {
281281
MaterialPageRoute(
282282
builder: (context) => FileService(child: widget)));
283283
} else {
284-
await alert(context, 'Please login to continue');
284+
await showSolidAlert(context, 'Please login to continue');
285285
}
286286
},
287287
child: const Text('Upload / Download Large File'));
@@ -387,11 +387,12 @@ class HomeState extends State<Home> with SingleTickerProviderStateMixin {
387387
},
388388
),
389389
smallGapV,
390-
ElevatedButton(
391-
onPressed: () {
392-
changeKeyPopup(context, widget);
393-
},
394-
child: const Text('Change Security Key on Pod')),
390+
// TODO: Implement change key popup using SolidKeyInputForm from solidui
391+
// ElevatedButton(
392+
// onPressed: () {
393+
// // changeKeyPopup(context, widget);
394+
// },
395+
// child: const Text('Change Security Key on Pod')),
395396
smallGapV,
396397
ElevatedButton(
397398
child: const Text('Forget Security Key Locally'),

example/pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ dependencies:
1616
# solidpod: ^0.7.0
1717
solidpod:
1818
path: ..
19+
solidui:
20+
path: ../../solidui
1921
universal_io: ^2.2.2
2022
window_manager: ^0.5.1
2123

lib/solidpod.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export 'src/solid/utils/app_info.dart';
7676
/// Includes the KeyManager class which stores all keys and their parameters
7777
/// such as Security key, Public key, Private key, and Individual keys.
7878
79-
export 'src/solid/utils/key_helper.dart' show KeyManager;
79+
export 'src/solid/utils/key_helper.dart' show KeyManager, verifySecurityKey;
8080

8181
/// Includes common TTL conversion functions such as parseTTLMap.
8282
@@ -103,9 +103,8 @@ export 'src/solid/utils/misc.dart'
103103
getEncKeyPath,
104104
readEncryptionKeyContent;
105105

106-
/// Change security key popup widget
107-
108-
export 'src/widgets/change_key_dialog.dart';
106+
/// Change security key popup widget - now in solidui
107+
/// Use SolidKeyInputForm from package:solidui/solidui.dart
109108
110109
/// Read encrypted/non-encrypted files stored in a POD
111110

lib/src/screens/initial_setup/initial_setup_screen_body.dart

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ import 'package:flutter/material.dart';
3737
import 'package:flutter_form_builder/flutter_form_builder.dart';
3838

3939
import 'package:solidpod/solidpod.dart';
40-
import 'package:solidpod/src/screens/initial_setup/widgets/enc_key_input_form.dart';
40+
import 'package:solidpod/src/screens/initial_setup/initial_setup_constants.dart';
4141
import 'package:solidpod/src/screens/initial_setup/widgets/initial_setup_welcome.dart';
4242
import 'package:solidpod/src/screens/initial_setup/widgets/res_create_form_submission.dart';
43+
import 'package:solidui/solidui.dart';
4344

4445
/// A [StatefulWidget] that represents the initial setup screen for the desktop version of an application.
4546
///
@@ -181,8 +182,37 @@ class _InitialSetupScreenBodyState extends State<InitialSetupScreenBody> {
181182
child: Column(
182183
crossAxisAlignment: CrossAxisAlignment.start,
183184
children: <Widget>[
184-
EncKeyInputForm(
185+
SolidKeyInputForm(
185186
formKey: formKey,
187+
fields: [
188+
SolidKeyInputConfig(
189+
fieldKey: securityKeyStr,
190+
fieldLabel: 'Security Key',
191+
),
192+
SolidKeyInputConfig(
193+
fieldKey: securityKeyStrReType,
194+
fieldLabel: 'Retype Security Key',
195+
validateFunc: (val) {
196+
if (val != formKey.currentState!.fields[securityKeyStr]?.value) {
197+
return 'Security keys do not match';
198+
}
199+
return null;
200+
},
201+
),
202+
],
203+
title: 'We require a security key to protect your data:',
204+
description: requiredSecurityKeyMsg,
205+
showPermissionCheckbox: true,
206+
additionalContent: [
207+
const Text(
208+
publicKeyMsg,
209+
style: TextStyle(
210+
color: Colors.black,
211+
fontSize: 15,
212+
fontWeight: FontWeight.w500,
213+
),
214+
),
215+
],
186216
),
187217
Center(
188218
child: TextButton.icon(

0 commit comments

Comments
 (0)