review bonus
This commit is contained in:
parent
f2f8bddedf
commit
9786bcdfce
|
|
@ -7,7 +7,7 @@ import 'DebugHelper.dart';
|
||||||
class DataManager{
|
class DataManager{
|
||||||
static int ClientVersion = 2;
|
static int ClientVersion = 2;
|
||||||
|
|
||||||
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/";
|
static const String API_ENDPOINT = "http://vps.playpoolstudios.com/faucet/api/v2/";
|
||||||
static Map<String,String> Settings = {};
|
static Map<String,String> Settings = {};
|
||||||
|
|
||||||
static List<dynamic> AllGames = [];
|
static List<dynamic> AllGames = [];
|
||||||
|
|
@ -104,14 +104,14 @@ class DataManager{
|
||||||
Debug.Log("err044 : $UserJson");
|
Debug.Log("err044 : $UserJson");
|
||||||
LinkedGamesJson = [];
|
LinkedGamesJson = [];
|
||||||
NonLinkedGamesJson = [];
|
NonLinkedGamesJson = [];
|
||||||
if (UserJson['linkedGames']
|
if (UserJson['linked_games']
|
||||||
.toString()
|
.toString()
|
||||||
.length < 3) {
|
.length < 3) {
|
||||||
NonLinkedGamesJson = AllGames;
|
NonLinkedGamesJson = AllGames;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Map<String, dynamic>> linkedGames = jsonDecode(
|
List<Map<String, dynamic>> linkedGames = jsonDecode(
|
||||||
UserJson['linkedGames']).cast<Map<String, dynamic>>();
|
UserJson['linked_games']).cast<Map<String, dynamic>>();
|
||||||
|
|
||||||
AllGames.forEach((element) {
|
AllGames.forEach((element) {
|
||||||
bool foundLink = false;
|
bool foundLink = false;
|
||||||
|
|
@ -325,6 +325,31 @@ class DataManager{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<int> Review() async{
|
||||||
|
var loginResponse = null;
|
||||||
|
try {
|
||||||
|
loginResponse = (await http.post(
|
||||||
|
Uri.parse('${DataManager.API_ENDPOINT}review.php'),
|
||||||
|
body: <String, String>{
|
||||||
|
"username": username,
|
||||||
|
"password": password
|
||||||
|
}));
|
||||||
|
Debug.LogResponse(loginResponse.body.toString(),src: "review.php");
|
||||||
|
|
||||||
|
try{
|
||||||
|
DataManager.UserJson = jsonDecode(loginResponse.body.toString());
|
||||||
|
await DataManager.GetGamesProgress();
|
||||||
|
return 0;
|
||||||
|
}catch(e){
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Debug.LogError("Error while review $e");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Future<List<dynamic>> GetWithdrawalHistory() async{
|
static Future<List<dynamic>> GetWithdrawalHistory() async{
|
||||||
Map<String,String> body = <String, String>{
|
Map<String,String> body = <String, String>{
|
||||||
|
|
|
||||||
537
lib/home.dart
537
lib/home.dart
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:external_app_launcher/external_app_launcher.dart';
|
||||||
import 'package:fhub/backend/DataManager.dart';
|
import 'package:fhub/backend/DataManager.dart';
|
||||||
import 'package:fhub/backend/DebugHelper.dart';
|
import 'package:fhub/backend/DebugHelper.dart';
|
||||||
import 'package:fhub/backend/Dialogs.dart';
|
import 'package:fhub/backend/Dialogs.dart';
|
||||||
|
|
@ -13,6 +14,7 @@ import 'package:fhub/welcome.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import 'backend/helpers.dart';
|
import 'backend/helpers.dart';
|
||||||
|
|
@ -35,19 +37,22 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
|
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) async{
|
subscription = Connectivity()
|
||||||
|
.onConnectivityChanged
|
||||||
|
.listen((ConnectivityResult result) async {
|
||||||
// Got a new connectivity status!
|
// Got a new connectivity status!
|
||||||
try{
|
try {
|
||||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||||
Debug.Log(connectivityResult);
|
Debug.Log(connectivityResult);
|
||||||
if(connectivityResult != ConnectivityResult.mobile && connectivityResult != ConnectivityResult.mobile && connectivityResult != ConnectivityResult.ethernet){
|
if (connectivityResult != ConnectivityResult.mobile &&
|
||||||
Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_)=>OfflinePage(id:0)));
|
connectivityResult != ConnectivityResult.mobile &&
|
||||||
|
connectivityResult != ConnectivityResult.ethernet) {
|
||||||
|
Navigator.of(context).pushReplacement(
|
||||||
|
MaterialPageRoute(builder: (_) => OfflinePage(id: 0)));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}catch(e){
|
} catch (e) {}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,20 +71,17 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
super.didChangeAppLifecycleState(state);
|
super.didChangeAppLifecycleState(state);
|
||||||
// Debug.Log(state);
|
// Debug.Log(state);
|
||||||
|
|
||||||
if(state == AppLifecycleState.resumed){
|
if (state == AppLifecycleState.resumed) {
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh()async{
|
void Refresh() async {
|
||||||
await DataManager.GrabOnce();
|
await DataManager.GrabOnce();
|
||||||
|
|
||||||
setState(() {
|
setState(() {});
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void kickstartAnimations() async {
|
void kickstartAnimations() async {
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
|
|
||||||
|
|
@ -111,12 +113,12 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
},
|
},
|
||||||
bottomNav: [
|
bottomNav: [
|
||||||
BottomNavBarItem(
|
BottomNavBarItem(
|
||||||
icon: Icons.home,
|
icon: Icons.people,
|
||||||
active: selectedPageId == 0,
|
active: selectedPageId == 4,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
TitleText = "Home";
|
TitleText = "Share";
|
||||||
selectedPageId = 0;
|
selectedPageId = 4;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -129,6 +131,16 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
selectedPageId = 3;
|
selectedPageId = 3;
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
BottomNavBarItem(
|
||||||
|
icon: Icons.home,
|
||||||
|
active: selectedPageId == 0,
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
TitleText = "Home";
|
||||||
|
selectedPageId = 0;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
BottomNavBarItem(
|
BottomNavBarItem(
|
||||||
icon: Icons.wallet,
|
icon: Icons.wallet,
|
||||||
active: selectedPageId == 1,
|
active: selectedPageId == 1,
|
||||||
|
|
@ -191,6 +203,8 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
return games();
|
return games();
|
||||||
case 2:
|
case 2:
|
||||||
return settings();
|
return settings();
|
||||||
|
case 4:
|
||||||
|
return share();
|
||||||
default:
|
default:
|
||||||
return home();
|
return home();
|
||||||
}
|
}
|
||||||
|
|
@ -261,7 +275,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
GlassButton(
|
GlassButton(
|
||||||
color: Colors.lightBlueAccent,
|
color: Colors.lightBlueAccent,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedPageId = 3;
|
selectedPageId = 3;
|
||||||
|
|
@ -310,7 +324,9 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(15.0),
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Install a game from the list below and Link it to FaucetHub(FH) to Start Earning!",style: TextStyle(color: Colors.blue.withGreen(150).withRed(100)),
|
"Install a game from the list below and Link it to FaucetHub(FH) to Start Earning!",
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.blue.withGreen(150).withRed(100)),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
@ -337,15 +353,13 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
Widget GameCard({required int index, required List<dynamic> list}) {
|
Widget GameCard({required int index, required List<dynamic> list}) {
|
||||||
return GlassCard(
|
return GlassCard(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async{
|
onTap: () async {
|
||||||
await Navigator.of(context).push(MaterialPageRoute(
|
await Navigator.of(context).push(MaterialPageRoute(
|
||||||
builder: (BuildContext context) =>
|
builder: (BuildContext context) =>
|
||||||
GameInfoPage(gameJson: list[index])));
|
GameInfoPage(gameJson: list[index])));
|
||||||
|
|
||||||
await DataManager.GrabOnce();
|
await DataManager.GrabOnce();
|
||||||
setState(() {
|
setState(() {});
|
||||||
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(12),
|
padding: EdgeInsets.all(12),
|
||||||
|
|
@ -363,9 +377,11 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
width: 50,
|
width: 50,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
child: CachedNetworkImage(imageUrl: list[index]['icon'],)
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: list[index]['icon'],
|
||||||
|
)
|
||||||
// child: Image.network(list[index]['icon'])
|
// child: Image.network(list[index]['icon'])
|
||||||
)),
|
)),
|
||||||
Icon(Helpers.GetIconForCrypto(list[index]['coin']))
|
Icon(Helpers.GetIconForCrypto(list[index]['coin']))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -414,138 +430,290 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
),
|
),
|
||||||
Text('~ \$${DataManager.currentEarnings.toStringAsFixed(2)} ',
|
Text('~ \$${DataManager.currentEarnings.toStringAsFixed(2)} ',
|
||||||
style: TextStyle(fontSize: 50)),
|
style: TextStyle(fontSize: 50)),
|
||||||
|
SizedBox(
|
||||||
SizedBox(height: 20,),
|
height: 20,
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
GlassButton(onTap: (){
|
GlassButton(
|
||||||
if(DataManager.currentEarnings <= 1){
|
onTap: () {
|
||||||
Dialogs.showAlertDialog(context, "Not Enough To Withdraw", "You need atleast \$1 to initiate a withdraw.");
|
if (DataManager.currentEarnings <= 1) {
|
||||||
return;
|
Dialogs.showAlertDialog(
|
||||||
}
|
context,
|
||||||
|
"Not Enough To Withdraw",
|
||||||
|
"You need atleast \$1 to initiate a withdraw.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!DataManager.UserJson['wd_address'].toString().contains("@")){
|
if (!DataManager.UserJson['wd_address']
|
||||||
Dialogs.showAlertDialog(context, "Invalid Withdrawal Address", "Please enter a valid email address for coinbase address. Your earnings will be sent to that address via coinbase");
|
.toString()
|
||||||
return;
|
.contains("@")) {
|
||||||
}
|
Dialogs.showAlertDialog(
|
||||||
|
context,
|
||||||
|
"Invalid Withdrawal Address",
|
||||||
|
"Please enter a valid email address for coinbase address. Your earnings will be sent to that address via coinbase");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Navigator.of(context).push(wdRoute);
|
Navigator.of(context).push(wdRoute);
|
||||||
}, child: Text("Withdraw"),height: 40, width: 200, color: Colors.greenAccent),
|
},
|
||||||
GlassButton(onTap: (){
|
child: Text("Withdraw"),
|
||||||
Navigator.of(context).push(MaterialPageRoute(
|
height: 40,
|
||||||
builder: (BuildContext context) =>
|
width: 200,
|
||||||
WithdrawalHistoryPage()));
|
color: Colors.greenAccent),
|
||||||
}, child: Icon(Icons.history), width: 60, height: 40)
|
GlassButton(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
|
builder: (BuildContext context) =>
|
||||||
|
WithdrawalHistoryPage()));
|
||||||
|
},
|
||||||
|
child: Icon(Icons.history),
|
||||||
|
width: 60,
|
||||||
|
height: 40)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(DataManager.currentEarnings <=0) ? Container() : Column(children: [
|
(DataManager.currentEarnings <= 0)
|
||||||
SizedBox(
|
? Container()
|
||||||
height: 30,
|
: Column(children: [
|
||||||
),
|
SizedBox(
|
||||||
Row(
|
height: 30,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: [
|
Row(
|
||||||
Text("Sort earnings by "),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
SizedBox(
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
GlassCard(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 15),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
Text("Sort earnings by "),
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
sortByGames = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: GlassCard(
|
|
||||||
highlighted: sortByGames,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: 8, horizontal: 20),
|
|
||||||
child: Text("Game"),
|
|
||||||
))),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5,
|
width: 20,
|
||||||
),
|
),
|
||||||
InkWell(
|
GlassCard(
|
||||||
onTap: () {
|
child: Padding(
|
||||||
setState(() {
|
padding: const EdgeInsets.symmetric(
|
||||||
sortByGames = false;
|
vertical: 8.0, horizontal: 15),
|
||||||
});
|
child: Row(
|
||||||
},
|
children: [
|
||||||
child: GlassCard(
|
InkWell(
|
||||||
highlighted: !sortByGames,
|
onTap: () {
|
||||||
child: Padding(
|
setState(() {
|
||||||
padding: EdgeInsets.symmetric(
|
sortByGames = true;
|
||||||
vertical: 8, horizontal: 20),
|
});
|
||||||
child: Text("Crypto"),
|
},
|
||||||
))),
|
child: GlassCard(
|
||||||
|
highlighted: sortByGames,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 8, horizontal: 20),
|
||||||
|
child: Text("Game"),
|
||||||
|
))),
|
||||||
|
SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
sortByGames = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: GlassCard(
|
||||||
|
highlighted: !sortByGames,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 8, horizontal: 20),
|
||||||
|
child: Text("Crypto"),
|
||||||
|
))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
SizedBox(
|
||||||
],
|
height: 10,
|
||||||
),
|
),
|
||||||
SizedBox(
|
GlassCard(
|
||||||
height: 10,
|
child: Padding(
|
||||||
),
|
padding: const EdgeInsets.all(16.0),
|
||||||
GlassCard(
|
child: Column(
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(16.0),
|
sortByGames
|
||||||
child: Column(
|
? ListView.builder(
|
||||||
children: [
|
shrinkWrap: true,
|
||||||
sortByGames
|
controller: scrollController,
|
||||||
? ListView.builder(
|
itemCount: DataManager.GamesEarnings.length,
|
||||||
shrinkWrap: true,
|
itemBuilder: (BuildContext context, int index) {
|
||||||
controller: scrollController,
|
String gameName = DataManager.GamesEarnings.keys
|
||||||
itemCount: DataManager.GamesEarnings.length,
|
.elementAt(index);
|
||||||
itemBuilder: (BuildContext context, int index) {
|
dynamic GameJson =
|
||||||
String gameName =
|
Helpers.GetGameFromCode(gameName);
|
||||||
DataManager.GamesEarnings.keys.elementAt(index);
|
if (GameJson == null) {
|
||||||
dynamic GameJson = Helpers.GetGameFromCode(gameName);
|
Debug.LogError(
|
||||||
if (GameJson == null) {
|
("Error getting game json from ${gameName}. returned:\n$GameJson"));
|
||||||
Debug.LogError(
|
return GlassCard(
|
||||||
("Error getting game json from ${gameName}. returned:\n$GameJson"));
|
child: Padding(
|
||||||
return GlassCard(
|
padding: EdgeInsets.all(16),
|
||||||
child: Padding(
|
child: Text(
|
||||||
padding: EdgeInsets.all(16),
|
"Error",
|
||||||
child: Text(
|
textAlign: TextAlign.center,
|
||||||
"Error",
|
),
|
||||||
textAlign: TextAlign.center,
|
));
|
||||||
),
|
}
|
||||||
));
|
double amount = Helpers.SatsToCoin(DataManager
|
||||||
}
|
.GamesEarnings.values
|
||||||
double amount = Helpers.SatsToCoin(DataManager
|
.elementAt(index));
|
||||||
.GamesEarnings.values
|
|
||||||
.elementAt(index));
|
|
||||||
|
|
||||||
return WalletGameListItem(GameJson, amount);
|
return WalletGameListItem(GameJson, amount);
|
||||||
})
|
})
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
itemCount: DataManager.CryptoEarnings.length,
|
itemCount: DataManager.CryptoEarnings.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return WalletCurrencyListItem(
|
return WalletCurrencyListItem(DataManager
|
||||||
DataManager.CryptoEarnings.keys.elementAt(index));
|
.CryptoEarnings.keys
|
||||||
},
|
.elementAt(index));
|
||||||
)
|
},
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
))
|
),
|
||||||
])
|
))
|
||||||
|
])
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextEditingController TxtRefId = TextEditingController();
|
||||||
|
|
||||||
|
Widget share() {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
GlassCard(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text("Referral Program", style: TextStyle(fontSize: 18)),
|
||||||
|
SizedBox(width: 10,),
|
||||||
|
InkWell(child: Container(padding: EdgeInsets.all(5),child: Icon(Icons.help),),
|
||||||
|
onTap: (){
|
||||||
|
Dialogs.showAlertDialog(context, "Referral Program", "Share your Referral ID among your friends.\nFor each submission of your Referral ID, You'll receive a Reward!");
|
||||||
|
},)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
// Text("Earn 0.00000500 ETH for sharing with each friend."),//${DataManager.Settings['ref_reward']}
|
||||||
|
Text("Earn"),
|
||||||
|
SizedBox(height: 5,),
|
||||||
|
Text("0.00000100 BTC", style: TextStyle(fontWeight: FontWeight.bold,color: Colors.greenAccent,fontSize: 16)),
|
||||||
|
Text("For Sharing with each Friend"),
|
||||||
|
|
||||||
|
SizedBox(height: 30,),
|
||||||
|
Text("Your Referral ID"),
|
||||||
|
InkWell(
|
||||||
|
onTap: (){
|
||||||
|
Share.share('Join this platform with my referral ${DataManager.UserJson['id']}\nhttps://play.google.com/store/apps/details?id=com.Xperience.FaucetHub');
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(DataManager.UserJson['id'].toString(),style: TextStyle(fontSize: 50,fontWeight: FontWeight.bold),),
|
||||||
|
SizedBox(width: 15,),
|
||||||
|
Icon(Icons.share,size: 40)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
GlassButton(onTap: (){
|
||||||
|
if(DataManager.UserJson["refer"] != "0"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AlertDialog alert = AlertDialog(
|
||||||
|
backgroundColor: Color(0xFF1F1F1F),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)),
|
||||||
|
title: Text("Enter a Referral",textAlign: TextAlign.center,),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text("Enter your friends Referral ID",textAlign: TextAlign.center,),
|
||||||
|
TextField(controller: refController,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: Text("Submit"),
|
||||||
|
onPressed: () async{
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Dialogs.waiting();
|
||||||
|
await Future.delayed(const Duration(seconds: 3));
|
||||||
|
Dialogs.hide();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text("Cancel"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
showDialog(context: context, builder: (BuildContext context){return alert;});
|
||||||
|
}, child: Text((DataManager.UserJson["refer"] == "0") ? "Use Referral" : "Already Reffered to ${DataManager.UserJson["refer"]}"), width: 200,height: 40, color: Colors.greenAccent),
|
||||||
|
SizedBox(height: 10,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 20,),
|
||||||
|
InkWell(
|
||||||
|
onTap: () async{
|
||||||
|
|
||||||
|
await LaunchApp.openApp(
|
||||||
|
androidPackageName: 'https://play.google.com/store/apps/details?id=com.Xperience.FaucetHub',
|
||||||
|
// openStore: false
|
||||||
|
);
|
||||||
|
await DataManager.Review();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: GlassCard(child: Container(padding: EdgeInsets.all(10),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text("Review on Playstore", style: TextStyle(fontSize: 18)),
|
||||||
|
SizedBox(width: 10,),
|
||||||
|
Container(padding: EdgeInsets.all(5),child: Icon(Icons.star)),
|
||||||
|
Text("5"),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
(DataManager.UserJson["review"] == "0") ? Text("Get 0.00000300 BTC", style: TextStyle(color: Colors.greenAccent, fontWeight: FontWeight.bold)) : Container()
|
||||||
|
],
|
||||||
|
),)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditingController refController = TextEditingController();
|
||||||
|
|
||||||
Widget WalletGameListItem(dynamic GameJson, double amount) {
|
Widget WalletGameListItem(dynamic GameJson, double amount) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(3.0),
|
padding: const EdgeInsets.all(3.0),
|
||||||
|
|
@ -604,56 +772,84 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditingController TxtCoinbaseAddress = TextEditingController();
|
TextEditingController TxtCoinbaseAddress = TextEditingController();
|
||||||
Widget settings() {
|
Widget settings() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
GlassCard(child: AnimatedSize(
|
GlassCard(
|
||||||
|
child: AnimatedSize(
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
child: Padding(padding: EdgeInsets.all(15), child: Column(
|
child: Padding(
|
||||||
children: [
|
padding: EdgeInsets.all(15),
|
||||||
Row(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Text("Coinbase Address"),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
InkWell(onTap: (){Dialogs.ShowCoinbaseDialog(context);},child: Icon(Icons.help))
|
children: [
|
||||||
],
|
Text("Coinbase Address"),
|
||||||
),
|
InkWell(
|
||||||
TextField(controller: TxtCoinbaseAddress, onChanged: (e){setState(() {
|
onTap: () {
|
||||||
|
Dialogs.ShowCoinbaseDialog(context);
|
||||||
});},),
|
},
|
||||||
(TxtCoinbaseAddress.text != (DataManager.UserJson['wd_address'] ?? "") )? Container(padding: EdgeInsets.all(10), child: GlassButton(onTap: () async{
|
child: Icon(Icons.help))
|
||||||
String response = await DataManager.SetWdAddress(TxtCoinbaseAddress.text);
|
],
|
||||||
bool success = response == TxtCoinbaseAddress.text;
|
),
|
||||||
// DataManager.UserJson['wd_address'] = TxtCoinbaseAddress.text;
|
TextField(
|
||||||
if(!success){
|
controller: TxtCoinbaseAddress,
|
||||||
Dialogs.showAlertDialog(context, "Error saving Coinbase Address", response);
|
onChanged: (e) {
|
||||||
}
|
setState(() {});
|
||||||
setState(() {
|
},
|
||||||
|
),
|
||||||
});
|
(TxtCoinbaseAddress.text !=
|
||||||
}, child: Text("Save"), width: 250),) : Container()
|
(DataManager.UserJson['wd_address'] ?? ""))
|
||||||
],
|
? Container(
|
||||||
),),
|
padding: EdgeInsets.all(10),
|
||||||
|
child: GlassButton(
|
||||||
|
onTap: () async {
|
||||||
|
String response = await DataManager.SetWdAddress(
|
||||||
|
TxtCoinbaseAddress.text);
|
||||||
|
bool success =
|
||||||
|
response == TxtCoinbaseAddress.text;
|
||||||
|
// DataManager.UserJson['wd_address'] = TxtCoinbaseAddress.text;
|
||||||
|
if (!success) {
|
||||||
|
Dialogs.showAlertDialog(context,
|
||||||
|
"Error saving Coinbase Address", response);
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: Text("Save"),
|
||||||
|
width: 250),
|
||||||
|
)
|
||||||
|
: Container()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 10,),
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: ()async{
|
onTap: () async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
prefs.clear();
|
prefs.clear();
|
||||||
|
|
||||||
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) =>
|
Navigator.of(context).pushAndRemoveUntil(
|
||||||
MyHomePage()), (Route<dynamic> route) => false);
|
MaterialPageRoute(builder: (context) => MyHomePage()),
|
||||||
|
(Route<dynamic> route) => false);
|
||||||
DataManager.Reset();
|
DataManager.Reset();
|
||||||
},
|
},
|
||||||
child: GlassCard(child: Padding(
|
child: GlassCard(
|
||||||
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(15.0),
|
padding: const EdgeInsets.all(15.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.logout),
|
Icon(Icons.logout),
|
||||||
SizedBox(width: 10,),
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
Text("Signout"),
|
Text("Signout"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -681,7 +877,10 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
||||||
children: [
|
children: [
|
||||||
Text(gameName, style: TextStyle(fontSize: 16)),
|
Text(gameName, style: TextStyle(fontSize: 16)),
|
||||||
Row(
|
Row(
|
||||||
children: [Icon(Helpers.GetIconForCrypto(coin)), Text(" $coin")],
|
children: [
|
||||||
|
Icon(Helpers.GetIconForCrypto(coin)),
|
||||||
|
Text(" $coin")
|
||||||
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import connectivity_plus
|
||||||
import firebase_auth
|
import firebase_auth
|
||||||
import firebase_core
|
import firebase_core
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
import share_plus
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
import sqflite
|
import sqflite
|
||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
@ -18,6 +19,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||||
|
|
|
||||||
32
pubspec.lock
32
pubspec.lock
|
|
@ -113,6 +113,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.4"
|
version: "1.2.4"
|
||||||
|
cross_file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cross_file
|
||||||
|
sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.3+4"
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -376,6 +384,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.9.1"
|
||||||
|
mime:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: mime
|
||||||
|
sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
nm:
|
nm:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -496,6 +512,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.27.7"
|
version: "0.27.7"
|
||||||
|
share_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: share_plus
|
||||||
|
sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.1.0"
|
||||||
|
share_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: share_plus_platform_interface
|
||||||
|
sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.3.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ dependencies:
|
||||||
intl: ^0.18.1
|
intl: ^0.18.1
|
||||||
cached_network_image: ^3.2.3
|
cached_network_image: ^3.2.3
|
||||||
connectivity_plus: ^4.0.2
|
connectivity_plus: ^4.0.2
|
||||||
|
share_plus: ^7.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||||
|
#include <share_plus/share_plus_windows_plugin_c_api.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
|
|
@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
FirebaseCorePluginCApiRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||||
|
SharePlusWindowsPluginCApiRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
connectivity_plus
|
connectivity_plus
|
||||||
firebase_core
|
firebase_core
|
||||||
|
share_plus
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user