item_facility_book.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import 'package:cs_resources/theme/app_colors_theme.dart';
  2. import 'package:domain/entity/facility_index_entity.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:shared/utils/log_utils.dart';
  5. import 'package:shared/utils/util.dart';
  6. import 'package:widgets/ext/ex_widget.dart';
  7. import 'package:widgets/my_load_image.dart';
  8. import 'package:widgets/my_text_view.dart';
  9. /// 设施的Book的Item
  10. class FacilityBookItem extends StatelessWidget {
  11. final int index;
  12. final FacilityIndexEntity item;
  13. const FacilityBookItem({
  14. required this.index,
  15. required this.item,
  16. });
  17. @override
  18. Widget build(BuildContext context) {
  19. Log.d("width:${Utils.extractWidthHeight(item.icon)?[0]} height:${Utils.extractWidthHeight(item.icon)?[1]}");
  20. return Container(
  21. width: double.infinity,
  22. height: 80,
  23. margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
  24. padding: const EdgeInsets.symmetric(horizontal: 20),
  25. decoration: BoxDecoration(
  26. color: context.appColors.whiteBG,
  27. borderRadius: BorderRadius.circular(6.0), // 圆角
  28. ),
  29. child: Row(
  30. mainAxisSize: MainAxisSize.max,
  31. crossAxisAlignment: CrossAxisAlignment.center,
  32. children: [
  33. MyLoadImage(
  34. item.icon,
  35. //因为传的是xxhdpi的图片,故要除以3才是显示的宽高
  36. width: Utils.extractWidthHeight(item.icon) == null ? 40 : Utils.extractWidthHeight(item.icon)![0] / 3,
  37. height: Utils.extractWidthHeight(item.icon) == null ? 40 : Utils.extractWidthHeight(item.icon)![1] / 3,
  38. ),
  39. MyTextView(
  40. item.name ?? "-",
  41. marginLeft: 17,
  42. fontSize: 15.5,
  43. textColor: context.appColors.textBlack,
  44. isFontMedium: true,
  45. ).expanded(),
  46. ],
  47. ),
  48. );
  49. }
  50. }