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.6KB

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