Skip to content

Add example of using HtmlElementView.fromTagName to flutter.dev #140100

Description

@srujzs

HtmlElementView.fromTagName currently has the following example in its dartdoc:

 import 'package:flutter/widgets.dart';
 import 'package:web/web.dart' as web;

 // ...

 class MyWidget extends StatelessWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return HtmlElementView.fromTagName(
     tagName: 'div',
     onElementCreated: (Object element) {
        element as web.HTMLElement;
       element.style
           ..backgroundColor = 'blue'
            ..border = '1px solid red';
     },
    );
  }
}

/// Creates a platform view that creates a DOM element specified by [tagName].

#139696 is planning on removing the dependency to package:web in Flutter, so while the above code example is valid, it does not pass analysis as Flutter no longer depends on package:web. This example should now instead move to flutter.dev once that PR removes it from the dartdoc.

Activity

  1. transferred this issue fromflutter/flutteron Dec 12, 2023
  2. transferred this issue fromflutter/websiteon Dec 13, 2023
  3. atsansone commented on Dec 13, 2023

    @atsansone

    Moved from flutter/website as this covers API docs.

  4. added
    team-webOwned by Web platform team
    and removed on Dec 19, 2023
  5. added
    P2Important issues not at the top of the work list
    triaged-webTriaged by Web platform team
    on Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.team-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions