import 'package:modelo/funcoes_gerais.dart';
import 'package:flutter/material.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:get/get.dart';
import 'package:page_transition/page_transition.dart';

import 'splash_controller.dart';

class SplashScreen extends StatelessWidget {
  final SplashController c = Get.put(SplashController());
  @override
  Widget build(BuildContext context) {
    return AnimatedSplashScreen.withScreenFunction(
      splash: Container(
        width: double.maxFinite,
        height: Get.size.height,
        //color: Colors.red,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            ClipRRect(
                borderRadius: BorderRadius.circular(8.0),
                child: Container(
                    width: 120.0,
                    height: 120.0,
                    child: Image.asset(
                      'assets/images/logo.png',
                      fit: BoxFit.contain,
                    ))),
            SizedBox(
              height: 10.0,
            ),
            Padding(
              padding: const EdgeInsets.all(10.0),
              child: Text(
                FuncoesGerais.nomeApp,
                style: TextStyle(color: Colors.white, fontSize: 22.0),
              ),
            ),
            LinearProgressIndicator()
          ],
        ),
      ),
      //splashIconSize: 90.0,
      splashIconSize: Get.size.height,
      splashTransition: SplashTransition.slideTransition,
      pageTransitionType: PageTransitionType.fade,
      backgroundColor: Colors.blueGrey.shade800,
      screenFunction: () async {
        await c.firebaseCloudMessagingListeners();
        //await c.verTutorial();
        var screen = await c.verUsuLogado();
        return screen;
      },
      //backgroundColor: Colors.blue
    );
  }
}
