TF-2116 Add RequestReadReceipt and more option

(cherry picked from commit 5f9eb6b9c78239ffb586eea98feaf3e6c30981f9)
This commit is contained in:
dab246
2023-09-07 19:10:23 +07:00
committed by Dat H. Pham
parent 3809a05a35
commit 655446133c
17 changed files with 354 additions and 44 deletions
@@ -16,14 +16,24 @@ mixin PopupContextMenuActionMixin {
.show();
}
void openPopupMenuAction(BuildContext context, RelativeRect? position, List<PopupMenuEntry> popupMenuItems) async {
void openPopupMenuAction(
BuildContext context,
RelativeRect? position,
List<PopupMenuEntry> popupMenuItems,
{
double? radius,
}
) async {
await showMenu(
context: context,
position: position ?? const RelativeRect.fromLTRB(16, 40, 16, 16),
color: Colors.white,
elevation: 4,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
items: popupMenuItems);
context: context,
position: position ?? const RelativeRect.fromLTRB(16, 40, 16, 16),
color: Colors.white,
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(radius ?? 16))
),
items: popupMenuItems
);
}
Widget buildCancelButton(BuildContext context) {
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
class PopupItemWidgetStyle {
static const double iconSize = 20;
static const double selectedIconSize = 16;
static const double space = 12;
static const double height = 48;
static const EdgeInsetsGeometry padding = EdgeInsets.symmetric(horizontal: 20, vertical: 16);
static const EdgeInsetsGeometry iconSelectedPadding = EdgeInsetsDirectional.only(start: 12);
static const TextStyle labelTextStyle = TextStyle(
fontSize: 17,
fontWeight: FontWeight.normal,
color: Colors.black
);
}
+34 -25
View File
@@ -1,8 +1,8 @@
import 'package:core/core.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:tmail_ui_user/features/base/styles/popup_item_widget_style.dart';
class PopupItemWidget extends StatelessWidget {
@@ -11,7 +11,9 @@ class PopupItemWidget extends StatelessWidget {
final Color? colorIcon;
final double? iconSize;
final TextStyle? styleName;
final EdgeInsets? padding;
final bool? isSelected;
final String? selectedIcon;
final EdgeInsetsGeometry? padding;
final VoidCallback? onCallbackAction;
const PopupItemWidget(
@@ -22,7 +24,9 @@ class PopupItemWidget extends StatelessWidget {
this.colorIcon,
this.iconSize,
this.styleName,
this.isSelected,
this.padding,
this.selectedIcon,
this.onCallbackAction
}
) : super(key: key);
@@ -32,28 +36,33 @@ class PopupItemWidget extends StatelessWidget {
return PointerInterceptor(
child: InkWell(
onTap: onCallbackAction,
child: Padding(
padding: padding ?? const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
child: SizedBox(
child: Row(children: [
SvgPicture.asset(
_iconAction,
width: iconSize ?? 20,
height: iconSize ?? 20,
fit: BoxFit.fill,
colorFilter: colorIcon.asFilter()
),
const SizedBox(width: 12),
Expanded(child: Text(
_nameAction,
style: styleName ?? const TextStyle(
fontSize: 17,
fontWeight: FontWeight.normal,
color: Colors.black
)
)),
])
),
child: Container(
height: PopupItemWidgetStyle.height,
padding: padding,
child: Row(children: [
SvgPicture.asset(
_iconAction,
width: iconSize ?? PopupItemWidgetStyle.iconSize,
height: iconSize ?? PopupItemWidgetStyle.iconSize,
fit: BoxFit.fill,
colorFilter: colorIcon?.asFilter()
),
const SizedBox(width: PopupItemWidgetStyle.space),
Expanded(child: Text(
_nameAction,
style: styleName ?? PopupItemWidgetStyle.labelTextStyle
)),
if (isSelected == true && selectedIcon != null)
Padding(
padding: PopupItemWidgetStyle.iconSelectedPadding,
child: SvgPicture.asset(
selectedIcon!,
width: PopupItemWidgetStyle.selectedIconSize,
height: PopupItemWidgetStyle.selectedIconSize,
fit: BoxFit.fill
),
)
]),
)
),
);