You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
annahernandez99
4 years agoExplorer | Level 4
Flutter How to print selected value on textfield when keyboard is hide
hellow thank you in advance can you help me....! i made dropbox under the textfield..and in that case...i dont want keyboard...! but when i selecte value from my items then that value is not printed on my textfield...! let me explain you as live... if you are a existing custmor the value is shown on textfield and when you select value MALE FEMALE is not going to change.....! if i remove the onTap() {} from my textfield its going to change...! what should i do now i stuck here since 2,3 days
look at my code
@override
Widget build(BuildContext context) {
return Scaffold(
body: (_isLoading) ? Center(child: CircularProgressIndicator()) :
FutureBuilder<UserUpdate>(
future: _futureProfileupdate,
builder: (context, snapshot) {
if (snapshot.hasData) {
TextEditingController _textEditingControllerGender = TextEditingController(text:
snapshot.data.gender);
var items = ["MALE" , "FEMALE"];
return Form(
key: _formKey,
child: Stack(
children: <Widget>[
SingleChildScrollView(
reverse: true,
child: new Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 10,left: 30,right: 30),
child: SizedBox(
height: 65,
child: TextFormField(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
}, // if i remove this iteam is going to print on tetxfiled
focusNode: FocusNode(canRequestFocus: false),
textInputAction: TextInputAction.next,
controller: _textEditingControllerGender,
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(
color: Color(0x3df58634)
)
),
labelText: "GENDER",
labelStyle: GoogleFonts.nunito(
color: const Color(0xfff58634)),
hintText: "GENDER",
hintStyle: GoogleFonts.nunito(
color: const Color(0xfff58634)),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(
5.0),
borderSide: BorderSide(
color: const Color(0x3df58634),
)
),
suffixIcon: PopupMenuButton<String>(
icon: const Icon(Icons.arrow_drop_down),
onSelected: (String value) {
_textEditingControllerGender.text = value;
},
itemBuilder: (BuildContext context) {
return items
.map<PopupMenuItem<String>>((String value) {
return new PopupMenuItem(
child: new Text(value), value: value);
}).toList();
},
),
),
onSaved: (String value) {
_Gender = value;
},
),
),
),
Padding(
padding: EdgeInsets.only(top: 10.0,left: 230,right: 30),
child: SizedBox(
width: 140,
height: 45,
child: RaisedButton(
onPressed: () {
if (!_formKey.currentState.validate()) {
return;
}
setState(() {
_isLoading = true;
});
Profile(
_textEditingControllerGender.text,
);
},
here is my json data.... plz help me i am stuck here since 2,3 days UserUpdate userUpdateFromJson(String str) => UserUpdate.fromJson(json.decode(str));
String userUpdateToJson(UserUpdate data) => json.encode(data.toJson());
class UserUpdate {
UserUpdate({
this.successCode,
this.successMessage,
this.firstName,
this.lastName,
this.email,
this.gender, //i want thiis default to my textfiled and change when i select new
this.birthDate,
this.birthMonth,
this.anniversaryDate,
this.profilePicture,
});
String successCode;
String successMessage;
String firstName;
String lastName;
String email;
dynamic gender;
String birthDate;
String birthMonth;
String anniversaryDate;
String profilePicture;
factory UserUpdate.fromJson(Map<String, dynamic> json) => UserUpdate(
successCode: json["SuccessCode"],
successMessage: json["SuccessMessage"],
firstName: json["FirstName"],
lastName: json["LastName"],
email: json["Email"],
gender: json["Gender"],
birthDate: json["BirthDate"],
birthMonth: json["BirthMonth"],
anniversaryDate: json["AnniversaryDate"],
profilePicture: json["ProfilePicture"],
);
Map<String, dynamic> toJson() => {
"SuccessCode": successCode,
"SuccessMessage": successMessage,
"FirstName": firstName,
"LastName": lastName,
"Email": email,
"Gender": gender,
"BirthDate": birthDate,
"BirthMonth": birthMonth,
"AnniversaryDate": anniversaryDate,
"ProfilePicture": profilePicture,
};
}
- Greg-DBDropbox Staff
This is the forum for Dropbox and the Dropbox API, but it doesn't look like your question is related to Dropbox or the Dropbox API. You seem to be asking about Flutter, which isn't made by Dropbox. You may want to post on a forum for Flutter instead.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!