Widgets

View

View

A full-screen route surface used in page-based navigation.

Example

page.appbar = app_bar(
  title: text(value: "Home")
)

page.views = [
  view(
    route: "/home",
    controls: [
      container(
        padding: 16,
        content: text(value: "Welcome")
      )
    ]
  )
]

Common properties

  • route
  • controls
  • padding
  • bgcolor
  • floating_action_button

Usage

Use view when the app manages multiple routes or full-screen destinations:

view(
  route: "/settings",
  controls: [
    text(value: "Settings")
  ]
)

Notes

  • Attach the top app bar to the page with page.appbar = app_bar(...)
  • page.views usually holds the current navigation stack
  • controls takes an array of child controls

Complete API

Helpers

  • view(children = ..., **props, &block)

Accepted properties

  • align — Alignment of the control within its parent.
  • animate_align — Animates alignment changes.
  • animate_margin — Animates margin changes.
  • animate_offset — Animates offset changes.
  • animate_opacity — Animates opacity changes.
  • animate_position — Animates position changes.
  • animate_rotation — Animates rotation changes.
  • animate_scale — Animates scale changes.
  • animate_size — Animates size changes.
  • appbar — Sets the appbar property.
  • aspect_ratio — Width-to-height ratio to maintain.
  • auto_scroll — Sets the auto scroll property.
  • badge — Badge drawn on the corner of the control.
  • bgcolor — Background color.
  • bottom — Bottom offset when positioned inside a stack.
  • bottom_appbar — Sets the bottom appbar property.
  • can_pop — Sets the can pop property.
  • col — Responsive column span (1-12) per breakpoint.
  • controls — The list of child controls.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • decoration — Sets the decoration property.
  • disabled — Disables interaction when true.
  • drawer — Sets the drawer property.
  • end_drawer — Sets the end drawer property.
  • expand — Fills the available space along the parent's main axis when true.
  • expand_loose — Like expand, but only grows up to the child's natural size.
  • floating_action_button — Sets the floating action button property.
  • floating_action_button_location — Sets the floating action button location property.
  • foreground_decoration — Sets the foreground decoration property.
  • fullscreen_dialog — Sets the fullscreen dialog property.
  • height — Fixed height in logical pixels.
  • horizontal_alignment — Horizontal alignment.
  • key — Stable identity used to preserve state across rebuilds.
  • left — Left offset when positioned inside a stack.
  • margin — Outer spacing around the control.
  • navigation_bar — Sets the navigation bar property.
  • offset — Translation offset applied to the control.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • padding — Inner spacing between the border and the content.
  • right — Right offset when positioned inside a stack.
  • rotate — Rotation applied to the control.
  • route — Sets the route property.
  • rtl — Renders right-to-left when true.
  • scale — Scale transform applied to the control.
  • scroll — Sets the scroll property.
  • scroll_interval — Sets the scroll interval property.
  • services — Sets the services property.
  • size_change_interval — Throttle interval for on_size_change, in ms.
  • spacing — Sets the spacing property.
  • tooltip — Text shown on hover/long-press.
  • top — Top offset when positioned inside a stack.
  • vertical_alignment — Vertical alignment.
  • visible — Hides the control when false.
  • width — Fixed width in logical pixels.

Events

  • on_animation_end — Fired when an animation completes.
  • on_confirm_pop — Fired on confirm pop.
  • on_scroll — Fired when the scroll position changes.
  • on_size_change — Fired when the control's size changes.

Wire reference

  • Family: shared
  • Widget type: view