1
votes

Flare Actor ne fonctionne pas dans le widget positionné ni même dans la colonne ou dans la ligne en scintillement

The following assertion was thrown during performLayout():
I/flutter (18558): RenderStack object was given an infinite size during layout.
I/flutter (18558): This probably means that it is a render object that tries to be as big as possible, but it was put
I/flutter (18558): inside another render object that allows its children to pick their own size.
I/flutter (18558): The nearest ancestor providing an unbounded width constraint is:
I/flutter (18558):   RenderStack#2151d relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (18558):   creator: Stack ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
I/flutter (18558):   AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#874dd ink
 renderer] ← NotificationListener<LayoutChangedNotification> ← PhysicalModel ←
I/flutter (18558):   AnimatedPhysicalModel ← Material ← ⋯
I/flutter (18558):   parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
I/flutter (18558):   constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=560.0) size: Size(360.0, 560.0)
I/flutter (18558):   alignment: AlignmentDirectional.topStart
I/flutter (18558):   textDirection: ltr
I/flutter (18558):   fit: loose
I/flutter (18558):   overflow: clip
I/flutter (18558): The nearest ancestor providing an unbounded height constraint is:
I/flutter (18558):   RenderStack#2151d relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (18558):   creator: Stack ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
I/flutter (18558):   AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#874dd ink
I/flutter (18558):   renderer] ← NotificationListener<LayoutChangedNotification> ← PhysicalModel ←
I/flutter (18558):   AnimatedPhysicalModel ← Material ← ⋯
I/flutter (18558):   parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
I/flutter (18558):   constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=560.0)
I/flutter (18558):   size: Size(360.0, 560.0)
I/flutter (18558):   alignment: AlignmentDirectional.topStart
I/flutter (18558):   textDirection: ltr 
I/flutter (18558):   fit: loose
I/flutter (18558):   overflow: clip
I/flutter (18558): The constraints that applied to the RenderStack were:
I/flutter (18558):   BoxConstraints(unconstrained)
I/flutter (18558): The exact size it was given was:
I/flutter (18558):   Size(Infinity, Infinity)
I/flutter (18558): See https://flutter.dev/layout/ for more information.  

0 commentaires

3 Réponses :


0
votes

Enveloppez le FlareActor avec Expanded (): Exemple:

Expanded(child: FlareActor("Assets/wellness.flr", alignment:Alignment.center, fit:BoxFit.contain, animation:"idle")),


0 commentaires

1
votes

Ceci est dû au problème de taille ...

Lisez attentivement l'erreur suivante

I / flutter (18558): l'objet RenderStack a reçu une taille infinie lors de la mise en page.

I / flutter (18558): Cela signifie probablement que c'est un objet de rendu qui essaie d'être aussi grand que possible, mais il a été mis à l'intérieur d'un autre objet de rendu qui permet son les enfants à choisir leur propre taille.

Concentrez-vous sur ces lignes, vous comprendrez le problème

mais il a été mis à l'intérieur d'un autre objet de rendu qui permet son les enfants à choisir leur propre taille.

Appliquez les ajouts suivants:

  • Ajoutez des décalages de position dans le widget Positionné.
  • Augmentez la taille de SizedBox à (360.0, 560.0).
  • Remplacez Sizedbox () par un Container ().
  • Renommez votre fichier flare et réimportez-le.
  • ajoutez une propriété fit dans FlareActor ().
  • Utilisez un widget parent approprié pour Flareactor () qui ne restreint pas la taille de l'enfant.

0 commentaires

1
votes

vous pouvez réellement le mettre dans un Expanded () et avoir par exemple un conteneur comme l'enfant. Par exemple. cela fonctionne parfaitement bien:

body: Column(
          children: [
            Expanded(
              child: Container(
                child: FlareActor(

De cette façon, vous pouvez mettre plusieurs fusées éclairantes dans une colonne. Il y a une excellente documentation. Faites simplement défiler jusqu'à l'exemple 25 ici: https://flutter.dev/docs/development/ ui / layout / contraintes


0 commentaires