import 'package:ambito/src/pages/start/start_page.dart';
import 'package:flutter/material.dart';

class LoadingPage extends StatelessWidget {
  const LoadingPage({super.key});

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: Future.delayed(
        const Duration(seconds: 1),
        () {
          Navigator.pushAndRemoveUntil(
            context,
            MaterialPageRoute(
              builder: (context) {
                return const StartPage();
              },
            ),
            (route) => false,
          );
        },
      ),
      builder: (context, snapshot) {
        if (snapshot.connectionState != ConnectionState.done) {
          return Center(
            child: Hero(
                tag: 'logo',
                child: Image.asset('assets/images/logo_trans.png')),
          );
        }
        return Center(
          child: Hero(
              tag: 'logo', child: Image.asset('assets/images/logo_trans.png')),
        );
      },
    );
  }
}
