operation_button.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. ///操作按钮
  4. class OperationButton extends StatelessWidget {
  5. final Widget child;
  6. final String text;
  7. final void Function() onTap;
  8. const OperationButton(
  9. {super.key,
  10. required this.child,
  11. required this.text,
  12. required this.onTap});
  13. @override
  14. Widget build(BuildContext context) {
  15. return GestureDetector(
  16. onTap: onTap,
  17. child: Column(
  18. mainAxisSize: MainAxisSize.min,
  19. children: [
  20. Container(
  21. width: 50.r,
  22. height: 50.r,
  23. alignment: Alignment.center,
  24. decoration: BoxDecoration(
  25. shape: BoxShape.circle, color: Colors.white.withOpacity(0.18)),
  26. child: child,
  27. ),
  28. SizedBox(
  29. height: 10.h,
  30. ),
  31. Container(
  32. padding: EdgeInsets.symmetric(horizontal: 13.w, vertical: 3.h),
  33. decoration: BoxDecoration(
  34. color: Colors.white.withOpacity(0.18),
  35. borderRadius: BorderRadius.circular(30.r)),
  36. child: Text(
  37. text,
  38. style: const TextStyle(color: Colors.white),
  39. ),
  40. ),
  41. ],
  42. ),
  43. );
  44. }
  45. }