mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 22:09:40 +00:00
Refactor CustomExpansionTile and SpaceDetailsDialogHelper for improved functionality and UI consistency
- Updated CustomExpansionTile to enhance selection state handling and UI responsiveness. - Integrated success and error snackbars in SpaceDetailsDialogHelper for better user feedback during space creation and updates. - Removed redundant comments and improved code readability.
This commit is contained in:
@ -12,6 +12,7 @@ import 'package:syncrow_web/pages/space_management_v2/modules/update_space/data/
|
||||
import 'package:syncrow_web/pages/space_management_v2/modules/update_space/domain/params/update_space_param.dart';
|
||||
import 'package:syncrow_web/pages/space_management_v2/modules/update_space/presentation/bloc/update_space_bloc.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/extension/app_snack_bar.dart';
|
||||
|
||||
abstract final class SpaceDetailsDialogHelper {
|
||||
static void showCreate(
|
||||
@ -140,6 +141,9 @@ abstract final class SpaceDetailsDialogHelper {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
onSuccess?.call(space);
|
||||
context.showSuccessSnackbar(
|
||||
'${space.spaceName} space was updated successfully',
|
||||
);
|
||||
}
|
||||
|
||||
static void _onLoading(BuildContext context) {
|
||||
@ -152,20 +156,7 @@ abstract final class SpaceDetailsDialogHelper {
|
||||
|
||||
static void _onError(BuildContext context, String errorMessage) {
|
||||
Navigator.of(context).pop();
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
context.showFailureSnackbar(errorMessage);
|
||||
}
|
||||
|
||||
static void _onCreateSuccess(
|
||||
@ -176,5 +167,8 @@ abstract final class SpaceDetailsDialogHelper {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
onSuccess?.call(space);
|
||||
context.showSuccessSnackbar(
|
||||
'${space.spaceName} space created successfully',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user