Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class App extends StatelessWidget {
home: const SolidLogin(
image: AssetImage('assets/images/app_image.jpg'),
logo: AssetImage('assets/images/app_icon.jpg'),
customFolderPathList: [
'customDir1',
'customDir2',
'customDir2/customDir3',
],
child: appScaffold,
),
);
Expand Down
6 changes: 5 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ dependencies:
sdk: flutter
markdown_tooltip: 0.0.10
shared_preferences: ^2.5.4
solidpod: ^0.9.0
# solidpod: ^0.9.0
solidpod:
git:
url: https://github.com/anusii/solidpod.git
ref: av/522_custom_folder_structure_at_initialisation_stage
solidui:
path: ..
window_manager: ^0.5.1
Expand Down
17 changes: 16 additions & 1 deletion lib/src/widgets/solid_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import 'package:solidpod/solidpod.dart'
getAppNameVersion,
generateDefaultFolders,
generateDefaultFiles,
generateCustomFolders,
setAppDirName;
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -81,6 +82,7 @@ class SolidLogin extends StatefulWidget {
this.changeKeyButtonStyle = const ChangeKeyButtonStyle(),
this.themeConfig = const SolidLoginTheme(),
this.snackbarConfig = const SnackbarConfig(),
this.customFolderPathList = const [],
super.key,
});

Expand Down Expand Up @@ -154,6 +156,17 @@ class SolidLogin extends StatefulWidget {

final SnackbarConfig snackbarConfig;

/// Custom list of folders to be created inside the data folder.
/// Following are few examples.
/// - Custom folder 'myDir1' will be created as '/data/myDir1'
/// - Custom folder 'data' will be created as '/data/data'
/// If multi-level folder structure is needed you need to provide
/// upper level folders first in the list. For instance, to create
/// 'myDir1/myDir2/myDir3', add three values to the list as follows
/// in that order.
/// 'myDir1', 'myDir1/myDir2', 'myDir1/myDir2/myDir3'
final List customFolderPathList;

@override
State<SolidLogin> createState() => _SolidLoginState();
}
Expand Down Expand Up @@ -266,14 +279,16 @@ class _SolidLoginState extends State<SolidLogin> with WidgetsBindingObserver {
final folders = await generateDefaultFolders();
final files = await generateDefaultFiles();

final customFolders = generateCustomFolders(widget.customFolderPathList);

// Check if widget is still mounted after async operations and before setState.
// This prevents "setState() called after dispose()" errors that can occur
// if the widget was disposed while async operations were running.

if (!mounted) return;

setState(() {
defaultFolders = folders;
defaultFolders = folders + customFolders;
defaultFiles = files;
});

Expand Down
6 changes: 5 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ dependencies:
path: ^1.9.1
rdflib: ^0.2.12
shared_preferences: ^2.5.4
solidpod: ^0.9.0
# solidpod: ^0.9.0
solidpod:
git:
url: https://github.com/anusii/solidpod.git
ref: av/522_custom_folder_structure_at_initialisation_stage
url_launcher: ^6.3.2
version_widget: ^1.0.6

Expand Down
Loading