import 'package:external_app_launcher/external_app_launcher.dart'; import 'package:fhub/backend/DataManager.dart'; import 'package:fhub/backend/helpers.dart'; import 'package:fhub/src/CustomWidgets.dart'; import 'package:flutter/material.dart'; class GameInfoPage extends StatefulWidget { const GameInfoPage({Key? key, required this.gameJson}) : super(key: key); final dynamic gameJson; @override State createState() => _GameInfoPageState(); } class _GameInfoPageState extends State { @override void initState() { // TODO: implement initState super.initState(); kickstartAnimations(); } void kickstartAnimations() async { await Future.delayed(const Duration(milliseconds: 500)); setState(() { op1 = 0.5; op2 = 0.5; op3 = 0.5; }); } @override Widget build(BuildContext context) { bool linked = DataManager.LinkedGamesJson.contains(widget.gameJson); return Scaffold( backgroundColor: Colors.black, body: CustomBody(child: SafeArea(child: Padding( padding: const EdgeInsets.all(8.0), child: SingleChildScrollView( child: Column(children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell(child: Container(margin:EdgeInsets.all(10), child: Icon(Icons.keyboard_arrow_left,size: 50)), onTap: (){Navigator.of(context).pop();},), GradientText( text: widget.gameJson['name'], gradient: LinearGradient(colors: [ Colors.white.withOpacity(0.6), Colors.white.withOpacity(0.5), Colors.white.withOpacity(0.2) ]), style: TextStyle(fontSize: 33, fontWeight: FontWeight.bold), ), Container(width: 40,) ], ), SizedBox(height: 50,), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( width: 120, child: ClipRRect( borderRadius: BorderRadius.circular(10), child: Image.network(widget.gameJson['icon']))), Column( children: [ Column( children: [ Text("Earn"), Text("${widget.gameJson['coin']}", style: TextStyle(fontSize: 25,fontWeight: FontWeight.bold),), ], ),SizedBox(height: 10,), Icon(Helpers.GetIconForCrypto(widget.gameJson['coin']),size: 50) ], ) ], ), SizedBox(height: 50,), GlassButton(onTap: ()async{ await LaunchApp.openApp( androidPackageName: widget.gameJson['link'], // openStore: false ); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Icon(Icons.g_mobiledata_rounded,size: 40), Text("Open on Playstore"), ], ), width: 200,height: 50), SizedBox(height: 35,), Text(widget.gameJson['description'],textAlign: TextAlign.center), SizedBox(height: 20,), (linked) ? Container(child: Text("\nThis game is already linked to this FH account.\n\nYour Earnings from game will be accounted to this FH account",textAlign: TextAlign.center,),) :Column( children: [ Text("Your FH ID"), Text(DataManager.UserJson['id'], style: TextStyle(fontSize: 50, fontWeight: FontWeight.bold)), SizedBox(height: 20,), Text("Install this game from playstore and login with the same google account to Link the game to this FaucetHub Automatically.\n\nTo Link manually, Navigate to 'Link to FH' in game settings, Then Enter '${DataManager.UserJson['id']}' As FH ID.\n\n Then enjoy your earnings from playing this game!",textAlign: TextAlign.center) ], ), ],), ), )), context: context, onAnimEnd: (){setState(() {});}), ); } }