You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.7KB

  1. import 'package:flutter/material.dart';
  2. import '../../../themes/styles_text.dart';
  3. class SecondButton extends StatelessWidget {
  4. final IconData? leftIcon;
  5. final Function onPressed;
  6. final String title;
  7. final Color? color;
  8. final Color? textColor;
  9. final Color? borderColor;
  10. final double? width;
  11. final double? height;
  12. const SecondButton({
  13. super.key,
  14. required this.onPressed,
  15. this.leftIcon,
  16. required this.title,
  17. this.color,
  18. this.textColor,
  19. this.borderColor,
  20. this.width,
  21. this.height,
  22. });
  23. @override
  24. Widget build(BuildContext context) {
  25. return GestureDetector(
  26. onTap: () {
  27. onPressed();
  28. },
  29. child: Container(
  30. width: width,
  31. height: height,
  32. padding: EdgeInsets.all(7),
  33. margin: EdgeInsets.symmetric(horizontal: 8),
  34. decoration: BoxDecoration(
  35. borderRadius: BorderRadius.circular(10),
  36. border: Border.all(
  37. color: borderColor ?? Colors.white,
  38. width: 2,
  39. ),
  40. color: color ?? Colors.white,
  41. ),
  42. child: Row(
  43. mainAxisSize: MainAxisSize.min,
  44. mainAxisAlignment: MainAxisAlignment.center,
  45. children: [
  46. leftIcon != null
  47. ? Icon(
  48. leftIcon,
  49. size: 16,
  50. color: textColor ?? Colors.grey.shade500,
  51. )
  52. : const SizedBox.shrink(),
  53. const SizedBox(
  54. width: 4,
  55. ),
  56. Text(
  57. title,
  58. style: StylesText.body5.copyWith(color: textColor ?? Colors.white),
  59. ),
  60. ],
  61. ),
  62. ),
  63. );
  64. }
  65. }