main_item_module.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // 自定义的模块项 Widget
  2. import 'package:domain/entity/home_module.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:widgets/ext/ex_widget.dart';
  5. import 'package:widgets/my_load_image.dart';
  6. import 'package:widgets/my_text_view.dart';
  7. class ModuleItem extends StatelessWidget {
  8. final HomeModule item;
  9. final VoidCallback onTap;
  10. ModuleItem(this.item, this.onTap);
  11. @override
  12. Widget build(BuildContext context) {
  13. return GestureDetector(
  14. onTap: onTap,
  15. child: Container(
  16. decoration: BoxDecoration(
  17. color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  18. borderRadius: BorderRadius.circular(7.5), // 设置圆角
  19. ),
  20. child: Column(
  21. crossAxisAlignment: CrossAxisAlignment.start,
  22. children: [
  23. // 模块的名称
  24. MyTextView(
  25. item.moduleName,
  26. textColor: Colors.white,
  27. isTextEllipsis: true,
  28. maxLines: 2,
  29. isFontBold: true,
  30. margin: 20,
  31. fontSize: 17,
  32. ).constrained(minHeight: 80),
  33. Center(
  34. child: MyAssetImage(item.moduleIconPath, width: item.iconWidth, height: item.iconHeight),
  35. ),
  36. ],
  37. ),
  38. ),
  39. );
  40. }
  41. }