Skip to content

declarative::experimental::Dynamic#

A view that exposes a contract::In<_> to provide dynamic content.

The view simply forwards the provided child view as its content. It can be used in declarative UI to inject arbitrary views at runtime.

Header:#include <AUI/View/Dynamic.h>
CMake:aui_link(my_target PUBLIC aui::views)

Examples#

examples/app/notes/src/main.cpp

Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.

                        } AUI_LET {
                            connect(AUI_REACT(mCurrentNote != nullptr), AUI_SLOT(it)::setEnabled);
                        },
                      },
                      experimental::Dynamic { AUI_REACT(noteEditor(mCurrentNote)) } AUI_OVERRIDE_STYLE { Expanding() },
                    } << ".plain_bg" AUI_OVERRIDE_STYLE { MinSize { 200_dp } },
                  })
                  .build() AUI_OVERRIDE_STYLE { Expanding() },
        });
examples/ui/contacts/src/main.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

                            _new<ATextField>() && mSearchQuery,
                            SpacerFixed(8_dp),
                            AText::fromString(predefined::DISCLAIMER) AUI_OVERRIDE_STYLE { ATextAlign::CENTER },
                            SpacerFixed(8_dp),
                            experimental::Dynamic {
                                .content = AUI_REACT(mSearchQuery->empty() ? indexedList() : searchQueryList()),
                            },
                            Label { AUI_REACT("{} contact(s)"_format(mContactCount)) } AUI_LET {
                                AObject::connect(AUI_REACT(ass::PropertyList{
                                    FontSize { 10_pt },