Objet qui reçois une taille infinie

Bonjour, quand je compile , il me dis l’objet à reçu une taille infinie.

Le ListView est apparemment le problème, mais en essayant différent widget, cela ma revient à la même erreur. Vous avez une idée de comment résoudre cela?

════════ Exception caught by rendering library ═════════════════════════════════
RenderIndexedSemantics object was given an infinite size during layout.
The relevant error-causing widget was
ListView
════════════════════════════════════════════════════════════════════════════════

  body: InteractiveViewer(
          child: ListView(shrinkWrap: false, children: <Widget>[
            AspectRatio(
              aspectRatio: 1 / 1,
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  AspectRatio(
                    aspectRatio: 1,
                    child: target != null
                        ? Image(
                            width: 800,
                            fit: BoxFit.fitWidth,
                            image: target!,
                          )
                        : Container(),
                  ),
                ],
              ),
            ),
            Row(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                _img.buffer.lengthInBytes == 0
                    ? Container()
                    : LimitedBox(
                        maxHeight: 100.0,
                        child: Image.memory(_img.buffer.asUint8List())),
                ElevatedButton(
                  onPressed: () async {
                    await addText(nom, prenom, rue, lieu, date);
                  },
                  child: const Text('Ajoutés vos informations'),
                ),
              ],
            ),
            _buildNom(),
            _buildPrenom(),
            _buildRue(),
            _buildLieu(),
            _buildDate(),
            Column(
              children: [
                Padding(
                  padding: EdgeInsets.all(8.0),
                  child: Signature(
                    color: color,
                    key: _sign,
                    onSign: () {
                      final sign = _sign.currentState;
                    },
                    backgroundPainter: null,
                    strokeWidth: strokeWidth,
                  ),
                ),
                ElevatedButton(
                    onPressed: () async {
                      final sign = _sign.currentState;
                      //retrieve image data, do whatever you want with it (send to server, save locally...)
                      final image = await sign!.getData();
                      var data = await image.toByteData(
                          format: ui.ImageByteFormat.png);
                      sign.clear();
                      final encoded = base64.encode(data!.buffer.asUint8List());
                      setState(() {
                        _img = data;
                      });
                      debugPrint("onPressed " + encoded);
                    },
                    child: const Text("Afficher sur le contrat")),
                ElevatedButton(
                    onPressed: () {
                      final sign = _sign.currentState;
                      sign!.clear();
                      setState(() {
                        _img = ByteData(0);
                      });
                      debugPrint("cleared");
                    },
                    child: const Text("Effacé")),
              ],
            ),
          ]),
        ));

Salut @RodC,
C’est surement parce que ton contenu dépasse de ton écran. Tu devrais remplacer ton InteractiveViewer par un widget SingleChildScrollView (SingleChildScrollView class - widgets library - Dart API).
Je comprend pas trop pourquoi tu as un InteractiveViewer. :thinking:

C’est pas impossible que je me trompe. N’hesite pas à revenir si jamais cette solution ne fonction pas :slight_smile:

1 « J'aime »

InteractiveViewver me permettait de défiler l’écran vers le bas, mais en effet cela marche mieux avec le ** SingleChildScrollView **

Merci de ta réponse !

Une dernière question, sais-tu comment je peux superposé un widget sur un autre?
J’aimerais que la signature soit affiché au dessus de l’image pour après sauvegardé le document modifié.

@RodC Je pense que tu trouveras ta réponse là-dedans :