So, I'm still fairly new to flutter and I don't quite understand how to get the data to flow logically.
I have this as the very top of my sign up pages logic:
class _SignUpPageTextFieldsAndLabels extends State<SignUpPageTextFieldsAndLabels>{
_SignUpPageTextFieldsAndLabels();
final _emailField = EntryPageTextFormField('Email', Icons.clear);
final _firstNameField = EntryPageTextFormField('First Name', Icons.clear);
final _surnameField = EntryPageTextFormField('Surname', Icons.clear);
final _cellNumberField = EntryPageTextFormField('Cellphone Number', Icons.clear);
final _passwordField = EntryPagePasswordTextFormField('Password');
final _passwordConfirmField = EntryPagePasswordTextFormField('Confirm Password');
final _photoUploadField = _SignUpPageUploadPhotoButton();
final _faithDropDown = _DecoratedDropdownForFaithSelection();
List _GetFieldData() {
List userSignUpData = List.filled(SIGN_UP_PAGE_NUM_DATA_FIELDS, '');
userSignUpData[PASSWORD] = _passwordField.GetText();
userSignUpData[EMAIL] = _emailField.GetText();
userSignUpData[DISPLAY_NAME] = _firstNameField.GetText();
userSignUpData[SURNAME] = _surnameField.GetText();
userSignUpData[CELL_NUMBER] = _cellNumberField;
userSignUpData[FAITH] = _faithDropDown.GetDropdownValue();
userSignUpData[IMAGE] = _photoUploadField.photoURL;
return userSignUpData;
}
@override Widget build(BuildContext context){
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const CustomBackButton(),
const ThePatriotLogo(),
const _SignUpLabelArea(),
_firstNameField,
_surnameField,
_cellNumberField,
_emailField,
_passwordField,
_passwordConfirmField,
_photoUploadField,
_faithDropDown,
_SignUpCreateAccountIconButton(_GetFieldData),
],
),
);
}
}
Obviously, each field has a separate class (for code cleanliness) that handles the way those Widgets are structured and also logic. The actual account creation occurs inside _SignUpCreateAccountIconButton().
Now, my problem is that the data that is passed to the account creation is all empty. I assume that this is caused by the fields not actively passing data to account creation. It only sends the data once, at Widget construction. But I'm kinda stumped as to how I can send data when the Button inside _SignUpCreateAccountIconButton() is clicked? Or am I going about this totally wrong?