import 'package:cached_network_image/cached_network_image.dart'; import 'package:teso/Classes/inbox.dart'; import 'package:flutter/material.dart'; import 'package:time_elapsed/time_elapsed.dart'; import 'package:teso/util/consts.dart'; buildInboxTile(BuildContext context, InboxMessage message, bool read) { return Container( width: MediaQuery.of(context).size.width, height: 80, child: Row( children: [ Container( margin: EdgeInsets.symmetric(horizontal: 10), height: 50.0, width: 50.0, decoration: new BoxDecoration( shape: BoxShape.circle, ), child: ClipRRect( borderRadius: BorderRadius.circular(30.0), child: message.thumbnail == null ? Center( child: Text( message.firstname!.characters .characterAt(0) .toString() .toUpperCase(), ), ) : CachedNetworkImage( imageUrl: userdpURL + message.thumbnail!, imageBuilder: (context, imageProvider) => FadeInImage( height: 90, width: 90, fit: BoxFit.fill, image: imageProvider, placeholder: AssetImage("assets/images/tesoDP/dp1.png"), ), ), ), ), Container( width: MediaQuery.of(context).size.width - 80, margin: EdgeInsets.only( top: 10, ), child: Column( children: [ Row( children: [ 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( message.firstname! + " " + message.surname!, style: TextStyle( fontSize: 12.5, color: Theme.of(context).primaryColorLight, fontWeight: FontWeight.bold, ), textAlign: TextAlign.left, ), ), ), ), Container( width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.35), child: Text( message.message!.length > 73 ? message.message!.substring(0, 73).toString() + "...." : message.message!, textAlign: TextAlign.left, style: TextStyle( fontSize: 11, ), ), ), ], ), Visibility( visible: !read, child: Container( child: Column( children: [ Container( width: 30, height: 30, // padding: EdgeInsets.symmetric(horizontal: 20.0), child: Center( child: Text( TimeElapsed.fromDateTime(message.timestamp!), style: TextStyle( color: Theme.of(context).colorScheme.secondary, ), ), ), ), Material( color: Colors.grey[300], elevation: 10.0, borderRadius: BorderRadius.circular(30.0), shadowColor: Colors.grey, child: Container( width: 10, height: 10, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), color: Theme.of(context).colorScheme.secondary, ), // padding: EdgeInsets.symmetric(horizontal: 20.0), ), ), ], ), ), ), Visibility( visible: read, child: Container( height: 30, child: Center( child: Text( TimeElapsed.fromDateTime(message.timestamp!), ), ), ), ), ], ), Divider(), ], ), ), ], ), ); }