mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
33 lines
689 B
Dart
33 lines
689 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:toolbox/core/utils/function.dart';
|
|
|
|
extension WidgetX on Widget {
|
|
Widget padding(EdgeInsetsGeometry padding) {
|
|
return Padding(padding: padding, child: this);
|
|
}
|
|
|
|
Widget expanded({int flex = 1}) {
|
|
return Expanded(flex: flex, child: this);
|
|
}
|
|
|
|
Widget center() {
|
|
return Center(child: this);
|
|
}
|
|
|
|
Widget tap({
|
|
VoidCallback? onTap,
|
|
bool disable = false,
|
|
VoidCallback? onLongTap,
|
|
VoidCallback? onDoubleTap,
|
|
}) {
|
|
if (disable) return this;
|
|
|
|
return InkWell(
|
|
onTap: () => Funcs.throttle(onTap),
|
|
onLongPress: onLongTap,
|
|
onDoubleTap: onDoubleTap,
|
|
child: this,
|
|
);
|
|
}
|
|
}
|