status.dart 971 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/material.dart';
  2. /// 状态标签
  3. class StatusLabel extends StatelessWidget {
  4. const StatusLabel({Key? key, this.title, this.color}) : super(key: key);
  5. /// 状态名称
  6. final String? title;
  7. /// 状态颜色
  8. final Color? color;
  9. /// 状态外边框
  10. final BorderRadius? borderRadius = const BorderRadius.only(
  11. topLeft: Radius.circular(15.0),
  12. bottomLeft: Radius.circular(15.0),
  13. );
  14. @override
  15. Widget build(BuildContext context) {
  16. return Container(
  17. height: 30,
  18. padding: const EdgeInsets.only(
  19. left: 14,
  20. right: 10,
  21. ),
  22. decoration: BoxDecoration(
  23. borderRadius: borderRadius,
  24. color: color ?? Colors.amberAccent,
  25. ),
  26. child: Center(
  27. widthFactor: 1,
  28. child: Text(
  29. title!,
  30. style: const TextStyle(
  31. height: 1,
  32. fontSize: 16,
  33. color: Colors.white,
  34. ),
  35. ),
  36. ),
  37. );
  38. }
  39. }