Skip to content

[Web] [CanvasKit] FittedBox misplaces HtmlElementView #61290

@cbenhagen

Description

@cbenhagen

The HtmlElementView does not fill the card as expected. It works in DomCanvas.

CanvasKit
Screenshot 2020-07-11 at 09 39 05

DomCanvas
Screenshot 2020-07-11 at 09 39 38

import 'dart:html';
import 'dart:ui' as ui;

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    ui.platformViewRegistry.registerViewFactory(
      '123',
      (int viewId) => DivElement()
        ..style.backgroundColor = 'blue'
        ..style.border = 'none',
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Container(
          width: 300,
          height: 300,
          child: Card(
            color: Colors.red,
            child: FittedBox(
              fit: BoxFit.fill,
              child: SizedBox(
                width: 10,
                height: 10,
                child: HtmlElementView(viewType: '123'),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
[✓] Flutter (Channel master, 1.20.0-8.0.pre.55, on Mac OS X 10.15.5 19F101, locale en-CH)
    • Flutter version 1.20.0-8.0.pre.55 at /Users/ben/flutter
    • Framework revision aa0125387c (4 hours ago), 2020-07-10 21:49:40 -0700
    • Engine revision 9b3e3410f0
    • Dart version 2.9.0 (build 2.9.0-21.0.dev 06cb010247)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/ben/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.8.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 47.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (3 available)
    • macOS (desktop)  • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 83.0.4103.116

• No issues found!

Metadata

Metadata

Labels

P1High-priority issues at the top of the work liste: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 1.20Found to occur in 1.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions