import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class WelcomeLogin extends StatefulWidget {
  @override
  _WelcomeLogin createState() => _WelcomeLogin();
}

class _WelcomeLogin extends State<WelcomeLogin> {
  bool isLoading = true;

  @override
  void initState() {
    isLoading = true;
    // checkUser(context);
    super.initState();
  }

  Widget build(BuildContext context) {
    return AppScaffold(
        appBarTitle: TranslationBase.of(context).welcome,
        isShowDecPage: false,
        isShowAppBar: true,
        body: Padding(
            padding: EdgeInsets.all(20),
            child: Column(
              children: <Widget>[
                Expanded(
                  flex: 6,
                  child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Image.asset('assets/images/DQ/logo.png',
                            height: 90, width: 90),
                        AppText(
                          TranslationBase.of(context).welcome,
                          fontSize: 30,
                          fontWeight: FontWeight.bold,
                        ),
                        AppText(
                          TranslationBase.of(context).welcomeText,
                          fontSize: 24,
                          textAlign: TextAlign.start,
                        ),
                        AppText(
                          TranslationBase.of(context).welcomeText2,
                          fontSize: 24,
                          textAlign: TextAlign.start,
                        ),
                        SizedBox(
                          height: SizeConfig.realScreenHeight * .15,
                        )
                      ]),
                ),
                Expanded(
                    flex: 2,
                    child: Column(
                      //mainAxisAlignment: MainAxisAlignment.end,
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: <Widget>[
                        Row(
                          children: <Widget>[
                            Expanded(
                                child: DefaultButton(
                              TranslationBase.of(context).yes,
                              () => {
                                Navigator.of(context)
                                    .push(FadePage(page: LoginType())),
                              },
                              color: Color(0xFFc5272c),
                              textColor: Colors.white,
                            ))
                          ],
                        ),
                        Row(
                          children: <Widget>[
                            Expanded(
                                child: DefaultButton(
                              TranslationBase.of(context).no,
                              () => {
                                Navigator.of(context)
                                    .push(FadePage(page: Register())),
                              },
                            ))
                          ],
                        ),
                      ],
                    ))
              ],
            )));
  }
}
