Passwords are basic requirement for everyone. We do not share our password with anyone because they are confidential. In flutter we can set TextField Input Type Password easily with obscureText property. obscureText disables copy paste of password in TextField which is quite good for securing our password.
Flutter TextField Input Type Password
1. Creating TextField widget and define obscureText with True value. We are also defining autofocus and enableSuggestion with false value to disable auto focus turn off.
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Type Password...',
),
autofocus: false,
obscureText: true,
enableSuggestions: false,
)
Screenshot:
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
width: 280,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'Type Password...',
),
autofocus: false,
obscureText: true,
enableSuggestions: false,
)))));
}
}
Comments
Post a Comment