TF-234 Implement delete a mailbox
This commit is contained in:
@@ -41,11 +41,13 @@ export 'presentation/views/context_menu/context_menu_header_builder.dart';
|
||||
export 'presentation/views/context_menu/simple_context_menu_action_builder.dart';
|
||||
export 'presentation/views/dialog/loading_dialog_builder.dart';
|
||||
export 'presentation/views/dialog/downloading_file_dialog_builder.dart';
|
||||
export 'presentation/views/dialog/confirmation_dialog_builder.dart';
|
||||
export 'presentation/views/background/background_widget_builder.dart';
|
||||
export 'presentation/views/html_viewer/html_content_viewer_widget.dart';
|
||||
export 'presentation/views/floating_button/scrolling_floating_button_animated.dart';
|
||||
export 'presentation/views/bottom_popup/cupertino_action_sheet_action_builder.dart';
|
||||
export 'presentation/views/bottom_popup/cupertino_action_sheet_builder.dart';
|
||||
export 'presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder.dart';
|
||||
|
||||
// Resources
|
||||
export 'presentation/resources/assets_paths.dart';
|
||||
|
||||
@@ -80,6 +80,11 @@ extension AppColor on Color {
|
||||
static const colorInputBackgroundErrorVerifyName = Color(0xFFFAEBEB);
|
||||
static const colorInputBackgroundCreateMailbox = Color(0xFFF2F3F5);
|
||||
static const colorHintInputCreateMailbox= Color(0xFFA9B4C2);
|
||||
static const colorMessageConfirmDialog= Color(0xFF6D7885);
|
||||
static const colorActionDeleteConfirmDialog= Color(0xFFE64646);
|
||||
static const colorActionCancelDialog= Color(0xFF007AFF);
|
||||
static const colorMessageDialog= Color(0xFF222222);
|
||||
static const colorConfirmActionDialog= Color(0xFFF2F2F2);
|
||||
|
||||
static const mapGradientColor = [
|
||||
[Color(0xFF21D4FD), Color(0xFFB721FF)],
|
||||
|
||||
@@ -82,6 +82,8 @@ class ImagePaths {
|
||||
String get icSendToast => _getImagePath('ic_send_toast.svg');
|
||||
String get icClearTextSearch => _getImagePath('ic_clear_text_search.svg');
|
||||
String get icRenameMailbox => _getImagePath('ic_rename_mailbox.svg');
|
||||
String get icDeleteToast => _getImagePath('ic_delete_toast.svg');
|
||||
String get icRemoveDialog => _getImagePath('ic_remove_dialog.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef OnConfirmActionClick = void Function();
|
||||
typedef OnCancelActionClick = void Function();
|
||||
|
||||
class ConfirmationDialogActionSheetBuilder {
|
||||
|
||||
final BuildContext _context;
|
||||
|
||||
String? _messageText;
|
||||
String? _confirmText;
|
||||
String? _cancelText;
|
||||
OnConfirmActionClick?_onConfirmActionClick;
|
||||
OnCancelActionClick? _onCancelActionClick;
|
||||
|
||||
ConfirmationDialogActionSheetBuilder(this._context);
|
||||
|
||||
void onConfirmAction(String confirmText, OnConfirmActionClick onConfirmActionClick) {
|
||||
_onConfirmActionClick = onConfirmActionClick;
|
||||
_confirmText = confirmText;
|
||||
}
|
||||
|
||||
void onCancelAction(String cancelText, OnCancelActionClick onCancelActionClick) {
|
||||
_onCancelActionClick = onCancelActionClick;
|
||||
_cancelText = cancelText;
|
||||
}
|
||||
|
||||
void messageText(String message) {
|
||||
_messageText = message;
|
||||
}
|
||||
|
||||
void show() {
|
||||
showCupertinoModalPopup(
|
||||
context: _context,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
builder: (context) => CupertinoActionSheet(
|
||||
actions: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 10),
|
||||
color: Colors.white,
|
||||
child: CupertinoActionSheetAction(
|
||||
child: Text(
|
||||
_messageText ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 14, color: AppColor.colorMessageConfirmDialog)),
|
||||
onPressed: () => {},
|
||||
)
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: CupertinoActionSheetAction(
|
||||
child: Text(
|
||||
_confirmText ?? '',
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: AppColor.colorActionDeleteConfirmDialog)),
|
||||
onPressed: () => _onConfirmActionClick?.call(),
|
||||
)
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
child: Text(
|
||||
_cancelText ?? '',
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: AppColor.colorActionCancelDialog)),
|
||||
onPressed: () => _onCancelActionClick?.call(),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class CupertinoActionSheetBuilder {
|
||||
_actionTiles.addAll(tiles);
|
||||
}
|
||||
|
||||
void build() {
|
||||
void show() {
|
||||
showCupertinoModalPopup(
|
||||
context: _context,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
typedef OnConfirmButtonAction = void Function();
|
||||
typedef OnCancelButtonAction = void Function();
|
||||
typedef OnCloseButtonAction = void Function();
|
||||
|
||||
class ConfirmDialogBuilder {
|
||||
final ImagePaths _imagePath;
|
||||
|
||||
Key? _key;
|
||||
String _title = '';
|
||||
String _content = '';
|
||||
String _confirmText = '';
|
||||
String _cancelText = '';
|
||||
Widget? _iconWidget;
|
||||
|
||||
OnConfirmButtonAction? _onConfirmButtonAction;
|
||||
OnCancelButtonAction? _onCancelButtonAction;
|
||||
OnCloseButtonAction? _onCloseButtonAction;
|
||||
|
||||
ConfirmDialogBuilder(this._imagePath);
|
||||
|
||||
void key(Key key) {
|
||||
_key = key;
|
||||
}
|
||||
|
||||
void title(String title) {
|
||||
_title = title;
|
||||
}
|
||||
|
||||
void content(String content) {
|
||||
_content = content;
|
||||
}
|
||||
|
||||
void addIcon(Widget? icon) {
|
||||
_iconWidget = icon;
|
||||
}
|
||||
|
||||
void onConfirmButtonAction(String confirmText, OnConfirmButtonAction? onConfirmButtonAction) {
|
||||
_confirmText = confirmText;
|
||||
_onConfirmButtonAction = onConfirmButtonAction;
|
||||
}
|
||||
|
||||
void onCancelButtonAction(String cancelText, OnCancelButtonAction? onCancelButtonAction) {
|
||||
_cancelText = cancelText;
|
||||
_onCancelButtonAction = onCancelButtonAction;
|
||||
}
|
||||
|
||||
void onCloseButtonAction(OnCloseButtonAction? onCloseButtonAction) {
|
||||
_onCloseButtonAction = onCloseButtonAction;
|
||||
}
|
||||
|
||||
Widget build() {
|
||||
return Dialog(
|
||||
key: _key,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
insetPadding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0),
|
||||
child: Container(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.zero,
|
||||
width: 400,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
child: Wrap(children: [
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.only(top: 16, right: 16),
|
||||
onPressed: () => _onCloseButtonAction?.call(),
|
||||
icon: SvgPicture.asset(_imagePath.icCloseMailbox, width: 30, height: 30, fit: BoxFit.fill))),
|
||||
if (_iconWidget != null)
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24),
|
||||
alignment: Alignment.center,
|
||||
child: _iconWidget,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 12),
|
||||
child: Center(
|
||||
child: Text(
|
||||
_title,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 20.0, color: AppColor.colorActionDeleteConfirmDialog, fontWeight: FontWeight.w500)
|
||||
)
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
child: Center(
|
||||
child: Text(_content,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 17.0, color: AppColor.colorMessageDialog)
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 16, left: 16, right: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildButton(name: _cancelText, action: _onCancelButtonAction)
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildButton(
|
||||
name: _confirmText,
|
||||
bgColor: AppColor.colorConfirmActionDialog,
|
||||
nameColor: AppColor.colorActionDeleteConfirmDialog,
|
||||
action: _onConfirmButtonAction)
|
||||
)
|
||||
]
|
||||
))
|
||||
])
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildButton({
|
||||
String? name, Color? nameColor, Color? bgColor, Function? action
|
||||
}) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 48,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => action?.call(),
|
||||
style: ButtonStyle(
|
||||
foregroundColor: MaterialStateProperty.resolveWith<Color>(
|
||||
(Set<MaterialState> states) => bgColor ?? AppColor.colorTextButton),
|
||||
backgroundColor: MaterialStateProperty.resolveWith<Color>(
|
||||
(Set<MaterialState> states) => bgColor ?? AppColor.colorTextButton),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(width: 0, color: bgColor ?? AppColor.colorTextButton),
|
||||
)),
|
||||
padding: MaterialStateProperty.resolveWith<EdgeInsets>(
|
||||
(Set<MaterialState> states) => EdgeInsets.symmetric(horizontal: 16)),
|
||||
elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) => 0)),
|
||||
child: Text(name ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: nameColor ?? Colors.white)),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user