1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- // 自定义的模块项 Widget
- import 'package:domain/entity/home_module.dart';
- import 'package:flutter/material.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- class ModuleItem extends StatelessWidget {
- final HomeModule item;
- final VoidCallback onTap;
- ModuleItem(this.item, this.onTap);
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: onTap,
- child: Container(
- decoration: BoxDecoration(
- color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
- borderRadius: BorderRadius.circular(7.5), // 设置圆角
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // 模块的名称
- MyTextView(
- item.moduleName,
- textColor: Colors.white,
- isTextEllipsis: true,
- maxLines: 2,
- isFontBold: true,
- marginLeft: 20,
- marginRight: 20,
- marginTop: 20,
- fontSize: 17,
- ),
- Center(
- child: MyAssetImage(item.moduleIconPath, width: item.iconWidth, height: item.iconHeight),
- ).expanded(),
- ],
- ),
- ),
- );
- }
- }
|