import 'package:flutter/widgets.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../models/entities/CardInfo.dart'; class ExtendContentList extends StatelessWidget { final List item; const ExtendContentList({Key? key, required this.item}) : super(key: key); Widget? _image(String? content) { if (null == content || content.isEmpty) return null; return Image.network(content, fit: BoxFit.cover); } Widget? _text(String? content) { if (null == content || content.isEmpty) return null; return Text(content); } @override Widget build(BuildContext context) { return Column( children: item.map((item) { if (item.contentType != 'image') { return Container( padding: EdgeInsets.fromLTRB(0, 20, 0, 10), width: 344.w, child: _text(item.content)); } else { return Container( padding: EdgeInsets.fromLTRB(0, 10, 0, 10), child: _image(item.content), ); } }).toList(), ); } }