Hacker News new | ask | show | jobs
by wmleler 3040 days ago
The killer feature of building UI elements in code is that you can build up more complex widgets from simpler ones using composition. Flutter does this everywhere, which makes it super easy to modify or customize any widget, or to reuse widgets to build a new one.

You mention following complex nesting chains through code declarations. I understand what you are talking about, but the (awesome) Flutter tooling now has two views that make this far easier: the Widget Inspector, which lets you see and modify the widget tree at runtime (there was a talk on this at DartConf), and the new Outline view (just released a few days ago), which helps you play with the widget declarations in your code.

See https://flutter.io/inspector/ and https://groups.google.com/forum/#!topic/flutter-dev/lKtTQ-45... (for the outline view)

2 comments

> The killer feature of building UI elements in code is that you can build up more complex widgets from simpler ones using composition.

You can do this in XAML since 2006, and JSP since 2004.

Not sure why you're being downvoted. XAML definitely supports complex widget composition in markup. Since the XML is basically just describing an object graph, it's a more concise way of writing the equivalent imperative code:

    <Button>
        <StackPanel>
            <Image/>
            <TextBlock/>

    ...

    <Button>
        <Canvas>
            <Ellipse/>
although the Dart syntax makes this look similar, albeit a little more verbose, if you squint.

Full disclosure: I work at Microsoft.

So why nobody is writing these "more complex" widgets? Really, react is here for a while and yet there is still no "solid" UI library.

Nothing with keyboard-friendly lists, data-grids and trees. And what about "controls"? How come I can't disable the whole form, including tabs and other controls, with just one attribute? Or a panel which can be detached into floating window?

Thats what I would call complex (and useful) widget.

BTW: This is what customers want (checktree, columncombo, dateragepicker, moneyfield with calculator, ...) https://www.tmssoftware.com/site/products.asp?t=vcl