rounded_button.dart 746 B

123456789101112131415161718192021222324252627282930313233
  1. import 'package:flutter/material.dart';
  2. class RoundedButton extends StatelessWidget {
  3. final VoidCallback? press;
  4. final String? title;
  5. final Size? size;
  6. const RoundedButton({
  7. Key? key,
  8. this.press,
  9. this.title,
  10. this.size,
  11. }) : super(key: key);
  12. @override
  13. Widget build(BuildContext context) {
  14. return ConstrainedBox(
  15. constraints: BoxConstraints(
  16. minWidth: 100,
  17. maxWidth: size?.width ?? double.infinity,
  18. minHeight: 50,
  19. maxHeight: size?.height ?? double.infinity,
  20. ),
  21. child: Container(
  22. margin: const EdgeInsets.symmetric(vertical: 10),
  23. child: TextButton(
  24. child: Text(title ?? ''),
  25. onPressed: press,
  26. ),
  27. ),
  28. );
  29. }
  30. }