-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-2101 Add `recovering messages loading banner
(cherry picked from commit 3771756)
- Loading branch information
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
...mailbox_dashboard/presentation/widgets/recover_deleted_message_loading_banner_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import 'package:core/presentation/extensions/color_extension.dart'; | ||
import 'package:core/presentation/state/failure.dart'; | ||
import 'package:core/presentation/state/success.dart'; | ||
import 'package:core/presentation/utils/responsive_utils.dart'; | ||
import 'package:core/utils/app_logger.dart'; | ||
import 'package:dartz/dartz.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:tmail_ui_user/features/email/domain/state/get_restored_deleted_message_state.dart'; | ||
import 'package:tmail_ui_user/features/email/domain/state/restore_deleted_message_state.dart'; | ||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; | ||
|
||
class RecoverDeletedMessageLoadingBannerWidget extends StatelessWidget { | ||
final Either<Failure, Success> viewState; | ||
final Widget horizontalLoadingWidget; | ||
final ResponsiveUtils responsiveUtils; | ||
|
||
const RecoverDeletedMessageLoadingBannerWidget({ | ||
super.key, | ||
required this.viewState, | ||
required this.horizontalLoadingWidget, | ||
required this.responsiveUtils, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return viewState.fold( | ||
(failure) { | ||
log('RecoverDeletedMessageLoadingBannerWidget:: failure $failure'); | ||
return const SizedBox.shrink(); | ||
|
||
}, | ||
(success) { | ||
if (success is RestoreDeletedMessageLoading | ||
|| success is RestoreDeletedMessageSuccess | ||
|| success is GetRestoredDeletedMessageLoading | ||
) { | ||
return Padding( | ||
padding: EdgeInsets.only( | ||
top: responsiveUtils.isDesktop(context) ? 16 : 0, | ||
right: 16, | ||
bottom: responsiveUtils.isDesktop(context) ? 0 : 16, | ||
), | ||
child: Container( | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: 16, | ||
vertical: 12, | ||
), | ||
decoration: const ShapeDecoration( | ||
color: Colors.white, | ||
shape: RoundedRectangleBorder( | ||
side: BorderSide( | ||
width: 1, | ||
color: AppColor.colorBorderBodyThread, | ||
), | ||
borderRadius: BorderRadius.all(Radius.circular(14)), | ||
) | ||
), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
AppLocalizations.of(context).bannerProgressingRecoveryMessage, | ||
style: const TextStyle( | ||
fontSize: 15, | ||
fontWeight: FontWeight.w400, | ||
color: AppColor.primaryColor, | ||
), | ||
), | ||
const SizedBox(height: 12), | ||
horizontalLoadingWidget | ||
], | ||
), | ||
), | ||
); | ||
} else { | ||
return const SizedBox.shrink(); | ||
} | ||
} | ||
); | ||
} | ||
} |