Je reçois une exception de rendu que je ne comprends pas comment résoudre. J'essaie de créer une colonne à trois rangées.
Rangée [Image]
Row [TextField]
Rangée [Boutons]
Voici mon code pour construire le conteneur :
Container buildEnterAppContainer(BuildContext context) {
var container = new Container(
padding: const EdgeInsets.all(8.0),
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
buildImageRow(context),
buildAppEntryRow(context),
buildButtonRow(context)
],
),
);
return container;
}
et mon code buildAppEntryRow pour le conteneur de texte
Widget buildAppEntryRow(BuildContext context) {
return new Row(
children: <Widget>[
new TextField(
decoration: const InputDecoration(helperText: "Enter App ID"),
style: Theme.of(context).textTheme.body1,
)
],
);
}
Lorsque je l'exécute, j'obtiens l'exception suivante :
I/flutter ( 7674): BoxConstraints forces an infinite width.
I/flutter ( 7674): These invalid constraints were provided to RenderStack's layout() function by the following
I/flutter ( 7674): function, which probably computed the invalid constraints in question:
I/flutter ( 7674): RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:256:13)
I/flutter ( 7674): The offending constraints were:
I/flutter ( 7674): BoxConstraints(w=Infinity, 0.0<=h<=Infinity)
Si je change buildAppEntryRow en un simple TextField comme ceci
Widget buildAppEntryRow2(BuildContext context) {
return new TextField(
decoration: const InputDecoration(helperText: "Enter App ID"),
style: Theme.of(context).textTheme.body1,
);
}
Je ne reçois plus l'exception. Qu'est-ce qui m'échappe dans l'implémentation de Row et qui empêche le calcul de la taille de cette ligne ?
0 votes
Voir ceci pour résoudre le problème ci-dessus : stackoverflow.com/a/63698894/10563627