my_textfield.dart (1003B)
1 import 'package:flutter/material.dart'; 2 3 class MyTextField extends StatelessWidget { 4 final TextEditingController controller; 5 final String hintText; 6 final bool obscureText; 7 8 const MyTextField({ 9 super.key, 10 required this.controller, 11 required this.hintText, 12 required this.obscureText, 13 }); 14 15 @override 16 Widget build(BuildContext context) { 17 return Padding( 18 padding: const EdgeInsets.symmetric(horizontal: 25.0), 19 child: TextField( 20 controller: controller, 21 obscureText: obscureText, 22 decoration: InputDecoration( 23 enabledBorder: const OutlineInputBorder( 24 borderSide: BorderSide(color: Colors.black), 25 ), 26 focusedBorder: const OutlineInputBorder( 27 borderSide: BorderSide(color: Colors.black), 28 ), 29 fillColor: Colors.white, 30 filled: true, 31 hintText: hintText, 32 hintStyle: const TextStyle(color: Colors.black)), 33 ), 34 ); 35 } 36 }