Set default DividerTheme
(cherry picked from commit 9be02961277e990f8ded19106532f9c788eb1d7e)
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
|
||||
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';
|
||||
|
||||
typedef IconWebCallback = void Function();
|
||||
typedef IconWebHasPositionCallback = void Function(RelativeRect);
|
||||
typedef OnTapIconButtonCallbackAction = void Function();
|
||||
typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails tapDetails);
|
||||
|
||||
@@ -51,7 +50,7 @@ Widget buildSVGIconButton({
|
||||
width: iconSize,
|
||||
height: iconSize,
|
||||
fit: BoxFit.fill,
|
||||
colorFilter: iconColor.asFilter(),
|
||||
colorFilter: iconColor?.asFilter(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -76,46 +75,6 @@ Widget buildSVGIconButton({
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildIconWebHasPosition(BuildContext context, {
|
||||
required Widget icon,
|
||||
String? tooltip,
|
||||
IconWebHasPositionCallback? onTapDown,
|
||||
IconWebCallback? onTap,
|
||||
}) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
shape: const CircleBorder(),
|
||||
child: InkWell(
|
||||
onTapDown: (detail) {
|
||||
onTapDown?.call(detail.getPosition(context));
|
||||
},
|
||||
onTap: () => onTap?.call(),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
child: Tooltip(
|
||||
message: tooltip ?? '',
|
||||
child: icon,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTextIcon(String text, {
|
||||
TextStyle? textStyle,
|
||||
EdgeInsetsGeometry? padding,
|
||||
IconWebCallback? onTap,
|
||||
}) {
|
||||
return Material(
|
||||
shape: const CircleBorder(),
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.all(10),
|
||||
child: Text(text, style: textStyle ?? const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.lineItemListColor))),
|
||||
onTap: () => onTap?.call()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTextButton(String text, {
|
||||
TextStyle? textStyle,
|
||||
double? width,
|
||||
@@ -188,72 +147,4 @@ Widget buildButtonWrapText(String name, {
|
||||
color: Colors.white)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildIconWithLowerMenu(
|
||||
Widget icon,
|
||||
BuildContext context,
|
||||
List<PopupMenuEntry> popupMenuItems,
|
||||
Function(BuildContext context, RelativeRect? position,
|
||||
List<PopupMenuEntry> popupMenuItems)
|
||||
openPopUpMenuAction,
|
||||
) {
|
||||
return Builder(
|
||||
builder: (iconContext) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return buildIconWeb(
|
||||
icon: icon,
|
||||
onTap: () {
|
||||
// get size and position of the icon
|
||||
RenderBox box = iconContext.findRenderObject() as RenderBox;
|
||||
Offset iconTopLeft = box.localToGlobal(Offset.zero);
|
||||
final iconSize = box.size;
|
||||
|
||||
// calculate the popup position for popup menu action
|
||||
final popupLeft = iconTopLeft.dx + iconSize.width * 3 / 4;
|
||||
final popupTop = iconTopLeft.dy + iconSize.height * 4 / 5;
|
||||
final popupRight = screenSize.width - popupLeft;
|
||||
final popupBottom = screenSize.height - popupRight;
|
||||
final position = RelativeRect.fromLTRB(
|
||||
popupLeft, popupTop, popupRight, popupBottom);
|
||||
|
||||
openPopUpMenuAction(context, position, popupMenuItems);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildIconWithUpperMenu(
|
||||
Widget icon,
|
||||
BuildContext context,
|
||||
List<PopupMenuEntry> popupMenuItems,
|
||||
Function(BuildContext context, RelativeRect? position,
|
||||
List<PopupMenuEntry> popupMenuItems)
|
||||
openPopUpMenuAction,
|
||||
) {
|
||||
return Builder(
|
||||
builder: (iconContext) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return buildIconWeb(
|
||||
icon: icon,
|
||||
onTap: () {
|
||||
// get size and position of the icon
|
||||
RenderBox box = iconContext.findRenderObject() as RenderBox;
|
||||
Offset iconTopLeft = box.localToGlobal(Offset.zero);
|
||||
final iconSize = box.size;
|
||||
|
||||
// calculate the popup position for popup menu action
|
||||
final popupLeft = iconTopLeft.dx + iconSize.width * 3 / 4;
|
||||
final popupTop = iconTopLeft.dy - iconSize.height * 9 / 5;
|
||||
final popupRight = screenSize.width - popupLeft;
|
||||
final popupBottom = screenSize.height - popupRight;
|
||||
final position = RelativeRect.fromLTRB(
|
||||
popupLeft, popupTop, popupRight, popupBottom);
|
||||
|
||||
openPopUpMenuAction(context, position, popupMenuItems);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user