Files
PiliPlus/lib/plugin/pl_player/widgets/common_btn.dart
bggRGjQaUbCoE 5f8dc76891 opt mouse control
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-09-28 17:39:58 +08:00

42 lines
898 B
Dart

import 'package:flutter/material.dart';
class ComBtn extends StatelessWidget {
final Widget icon;
final VoidCallback? onTap;
final VoidCallback? onLongPress;
final VoidCallback? onSecondaryTap;
final double width;
final double height;
final String? tooltip;
const ComBtn({
super.key,
required this.icon,
this.onTap,
this.onLongPress,
this.onSecondaryTap,
this.width = 34,
this.height = 34,
this.tooltip,
});
@override
Widget build(BuildContext context) {
final child = SizedBox(
width: width,
height: height,
child: GestureDetector(
onTap: onTap,
onLongPress: onLongPress,
onSecondaryTap: onSecondaryTap,
behavior: HitTestBehavior.opaque,
child: icon,
),
);
if (tooltip != null) {
return Tooltip(message: tooltip, child: child);
}
return child;
}
}