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.
 
 

241 lines
10 KiB

import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';
import 'package:teso/Pages/PageWidgets/CoinPurchase/SilverPurchase.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:teso/Pages/Sub_Pages/PersonalSub/Referral.dart';
import 'package:teso/providers/user_provider.dart';
import 'package:teso/util/consts.dart';
class SilverTransaction extends StatefulWidget {
@override
_SilverTransactionState createState() => _SilverTransactionState();
}
class _SilverTransactionState extends State<SilverTransaction> {
@override
Widget build(BuildContext context) {
return Consumer<UserProvider>(builder: (context, value, child) {
if (value.currentUser == null) {
return Center(
child: CupertinoActivityIndicator(
animating: true,
radius: 15,
),
);
} else {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65),
child: Container(
child: Material(
elevation: 5.0,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Wrap(
direction: Axis.horizontal,
children: [
Container(
child: Container(
height: 50.0,
width: 50.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
),
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50.0),
topRight: Radius.circular(50.0),
bottomLeft: Radius.circular(50),
bottomRight: Radius.circular(50),
),
child: Image(
height: 50,
width: 50,
fit: BoxFit.fill,
image: AssetImage(
"assets/images/silver1.png"),
),
),
),
),
),
Container(
// width: 40,
height: 40,
child: Center(
child: Text(
value.currentUser != null
? value.currentUser.silver
: "00",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
// InkWell(
// onTap: () => showModalBottomSheet(
// context: context,
// isScrollControlled: true,
// enableDrag: true,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// top: Radius.circular(20.0)),
// ),
// builder: (BuildContext bc) {
// return SilverPurchase();
// },
// ),
// child: Container(
// height: 35,
// padding: EdgeInsets.all(10),
// margin: EdgeInsets.all(7),
// decoration: BoxDecoration(
// color: Theme.of(context).backgroundColor,
// borderRadius:
// BorderRadius.all(Radius.circular(20.0)),
// border: Border.all(
// color: Theme.of(context).accentColor,
// )),
// child: Text(
// "PURCHASE COINS",
// style: TextStyle(
// color: Theme.of(context).accentColor,
// ),
// ),
// ),
// ),
],
),
],
),
),
),
),
),
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(
top: 10,
),
//height: MediaQuery.of(context).size.height - 120,
child: Center(
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
buildSilverCard(
context: context,
goldEquivalent: "1",
cashEquivalent: "1",
funds: "100",
user: value.currentUser,
),
buildSilverCard(
context: context,
goldEquivalent: "2",
cashEquivalent: "2",
funds: "240",
user: value.currentUser,
),
buildSilverCard(
context: context,
goldEquivalent: "3",
cashEquivalent: "3",
funds: "380",
user: value.currentUser,
),
buildSilverCard(
context: context,
goldEquivalent: "4",
cashEquivalent: "4",
funds: "520",
user: value.currentUser,
),
buildSilverCard(
context: context,
goldEquivalent: "5",
cashEquivalent: "5",
funds: "660",
user: value.currentUser,
)
],
),
),
SizedBox(height: 14.0),
Container(
width: MediaQuery.of(context).size.width,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Earn more silver coins and use them for in-app purchases.",
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).primaryColorLight,
),
),
),
),
),
Container(
height: 35,
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
color: tesoBlue,
borderRadius:
BorderRadius.all(Radius.circular(20.0)),
border: Border.all(
color: tesoBlue,
)),
child: InkWell(
onTap: () => showDialog(
context: context,
builder: (BuildContext context) => Referrals(),
),
child: Text(
"REFER AND EARN",
style: TextStyle(
color: Colors.white,
),
),
),
),
],
),
),
),
),
),
);
}
});
}
}