chip_button_widget.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import "package:flutter/material.dart";
  2. import "package:photos/theme/ente_theme.dart";
  3. ///https://www.figma.com/file/SYtMyLBs5SAOkTbfMMzhqt/ente-Visual-Design?node-id=8119%3A59513&t=gQa1to5jY89Qk1k7-4
  4. class ChipButtonWidget extends StatelessWidget {
  5. final String? label;
  6. final IconData? leadingIcon;
  7. final VoidCallback? onTap;
  8. final bool noChips;
  9. const ChipButtonWidget(
  10. this.label, {
  11. this.leadingIcon,
  12. this.onTap,
  13. this.noChips = false,
  14. super.key,
  15. });
  16. @override
  17. Widget build(BuildContext context) {
  18. return GestureDetector(
  19. onTap: onTap?.call,
  20. child: Container(
  21. width: noChips ? double.infinity : null,
  22. decoration: BoxDecoration(
  23. color: getEnteColorScheme(context).fillFaint,
  24. borderRadius: const BorderRadius.all(Radius.circular(4)),
  25. ),
  26. child: Padding(
  27. padding: const EdgeInsets.all(8.0),
  28. child: Row(
  29. mainAxisSize: MainAxisSize.min,
  30. mainAxisAlignment: MainAxisAlignment.center,
  31. children: [
  32. leadingIcon != null
  33. ? Icon(
  34. leadingIcon,
  35. size: 17,
  36. )
  37. : const SizedBox.shrink(),
  38. const SizedBox(width: 4),
  39. Padding(
  40. padding: const EdgeInsets.symmetric(horizontal: 4),
  41. child: Text(
  42. label ?? "",
  43. style: getEnteTextTheme(context).smallBold,
  44. ),
  45. )
  46. ],
  47. ),
  48. ),
  49. ),
  50. );
  51. }
  52. }