Flutter: How to underline in textformfield - flutter

I'm trying to make it such that the user can enter his pin, and the pin is supposed to be 4 digits long. Now, the 4 digits that he can enter should be underscored in the text form field (even before he enters the pin), somewhat like ____.
So something like this:
Basically just a normal input field that has the 4 underscores. Is there anyway I can do this in textformfield?
Thanks in advance!

I have tried this on Android Kotlin by using TextWatcher, and I think this could be done by this link below:
Here's a reference!

Try This : https://api.flutter.dev/flutter/material/UnderlineInputBorder-class.html
Full Code :
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('TextField Input Decoration Demo'),
),
body: new SafeArea(
top: true,
bottom: true,
child: Column(
children: [
Padding(
padding: EdgeInsets.all(20),
child: Row(
children: [
Container(
width: 40,
child: TextFormField(
style: TextStyle(fontSize: 50),
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
),
),
),
)),
SizedBox(width: 5),
Container(
width: 40,
child: TextFormField(
style: TextStyle(fontSize: 50),
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
),
),
),
)),
SizedBox(width: 5),
Container(
width: 40,
child: TextFormField(
style: TextStyle(fontSize: 50),
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
),
),
),
)),
SizedBox(width: 5),
Container(
width: 40,
child: TextFormField(
style: TextStyle(fontSize: 50),
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 10.0,
),
),
),
)),
],
)),
new Divider(
color: Colors.black,
),
],
)));
}
}

Related

Flutter : credit card textfield style all details in single texfield

please i looking to do this particular kind of texfield for credit card with flutter. In a single texfield there have all number, exp date and cvv in the same line of texfield. Thank you for help.
Textfield basic code example :
import 'package:flutter/material.dart';
class MyCardField extends StatelessWidget {
final TextEditingController controller;
final String hintText;
const MyCardField({Key key, this.controller, this.hintText}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 16),
child: TextField(
controller: controller,
decoration: InputDecoration(
hintText: hintText,
hintStyle: TextStyle(
color: Colors.grey[400],
fontSize: 16,
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue, width: 2),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey[300], width: 2),
),
),
),
);
}
}
I am not aware of a solution that lets you have multiple TextFields in one TextField. What you can do though, is make it look like you have.
In the code below I have made a Container with decoration making it look like a TextField. The Container takes a Form as a child and the Form takes a Row as a child. Inside the Row I put the TextFields as children.
Make sure you don't use fixed whidts, but rather calculate the devices width using MediaQuery.of(context).size.width.
import 'package:flutter/material.dart';
class Test extends StatelessWidget {
final GlobalKey _formKey = GlobalKey();
final TextEditingController cardNumberController;
final TextEditingController expireDateController;
final TextEditingController cvcController;
final String hintText;
Test({
Key key,
this.cardNumberController,
this.hintText,
this.expireDateController,
this.cvcController,
}) : super(key: key);
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Column(
children: [
Container(
margin: EdgeInsets.all(4),
height: 50,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.black38),
),
child: Form(
key: _formKey,
child: Row(
children: [
SizedBox(
width: 190,
child: TextField(
controller: cardNumberController,
decoration: InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
prefixIcon:
Icon(Icons.credit_card, color: Colors.black54),
labelText: 'Card number',
labelStyle: TextStyle(
color: Colors.black54,
fontSize: 12,
),
),
),
),
Expanded(
child: TextField(
controller: expireDateController,
decoration: InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
labelText: 'MM/YY',
labelStyle: TextStyle(
color: Colors.black54,
fontSize: 12,
),
),
),
),
SizedBox(
width: 90,
child: TextField(
controller: cvcController,
decoration: InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
labelText: 'CVC',
labelStyle: TextStyle(
color: Colors.black54,
fontSize: 12,
),
),
),
),
],
),
),
),
TextButton(
onPressed: () {},
child: Text(
'Pay',
style: TextStyle(
color: Colors.blueGrey,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
),
],
),
);
}
}

Flutter: UI didn't push up when the keyboard appear

I create 3 text fields to get input from the user on this screen. The problem is when the keyboard appears, the UI didn't move up to the keyboard.. I already add resizeToAvoidBottomInset: false inside the Scaffold widget but it won't work. Here is the screenshot and the code for this page.
Screenshot
class AddEmployee extends StatelessWidget {
const AddEmployee({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return const Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(child: AddNewEmployeeWidget()),
);
}
}
class AddNewEmployeeWidget extends StatefulWidget {
const AddNewEmployeeWidget({Key? key}) : super(key: key);
#override
State<AddNewEmployeeWidget> createState() => _AddNewEmployeeWidgetState();
}
class _AddNewEmployeeWidgetState extends State<AddNewEmployeeWidget> {
TextEditingController nameController = TextEditingController(),
usernameController = TextEditingController(),
passwordController = TextEditingController();
addEmployee() async {
await FirebaseFirestore.instance.collection('employee').add({
'username': usernameController.text,
'name': nameController.text,
'password': passwordController.text
});
Fluttertoast.showToast(
msg: "Successfully Add a new employee!",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.TOP,
timeInSecForIosWeb: 1,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 20.0);
}
#override
void initState() {
super.initState();
}
#override
Widget build(BuildContext context) {
return Form(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
//Logo
// Center(
// child: Image.asset(
// 'assets/mashiso.png',
// height: 250,
// ),
// ),
const SizedBox(
height: 100,
),
// name
SizedBox(
width: 300,
child: TextField(
controller: nameController,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
focusColor: Color(0xffFDBF05),
prefixIcon: Icon(Icons.alternate_email),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25))),
hintText: "Enter name",
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25)))),
),
),
//
const SizedBox(
height: 10,
),
//username
SizedBox(
width: 300,
child: TextFormField(
controller: usernameController,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
focusColor: Color(0xffFDBF05),
prefixIcon: Icon(Icons.person),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25))),
hintText: "Enter username",
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25)))),
),
),
//
const SizedBox(
height: 10,
),
//password
SizedBox(
width: 300,
child: TextField(
controller: passwordController,
textInputAction: TextInputAction.next,
obscureText: true,
decoration: const InputDecoration(
focusColor: Color(0xffFDBF05),
prefixIcon: Icon(Icons.lock),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25))),
hintText: "Enter password",
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Color(0xffFDBF05), width: 3),
borderRadius: BorderRadius.all(Radius.circular(25)))),
),
),
const SizedBox(
height: 10,
),
//Add Button
SizedBox(
width: 170,
height: 50,
child: ElevatedButton(
onPressed: () {
setState(() {
usernameController;
nameController;
passwordController;
});
addEmployee();
Future.delayed(
const Duration(seconds: 1),
(() => Navigator.pushReplacement(
context,
PageTransition(
child: const MobileHome(),
type: PageTransitionType.leftToRight))));
},
child: const Text(
"Add",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 30),
),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(const Color(0xffFDBF05))),
),
),
],
),
),
);
}
}
If you remove 'resizeToAvoidBottomInset: false' your code should work as expected. Are you using this widget inside another one? Maybe the wrapper widget is having some issue.
Wrap your Column with a SingleChildScrollView

How to decrease the height of Input Text Field in Flutter?

Well, I am designing something that needs a compact layout. The design that I had made in Figma is what I want but the result I am getting while doing so, that's a bit different. I am not able to attain that level of compactness that I need.
What I designed in Figma:
What I coded in Flutter:
You see, there's an extra amount of space present above the text. I want to remove that text any how. So could anyone please help me in cutting out the extra padding that I don't need.
Here's my code:
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class CardHolderTextField extends StatelessWidget {
const CardHolderTextField({
Key? key,
}) : super(key: key);
#override
Widget build(BuildContext context) {
return Container(
width: 175,
height: 55,
child: TextField(
keyboardType: TextInputType.name,
maxLength: 30,
minLines: 1,
textCapitalization: TextCapitalization.characters,
style: GoogleFonts.mavenPro(
fontSize: 10,
color: Colors.white,
textBaseline: TextBaseline.alphabetic,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
counter: Text(""),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
border: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
fillColor: Colors.white,
focusColor: Colors.white,
),
),
);
}
}
I tried a lot, playing with the size of the container, but that doesn't work, instead pops out a -ve error.
This happened when I tried to decrease the size of the container to 40:
TextAlignVertical.top() also fails to solve the problem when container size is reduced to 40.
What I guess is it's not the problem of container, it's the problem of Text Field.
Anyways, thanks in advance!
TextField size depends on parent size. In this case, you can tweak the value according to your UI and providing contentPadding from TextFiled>decoration:. How-ever, there could be space-problem depending on fontSize+ etc. I prefer using stack.
I removed Container from your CardHolderTextField
class CardHolderTextField extends StatelessWidget {
const CardHolderTextField({
Key? key,
}) : super(key: key);
#override
Widget build(BuildContext context) {
return TextField(
keyboardType: TextInputType.name,
maxLength: 30,
minLines: 1,
textCapitalization: TextCapitalization.characters,
style: GoogleFonts.mavenPro(
color: Colors.white,
fontSize: 12,
textBaseline: TextBaseline.alphabetic,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
border: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
fillColor: Colors.white,
// filled: true,
focusColor: Colors.white,
),
);
}
}
And use with Stack
SizedBox(
height: 80,
width: 175,
child: Stack(
children: [
Positioned(
top: 0,
left: 0,
child: Text(
"card holder".toUpperCase(),
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
Align(
alignment: Alignment.bottomCenter,
child: CardHolderTextField(),
),
],
),
)
In this case, the result will be
If you consider removing bottom line border: InputBorder.none and use Divider on Stack, you will get more control over UI.
Container(
width: 100.0,
child: TextField(
style: TextStyle(
fontSize: 40.0,
height: 2.0,
color: Colors.black
)
)
)

Can I custom TextField suffixIcon with background?

I want the text field search icon (suffix) to have a green background, then my text field using shadow not border. Can u help me with this? or this one cannot implement in flutter?
Here my code:
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
borderSide: BorderSide(
width: 0,
style: BorderStyle.solid,
),
),
contentPadding: EdgeInsets.only(left: 25),
hintText: "Bandung, Jawa Barat",
hintStyle: TextStyle(fontSize: 15, color: Colors.black45),
filled: true,
fillColor: Colors.white,
prefixIcon: Image.asset('assets/img/map.png', height: 15),
suffixIcon: Image.asset('assets/img/search.png', color: Colors.green),
suffixIconConstraints: BoxConstraints(
minWidth: 50,
)
),
)
to
To obtain shadow for your TextField widget, one option is Material widget. Wrap your Textfield with Material widget which has properties like elevation, shadowColor, borderRadius. It is cleaner option for shadow than Container widget which has property decoration.
Output
Copy paste this below code to see the effect:
class CustomTextField extends StatefulWidget {
#override
_CustomTextField State createState() => _CustomTextField State();
}
class _CustomTextField State extends State<CustomTextField > {
#override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 25),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Material(
elevation: 5.0,
shadowColor: Colors.green,
borderRadius: BorderRadius.circular(15.0),
child: TextFormField(
obscureText: true,
autofocus: false,
decoration: InputDecoration(
hintText: 'Search here',
hintStyle:
TextStyle(fontSize: 16, color: Colors.black45),
fillColor: Colors.white,
filled: true,
prefixIcon: Icon(Icons.person, color: Colors.green),
suffixIcon: Material(
elevation: 5.0,
color: Colors.green,
shadowColor: Colors.green,
borderRadius: BorderRadius.only(
topRight: Radius.circular(15.0),
bottomRight: Radius.circular(15.0),
),
child: Icon(Icons.search, color: Colors.white),
),
contentPadding:
EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(15.0),
borderSide:
BorderSide(color: Colors.white, width: 3.0))),
),
),
),
],
),
),
),
),
);
}
}

Flutter's TextFormField doesn't work inside a Positioned widget

I'm trying to create an UI for a signup page with a little overlap between the container that contains the TextFormFields and the blue container that is only for decoration. But, when I do so, using a Stack widget and a Positioned to set the position of the white Container, my TextFormFields don't work (they don't open the keyboard when I click). The FlatButton I used also isn't working. I wonder what I'm doing wrong...
enter image description here
class TelaCadastro extends StatefulWidget {
#override
_TelaCadastroState createState() => _TelaCadastroState();
}
final GlobalKey<FormState> _cadastroKey = GlobalKey<FormState>();
final FirebaseAuth _auth = FirebaseAuth.instance;
final TextEditingController _nomeController = TextEditingController();
final TextEditingController _emailController = TextEditingController();
final TextEditingController _senhaController = TextEditingController();
final TextEditingController _confirmarSenhaController = TextEditingController();
class _TelaCadastroState extends State<TelaCadastro> {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
title: Text('Cadastrar'),
),
body: Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 17),
color: Colors.indigo,
height: 150,
child: Align(
alignment: Alignment.centerLeft,
child: Container(
width: MediaQuery.of(context).size.width - 50,
child: Text('A Corretora trabalha com as melhores '
'seguradoras do mercado',
style: TextStyle(fontSize: 21, color: Colors.white),),
),
),
),
SizedBox(height: 15,),
Positioned(
width: MediaQuery.of(context).size.width - 30,
left: 15,
top: 135,
child: Container(
height: 460,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Form(
key: _cadastroKey,
child: Padding(
padding: EdgeInsets.only(left: 15, right: 15),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.person_add, color: Colors.indigo,),
Text(' Cadastre-se abaixo!',
style: TextStyle(fontSize: 16, color: Colors.indigo),),
],
),
SizedBox(height: 15),
TextFormField(
controller: _nomeController,
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
) ,
prefixIcon: Icon(Icons.person),
hintText: 'Nome Completo',
filled: true,
fillColor: Colors.grey[200]
),
),
SizedBox(height: 20,),
TextFormField(
controller: _emailController,
validator: (String texto){
if (texto.isEmpty || !texto.contains('#')){
return 'Por favor, informe um email válido';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
) ,
prefixIcon: Icon(Icons.email),
hintText: 'Email',
filled: true,
fillColor: Colors.grey[200]
),
),
SizedBox(height: 20,),
TextFormField(
controller: _senhaController,
validator: (String texto){
if (texto.isEmpty || texto.length < 6){
return 'Por favor, informe uma senha válida';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
) ,
prefixIcon: Icon(Icons.lock),
hintText: 'Senha',
filled: true,
fillColor: Colors.grey[200]
),
obscureText: true,
),
SizedBox(height: 20,),
TextFormField(
controller: _confirmarSenhaController,
validator: (String texto){
if (texto.isEmpty || texto.length < 6){
return 'Por favor, informe uma senha válida';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(10))
) ,
prefixIcon: Icon(Icons.lock),
hintText: 'Confirme sua Senha',
filled: true,
fillColor: Colors.grey[200]
),
obscureText: true,
),
SizedBox(height: 30,),
Builder(
builder: (context) => Container(
width: MediaQuery.of(context).size.width - 30,
height: 50,
decoration: BoxDecoration(
color: Colors.indigo,
borderRadius: BorderRadius.all(Radius.circular(10))
),
child: FlatButton(
child: Text('Criar Conta', style: TextStyle(color: Colors.white),),
onPressed: (){
print('test');
},
),
),
),
SizedBox(height: 15,)
],
),
),
),
),
),
],
)
);
}
}
Here I had Commented your SizedBox widget and wrapped blue Container which is only for decoration with Positioned widget also giving appropriate width and height.
Now its completely working/!!
You can copy and paste run the full code below:-
class TelaCadastro extends StatefulWidget {
#override
_TelaCadastroState createState() => _TelaCadastroState();
}
final GlobalKey<FormState> _cadastroKey = GlobalKey<FormState>();
//final FirebaseAuth _auth = FirebaseAuth.instance;
final TextEditingController _nomeController = TextEditingController();
final TextEditingController _emailController = TextEditingController();
final TextEditingController _senhaController = TextEditingController();
final TextEditingController _confirmarSenhaController = TextEditingController();
class _TelaCadastroState extends State<TelaCadastro> {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
title: Text('Cadastrar'),
),
body: Stack(
overflow: Overflow.visible,
children: <Widget>[
Positioned(
width: 414,
height: 150,
child: Container(
padding: EdgeInsets.only(left: 17),
color: Colors.indigo,
height: 150,
child: Align(
alignment: Alignment.centerLeft,
child: Container(
width: MediaQuery.of(context).size.width - 50,
child: Text(
'A Corretora trabalha com as melhores '
'seguradoras do mercado',
style: TextStyle(fontSize: 21, color: Colors.white),
),
),
),
),
),
// SizedBox(
// height: 15,
// ),
Positioned(
width: MediaQuery.of(context).size.width - 30,
left: 15,
top: 135,
child: Container(
height: 460,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Form(
key: _cadastroKey,
child: Padding(
padding: EdgeInsets.only(left: 15, right: 15),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.person_add,
color: Colors.indigo,
),
Text(
' Cadastre-se abaixo!',
style:
TextStyle(fontSize: 16, color: Colors.indigo),
),
],
),
SizedBox(height: 15),
TextFormField(
controller: _nomeController,
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
prefixIcon: Icon(Icons.person),
hintText: 'Nome Completo',
filled: true,
fillColor: Colors.grey[200]),
),
SizedBox(
height: 20,
),
TextFormField(
controller: _emailController,
validator: (String texto) {
if (texto.isEmpty || !texto.contains('#')) {
return 'Por favor, informe um email válido';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
prefixIcon: Icon(Icons.email),
hintText: 'Email',
filled: true,
fillColor: Colors.grey[200]),
),
SizedBox(
height: 20,
),
TextFormField(
controller: _senhaController,
validator: (String texto) {
if (texto.isEmpty || texto.length < 6) {
return 'Por favor, informe uma senha válida';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
prefixIcon: Icon(Icons.lock),
hintText: 'Senha',
filled: true,
fillColor: Colors.grey[200]),
obscureText: true,
),
SizedBox(
height: 20,
),
TextFormField(
controller: _confirmarSenhaController,
validator: (String texto) {
if (texto.isEmpty || texto.length < 6) {
return 'Por favor, informe uma senha válida';
}
return null;
},
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.transparent),
borderRadius:
BorderRadius.all(Radius.circular(10))),
prefixIcon: Icon(Icons.lock),
hintText: 'Confirme sua Senha',
filled: true,
fillColor: Colors.grey[200]),
obscureText: true,
),
SizedBox(
height: 30,
),
Builder(
builder: (context) => Container(
width: MediaQuery.of(context).size.width - 30,
height: 50,
decoration: BoxDecoration(
color: Colors.indigo,
borderRadius:
BorderRadius.all(Radius.circular(10))),
child: FlatButton(
child: Text(
'Criar Conta',
style: TextStyle(color: Colors.white),
),
onPressed: () {
print('test');
},
),
),
),
SizedBox(
height: 15,
)
],
),
),
),
),
),
],
));
}
}