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.
305 lines
10 KiB
305 lines
10 KiB
3 years ago
|
import 'package:cached_network_image/cached_network_image.dart';
|
||
|
import 'package:teso/Classes/TesoUser.dart';
|
||
|
import 'package:teso/util/consts.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
buildHead(
|
||
|
{BuildContext context,
|
||
|
TesoUser user,
|
||
|
String posts,
|
||
|
List friends,
|
||
|
List following,
|
||
|
bool relation,
|
||
|
bool pending,
|
||
|
bool approveRequest,
|
||
|
bool loading,
|
||
|
Function unFriend,
|
||
|
Function approve,
|
||
|
Function cancelRequest,
|
||
|
Function decline}) {
|
||
|
return Container(
|
||
|
color: Theme.of(context).backgroundColor,
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Container(
|
||
|
child: Container(
|
||
|
height: 70.0,
|
||
|
width: 70.0,
|
||
|
decoration: new BoxDecoration(
|
||
|
shape: BoxShape.circle,
|
||
|
color: Colors.grey,
|
||
|
),
|
||
|
child: user.thumbnail_dp == null
|
||
|
? Center(
|
||
|
child: Text(
|
||
|
user.username.characters
|
||
|
.characterAt(0)
|
||
|
.toString()
|
||
|
.toUpperCase(),
|
||
|
),
|
||
|
)
|
||
|
: Container(
|
||
|
width: 70,
|
||
|
height: 70,
|
||
|
decoration: BoxDecoration(
|
||
|
shape: BoxShape.circle,
|
||
|
),
|
||
|
child: ClipRRect(
|
||
|
borderRadius: BorderRadius.only(
|
||
|
topLeft: Radius.circular(40.0),
|
||
|
topRight: Radius.circular(40.0),
|
||
|
bottomLeft: Radius.circular(40),
|
||
|
bottomRight: Radius.circular(40),
|
||
|
),
|
||
|
child: CachedNetworkImage(
|
||
|
imageUrl: userdpURL + user.thumbnail_dp,
|
||
|
imageBuilder: (context, imageProvider) => Image(
|
||
|
height: 70,
|
||
|
width: 70,
|
||
|
fit: BoxFit.fill,
|
||
|
image: imageProvider,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
margin: EdgeInsets.only(
|
||
|
bottom: 10,
|
||
|
top: 10,
|
||
|
),
|
||
|
child: Center(
|
||
|
child: Text(
|
||
|
user.firstname + " " + user.lastname,
|
||
|
style: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
user.description != null
|
||
|
? Container(
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
margin: EdgeInsets.only(
|
||
|
bottom: 10,
|
||
|
),
|
||
|
child: Text(
|
||
|
user.description != null ? user.description : "",
|
||
|
textAlign: TextAlign.center,
|
||
|
style: TextStyle(
|
||
|
fontSize: 12,
|
||
|
color: Colors.grey,
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
: Container(),
|
||
|
Container(
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
margin: EdgeInsets.symmetric(horizontal: 5, vertical: 10),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
children: [
|
||
|
new Wrap(
|
||
|
direction: Axis.vertical,
|
||
|
children: [
|
||
|
Container(
|
||
|
child: Text(
|
||
|
"Posts",
|
||
|
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
child: Text(
|
||
|
posts != null ? posts.toString() : "",
|
||
|
textAlign: TextAlign.center,
|
||
|
style: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
// new Wrap(
|
||
|
// direction: Axis.vertical,
|
||
|
// children: [
|
||
|
// Container(
|
||
|
// child: Text(
|
||
|
// "Following",
|
||
|
// style: TextStyle(color: Colors.grey, fontSize: 12),
|
||
|
// ),
|
||
|
// ),
|
||
|
// Container(
|
||
|
// child: Text(
|
||
|
// following != null ? following.length.toString() : "",
|
||
|
// style: TextStyle(
|
||
|
// fontWeight: FontWeight.bold,
|
||
|
// ),
|
||
|
// ),
|
||
|
// ),
|
||
|
// ],
|
||
|
// ),
|
||
|
new Wrap(
|
||
|
direction: Axis.vertical,
|
||
|
children: [
|
||
|
Container(
|
||
|
child: Text(
|
||
|
"Friends",
|
||
|
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
child: Text(
|
||
|
friends != null ? friends.length.toString() : "",
|
||
|
style: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
// Container(
|
||
|
// width: MediaQuery.of(context).size.width,
|
||
|
// height: 45,
|
||
|
// margin: EdgeInsets.only(bottom: 10),
|
||
|
// child: Wrap(
|
||
|
// spacing: 10,
|
||
|
// alignment: WrapAlignment.center,
|
||
|
// direction: Axis.horizontal,
|
||
|
// children: [
|
||
|
// Visibility(
|
||
|
// visible: loading,
|
||
|
// child: Center(
|
||
|
// child: CupertinoActivityIndicator(
|
||
|
// animating: true,
|
||
|
// radius: 15,
|
||
|
// ),
|
||
|
// ),
|
||
|
// ),
|
||
|
// Visibility(
|
||
|
// visible: approveRequest,
|
||
|
// child: RaisedGradientButton(
|
||
|
// child: Text(
|
||
|
// "Accept Request",
|
||
|
// style: TextStyle(color: Colors.white, fontSize: 14),
|
||
|
// ),
|
||
|
// gradient: LinearGradient(
|
||
|
// begin: Alignment.topCenter,
|
||
|
// end: Alignment.bottomCenter,
|
||
|
// colors: [
|
||
|
// accentMain,
|
||
|
// darkAccent,
|
||
|
// //darkAccent,
|
||
|
// ],
|
||
|
// ),
|
||
|
// onPressed: approve,
|
||
|
// width: 120,
|
||
|
// height: 45,
|
||
|
// ),
|
||
|
// ),
|
||
|
// Visibility(
|
||
|
// visible: approveRequest,
|
||
|
// child: RaisedGradientButton(
|
||
|
// child: Text(
|
||
|
// "Decline Request",
|
||
|
// style: TextStyle(color: Colors.white, fontSize: 14),
|
||
|
// ),
|
||
|
// gradient: LinearGradient(
|
||
|
// begin: Alignment.topCenter,
|
||
|
// end: Alignment.bottomCenter,
|
||
|
// colors: [
|
||
|
// accentMain,
|
||
|
// darkAccent,
|
||
|
// //darkAccent,
|
||
|
// ],
|
||
|
// ),
|
||
|
// onPressed: decline,
|
||
|
// width: 120,
|
||
|
// height: 45,
|
||
|
// ),
|
||
|
// ),
|
||
|
// Visibility(
|
||
|
// visible: relation,
|
||
|
// child: Container(
|
||
|
// width: 95,
|
||
|
// height: 40,
|
||
|
// //padding: EdgeInsets.all(10),
|
||
|
// //margin: EdgeInsets.all(7),
|
||
|
// decoration: BoxDecoration(
|
||
|
// borderRadius: BorderRadius.all(Radius.circular(30.0)),
|
||
|
// border: Border.all(
|
||
|
// color: accentMain,
|
||
|
// )),
|
||
|
// child: InkWell(
|
||
|
// child: Center(
|
||
|
// child: Text(
|
||
|
// "Unfriend",
|
||
|
// style: TextStyle(color: accentMain, fontSize: 15),
|
||
|
// ),
|
||
|
// ),
|
||
|
// onTap: unFriend,
|
||
|
// ),
|
||
|
// ),
|
||
|
// ),
|
||
|
// Visibility(
|
||
|
// visible: pending,
|
||
|
// child: RaisedGradientButton(
|
||
|
// child: Text(
|
||
|
// "Cancel Request",
|
||
|
// style: TextStyle(color: Colors.white, fontSize: 14),
|
||
|
// ),
|
||
|
// gradient: LinearGradient(
|
||
|
// begin: Alignment.topCenter,
|
||
|
// end: Alignment.bottomCenter,
|
||
|
// colors: [
|
||
|
// accentMain,
|
||
|
// darkAccent,
|
||
|
// //darkAccent,
|
||
|
// ],
|
||
|
// ),
|
||
|
// onPressed: cancelRequest,
|
||
|
// width: 120,
|
||
|
// height: 45,
|
||
|
// ),
|
||
|
// ),
|
||
|
// Visibility(
|
||
|
// visible: relation,
|
||
|
// child: RaisedGradientButton(
|
||
|
// child: Text(
|
||
|
// "Message",
|
||
|
// style: TextStyle(color: Colors.white, fontSize: 14),
|
||
|
// ),
|
||
|
// gradient: LinearGradient(
|
||
|
// begin: Alignment.topCenter,
|
||
|
// end: Alignment.bottomCenter,
|
||
|
// colors: [
|
||
|
// accentMain,
|
||
|
// darkAccent,
|
||
|
// ],
|
||
|
// ),
|
||
|
// onPressed: () => Navigator.pushReplacement(
|
||
|
// context,
|
||
|
// PageTransition(
|
||
|
// child: ChatScreen(
|
||
|
// user: user,
|
||
|
// ),
|
||
|
// type: PageTransitionType.fade,
|
||
|
// ),
|
||
|
// ),
|
||
|
// width: 100,
|
||
|
// height: 45,
|
||
|
// ),
|
||
|
// ),
|
||
|
// ],
|
||
|
// ),
|
||
|
// )
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|