import 'package:aman_kassa_flutter/redux/actions/user_actions.dart';
import 'package:aman_kassa_flutter/redux/state/user_state.dart';
import 'package:aman_kassa_flutter/redux/store.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter/material.dart';


class StartUpView extends StatefulWidget {
  @override
  _StartUpViewState createState() => _StartUpViewState();
}

class _StartUpViewState extends State<StartUpView> {

  @override
  void initState() {
    super.initState();
    Redux.store!.dispatch(checkUserAction);
  }

  @override
  Widget build(BuildContext context) {

    return StoreConnector<AppState, UserState>(
        converter: (store) => store.state.userState!,
        builder: (context, userState) {
          return Scaffold(
              body: Center(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                SizedBox(
                  width: 500,
                  height: 200,
                  child: Image.asset('assets/images/icon_large.png'),
                ),
                CircularProgressIndicator(
                  strokeWidth: 3,
                  valueColor: AlwaysStoppedAnimation(
                    Colors.yellow[300],
                  ),
                )
              ],
            ),
          ));
        });
  }
}
