tag_widget.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import 'package:flutter/material.dart';
  2. class TagWidget extends StatelessWidget {
  3. final String label;
  4. final Color borderColor;
  5. final Color textColor;
  6. final Color backgroundColor;
  7. final EdgeInsets padding;
  8. final EdgeInsets margin;
  9. final double? width;
  10. final double? height;
  11. const TagWidget({
  12. Key? key,
  13. required this.label,
  14. this.borderColor = Colors.blue,
  15. this.textColor = Colors.white,
  16. this.backgroundColor = Colors.blue,
  17. this.padding = const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
  18. this.margin = const EdgeInsets.only(right: 8.0),
  19. this.width,
  20. this.height,
  21. }) : super(key: key);
  22. @override
  23. Widget build(BuildContext context) {
  24. return Container(
  25. decoration: BoxDecoration(
  26. color: backgroundColor,
  27. border: Border.all(color: borderColor),
  28. borderRadius: BorderRadius.only(
  29. topLeft: Radius.circular(4),
  30. bottomLeft: Radius.circular(4),
  31. topRight: Radius.circular(88),
  32. bottomRight: Radius.circular(88),
  33. ),
  34. ),
  35. width: width,
  36. height: height,
  37. margin: margin,
  38. child: Row(
  39. mainAxisSize: MainAxisSize.min,
  40. children: [
  41. Padding(
  42. padding: padding,
  43. child: Text(
  44. label,
  45. style: TextStyle(color: textColor),
  46. ),
  47. ),
  48. ],
  49. ),
  50. );
  51. }
  52. }