handle_view.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * @Author: XianKaiQun
  3. * @Date: 2020-08-28 14:58:44
  4. * @LastEditors : WuWei
  5. * @LastEditTime : 2021-07-13 17:40:04
  6. * @Description:
  7. */
  8. import 'package:flutter/widgets.dart';
  9. import 'package:wisdom_cli/wisdom_cli.dart';
  10. class WHandleView extends StatelessWidget {
  11. const WHandleView({
  12. Key? key,
  13. this.width,
  14. this.height,
  15. this.onTap,
  16. this.onDelete,
  17. this.borderRadius,
  18. this.border,
  19. this.child,
  20. this.color,
  21. }) : super(key: key);
  22. final double? width;
  23. final double? height;
  24. final Function()? onTap;
  25. final Function()? onDelete;
  26. final BorderRadius? borderRadius;
  27. final BoxBorder? border;
  28. final Widget? child;
  29. final Color? color;
  30. @override
  31. Widget build(BuildContext context) {
  32. Widget current = Wisdom(
  33. onTap: onTap,
  34. width: width,
  35. height: height,
  36. border: border,
  37. borderRadius: borderRadius,
  38. alignment: Alignment.center,
  39. color: color,
  40. child: child,
  41. );
  42. if (onDelete != null) {
  43. current = Stack(
  44. clipBehavior: Clip.none,
  45. children: [
  46. Padding(
  47. padding: EdgeInsets.fromLTRB(0, 7.pt, 7.pt, 7.pt),
  48. child: current,
  49. ),
  50. Positioned(
  51. right: 0.pt,
  52. top: 0.pt,
  53. child: WDot.delete(
  54. padding: EdgeInsets.all(1.pt),
  55. onTap: onDelete,
  56. ),
  57. ),
  58. ],
  59. );
  60. }
  61. return current;
  62. }
  63. }