import 'package:cached_network_image/cached_network_image.dart'; import 'package:teso/Classes/TesoUser.dart'; import 'package:flutter/material.dart'; import 'package:teso/util/consts.dart'; buildFriend(BuildContext context, TesoUser friend) { return Container( width: MediaQuery.of(context).size.width, height: 65, child: Row( children: [ Container( margin: EdgeInsets.symmetric(horizontal: 10), height: 45.0, width: 45.0, decoration: new BoxDecoration( shape: BoxShape.circle, color: Colors.grey[400], ), child: ClipRRect( borderRadius: BorderRadius.circular(30.0), child: friend.thumbnail_dp == null ? Center( child: Text( friend.username!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( imageUrl: userdpURL + friend.thumbnail_dp!, imageBuilder: (context, imageProvider) => Image( height: 90, width: 90, fit: BoxFit.fill, image: imageProvider, ), ), ), ), Container( width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Column( children: [ Container( width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), height: 30, child: Container( width: double.infinity, height: double.infinity, child: Align( alignment: Alignment.centerLeft, child: Text( friend.username!, style: TextStyle( fontSize: 12.5, color: Colors.grey, ), textAlign: TextAlign.left, ), ), ), ), Container( width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Text( friend.firstname! + " " + friend.lastname!, textAlign: TextAlign.left, ), ), // Divider(), ], ), ), ], ), ); }