import 'package:comunic/models/comment.dart'; import 'package:comunic/models/user.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:comunic/ui/widgets/network_image_widget.dart'; import 'package:flutter/material.dart'; /// Single comment tile /// /// @author Pierre HUBERT class CommentTile extends StatelessWidget { final Comment comment; final User user; const CommentTile({Key key, this.comment, this.user}) : assert(comment != null), assert(user != null), super(key: key); @override Widget build(BuildContext context) { return ListTile( leading: AccountImageWidget( user: user, ), title: Text(user.displayName,), subtitle: _buildCommentContent(), ); } Widget _buildCommentContent() { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // Comment image Container( child: comment.hasImage ? NetworkImageWidget( url: comment.imageURL, allowFullScreen: true, height: 100.0, ) : null, ), // Comment text Container( child: comment.hasContent ? Text(comment.content,) : null, ), ], ); } }