import 'package:external_app_launcher/external_app_launcher.dart';
import 'package:fhub/src/CustomWidgets.dart';
import 'package:flutter/material.dart';

class UpdatePage extends StatefulWidget {
  const UpdatePage({Key? key}) : super(key: key);

  @override
  State<UpdatePage> createState() => _UpdatePageState();
}

class _UpdatePageState extends State<UpdatePage> {

  @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) {
    return Scaffold(
        backgroundColor: Colors.black,
        body: CustomBody(
            context: context, onAnimEnd: (){setState(() {});},
            child: SafeArea(
              child: Center(
                child: GlassCard(child: Container(width: 300,height: 300, child: Padding(
                  padding: const EdgeInsets.all(38.0),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      GradientText(text: "New Update", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.7), Colors.white.withOpacity(0.2),]),style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),),
                      Icon(Icons.upcoming_outlined,size: 70,),
                      GlassButton(onTap: () async{
                        await LaunchApp.openApp(
                          androidPackageName: 'com.Xperience.FaucetHub',
                          // openStore: false
                        );
                      }, child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Icon(Icons.install_mobile,size: 20,),
                          SizedBox(width: 20,),
                          Text("Update"),
                          SizedBox(width: 15,)
                        ],
                      ), width: 200,height: 40,color: Colors.greenAccent)
                    ],
                  ),
                ),)),
              ),
            )
        )
    );
  }
}


class MaintaincePage extends StatefulWidget {
  const MaintaincePage({Key? key}) : super(key: key);

  @override
  State<MaintaincePage> createState() => _MaintaincePage();
}

class _MaintaincePage extends State<MaintaincePage> {

  @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) {
    return Scaffold(
        backgroundColor: Colors.black,
        body: CustomBody(
            context: context, onAnimEnd: (){setState(() {});},
            child: SafeArea(
              child: Center(
                child: GlassCard(child: Container(width: 300,height: 300, child: Padding(
                  padding: const EdgeInsets.all(38.0),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      GradientText(text: "Under Maintaince", gradient: LinearGradient(colors: [Colors.white.withOpacity(0.7), Colors.white.withOpacity(0.2),]),style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),),
                      Icon(Icons.construction,size: 60,),
                      Text("This app is currently under maintaince, Please check back shortly",textAlign: TextAlign.center,),
                    ],
                  ),
                ),)),
              ),
            )
        )
    );
  }
}