You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

69 lines
2.3 KiB

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:teso/Classes/API%20Clasess/PostedAd.dart';
import 'package:teso/providers/user_provider.dart';
import 'package:teso/util/consts.dart';
import 'package:time_elapsed/time_elapsed.dart';
buildPostTile(BuildContext context, PostedAd postedAd) {
return Consumer<UserProvider>(
builder: (context, value, child) {
return ListTile(
leading: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.black,
width: 1,
)),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(90.0),
topRight: Radius.circular(90.0),
bottomLeft: Radius.circular(90),
bottomRight: Radius.circular(90),
),
child: value.currentUser.thumbnail_dp == null
? Center(
child: Text(
value.currentUser.username.characters
.characterAt(0)
.toString()
.toUpperCase(),
),
)
: FadeInImage(
height: 90,
width: 90,
fit: BoxFit.fill,
image: NetworkImage(
userdpURL + value.currentUser.thumbnail_dp),
placeholder: AssetImage("assets/images/tesoDP/dp1.png"),
),
),
),
title: new RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 14.0,
color: Theme.of(context).primaryColorLight,
),
children: <TextSpan>[
new TextSpan(
text: value.currentUser.username + " ",
style: new TextStyle(fontWeight: FontWeight.bold)),
new TextSpan(
text: postedAd.post.title,
),
],
),
),
subtitle: Text(
TimeElapsed.fromDateTime(postedAd.post.timestamp),
),
);
},
);
}