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.
310 lines
13 KiB
310 lines
13 KiB
import 'package:flutter/material.dart';
|
|
import 'package:teso/Classes/API Clasess/ProximityCoupon.dart';
|
|
import 'package:teso/Classes/CouponRateCalculator.dart';
|
|
import 'package:teso/util/consts.dart';
|
|
|
|
Positioned buildDummyDiscountCoupon(
|
|
ProximityCoupon img,
|
|
double bottom,
|
|
double right,
|
|
double left,
|
|
double cardWidth,
|
|
double rotation,
|
|
double skew,
|
|
BuildContext context,
|
|
String discount,
|
|
double selectedDiscount) {
|
|
return new Positioned(
|
|
bottom: 60 + bottom,
|
|
child: Container(
|
|
width: (MediaQuery.of(context).size.width * 0.75),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: tesoGold, width: 0.5),
|
|
borderRadius: BorderRadius.only(
|
|
bottomLeft: Radius.circular(20),
|
|
bottomRight: Radius.circular(20),
|
|
topLeft: Radius.circular(20),
|
|
topRight: Radius.circular(20),
|
|
),
|
|
),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.only(
|
|
bottomLeft: Radius.circular(20),
|
|
bottomRight: Radius.circular(20),
|
|
topLeft: Radius.circular(20),
|
|
topRight: Radius.circular(20),
|
|
),
|
|
child: Container(
|
|
width: (MediaQuery.of(context).size.width * 0.75),
|
|
color: Colors.white,
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: (MediaQuery.of(context).size.width * 0.75),
|
|
height: MediaQuery.of(context).size.height * 0.55,
|
|
padding: EdgeInsets.all(8.0),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
image: img.upperLimit < 50.1
|
|
? DecorationImage(
|
|
fit: BoxFit.fill,
|
|
image: AssetImage("assets/images/blue.png"),
|
|
colorFilter: new ColorFilter.mode(
|
|
Color(0xFF0031ed).withOpacity(1.0),
|
|
BlendMode.multiply),
|
|
)
|
|
: DecorationImage(
|
|
fit: BoxFit.fill,
|
|
image: AssetImage("assets/images/redBack.png"),
|
|
colorFilter: new ColorFilter.mode(
|
|
Colors.red.withOpacity(1.0), BlendMode.multiply),
|
|
),
|
|
borderRadius: BorderRadius.only(
|
|
bottomLeft: Radius.circular(80),
|
|
bottomRight: Radius.circular(80),
|
|
),
|
|
),
|
|
child: Stack(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.topLeft,
|
|
child: Row(
|
|
children: [
|
|
Image(
|
|
width: 30,
|
|
image: AssetImage(
|
|
"assets/images/tesoCouponInsignia.png")),
|
|
SizedBox(
|
|
width: 5,
|
|
),
|
|
Text(
|
|
"TESO",
|
|
style: TextStyle(color: Colors.white, fontSize: 15),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.topCenter,
|
|
child: Container(
|
|
margin: EdgeInsets.only(
|
|
top: MediaQuery.of(context).size.width * 0.125,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
img.business.businessName,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 10,
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"VOUCHER",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 25,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.center,
|
|
child: Container(
|
|
height: MediaQuery.of(context).size.width * 0.2,
|
|
padding: EdgeInsets.all(4.5),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.white)),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"ORIGINAL PRICE : GH¢ " +
|
|
img.targetCost.toString(),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
"DISCOUNTED PRICE : GH¢ " +
|
|
(img.targetCost -
|
|
(img.targetCost *
|
|
(img.lowerLimit / 100)))
|
|
.toStringAsFixed(2),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
new Wrap(
|
|
direction: Axis.horizontal,
|
|
children: [
|
|
Text(
|
|
"SILVER COIN COST : ",
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Image(
|
|
width: 20,
|
|
image:
|
|
AssetImage("assets/images/silver1.png"),
|
|
),
|
|
Text(
|
|
CouponRateCalculator.getRate(img.targetCost *
|
|
(img.lowerLimit / 100))
|
|
.toString(),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.bottomCenter,
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: MediaQuery.of(context).size.width * 0.15),
|
|
child: Text(
|
|
img.targetName,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: MediaQuery.of(context).size.width * 0.02,
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.4,
|
|
height: 70,
|
|
padding: EdgeInsets.only(
|
|
top: 5,
|
|
),
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
child: Text(
|
|
"Price : GH¢ " +
|
|
(img.targetCost * (img.lowerLimit / 100))
|
|
.toStringAsFixed(2) +
|
|
" only",
|
|
style: TextStyle(
|
|
color: Colors.red,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
img.condition == 'none'
|
|
? Container()
|
|
: Container(
|
|
child: Text(
|
|
"Condition : " +
|
|
img.condition.replaceAll('"', ""),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 65,
|
|
height: 65,
|
|
padding: EdgeInsets.all(2.5),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: Colors.red,
|
|
),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(80),
|
|
topRight: Radius.circular(80),
|
|
bottomLeft: Radius.circular(80),
|
|
bottomRight: Radius.circular(80),
|
|
),
|
|
),
|
|
child: Container(
|
|
width: 65,
|
|
height: 65,
|
|
padding: EdgeInsets.all(2.5),
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.red,
|
|
border: Border.all(color: Colors.red),
|
|
image: DecorationImage(
|
|
fit: BoxFit.fill,
|
|
image: AssetImage("assets/images/red.png"),
|
|
colorFilter: new ColorFilter.mode(
|
|
Colors.red.withOpacity(0.5), BlendMode.overlay),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Wrap(
|
|
children: [
|
|
Text(
|
|
img.lowerLimit.toString() + "%",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 18.5,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 22,
|
|
),
|
|
child: Text(
|
|
"OFF",
|
|
textAlign: TextAlign.end,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|