Set Textfield Text Input Type Password Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 13-10-2020

obscureText parameter is used in TextField widget to automatically convert all the entered text into U+2022 BULLET characters. They look like bullet DOT inside Text Field widget. This parameter is mostly used to hide typed text inside Text Field like password typing. This would make the typing secure. obscureText cannot be set to null or empty you should have to pass Boolean true or false in it.

Set Textfield Text Input Type Password Using Flutter Android App

Input Type Password
Complete Code For  Input Type Password In Flutter
Main.dart

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
        home: Scaffold(
          appBar: AppBar(
            backgroundColor: Colors.pink,
            title: Text('Input type Password'),
            centerTitle: true,
          ),
            body: Padding(
              padding: const EdgeInsets.all(30.0),
              child: Container(
                  child:
                  Container(
                      width: 300,
                      child: TextField(
                        decoration: InputDecoration(
                          border: OutlineInputBorder(),
                          hintText: 'Enter Password Here',
                        ),
                        autofocus: false,
                        obscureText: true,
                      )
                  )

              ),
            )
        )
    );
  }
}

Related Post