Created
August 4, 2020 08:09
-
-
Save usimsek/5a1761829d4104a9b62fc02e8366684d to your computer and use it in GitHub Desktop.
flutter textfield
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class TextWidget extends StatelessWidget { | |
const TextWidget({ | |
this.labelText, | |
this.iconPrefix, | |
this.maxLines, | |
this.isPassword = false, | |
}); | |
final String labelText; | |
final Icon iconPrefix; | |
final int maxLines; | |
final bool isPassword; | |
@override | |
Widget build(BuildContext context) { | |
return TextField( | |
// maxLength: 10, // inputun altında 0/10 çıkar ve max 10 karakter yazar | |
maxLines: | |
maxLines, // çoklu satır, null verirsen satır bittikçe genişler, rakam verirsen o kadar geniş gözükür | |
obscureText: isPassword ? true : false, | |
style: TextStyle( | |
color: Colors.blue, | |
fontSize: 20.0, | |
), | |
decoration: InputDecoration( | |
prefixIcon: iconPrefix, | |
focusedBorder: OutlineInputBorder( | |
borderRadius: BorderRadius.all(Radius.circular(25)), | |
borderSide: BorderSide(width: 2, color: Colors.blueGrey), | |
), | |
enabledBorder: OutlineInputBorder( | |
borderRadius: BorderRadius.all(Radius.circular(25)), | |
borderSide: BorderSide(width: 2, color: Colors.lightBlue), | |
), | |
labelText: labelText, | |
labelStyle: TextStyle( | |
color: Colors.grey, | |
fontSize: 20, | |
)), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment