TF-2304 Add action sheet for sort selecting
(cherry picked from commit 5b962fcc42bf92b063d62057b174debfa9c9caa4)
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class EmailSortByCupertinoActionSheetActionBuilderStyle {
|
||||||
|
static const double space = 16.0;
|
||||||
|
|
||||||
|
static const EdgeInsetsDirectional iconPadding = EdgeInsetsDirectional.only(end: space);
|
||||||
|
|
||||||
|
static const backgroundColor = Colors.white;
|
||||||
|
}
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
import 'package:core/presentation/views/bottom_popup/cupertino_action_sheet_no_icon_builder.dart';
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_sort_order_type.dart';
|
||||||
|
import 'package:tmail_ui_user/features/search/email/presentation/styles/email_sort_by_cupertino_action_sheet_action_builder_style.dart';
|
||||||
|
|
||||||
|
class EmailSortByCupertinoActionSheetActionBuilder extends CupertinoActionSheetNoIconBuilder<EmailSortOrderType> {
|
||||||
|
final EmailSortOrderType sortType;
|
||||||
|
final EmailSortOrderType? sortTypeCurrent;
|
||||||
|
final SvgPicture? actionSelected;
|
||||||
|
final Color? bgColor;
|
||||||
|
final EdgeInsets? iconLeftPadding;
|
||||||
|
final EdgeInsets? iconRightPadding;
|
||||||
|
|
||||||
|
EmailSortByCupertinoActionSheetActionBuilder(
|
||||||
|
String actionName,
|
||||||
|
this.sortType,
|
||||||
|
{
|
||||||
|
Key? key,
|
||||||
|
this.sortTypeCurrent,
|
||||||
|
this.actionSelected,
|
||||||
|
this.bgColor,
|
||||||
|
this.iconLeftPadding,
|
||||||
|
this.iconRightPadding,
|
||||||
|
}
|
||||||
|
) : super(actionName);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build() {
|
||||||
|
return Container(
|
||||||
|
color: bgColor ?? EmailSortByCupertinoActionSheetActionBuilderStyle.backgroundColor,
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: PlatformInfo.isWeb ? MaterialStateMouseCursor.clickable : MouseCursor.defer,
|
||||||
|
child: CupertinoActionSheetAction(
|
||||||
|
key: key,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: EmailSortByCupertinoActionSheetActionBuilderStyle.space),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
actionName,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: actionTextStyle()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (sortTypeCurrent == sortType && actionSelected != null)
|
||||||
|
Padding(
|
||||||
|
padding: iconRightPadding ?? EmailSortByCupertinoActionSheetActionBuilderStyle.iconPadding,
|
||||||
|
child: actionSelected!
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (onCupertinoActionSheetActionClick != null) {
|
||||||
|
onCupertinoActionSheetActionClick!(sortType);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user