moarch 2.5.1
moarch: ^2.5.1 copied to clipboard
Flutter CLI — scaffold Clean Architecture projects with Riverpod, FVM and your own conventions.
2.5.1 #
Features #
AppAsyncView(moarch create widget async-view, generated byinit) — takes oneAsyncValueand draws the four states it can be in: a shimmered shape while the first load runs,ErrorViewwith a retry,EmptyViewwhen the screen says its data counts as empty, and your body when there is something to show. A reload over existing data leaves that data on screen rather than replacing a list mid-read with a spinner, and an error carrying no message of its own shows no detail instead of a stringified exception.ref.listenAction(...)(moarch create widget action-listener, generated byinit) — surfaces the one-shoterror/successfields a generated state already carries as anAppToast. PassonError/onSuccessto navigate or log instead; providing one replaces the toast for that outcome rather than adding to it, and a single action only ever reports one of the two.- The generated feature view is built on both.
moarch create featureused to write a.when(...)mapping by hand and leave// SHOW UI ERRORand// SHOW UI SUCCESSas comments in every feature. It now wires the two widgets up, passes its own body as the skeleton shape, and offers the retryErrorViewdraws a button for. It also writes both widgets if the project predates them, so the view it generates always compiles. AppMultiSelectInput(moarch create widget multi-select) —AppDropdownInput's plural: the same id/label entity list, any number selected, ticked in the search sheet with a per-row checkbox and a Done button. Shows its picks as removable chips, as labels, or as "3 selected"; enforcesrequired,minSelectedandmaxSelected, and stops the unticked rows at the ceiling rather than letting the form refuse the pick afterwards.SearchPickerSheet.showMulti(...)— the multi-select half of the sheet the dropdown and the country picker already open. It works on its own copy of the selection, so a dismissed sheet changes nothing and an empty result is a deliberate "none of them".AppDateRangeInput(moarch create widget date-range-input) — a read-only field holding a start and an end date, with amaxDaysrule the picker itself cannot express. It holds aDateTimeRangerather than the text of one.AppFilePickerField(moarch create widget file-input) — an attachment field: an area that opens whichever picker the app already uses, and a row per file with a thumbnail, a readable size and a remove button. It imports no picker package, so it costs the project no dependency it had not already chosen.AppRating(moarch create widget rating) — stars both ways round: tappable withonChanged, a read-only score without it. Halves come from tapping the left half of a star, and a display-only rating stays out ofForm.validate().AppTabs/AppTabBar(moarch create widget tabs) —AppTabsowns the controller and puts the views under the bar, replacing it when the tab count changes;AppTabBaris thePreferredSizeWidgethalf that drops intoAppAppBar'sbottomslot. Underline or pill indicator.AppDrawer(moarch create widget drawer) — the side menu, readingAppBottomNav's destination list, with header and footer slots. It closes itself after a pick, and does nothing when the same widget is pinned beside the content instead.AppNavRailandAppAdaptiveNav(moarch create widget nav-rail) — the vertical navigation a tablet shows instead of a bottom bar, and the scaffold that picks between them off the 600dp short-side breakpoint. All three nav widgets read oneAppNavDestinationlist.AppFab(moarch create widget fab) — the screen's floating action, circular or extended off one parameter, wearingAppButtonVariant/AppButtonTyperather than a vocabulary of its own.isLoadingswaps the icon for a spinner without resizing the button, andheroTagis exposed for the two-FABs-on-one-screen case.AppTimeline(moarch create widget timeline) — a vertical sequence of events joined by a connector, with done/current/pending/failed nodes.AppTimeline.entryBuilderhands you one row for a lazy list.AppCarousel(moarch create widget carousel) — swipeable pages with stretching dots, optional peek and auto-advance. The timer stops for good on the first swipe and never starts when the platform asks for reduced motion;AppCarouselDotsis usable on its own.
Fixes #
moarch initnever wrote its ownlib/main.dart.flutter createleaves one behind and generated files are never clobbered, so on the documented quick start (flutter create→moarch init) the counter demo survived and the scaffold's main.dart — the one that installsProviderScopeand initialises the selected services — was silently skipped. Every scaffolded app was missing its provider root. The counter demo is now replaced, matched on the two private names only that template declares; a main.dart you wrote is still left alone, and init says so instead of passing over it in silence. The counterwidget_test.dartthat pumped it is replaced on the same terms, soflutter testpasses on a fresh project.file_pickerresolved to 3.0.4 (2021) whenever the media service was selected, and 3.0.4 predates AGP'snamespacerequirement — so the Android build failed with "Namespace not specified" before the app could run. The entry was unversioned, and pub is free to resolve backwards:file_picker11 wantswin32 ^5,flutter_secure_storage_windowswantswin32 ^6, and walkingfile_pickerback to 3.0.4 settled that Windows-only conflict. It now carries a^11.0.0floor, andMediaServicecalls the staticFilePicker.pickFilesthat version moved to.- Three widgets used null-aware elements (
?header), which need the project's pubspec to ask for Dart 3.8+ — not merely a recent SDK to be installed — so they failed to compile in a project scaffolded a while ago. Rewritten to constructs with no language-version floor, and a test now fails if a template reaches for one again.
Improvements #
AppToastwas redrawn. It was a greysurfaceContainerHighestbar with a 4px accent stripe and an icon beside it — a Material 2 snackbar with a decoration. It is now a card: a surface tinted 7% with the status color, a status-colored outline, a soft shadow, and the icon in a tonal chip matchingAppLeadingIcon's. The outline is what the old one could not have — aSnackBartakes a color and a shape but not a border — so the toast now draws its own card inside a transparent, unelevated SnackBar. It also gains atitleover the detail line, an optional close button, awarning/infohelper to go withsuccess/error,AppToast.dismiss, a 480px ceiling so it stays a card rather than a banner on a tablet, and sideways swipe-to-dismiss. In dark themes it now sits onsurfaceContainerHighest— an overlay has to be lighter than the page it covers, and the old bar was darker than the content behind it.AppButton'shintmoved inside the button, centered under the label, in the button's own foreground color; the button grows to fit it. It used to be a left-aligned line floating above the button, which read as a caption for whatever was above it rather than as part of the action.- The design-system preview covers
AppPhoneInputandAppAsyncView— the phone field has been in the kit since 2.4.0 without a preview, and the async view's four states are steppable in it. A new test fails if a widget joins the catalog without either a preview section or an explicit, reasoned exemption, so the screen can no longer fall behind the kit unnoticed. moarch create featurerecords what it writes intoshared/widgets/in.moarch.yaml, somoarch updatecan tell those files apart from ones you have since edited.