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.

111 lines
3.7 KiB

3 years ago
import 'package:flutter/material.dart';
import 'package:teso/util/SizeConfig.dart';
import 'package:teso/util/consts.dart';
import 'package:time_elapsed/time_elapsed.dart';
buildAlert(
{BuildContext context,
DateTime timestamp,
String description,
Icon icons,
String thumbnail,
String username}) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 25.0),
child: Material(
elevation: 10,
child: Container(
width: MediaQuery.of(context).size.width,
color: Theme.of(context).primaryColor,
child: Row(
children: [
Container(
constraints: BoxConstraints(minHeight: 80, maxHeight: 150),
width: MediaQuery.of(context).size.width -
(MediaQuery.of(context).size.width) * 0.85,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
darkAccent,
accentMain,
],
),
),
child: icons,
),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Wrap(
direction: Axis.horizontal,
runSpacing: 10,
children: [
Icon(
Icons.timer,
size: 15,
),
Text(
TimeElapsed.fromDateTime(timestamp),
style: (TextStyle(
color: Colors.grey,
)),
),
],
),
Container(
width: MediaQuery.of(context).size.width * 0.527,
child: Text(
description,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: SizeConfig.blockSizeHorizontal * 3.5,
),
),
),
Container(),
],
),
),
),
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"),
),
),
),
],
),
),
),
);
}