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.
184 lines
6.7 KiB
184 lines
6.7 KiB
import 'package:flutter/material.dart';
|
|
import 'package:teso/util/SizeConfig.dart';
|
|
import 'package:teso/util/consts.dart';
|
|
|
|
import 'package:teso/Classes/customTesoButton.dart';
|
|
|
|
buildRequest(
|
|
{BuildContext context,
|
|
DateTime timestamp,
|
|
String description,
|
|
Icon icons,
|
|
String thumbnail,
|
|
String username,
|
|
Function approve,
|
|
Function decline}) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 8.0),
|
|
child: Material(
|
|
elevation: 10,
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
color: Theme.of(context).primaryColor,
|
|
height: 120,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Container(
|
|
height: 120,
|
|
width: MediaQuery.of(context).size.width -
|
|
(MediaQuery.of(context).size.width) * 0.90,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
darkAccent,
|
|
accentMain,
|
|
],
|
|
),
|
|
),
|
|
child: Center(
|
|
child: icons,
|
|
),
|
|
),
|
|
Container(
|
|
height: 120,
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
color: Theme.of(context).primaryColor,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Wrap(
|
|
direction: Axis.horizontal,
|
|
runSpacing: 10,
|
|
children: [
|
|
Icon(
|
|
Icons.timer,
|
|
size: 15,
|
|
),
|
|
Text(
|
|
DateTime.now().difference(timestamp).inMinutes > 60
|
|
? DateTime.now().difference(timestamp).inHours > 24
|
|
? DateTime.now()
|
|
.difference(timestamp)
|
|
.inDays
|
|
.toString() +
|
|
"d"
|
|
: DateTime.now()
|
|
.difference(timestamp)
|
|
.inHours
|
|
.toString() +
|
|
"h"
|
|
: DateTime.now().difference(timestamp).inMinutes ==
|
|
0
|
|
? "now"
|
|
: DateTime.now()
|
|
.difference(timestamp)
|
|
.inMinutes
|
|
.toString() +
|
|
"m",
|
|
style: (TextStyle(
|
|
color: Colors.grey,
|
|
)),
|
|
),
|
|
],
|
|
),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.45,
|
|
child: Text(
|
|
description,
|
|
textAlign: TextAlign.left,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.blockSizeHorizontal * 3.5,
|
|
),
|
|
),
|
|
),
|
|
Container(),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.all(5),
|
|
child: RaisedGradientButton(
|
|
child: Text(
|
|
"Accept",
|
|
style:
|
|
TextStyle(color: Colors.white, fontSize: 13.5),
|
|
),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
accentMain,
|
|
darkAccent,
|
|
//darkAccent,
|
|
],
|
|
),
|
|
onPressed: approve,
|
|
width: 90,
|
|
height: 30,
|
|
),
|
|
),
|
|
Container(
|
|
child: RaisedGradientButton(
|
|
child: Text(
|
|
"Decline",
|
|
style:
|
|
TextStyle(color: Colors.white, fontSize: 13.5),
|
|
),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
accentMain,
|
|
darkAccent,
|
|
//darkAccent,
|
|
],
|
|
),
|
|
onPressed: decline,
|
|
width: 90,
|
|
height: 30,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: (MediaQuery.of(context).size.width) * 0.10,
|
|
color: Theme.of(context).primaryColor,
|
|
child: Align(
|
|
alignment: Alignment.topCenter,
|
|
child: thumbnail == null
|
|
? Container(
|
|
height: 40,
|
|
width: 40,
|
|
color: Color.fromRGBO(0, 0, 0, 0.4),
|
|
child: Center(
|
|
child: Text(
|
|
username.characters
|
|
.characterAt(0)
|
|
.toString()
|
|
.toUpperCase(),
|
|
style: TextStyle(color: Colors.white),
|
|
),
|
|
),
|
|
)
|
|
: FadeInImage(
|
|
height: 40,
|
|
width: 40,
|
|
fit: BoxFit.fill,
|
|
image: NetworkImage(userdpURL + thumbnail),
|
|
placeholder: AssetImage("assets/images/tesoDP/dp1.png"),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|