Skip to content

Commit

Permalink
Merge pull request #1751 from ardriveapp/PE-6147-new-drive-empty-state
Browse files Browse the repository at this point in the history
PE-6147: feat(empty state): implement empty state
  • Loading branch information
thiagocarvalhodev authored May 31, 2024
2 parents eb0fdb6 + 23a2ed7 commit 49dabbe
Show file tree
Hide file tree
Showing 10 changed files with 784 additions and 102 deletions.
6 changes: 4 additions & 2 deletions lib/components/folder_create_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class _FolderCreateFormState extends State<FolderCreateForm> {
showProgressDialog(
context,
title: appLocalizationsOf(context).creatingFolderEmphasized,
useNewArDriveUI: true,
);
} else if (state is FolderCreateSuccess) {
Navigator.pop(context);
Expand All @@ -91,14 +92,15 @@ class _FolderCreateFormState extends State<FolderCreateForm> {
description: appLocalizationsOf(context).entityAlreadyExists(
state.folderName,
),
useNewArDriveUI: true,
);
}
},
builder: (context, state) => ArDriveStandardModal(
builder: (context, state) => ArDriveStandardModalNew(
title: appLocalizationsOf(context).createFolderEmphasized,
content: SizedBox(
width: kMediumDialogWidth,
child: ArDriveTextField(
child: ArDriveTextFieldNew(
controller: _folderNameController,
autofocus: true,
onFieldSubmitted: (value) {
Expand Down
25 changes: 9 additions & 16 deletions lib/components/pin_file_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ class PinFileDialog extends StatelessWidget {
final idValidationError = _getIdValidationError(context, state);
final nameValidationError = _getNameValidationError(context, state);

return ArDriveStandardModal(
return ArDriveStandardModalNew(
title: appLocalizationsOf(context).newFilePin,
content: SizedBox(
width: kMediumDialogWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ArDriveTextField(
ArDriveTextFieldNew(
isEnabled: state is! PinFileNetworkCheckRunning,
label: appLocalizationsOf(context).enterTxIdOrFileId,
isFieldRequired: true,
Expand All @@ -119,7 +119,7 @@ class PinFileDialog extends StatelessWidget {
);
},
),
ArDriveTextField(
ArDriveTextFieldNew(
isEnabled: true,
label: appLocalizationsOf(context).enterFileName,
isFieldRequired: true,
Expand Down Expand Up @@ -154,10 +154,6 @@ class PinFileDialog extends StatelessWidget {
}

String? _getIdValidationError(BuildContext context, PinFileState state) {
// if (state is PinFileInitial) {
// return null;
// }

if (state.idValidation == IdValidationResult.invalid) {
return appLocalizationsOf(context).theIdProvidedIsNotValid;
} else if (state.idValidation == IdValidationResult.required) {
Expand All @@ -183,10 +179,6 @@ class PinFileDialog extends StatelessWidget {
}

String? _getNameValidationError(BuildContext context, PinFileState state) {
// if (state is PinFileInitial) {
// return null;
// }

if (state.nameValidation == NameValidationResult.invalid) {
return appLocalizationsOf(context).validationInvalid;
} else if (state.nameValidation == NameValidationResult.required) {
Expand All @@ -197,21 +189,22 @@ class PinFileDialog extends StatelessWidget {
return null;
}

ArDriveStandardModal _errorDialog(
ArDriveStandardModalNew _errorDialog(
BuildContext context, {
required String errorText,
bool doublePop = false,
}) =>
ArDriveStandardModal(
ArDriveStandardModalNew(
width: kMediumDialogWidth,
title: appLocalizationsOf(context).failedToCreatePin,
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 16),
Text(errorText),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Text(errorText),
),
],
),
actions: [
Expand Down
2 changes: 2 additions & 0 deletions lib/components/progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ Future<void> showProgressDialog(
BuildContext context, {
required String title,
List<ModalAction>? actions,
bool useNewArDriveUI = false,
}) =>
showArDriveDialog(
context,
barrierDismissible: false,
content: ProgressDialog(
title: title,
actions: actions ?? const [],
useNewArDriveUI: useNewArDriveUI,
),
);

Expand Down
Loading

0 comments on commit 49dabbe

Please sign in to comment.