Skip to content

Document "How to create a widget with a custom RenderObject" #5173

Closed

Description

@sethladd

From a user:

A “creating a custom widget” section in basic Flutter layout documentation would be helpful, as the setup for a new Custom Widget requires a lot of knowledge up front:

  • Just the RenderBox performLayout() method has several important duties that aren’t reflected in its args or a return value
    • Loop through all the children via a linked list starting with “firstChild”
    • Execute each child RenderBox’s layout functions
    • Set the RenderBox’s size
    • Position each child RenderBox

Activity

  1. self-assigned this
    on Aug 1, 2016
  2. modified the milestone: on Sep 12, 2016
  3. changed the title [-]Document "How to create a custom widget"[/-] [+]Document "How to create a widget with a custom RenderObject"[/+] on Nov 14, 2017
  4. Hixie commented on Nov 14, 2017

    @Hixie
    Contributor

    Some of this is documented now in the RenderBox and RenderObject API docs. Maybe we should add more to the RenderObjectWidget API docs too?

  5. added
    d: api docsIssues with https://api.flutter.dev/
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Nov 14, 2017
  6. xster commented on Dec 21, 2017

    @xster
    Member

    The RenderBox doc was pretty useful. Especially examples like with RenderOpacity. I think a page like https://flutter.io/tutorials/layout/ that walks through a hypothetical exercise with a flow-chart like structure would be nice too.

    i.e.
    so you want to write your own RenderBox?

    How many children?
    -> Common reusable utils
    -> One
    -> Many

    Do you want to customize layout?
    -> Override X, details
    -> Override Y, details
    -> Example/exercise

    Do you want to paint different?
    -> Override X, details
    -> Override Y, details
    -> Example/exercise

  7. goderbauer commented on Dec 27, 2018

    @goderbauer
    Member

    @zoechi Should this be moved to the website repo? Most people I've talked to expect this to be a tutorial on the website. The API docs already have a lot of information on this, but most people want some kind of a codelab on this.

  8. zoechi commented on Dec 27, 2018

    @zoechi
    Contributor

    I copied it to flutter/website#2122 and am going to close here.
    Just reopen if you think there is still api-doc work to do as well.

  9. github-actions commented on Aug 15, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Aug 15, 2021
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

    d: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions