Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
clientHeight/Width of Flutter platform view is always 0

While trying to add a third party js library inside a Flutter web application, I'm facing an issue with clientHeight and clientWidth properties:

I've added a DivElement inside my widget tree with:

 @override
  void initState() {
    super.initState();

    divElement = DivElement()
      ..id = 'viewer_div'
      ..style.width = '100vh'
      ..style.height = '100vh'
      ..style.border = '1px solid green';

    // ignore: UNDEFINED_PREFIXED_NAME
    ui.platformViewRegistry.registerViewFactory(
        'viewer', (int viewId) => dicomElement);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 512, height: 512,
      color: Colors.transparent,
      child: const HtmlElementView(viewType: 'viewer'),
    );
  }

The divElement is used by the third party js library which adds a canvas DOM element as a child of the div. But the third party library also set the size the canvas according to the divElement clientWidth and clientHeight AND these values always return 0 so the final canvas width and height are set to 0!

I've tried to call the javascript method, which adds the canvas, after the first frame has been rendered but it does not change anything.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda