record_common_item.dart 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import 'package:flutter/material.dart';
  2. class RecordCommonItem extends StatelessWidget {
  3. final String itemName;
  4. final String itemValue;
  5. final double fontSize;
  6. const RecordCommonItem({
  7. super.key,
  8. required this.itemName,
  9. required this.itemValue,
  10. required this.fontSize,
  11. });
  12. @override
  13. Widget build(BuildContext context) {
  14. return _buildItem(itemName, itemValue, fontSize);
  15. }
  16. Widget _buildItem(String itemName, String itemValue, double fontSize) {
  17. return SizedBox(
  18. child: Text.rich(
  19. TextSpan(
  20. text: '$itemName ',
  21. style: TextStyle(
  22. color: Colors.black38,
  23. fontSize: fontSize,
  24. ),
  25. children: [
  26. TextSpan(
  27. text: itemValue,
  28. style: TextStyle(
  29. color: Colors.black,
  30. fontSize: fontSize,
  31. ),
  32. ),
  33. ],
  34. ),
  35. maxLines: 1, // Set the maximum lines
  36. overflow: TextOverflow.ellipsis, //
  37. ),
  38. );
  39. }
  40. }