Je me bats cette DropDownItem
erreur de boîte, tout semble fonctionner, mais fait apparaître le jaune hors des limites pendant le chargement. J'ai essayé plusieurs choses et je n'arrive pas à le résoudre. J'ai ce code pour mon Widget
. Je l'utilise ensuite comme l'une des fonctions suivantes.Flutter RenderIndexedStack objet a été donné une taille infinie pendant la mise en page
Widget _referrerPractice() {
assert(!_createNew);
return new Form(
key: _formKey2,
child: new Expanded(
child: new ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: <Widget>[
new InputDecorator(
decoration: const InputDecoration(
labelText: 'Referrer Practice',
hintText: 'Choose Referrer Practice or choose new',
),
isEmpty: _referPractice == null,
child: new DropdownButton<String>(
value: _referPractice,
isDense: true,
onChanged: (String newValue) {
setState(() {
_referPractice = newValue;
});
},
items: practicelist.map((Map value) {
return new DropdownMenuItem<String>(
value: value['id'].toString(),
child: new Text(value['name']),
);
}).toList(),
),
),
new RaisedButton(
child: new Text('Start'), onPressed: _startReferrer),
],
),
),
);
}
Il semble fonctionner sur une autre page et je ne pas utiliser une fonction pour remplir le widget, juste un var régulier de widgets, mais il semble qu'il devrait être la même que la structure est la même.
Des idées que je manque? Ceci est un DropDownButton
, mais il arrive sur la page qui a un DropDownButton
ainsi pour l'autre fonction.
EDIT ********** Ceci est le code de travail
final List<String> _allTypeAppt = <String>['Elective OP', 'Hospital Transfer', 'Phone Consult'];
new Form(
key: _formKey,
autovalidate: _autovalidate,
onWillPop: _warnUserAboutInvalidData,
child: new Expanded(
child: new ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: <Widget>[
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.person),
hintText: 'First Name?',
labelText: 'First Name *',
),
controller: _fnameController,
onSaved: (String value) { referral.fname = value; },
validator: _validateName,
),
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.person),
hintText: 'Last Name?',
labelText: 'Last Name *',
),
controller: _lnameController,
onSaved: (String value) { referral.lname = value; },
validator: _validateName,
),
new _DateTimePicker(
labelText: 'DOB',
selectedDate: _fromDate,
selectDate: (DateTime date) {
setState(() {
_fromDate = date;
});
},
),
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.phone),
hintText: 'How to contact?',
labelText: 'Phone Number *',
),
controller: _phoneController,
keyboardType: TextInputType.phone,
onSaved: (String value) { referral.contact = value; },
validator: _validatePhoneNumber,
// TextInputFormatters are applied in sequence.
/*inputFormatters: <TextInputFormatter> [
WhitelistingTextInputFormatter.digitsOnly,
// Fit the validating format.
_phoneNumberFormatter,
],*/
),
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.phone),
hintText: 'Alt contact?',
labelText: 'Alt Phone Number *',
),
controller: _altPhoneController,
keyboardType: TextInputType.phone,
onSaved: (String value) { referral.altcontact = value; },
validator: _validatePhoneNumber,
// TextInputFormatters are applied in sequence.
/*inputFormatters: <TextInputFormatter> [
WhitelistingTextInputFormatter.digitsOnly,
// Fit the validating format.
_phoneNumberFormatter,
],*/
),
new TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.email),
hintText: 'Patien Email?',
labelText: 'Patient Email *',
),
controller: _emailController,
onSaved: (String value) { referral.altcontact = value; },
//validator: _validatePhoneNumber,
// TextInputFormatters are applied in sequence.
/*inputFormatters: <TextInputFormatter> [
WhitelistingTextInputFormatter.digitsOnly,
// Fit the validating format.
_phoneNumberFormatter,
],*/
),
new TextFormField(
decoration: const InputDecoration(
hintText: 'Tell us about patient',
helperText: 'It does not have to be detailed yet',
labelText: 'Referral Details',
),
controller: _detailsController,
maxLines: 5,
),
new InputDecorator(
decoration: const InputDecoration(
labelText: 'Type of Appointment',
hintText: 'Choose an Appointment Type',
),
isEmpty: _typeAppt == null,
child: new DropdownButton<String>(
value: _typeAppt,
isDense: true,
onChanged: (String newValue) {
setState(() {
_typeAppt = newValue;
});
},
items: _allTypeAppt.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
),
),
new RaisedButton(
child: new Text('Submit Referral'),
onPressed: _submitData,
),
],
)
)
),
Je ne comprends pas vraiment votre question, pouvez-vous le rendre plus clair? Quelle est l'erreur à laquelle vous faites face? où exactement y faites-vous face? s'il vous plaît essayez d'expliquer le problème d'une manière claire? quel est le problème ? – aziza
Pouvez-vous montrer le code qui fonctionne sur une autre page? – aziza