chip_button_widget.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import "package:flutter/material.dart";
  2. import "package:photos/theme/ente_theme.dart";
  3. class ChipButtonWidget extends StatelessWidget {
  4. final String label;
  5. final IconData? leadingIcon;
  6. final VoidCallback? onTap;
  7. const ChipButtonWidget(
  8. this.label, {
  9. this.leadingIcon,
  10. this.onTap,
  11. super.key,
  12. });
  13. @override
  14. Widget build(BuildContext context) {
  15. return GestureDetector(
  16. onTap: onTap?.call,
  17. child: Padding(
  18. padding: const EdgeInsets.all(8.0),
  19. child: Row(
  20. mainAxisAlignment: MainAxisAlignment.center,
  21. children: [
  22. leadingIcon != null
  23. ? Icon(
  24. leadingIcon,
  25. size: 17,
  26. )
  27. : const SizedBox.shrink(),
  28. const SizedBox(width: 4),
  29. Padding(
  30. padding: const EdgeInsets.symmetric(horizontal: 4),
  31. child: Text(
  32. label,
  33. style: getEnteTextTheme(context).smallBold,
  34. ),
  35. )
  36. ],
  37. ),
  38. ),
  39. );
  40. }
  41. }