Mobile Deep Learning with TensorFlow Lite, ML Kit and Flutter by Anubhav Singh

Mobile Deep Learning with TensorFlow Lite, ML Kit and Flutter by Anubhav Singh

Author:Anubhav Singh [Anubhav Singh]
Language: eng
Format: epub
Tags: COM044000 - COMPUTERS / Neural Networks, COM016000 - COMPUTERS / Computer Vision and Pattern Recognition, COM051460 - COMPUTERS / Programming / Mobile Devices
Publisher: Packt
Published: 2020-04-03T14:17:25+00:00

Similar to TextField in Step 2, we define the next method, _createPasswordInput(), to create a TextFormField() for entering the password:

Widget _createPasswordInput() {

return Padding(

padding: const EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 0.0),

child: new TextFormField(

maxLines: 1,

obscureText: true,

autofocus: false,

decoration: new InputDecoration(

hintText: 'Password',

icon: new Icon(


color: Colors.grey,


validator: (value) => value.isEmpty ? 'Password can\'t be empty' : null,

onSaved: (value) => _userpassword = value.trim(),




We start by providing padding in all four cardinal directions using EdgeInsets.fromLTRB() to give an offset of 15.0 at the top. Next, we create a TextFormField with maxLines as 1, and set obscureText to true and autofocus to false. obscureText is used to hide the text that is being typed. We use InputDecoration to provide the hintText password and a gray-colored icon, Icons.lock. To make sure that the text field isn't left empty, a validator is used that gives a warning, Password can't be empty, when a null value is passed, that is, the user attempts to sign in/up without entering a password. Finally, trim() is used to remove all trailing spaces and store the password in a _userpassword string variable.

Next, we declare the FormMode enumeration outside _SignupSigninScreenState that operates between two modes, SIGNIN and SIGNUP, as seen in the following code snippet:


Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.