import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import './login.dart';
import './signup.dart';

class UnauthenticatedLandingWidget extends StatefulWidget {
  const UnauthenticatedLandingWidget({Key? key}) : super(key: key);

  @override
  State<UnauthenticatedLandingWidget> createState() => _UnauthenticatedLandingWidgetState();
}


class _UnauthenticatedLandingWidgetState extends State<UnauthenticatedLandingWidget> {
  @override
  Widget build(BuildContext context) {
    final ButtonStyle buttonStyle = ElevatedButton.styleFrom(
        primary: Theme.of(context).colorScheme.surface,
        onPrimary: Theme.of(context).colorScheme.onSurface,
        minimumSize: const Size.fromHeight(50),
        padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
        textStyle: const TextStyle(
            fontSize: 20,
            fontWeight: FontWeight.bold,
        ),
    );

    return WillPopScope(
        onWillPop: () async => false,
        child: Scaffold(
            body: SafeArea(
                child: Center(
                    child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: <Widget>[
                          Center(
                              child: Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: [
                                    FaIcon(
                                        FontAwesomeIcons.envelope,
                                        color: Theme.of(context).colorScheme.onBackground,
                                        size: 40
                                    ),
                                    const SizedBox(width: 15),
                                    Text(
                                        'Capsule',
                                        style: TextStyle(
                                            fontSize: 40,
                                            color: Theme.of(context).colorScheme.onBackground,
                                        ),
                                    )
                                  ]
                              ),
                          ),
                          const SizedBox(height: 10),
                          Padding(
                              padding: const EdgeInsets.only(
                                  top: 15,
                                  bottom: 15,
                                  left: 20,
                                  right: 20,
                              ),
                              child: Column (
                                  children: [
                                    ElevatedButton(
                                        child: const Text('Login'),
                                        onPressed: () => {
                                          Navigator.of(context).push(
                                              MaterialPageRoute(builder: (context) => const Login()),
                                          ),
                                        },

                                        style: buttonStyle,
                                    ),
                                    const SizedBox(height: 20),
                                    ElevatedButton(
                                        child: const Text('Sign Up'),
                                        onPressed: () => {
                                          Navigator.of(context).push(
                                              MaterialPageRoute(builder: (context) => const Signup()),
                                          ),
                                        },
                                        style: buttonStyle,
                                    ),
                                ]
                              ),
                          ),
                      ],
                  ),
              ),
          ),
      ),
    );
  }
}
