import 'package:baseproject/core/common/index.dart';
import 'package:baseproject/features/presentation/app/bloc/user_bloc.dart';
import 'package:baseproject/features/route/route_goto.dart';
import 'package:baseproject/features/usecases/index.dart';
import 'package:flutter/material.dart';

class InitScreen extends StatefulWidget {
  const InitScreen({super.key});

  @override
  State<InitScreen> createState() => _InitScreenState();
}

class _InitScreenState extends State<InitScreen> {
  UserBloc get _userBloc => BlocProvider.of<UserBloc>(context);
  @override
  void initState() {
    super.initState();
    initData();
  }

  void initData() {
    _userBloc.getUserInfo().then((value) {
      if (value) {
        gotoHome(context);
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: CircularProgressIndicator(),
      ),
    );
  }
}
