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.
308 lines
13 KiB
308 lines
13 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
|
|
import 'package:teso/util/consts.dart';
|
|
import 'package:teso/Classes/API Clasess/CouponDetails.dart';
|
|
|
|
class DetailPage extends StatefulWidget {
|
|
final CouponDetails type;
|
|
const DetailPage({Key key, this.type}) : super(key: key);
|
|
@override
|
|
_DetailPageState createState() => new _DetailPageState(type: type);
|
|
}
|
|
|
|
enum AppBarBehavior { normal, pinned, floating, snapping }
|
|
|
|
class _DetailPageState extends State<DetailPage> with TickerProviderStateMixin {
|
|
AnimationController _containerController;
|
|
Animation<double> width;
|
|
Animation<double> heigth;
|
|
CouponDetails type;
|
|
_DetailPageState({this.type});
|
|
double _appBarHeight = 256.0;
|
|
AppBarBehavior _appBarBehavior = AppBarBehavior.pinned;
|
|
|
|
@override
|
|
void initState() {
|
|
_containerController = new AnimationController(
|
|
duration: new Duration(milliseconds: 2000), vsync: this);
|
|
super.initState();
|
|
width = new Tween<double>(
|
|
begin: 200.0,
|
|
end: 220.0,
|
|
).animate(
|
|
new CurvedAnimation(
|
|
parent: _containerController,
|
|
curve: Curves.ease,
|
|
),
|
|
);
|
|
heigth = new Tween<double>(
|
|
begin: 400.0,
|
|
end: 400.0,
|
|
).animate(
|
|
new CurvedAnimation(
|
|
parent: _containerController,
|
|
curve: Curves.ease,
|
|
),
|
|
);
|
|
heigth.addListener(() {
|
|
setState(() {
|
|
if (heigth.isCompleted) {}
|
|
});
|
|
});
|
|
_containerController.forward();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_containerController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
timeDilation = 0.7;
|
|
return new Theme(
|
|
data: new ThemeData(
|
|
brightness: Brightness.light,
|
|
// primaryColor: const Color.fromRGBO(106, 94, 175, 1.0),
|
|
platform: Theme.of(context).platform,
|
|
),
|
|
child: new Container(
|
|
width: width.value,
|
|
height: heigth.value,
|
|
//color: const Color.fromRGBO(106, 94, 175, 1.0),
|
|
child: new Hero(
|
|
tag: type.couponId,
|
|
child: new Card(
|
|
color: Colors.transparent,
|
|
child: new Container(
|
|
alignment: Alignment.center,
|
|
width: width.value,
|
|
height: heigth.value,
|
|
decoration: new BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: new BorderRadius.circular(10.0),
|
|
),
|
|
child: new Stack(
|
|
alignment: AlignmentDirectional.bottomCenter,
|
|
children: <Widget>[
|
|
new CustomScrollView(
|
|
shrinkWrap: false,
|
|
slivers: <Widget>[
|
|
new SliverAppBar(
|
|
elevation: 0.0,
|
|
forceElevated: true,
|
|
leading: new IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: new Icon(
|
|
Icons.arrow_back,
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
size: 30.0,
|
|
),
|
|
),
|
|
expandedHeight: _appBarHeight,
|
|
pinned: _appBarBehavior == AppBarBehavior.pinned,
|
|
floating: _appBarBehavior == AppBarBehavior.floating ||
|
|
_appBarBehavior == AppBarBehavior.snapping,
|
|
snap: _appBarBehavior == AppBarBehavior.snapping,
|
|
backgroundColor: Theme.of(context).backgroundColor,
|
|
flexibleSpace: new FlexibleSpaceBar(
|
|
title: Container(
|
|
// padding: EdgeInsets.all(5),
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 40,
|
|
decoration: new BoxDecoration(
|
|
color: Color.fromRGBO(0, 0, 0, 0.4),
|
|
),
|
|
child: Align(
|
|
alignment: Alignment.bottomCenter,
|
|
child: new Text(
|
|
type.targetProduct.productName,
|
|
// style: TextStyle(
|
|
// // color: Theme.of(context).accentColor),
|
|
),
|
|
),
|
|
),
|
|
//),
|
|
background: new Stack(
|
|
fit: StackFit.expand,
|
|
children: <Widget>[
|
|
new Container(
|
|
width: width.value,
|
|
height: _appBarHeight,
|
|
decoration: new BoxDecoration(
|
|
image: DecorationImage(
|
|
image: NetworkImage(productURL +
|
|
type.targetProduct.productImage),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
new SliverList(
|
|
delegate: new SliverChildListDelegate(<Widget>[
|
|
new Container(
|
|
color: Colors.white,
|
|
child: new Padding(
|
|
padding: const EdgeInsets.all(35.0),
|
|
child: new Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
new Container(
|
|
padding: new EdgeInsets.only(bottom: 20.0),
|
|
alignment: Alignment.center,
|
|
decoration: new BoxDecoration(
|
|
color: Colors.white,
|
|
border: new Border(
|
|
bottom: new BorderSide(
|
|
color: Colors.black12))),
|
|
child: new Wrap(
|
|
direction: Axis.horizontal,
|
|
children: <Widget>[
|
|
new Row(
|
|
children: <Widget>[
|
|
new Icon(
|
|
Icons.price_change_sharp,
|
|
color: Theme.of(context)
|
|
.colorScheme
|
|
.secondary,
|
|
),
|
|
new Padding(
|
|
padding:
|
|
const EdgeInsets.all(8.0),
|
|
child: new Text("GH¢ " +
|
|
type.targetProduct.unitPrice
|
|
.toString()),
|
|
)
|
|
],
|
|
),
|
|
new Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: new Text(
|
|
type.worth.toString() + "% off"),
|
|
),
|
|
new Row(
|
|
children: <Widget>[
|
|
new Icon(
|
|
Icons.store,
|
|
color: Theme.of(context)
|
|
.colorScheme
|
|
.secondary,
|
|
),
|
|
new Padding(
|
|
padding:
|
|
const EdgeInsets.all(8.0),
|
|
child: new Text(
|
|
type.issuer.businessName),
|
|
)
|
|
],
|
|
),
|
|
new Row(
|
|
children: <Widget>[
|
|
new Icon(
|
|
Icons.map,
|
|
color: Theme.of(context)
|
|
.colorScheme
|
|
.secondary,
|
|
),
|
|
new Padding(
|
|
padding:
|
|
const EdgeInsets.all(8.0),
|
|
child: new Text("15 MILES"),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
new Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 16.0, bottom: 8.0),
|
|
child: new Text(
|
|
"Product Description",
|
|
style: new TextStyle(
|
|
fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
new Text(type.targetProduct.productDesc),
|
|
new Container(
|
|
margin: new EdgeInsets.only(top: 25.0),
|
|
padding: new EdgeInsets.only(
|
|
top: 5.0, bottom: 10.0),
|
|
height: 120.0,
|
|
decoration: new BoxDecoration(
|
|
color: Colors.white,
|
|
border: new Border(
|
|
top: new BorderSide(
|
|
color: Colors.black12),
|
|
),
|
|
),
|
|
),
|
|
new Container(
|
|
height: 100.0,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
],
|
|
),
|
|
new Container(
|
|
width: 600.0,
|
|
height: 80.0,
|
|
decoration: new BoxDecoration(
|
|
color: Color.fromRGBO(0, 0, 0, 0.4),
|
|
),
|
|
alignment: Alignment.center,
|
|
child: new Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
new TextButton(
|
|
onPressed: () {},
|
|
child: new Container(
|
|
height: 60.0,
|
|
width: 130.0,
|
|
alignment: Alignment.center,
|
|
decoration: new BoxDecoration(
|
|
color: Colors.red,
|
|
borderRadius: new BorderRadius.circular(60.0),
|
|
),
|
|
child: new Text(
|
|
"Not Interested",
|
|
style: new TextStyle(color: Colors.white),
|
|
),
|
|
)),
|
|
new TextButton(
|
|
onPressed: () {},
|
|
child: new Container(
|
|
height: 60.0,
|
|
width: 130.0,
|
|
alignment: Alignment.center,
|
|
decoration: new BoxDecoration(
|
|
color: accentMain,
|
|
borderRadius: new BorderRadius.circular(60.0),
|
|
),
|
|
child: new Text(
|
|
"Interested",
|
|
style: new TextStyle(color: Colors.white),
|
|
),
|
|
))
|
|
],
|
|
))
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|