Advertisement
muhaiminurabir

textfield input flutter type edittext write

May 7th, 2025 (edited)
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.54 KB | None | 0 0
  1.                       TextFormField(
  2.                         style: GoogleFonts.poppins(
  3.                           color: ProjectColors.black4,
  4.                           fontSize: 14,
  5.                           fontWeight: FontWeight.w500,
  6.                         ),
  7.                         maxLines: 1,
  8.                         controller: passwordController,
  9.                         inputFormatters: [
  10.                           FilteringTextInputFormatter.digitsOnly,
  11.                         ],
  12.                         validator: (value) {
  13.                           if (value!.trim().isEmpty) {
  14.                             return CustomStrings.required;
  15.                           }
  16.                           if (value.trim().length < 6) {
  17.                             return CustomStrings.min6;
  18.                           }
  19.                           return null;
  20.                         },
  21.                         obscureText: passwordVisible,
  22.                         keyboardType: TextInputType.number,
  23.                         decoration: InputDecoration(
  24.                           fillColor: ProjectColors.gray,
  25.                           filled: true,
  26.                           hintStyle: GoogleFonts.poppins(
  27.                             color: ProjectColors.black4.withValues(alpha: 90),
  28.                             fontSize: 14,
  29.                             fontWeight: FontWeight.w500,
  30.                           ),
  31.                           errorBorder: OutlineInputBorder(
  32.                             borderRadius: BorderRadius.circular(10.0),
  33.                             borderSide: BorderSide(
  34.                               color: Colors.red.shade800,
  35.                               width: 0.5,
  36.                             ),
  37.                           ),
  38.                           focusedBorder: OutlineInputBorder(
  39.                             borderRadius: BorderRadius.circular(10.0),
  40.                             borderSide: BorderSide(
  41.                               color: ProjectColors.primaryColor,
  42.                             ),
  43.                           ),
  44.                           focusedErrorBorder: OutlineInputBorder(
  45.                             borderRadius: BorderRadius.circular(10.0),
  46.                             borderSide: BorderSide(
  47.                               color: Colors.red.shade800,
  48.                               width: 0.5,
  49.                             ),
  50.                           ),
  51.                           contentPadding: EdgeInsets.fromLTRB(
  52.                             20.0,
  53.                             15.0,
  54.                             20.0,
  55.                             15.0,
  56.                           ),
  57.                           hintText: CustomStrings.pinHint,
  58.                           border: OutlineInputBorder(
  59.                             borderSide: BorderSide.none,
  60.                             borderRadius: BorderRadius.circular(10.0),
  61.                           ),
  62.                           suffixIcon: IconButton(
  63.                             icon: Icon(
  64.                               passwordVisible
  65.                                   ? Icons.visibility
  66.                                   : Icons.visibility_off,
  67.                               color: ProjectColors.black4,
  68.                             ),
  69.                             onPressed: () {
  70.                               setState(() {
  71.                                 passwordVisible = !passwordVisible;
  72.                               });
  73.                             },
  74.                           ),
  75.                         ),
  76.                       ),
  77.  
Tags: TextField
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement