Make the two text field always align together - flutter

How to make the length of the textField always same?
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Project"),
SizedBox(
width: 25,
),
Expanded(
child: TextField(
style: TextStyle(fontSize: 12),
// onChanged: (text) => _assetBloc.assetSink.add(text),
controller: _projectController,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius:
const BorderRadius.all(const Radius.circular(5.0))),
contentPadding: EdgeInsets.all(10),
hintText: "Phase 1",
labelText: "Phase 1",
),
))
],
),SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("To"),
SizedBox(
width: 25,
),
Expanded(
child: TextField(
style: TextStyle(fontSize: 12),
// onChanged: (text) => _assetBloc.assetSink.add(text),
controller: _projectController,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius:
const BorderRadius.all(const Radius.circular(5.0))),
contentPadding: EdgeInsets.all(10),
hintText: "Phase 1",
labelText: "Phase 1",
),
))
],
)

Try this code:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: TextFields()
),
),
);
}
}
class TextFields extends StatelessWidget {
#override
Widget build(BuildContext context) {
// TODO: implement build
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: MediaQuery.of(context).size.width/7,
child: Text("Project")),
SizedBox(
width: 25,
),
Flexible(
child: TextField(
style: TextStyle(fontSize: 12),
// onChanged: (text) => _assetBloc.assetSink.add(text),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0))),
contentPadding: EdgeInsets.all(10),
hintText: "Phase 1",
labelText: "Phase 1",
),
))
],
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: MediaQuery.of(context).size.width/7,
child: Text("To")),
SizedBox(
width: 25,
),
Expanded(
child: TextField(
style: TextStyle(fontSize: 12),
// onChanged: (text) => _assetBloc.assetSink.add(text),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0))),
contentPadding: EdgeInsets.all(10),
hintText: "Phase 1",
labelText: "Phase 1",
),
))
],
)
],
),
);
}
}

Since you are using an Expanded widget your Textfield always take whatever room is left.
I think the trick here would be to wrap your Text Widget in a Container of fix width.

You could use a Row and 2 Columns for this
Row(
children: [
Column(
children: [
Text("Project"),
Text("To")
]
),
SizedBox(width: 10),
Expanded(
child: Column(
children: [
TextField(),
TextField()
]
)
)

Related

How to make the text above the textformfield?

This is the design I want to make
This is my current design
I'm new to flutter. My question is how to make the text above the textformfield. I have searched on the internet and tried to do it but still no success. I don't know where else to go to solve my problem. I hope overflow is willing to help me.
This is my code:
Container(
width: double.infinity,
margin: EdgeInsets.fromLTRB(10, 0, 10, 10),
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
border: Border.all(
color: Colors.transparent,
width: 1.0,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
SizedBox(
height: 100,
width: 100,
child: Text('First Name'),
),
SizedBox(
width: 200,
child: TextFormField(
style: TextStyle(color: Colors.black),
controller: firstName,
onSaved: (String? value) {
firstName.text = value!;
},
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'First Name',
hintStyle: TextStyle(
color: Colors.black, fontSize: 16),
),
),
),
],
)
],
),
)
Your problem occurs because of wrong widget placement. Notice that you've Row inside a Column, but you don't really use Column's children in order to vertically place 'First Name' text widget.Also the row is basically redundant currently. You can make a Row of Columns I just shared below in order to achieve your desired UI. Try to play with it :)
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(
height: 20,
width: 100,
child: Text('First Name'),
),
SizedBox(
width: 150,
child: TextFormField(
style: const TextStyle(color: Colors.black),
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'First Name',
hintStyle: TextStyle(color: Colors.black, fontSize: 16),
),
),
)
],
),
200px is too big and structure I will prefer
Row
-Expanded
- Column (CrossAxisAlignment.startMainAxisSize.min,)
- Text
- TextFormField
-Expanded
- Column (CrossAxisAlignment.startMainAxisSize.min,)
- Text
- TextFormField
-Expanded
- Column (CrossAxisAlignment.startMainAxisSize.min,)
- Text
- TextFormField
#override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
border: Border.all(
color: Colors.transparent,
width: 1.0,
),
),
child: Row(
children: [
filed(),
filed(),
filed(),
],
),
)
],
),
);
}
Expanded filed() {
return Expanded(
child: Padding(
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(bottom: 20),
child: Text('First Name'),
),
TextFormField(
style: TextStyle(color: Colors.black),
onSaved: (String? value) {},
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'First Name',
hintStyle: TextStyle(color: Colors.black, fontSize: 16),
),
),
],
),
),
);
}
}
To create the TextField you want, you just need to use a Column like this:
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('First Name', style: TextStyle(fontWeight: FontWeight.bold),),
SizedBox(
width: 200,
child: TextFormField(
style: TextStyle(color: Colors.black),
onSaved: (String? value) {
// firstName.text = value!;
},
decoration: InputDecoration(
border: OutlineInputBorder(),
hintText: 'First Name',
hintStyle: TextStyle(color: Colors.black, fontSize: 16),
),
),
)
],
)
The result is:
In the input decoration of TextFormField, use label instead of hintText.
decoration: InputDecoration(
border: OutlineInputBorder(),
label: Text('First Name',
style: TextStyle(color: Colors.black, fontSize: 16),),
),
List item
You use the the property 'Labletext' of TextFormFiled or TextField....
to give the above text of the textformFiled.
just use column widget first children is Text and second children as TextFormField.

Facing assertion error when trying to add row inside a column

I am trying to make a login page which looks like this
But whenever I try to add row which has another column iside it for textinput field and text It shows assertion error. I also tried removing sized box before text row still it is showing the same error
My flutter code:
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: color,
body: SafeArea(
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 20.0,
),
Text('Life Drop',
style: TextStyle(fontSize: 40, color: Colors.white)),
SizedBox(
height: 10.0,
),
Text("your blood can save lives",
style: TextStyle(fontSize: 12, color: Colors.white)),
SizedBox(
height:20.0
),
Row(
children: [
Column(children: [
Text('Login'),
TextFormField(
controller: emailController,
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Email',
),
),
SizedBox(width: 20),
],)
],
)
],
),
),
)
)
);
}
edit your row like below code:
Expanded(
child: Row(
children: [
Expanded(
child: Column(
children: [
const Text('Login'),
TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Email',
),
),
const SizedBox(width: 20),
],
)),
],
))

converting a statelesswidget into statefulwidget or coding a checkbox in a statelesswidget

I want to use a checkbox for checking, if the user is an admin or a normal user.
I already tried to do a statefulwidget out of my statelesswidget, but it won't work at all.
How can I convert my authentification page into a statefulwidget?
The code for my checkbox would be:
Checkbox(
value: checkBoxValue,
onChanged: (bool value){
setState(() => checkBoxValue = value);
}),
Text("Admin",)
],
),
The problem is that "setState" isn't defined for a statelesswidget, so I need to convert my authentification page into a statefulwidge.
But how can I do this? I have already tried it a few times, but I always get a lot of errors.
Or is there maybe an other way to code the checkbox with using a statelesswidget?
authentication.dart code:
import 'package:bestfitnesstrackereu/pages/home/home_view.dart';
import 'package:bestfitnesstrackereu/routing/route_names.dart';
import 'package:flutter/material.dart';
class AuthenticationPage extends StatelessWidget {
const AuthenticationPage({Key key}) : super(key: key);
#override
Widget build(BuildContext context) {
bool checkBoxValue = false;
return Scaffold(
body: Center(
child: Container(
constraints: BoxConstraints(maxWidth: 400),
padding: EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Padding(
padding: EdgeInsets.only(right: 12),
child: Image.asset("assets/logo.png"),
),
Expanded(child: Container()),
],
),
SizedBox(
height: 30,
),
Row(
children: [
Text("Login",
style: TextStyle(
fontSize: 30, fontWeight: FontWeight.bold
)),
],
),
SizedBox(height: 10,),
Row(
children: [
Text(
"Welcome back to the admin panel",
style: TextStyle(
color: Colors.grey,))
],
),
SizedBox(height: 15,),
TextField(
decoration: InputDecoration(
labelText: "E-Mail",
hintText: "abc#domain.com",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20)
)
),
),
SizedBox(height: 15,),
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: "Password",
hintText: "123",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20)
)
),
),
SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox(
value: checkBoxValue,
onChanged: (bool value){
setState(() => checkBoxValue = value);
}),
Text("Admin",)
],
),
Text(
"Forgot password",
style: TextStyle(
color: Colors.white,
))
],
),
SizedBox(height: 15,),
InkWell(
onTap: (){
Navigator.of(context).pushNamed(HomeRoute);
},
child: Container(
decoration: BoxDecoration(color: Colors.grey,
borderRadius: BorderRadius.circular(20)),
alignment: Alignment.center,
width: double.maxFinite,
padding: EdgeInsets.symmetric(vertical: 16),
child: Text(
"Login",
style: TextStyle(
color: Colors.black,
),)
)
),
SizedBox(height: 15,),
InkWell(
onTap: (){
Navigator.of(context).pushNamed(HomeRoute);
},
child: Container(
decoration: BoxDecoration(color: Colors.grey,
borderRadius: BorderRadius.circular(20)),
alignment: Alignment.center,
width: double.maxFinite,
padding: EdgeInsets.symmetric(vertical: 16),
child: Text(
"Teilnehmer werden",
style: TextStyle(
color: Colors.black,
),)
)
),
RichText(text: TextSpan(
children: [
TextSpan(text: "Do not have admin credentials?\n"),
TextSpan(text: "Request credentials!", style: TextStyle(color: Colors.black))
]
))
],
),
)
),
);
}
}
Depending on the IDE you are using, when you hover on the widget class name, there is a light bulb that show on the left side in the editor. When you click on the light bulb, there is an option to convert to a stateless widget.

Flutter:(TextFormField)Problem when opening the keyboard and start typing

When I open the keyboard to start typing, the problem appears that there is too much space
[1]: https://i.stack.imgur.com/Nk4l6.png
[2]: https://i.stack.imgur.com/12jNe.png
the code:
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
class SignUpScreen extends StatelessWidget {
#override
var Email, Pass;
var txt;
GlobalKey<FormState> formstate = new GlobalKey<FormState>();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 0,
leading: Container(),
backgroundColor: Color(0xFF03045E),
),
body: Container(
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFF03045E),Color(0xFF1F21D5),]
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: 45,
height: 45,
margin: EdgeInsets.only(top: 70,right: 35),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xff383989),
),
child: FlatButton(
onPressed: (){
Get.back();
},
child: Image(
image: AssetImage('assets/images/cancel-icon.png'),
color: Colors.white,
width: double.infinity,
),
),
),
],
),
Container(
margin: EdgeInsets.symmetric(horizontal: 35),
child: Column(
children: [
Container(
margin: EdgeInsets.only(bottom: 40),
child: Row(
children: [
Text('Create\n Account',style: TextStyle(
color: Colors.white,
fontSize: 30
),),
],
),
),
Row(
children: [
Text('Create account and enjoy 7 days free trial',style: TextStyle(
color: Color(0xffB2B2DC),
fontSize: 15
),),
],
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.name,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
hintText: 'Your first and last name?',
labelText: 'Full Name',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.emailAddress,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 'Email',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.visiblePassword,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 'password',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Row(
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: TextFormField(
keyboardType: TextInputType.visiblePassword,
cursorColor: Colors.white,
style: TextStyle(fontSize: 18, color: Colors.white),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white24,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
contentPadding: EdgeInsets.symmetric(vertical: 25.0, horizontal: 20.0),
labelText: 're-password',
labelStyle: TextStyle(color:Colors.white60 , fontSize: 18),
hintStyle: TextStyle(color:Colors.white60 , fontSize: 18),
),
onSaved: (val) {
Email = val;
},
validator: (val) {
if (val == null || val.isEmpty) {
return 'Please enter some text';
}
},
),
),
Expanded(flex: 1 , child: Container(),)
],
),
Container(
margin: EdgeInsets.only(bottom: 50,top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(flex: 1 , child: Container(),),
Expanded(
flex: 10,
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)
),
color: Colors.white,
height: 70,
onPressed: (){},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text('Sign up',textAlign:TextAlign.center,
style: TextStyle(
color: Color(0xff03045E),
fontSize: 18.0,
),),
),
],
),
),
),
Expanded(flex: 1 , child: Container(),),
],
),
),
],
),
),
],
),),
],
),
),
);
}
}
======== Exception caught by rendering library =====================================================
The following assertion was thrown during layout:
A RenderFlex overflowed by 51 pixels on the bottom.
The relevant error-causing widget was:
Column Column:file:///M:/Android%20PG/lockvpn0/lib/view/auth/sign-up.dart:87:26
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
The specific RenderFlex in question is: RenderFlex#d12d3 relayoutBoundary=up5 OVERFLOWING
... needs compositing
... parentData: offset=Offset(0.0, 260.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, h=388.9)
... size: Size(411.4, 388.9)
... direction: vertical
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
You can wrap your column with a SingleChildScrollView. That should fix the overflow issue.
If you set resizeToAvoidBottomInset to true on your scaffold, the column won't be squished but you also won't be able to see your TextFields.

I want to update the text inside a TextFormField when I change the item in a DropDownButton in Flutter

I have a dropDownButton populated with a query from my database here I have the users, when I select an item I want to show all the user info in the TextFields below.
Since some of the information should not be edited by hand, I wanted to make some of the fields as containers, so I can't write in them, but some fields should be a TextField so I can edit them. I'm new to flutter so I still don't understand this at full, and I can't find a way to load the info in the TextFields when I change the dropDownButton.
here is the code below:
class UtilizadorPage extends StatefulWidget {
#override
_UtilizadorPageState createState() => new _UtilizadorPageState();
}
class _UtilizadorPageState extends State<UtilizadorPage> {
Utilizador user = Utilizador();
BDLocal db = BDLocal.instance;
Utilizador? _currentUser;
var txt = TextEditingController();
#override
void initState(){
super.initState();
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Utilizadores",
),
),
body: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FutureBuilder<List<Utilizador>>(
future: user.getUtilizadores(),
builder: (BuildContext context,
AsyncSnapshot<List<Utilizador>> snapshot){
if (!snapshot.hasData) return CircularProgressIndicator();
return DropdownButton<Utilizador>(
alignment: Alignment.center,
items: snapshot.data?.map((util) => DropdownMenuItem<Utilizador>(
child: Text(util.nome),
value: util,
)).toList(),
onChanged:(Utilizador? value) {
setState(() {
_currentUser = value;
});
},
isExpanded: false,
//value: _currentUser,
hint: Text('Select User'),
);
}),
]
),
SizedBox(height: 20.0),
Row(
children: [
_currentUser != null
? Expanded(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Nome",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.nome)
),
),
),
SizedBox(width: 10.0),
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "ID na BDNuvem",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.id_BDNuvem.toString())
),
),
),
]),
SizedBox(height: 20.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: TextFormField(
initialValue: _currentUser!.perfil.toString(),
decoration: InputDecoration(
label: Text("Perfil"),
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
),
),
SizedBox(width: 10.0),
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Numero de Colaborador",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.numero.toString())
),
),
),
],
),
SizedBox(height: 20.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Nome do Funcionario",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.nomeFuncionario)
),
),
),
],
),
SizedBox(height: 20.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Email",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.email)
),
),
),
],
),
SizedBox(height: 20.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Senha",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.senha)
),
),
),
],
),
SizedBox(height: 20.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Ultima Atualizacao",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.ultimaAtualizacao)
),
),
),
SizedBox(width: 10.0),
Expanded(
flex: 1,
child: Container(
child: InputDecorator(
decoration: InputDecoration(
labelText: "Atualizado Por",
floatingLabelBehavior:FloatingLabelBehavior.always,
border: OutlineInputBorder(),
),
child: Text(_currentUser!.atualizadoPor)
),
),
),
],
),
],
),
)
: Text("No User selected"),
],
)
],
),
);
}
}
I only have one textField now because I'm still experimenting things.
what I wanted to do is update the value of the text with the info I retrieved from the query for example: _currentUser!.perfil.toString(), which holds a string that represent the type of user
If you've assigned a TextEditingController to Textfield you can simply manipulate value in by
myTextEditingController.text = "new value";