TF-3427 Fix subject was not in print & click outside context menu can not close
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class HighlightSVGIconOnHover extends StatefulWidget {
|
||||
final String icon;
|
||||
final double size;
|
||||
final double borderRadius;
|
||||
final Color? iconColor;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final String? tooltipMessage;
|
||||
|
||||
const HighlightSVGIconOnHover({
|
||||
Key? key,
|
||||
required this.icon,
|
||||
this.size = 20.0,
|
||||
this.borderRadius = 5.0,
|
||||
this.iconColor,
|
||||
this.padding,
|
||||
this.tooltipMessage,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<HighlightSVGIconOnHover> createState() => _HighlightSVGIconOnHoverState();
|
||||
}
|
||||
|
||||
class _HighlightSVGIconOnHoverState extends State<HighlightSVGIconOnHover> {
|
||||
bool _isHovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final child = MouseRegion(
|
||||
onEnter: (_) => setState(() => _isHovered = true),
|
||||
onExit: (_) => setState(() => _isHovered = false),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(widget.borderRadius)),
|
||||
color: _isHovered ? Theme.of(context).hoverColor : null,
|
||||
),
|
||||
padding: widget.padding ?? const EdgeInsets.all(5),
|
||||
child: SvgPicture.asset(
|
||||
widget.icon,
|
||||
width: widget.size,
|
||||
height: widget.size,
|
||||
fit: BoxFit.fill,
|
||||
colorFilter: widget.iconColor?.asFilter(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (widget.tooltipMessage != null) {
|
||||
return Tooltip(
|
||||
message: widget.tooltipMessage,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
}
|
||||
@@ -34,37 +34,40 @@ class PopupItemWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PointerInterceptor(
|
||||
child: InkWell(
|
||||
onTap: onCallbackAction,
|
||||
child: Container(
|
||||
height: PopupItemWidgetStyle.height,
|
||||
constraints: const BoxConstraints(minWidth: PopupItemWidgetStyle.minWidth),
|
||||
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
|
||||
),
|
||||
)
|
||||
]),
|
||||
)
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
onTap: onCallbackAction,
|
||||
child: Container(
|
||||
height: PopupItemWidgetStyle.height,
|
||||
constraints: const BoxConstraints(minWidth: PopupItemWidgetStyle.minWidth),
|
||||
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
|
||||
),
|
||||
)
|
||||
]),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ class PopupMenuOverlayWidget extends StatelessWidget {
|
||||
final double? borderRadius;
|
||||
final Color? backgroundColor;
|
||||
final CustomPopupMenuController? controller;
|
||||
final bool arrangeAsList;
|
||||
final PreferredPosition? position;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const PopupMenuOverlayWidget({
|
||||
Key? key,
|
||||
@@ -20,6 +23,9 @@ class PopupMenuOverlayWidget extends StatelessWidget {
|
||||
this.borderRadius,
|
||||
this.backgroundColor,
|
||||
this.controller,
|
||||
this.position = PreferredPosition.bottom,
|
||||
this.arrangeAsList = false,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -36,14 +42,17 @@ class PopupMenuOverlayWidget extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 12)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Wrap(children: listButtonAction),
|
||||
padding: padding,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: arrangeAsList
|
||||
? IntrinsicWidth(child: Column(children: listButtonAction))
|
||||
: Wrap(children: listButtonAction)
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
pressType: PressType.singleClick,
|
||||
position: PreferredPosition.bottom,
|
||||
position: position,
|
||||
barrierColor: Colors.transparent,
|
||||
arrowSize: 0.0,
|
||||
verticalMargin: 8,
|
||||
|
||||
Reference in New Issue
Block a user