Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flutter → FLUI mapping

A vocabulary table for readers coming from Flutter. Every row is checked against the real trait or struct in crates/.

FlutterFLUIWhere
StatelessWidgetStatelessView (#[derive(StatelessView)])crates/flui-view/src/view/stateless.rs
StatefulWidget + State<T>StatefulView + ViewState<V>crates/flui-view/src/view/stateful.rs
BuildContextBuildContext trait for build; the presentation capabilities (rebuild_handle(), post_frame_handle(), text_input_handle(), focus_manager(), …) live on its LifecycleContext subtrait, which only create_state/init_state/did_change_dependencies receive (ADR-0078)crates/flui-view/src/context/build_context.rs
setState(() => ...)A Signal<T> created with ctx.signal(..) in create_state, written through the ctx of an event callback; the signal rebuilds the elements that read itcrates/flui-view/src/reactive/, crates/flui-view/src/context/build_context.rs
InheritedWidgetInheritedViewcrates/flui-view/src/view/inherited.rs
NavigatorThe page stack inside a Router<R>; a page reaches its router with Router::of(ctx) (GoRouter.of(context)) and its own route with PageHandle::of(ctx) (ModalRoute.of(context)), and Route, PageRoute and PageTransitions shape how a page is presentedcrates/flui-widgets/src/navigator/
RouterRouter<R: Routable> + RouterHandle<R>, with #[derive(Routable)] on a route enumcrates/flui-widgets/src/router/
WidgetsAppWidgetsApp (WidgetsApp::new(home) or WidgetsApp::router(router))crates/flui-widgets/src/app/widgets_app.rs
MaterialApp / CupertinoAppMaterialApp / CupertinoApppackages/flui-material/src/app.rs, packages/flui-cupertino/src/app.rs
WidgetTester (testWidgets, pumpWidget, pump, pumpAndSettle, tap, enterText, sendKeyEvent)scenario::Tester (Tester::mount, replace_root, pump, pump_for, settle, tap, type_text, press_keys), synchronouscrates/flui-testing/src/scenario/tester.rs, crates/flui-testing/src/scenario/in_process.rs
tester.platformDispatcher (textScaleFactorTestValue, accessibilityFeaturesTestValue, …), tester.viewTester::platform on a headless tester (set_system_preferences, set_motion, set_window_focused, set_window_visible): each is heard at once, and the next pump builds what it changedcrates/flui-testing/src/scenario/platform.rs
find.text, find.byKey, find.bySemanticsLabelfind::text, find::id, find::button, find::role: each a Find over the semantics tree, naming one element (.all(), .first(), .nth(n) widen it)crates/flui-testing/src/scenario/find.rs, crates/flui-protocol/src/locator.rs
expect(finder, findsOneWidget)t.expect(&find, exists()) (gone(), count(n), name, checked(), enabled(), …)crates/flui-testing/src/scenario/matcher.rs

Notes

  • A test finds what a user perceives. flui::testing::scenario::find builds the same Find the driver and an agent use, resolved over the window’s semantics tree, so a test written against a headless scenario::Tester runs unchanged on a device. find.byType and find.byWidget have no counterpart: the semantics tree carries no widget types, and a type finder ties a test to how a screen is composed rather than to what it shows. A widget that publishes no semantics is found by the identifier its author gives a group around it (Semantics::new().container(true).role(SemanticsRole::Group).identifier(..)) and find::id. Actions wait for their input to land and their frame to run, and an expectation waits while the application has a frame or work due now, then fails at once with the window’s outline; nothing waits on a clock the test did not move with pump_for. An ambiguous Find fails with its candidates instead of tapping the first.
  • Router is the primary navigation API. Routes are values: a #[derive(Routable)] enum with one #[route("…")] pattern per variant, and a Router<R> that keeps the stack of route values, which a page pushes and pops through the RouterHandle<R> that Router::of(ctx) resolves in build, as GoRouter.of(context) does; the callback that navigates moves the handle, since it runs with no place in the tree (ADR-0330). Navigator is the Router’s internal page stack, not a second way to navigate; Flutter’s named routes (pushNamed, onGenerateRoute) have no counterpart, since a route is a typed value with a path. Dialogs, popups and menus are pageless popup routes a page pushes through its PageHandle (show_dialog(&page, …) for showDialog(context: …)): they never enter the URL or the stack a Router restores. A thread that needs to navigate writes a signal the page reacts to; there is no cross-thread navigation command.
  • MaterialApp is WidgetsApp plus theming. MaterialApp wraps a WidgetsApp, resolves ThemeMode against the platform brightness, publishes the resolved ThemeData through Theme, and installs a ScaffoldMessenger. run_app(MaterialApp::new(home)) is the usual root; Theme::new(ThemeData::light(), <root view>) passed to run_app still works for an app that wants only the theme.
  • Layer is a closed enum, not a class hierarchy — see View, Element, RenderObject.

State outside the table

Flutter has no built-in equivalent of FLUI’s presentation-scoped signals: Signal<T> (ADR-0074) is a Copy handle created with ctx.signal(value) in create_state, read in build, and written from an event callback. See State for it and the other ways state enters the tree.