My background Image username + password fields buttons are not showing how can I fix this.
I did create two states one for the buttons and the other for the text field can someone please help me to fix this and how none of the 3 is showing
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new _LoginPageState();
}
enum FormType {
  login,
  register,
}
class _LoginPageState extends State<LoginPage> {
  final formKey = new GlobalKey<FormState>();
  String _email;
  String _password;
  FormType _formType = FormType.login;
  bool validateAndSave() {
    final form = formKey.currentState; // This is to print to the console to show username and password fields
    if (form.validate()) {
      form.save();
      return true;
    }
    return false;
  }
  void validateAndSubmit() async {
    if (validateAndSave()) {
      try {
        // ignore: deprecated_member_use
        FirebaseUser user = (await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email.trim(), password: _password)) as FirebaseUser;// This is the firebase_authentication
        print("Signed in: ${user.uid}");
      }
      catch (e) {
        print("Error: $e");
      }
    }
  }
  void moveToRegister() {
    setState(() {
      _formType = FormType.register;
    });
  }
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        leading: new Padding(
          padding: const EdgeInsets.all(8.0),// This is to adjust the padding around the appbar icon
          child: Image.asset("assets/images/RCC1.png"),
        ),
        centerTitle: true,
        title: new Text("Revival Christian Church",
          style: new TextStyle(color: Colors.black),
        ),
      ),
      body: Center(
          child: new Form(
            key: formKey,
            child: null,
          ),
      ),
    );
  }
  List<Widget> buildInPuts() {
    return [
      new Padding(
        padding: EdgeInsets.all(10.0),// This is to add padding to the TextFormField of username and password
        child: new Container(
          decoration: new BoxDecoration(// This is to change the text form field to given color
            color: Colors.white,
            borderRadius: new BorderRadius.circular(10.0),
          ),
          child: new Padding(// This is to add thickness to the TextFormField of username and password
            padding: EdgeInsets.only(left: 15, right: 15, top: 0),
            child: new TextFormField(
              decoration: new InputDecoration(labelText: "Email",icon: Icon(Icons.email,color: Colors.black)),
              validator: (value) => value.isEmpty ?"Email can\'t be empty" : null,
              onSaved: (value) => _email = value,//This is to save the value of the username
              style: new TextStyle(
                fontSize: 15.0,
                color: Colors.black,
              ),
            ),
          ),
        ),
      ),
      new Padding(
        padding: EdgeInsets.all(10.0),// This is to add padding to the TextFormField of username and password
        child: new Container(
          decoration: new BoxDecoration(// This is to change the text form field to given color
            color: Colors.white,
            borderRadius: new BorderRadius.circular(10.0),
          ),
          child: new Padding(// This is to add thickness to the TextFormField of username and password
            padding: EdgeInsets.only(left: 15, right: 15, top: 0),
            child: new TextFormField(
              decoration: new InputDecoration(labelText: "Password",icon: Icon(Icons.lock,color: Colors.black)),
              validator: (value) => value.isEmpty ?"Password can\'t be empty" : null,
              onSaved: (value) => _password = value,//This is to save the value of the username
              obscureText: true,
              style: new TextStyle(
                fontSize: 15.0,
                color: Colors.black,
              ),
            ),
          ),
        ),
      ),
    ];
  }
  List<Widget> buildSubmitButtons() {
    return [
      new Container(
        width: 180,
        child: new RaisedButton(
          child: new Text("Login",style: new TextStyle(fontSize: 20.0)),
          onPressed: validateAndSubmit,// This is the validateAndSave on the press of the button
        ),
      ),
      new FlatButton(
        child: new Text("Create an account ?", style: new TextStyle(fontSize: 20.0)),
        onPressed: moveToRegister,
        color: Colors.purple,
      ),
      new Container(
        padding: EdgeInsets.all(20.0),
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
          ],
        ),
      ),
      new Container(
          decoration: new BoxDecoration(
              image: new DecorationImage(
                image: new AssetImage("assets/images/RCC14.png"),
                fit: BoxFit.cover,
              ),
          ),
      ),
            ];
  }
}
 
                       
                    
0 Answer(s)