question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

simplify adding a single-child parent Widget

See original GitHub issue

From @HansMuller on February 19, 2016 0:13

This comes up all the time as one realizes that a widget needs padding, or a border, or a background, etc.

Say I start with this:

  return new Foo(
    child: new Column(
      justifyContent: FlexJustifyContent.start,
      children: <Widget>[
        ...
      ]
    )
  );

and I want to end up with this:

return new Foo(
  child: new Padding(
    padding: const EdgeDims.all(16.0),
    child: new Column(
      justifyContent: FlexJustifyContent.start,
      children: <Widget>[
        ...
      ]
    )
  )
);

I’d like to be able to put the cursor inside the Column(), press a magic key to get:

return new Foo(
  child: new TBD(
    child: new Column(
      justifyContent: FlexJustifyContent.start,
      children: <Widget>[
        ...
      ]
    )
  )
);

which is easily finished by changing TBD to Padding and add the padding: parameter.

Copied from original issue: flutter/flutter#2016

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
sethladdcommented, Dec 14, 2016

I strongly believe that this functionality should live in DAS and its plugins.

Yes, please!

0reactions
pqcommented, Mar 10, 2017

I heard this feature was shown in a recent demo.

It was and went over great! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reset child widget from parent widget in flutter - Stack Overflow
I have a child widget that is full of variables. When I do a setState() on my parent widget, I want it to...
Read more >
Flutter Single Child Layout Widgets | by Chamith Chathuka
As the name suggests, it can have only one child widget inside the parent ... This Widget help to build the layout by...
Read more >
9 Manager Widgets - O'Reilly
The Scale creates and manages its own widgets; the only children that you can add to a Scale are Label widgets that represent...
Read more >
StatefulWidget lifecycle | Flutter by Example
Initialize properties that rely on this widgets 'parent' in the tree. 3. ... initState(); // Add listeners to this class cartItemStream.listen((data) ...
Read more >
Flutter - Flexible Widget - GeeksforGeeks
In the body of the app, the parent widget is Center followed by Container and Padding. After that, we have a Column widget...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found