serenay_ecommerce_widgets 1.2.0
serenay_ecommerce_widgets: ^1.2.0 copied to clipboard
A backend-driven widget system for e-commerce screens. Renders TEXT, IMAGE, CAROUSEL, GRID, PRODUCTCARD, FLASHSALE and more from JSON, with nav/data/cart injected by the host app.
1.2.0 #
- Add six new catalog widgets:
RATING(star rating + review count, the first consumer of the previously-unusedEcommerceWidgetTheme. ratingFilledColor/ratingEmptyColor/starSize),BUNDLE("frequently bought together" product row backed byProductQuery.isBundleProduct),COUPON(copyable code with an expiry countdown),CATEGORYMENU(circular icon + label grid),LOYALTYPROGRESS(reward progress bar) andCOMPARISON(side-by-side product spec table). Each ships with adoc/widgets/usage page, a widget test, and a demo entry inexample/lib/main.dart. AddsEcommerceWidgetTheme.bundleTitleLabel,.addAllToCartLabel,.couponCopyLabeland.couponCopiedLabel. - Fix
WidgetCallbacks.imageErrorBuilderbeing defined but never wired up:CatalogNetworkImagenow actually uses it (across every widget that loads a network image) instead of always falling back to its own fixed placeholder icon. - Add
WidgetCallbacks.formatPriceto let a host app replace the built-in"<amount> <symbol>"price text with its own locale/currency formatting;RichProductCard,OldProductCardandMiniProductTilenow call it when set and fall back to the previous hardcoded formatting otherwise. - Add
WidgetCallbacks.productCardBuilderto let a host app replace the product card CAROUSEL, PRODUCTCARD and FLASHSALE render entirely, without forking the package (GRID keeps its ownOldProductCarddesign). - Add
WidgetCatalog.registerBuilder/.unregisterBuilderso a host app can render a widget for a backendtypethis package doesn't ship yet, instead of it silently falling back toUnknownWidget's empty 1px box.WidgetEntrynow keeps the raw wire-formattypestring (rawType) so registered builders can key off it. - Add a
"columns"paramsfield (falling back to the newEcommerceWidgetTheme.gridColumns, default2) toGridWidgetandProductCardWidget, so a backend can request a 3- or 4-column grid on a given screen without a package update. - Add
EcommerceWidgetTheme.favoriteAnimationDuration,.flashSaleBorderDurationand.storyAutoAdvanceDurationso a host app can tune (or shorten, for reduced-motion) the favorite "pop", the flash sale countdown border loop and the story auto-advance timer, which were previously hardcoded.StoryWidgetnow also accepts an optionaltheme. - All additions are backward compatible: every new parameter and callback is optional and defaults to the previous behavior.
1.1.6 #
- Add widget catalog demo videos (converted to animated WebP, ~450KB/1.1MB)
to the root and
doc/widgets/READMEs, so both GitHub and pub.dev show a preview of the widgets in action. - Fix
TimeImageWidget(TIMEIMAGE):_parseColorusedint.parseinstead oftryParse, so a malformed backendtitle_colorhex crashed the widget — every sibling color parser already degrades gracefully instead. - Fix theme leaks in
RichProductCard/OldProductCard's variant/measure bottom sheets,SearchWidget's bar, and three "not logged in" price buttons: they hardcodedColors.white/Colors.greyinstead of readingEcommerceWidgetTheme, so a host app's rebrand left them visibly off-theme. - Fix
FastRegisterWidget(FASTREGISTER) ignoring the theme entirely (hardcodedColors.green): its border/header/text accent now reads from the newEcommerceWidgetTheme.fastRegisterAccentColor(defaults to WhatsApp green, so the default look is unchanged). Its WhatsApplaunchUrlcall is now awaited and checked — a failure (e.g. WhatsApp isn't installed) shows a snackbar via the newtheme.fastRegisterLaunchFailedLabelinstead of silently doing nothing. - Deduplicate the inline muted/looping video player used by
OldProductCard(GRID) andVideoListWidget(VIDEOLIST) into a single sharedMutedLoopVideowidget, which now also falls back to a placeholder icon instead of a permanent black box when the video URL fails to load — matchingCatalogNetworkImage's existing graceful-degradation pattern. - Add
ModalWidget.resetShown()(now exported) to clear the "already shown this session" record for theurl+type+idcombo — useful on logout, or between widget tests that assert modal behavior. - Add
Semantics/tooltiplabels to previously unlabeled icon-only buttons (FavoriteButton, MODAL/variant-sheet/measure-sheet close buttons, the STORY close button) so screen readers announce them.FavoriteButtonalso gains asemanticLabelparameter (defaults to'Favorite'). - Add widget tests for TIMEIMAGE's color-parse fix, the SEARCH/FASTREGISTER
theme fixes,
ModalWidget.resetShown(), and smoke coverage for MIXEDCAROUSEL, STORY, SLIDER, VISITEDPRODUCTS and GRID, which previously had none.
1.1.5 #
- Add
GridWidget(GRID) its own card design,OldProductCard— ported from the source app instead of sharingRichProductCardwith CAROUSEL/ PRODUCTCARD/FLASHSALE: a taller image, inline.mp4variant video, a left-edge discount ribbon, a pre-order banner (ProductCardData.preOrder), and a size/package-tier picker (ProductCardData.measureOptions, now typed asProductMeasureOptioninstead of rawdynamic). AddsEcommerceWidgetTheme.preOrderLabeland.quickAddLabel. - Fix
GridWidgetandProductCardWidget(PRODUCTCARD): both used aGridViewwith a fixedchildAspectRatio, which didn't match their card's real content height — GRID's cards overflowed at the bottom, PRODUCTCARD's rows had extra dead space below each card. Both now lay out withWrap, sized to the actual card height. - Fix
MixedCarouselWidget(MIXEDCAROUSEL): a page's mini 2x2 product grid could need more vertical space than the page's height allowed (depending onheight_percentand the amount of title/description text), clipping the bottom row of cards. The page height now grows to fit the grid instead of cutting it off. - Fix
ModalWidgetandSliderWidget's zoom-image dialog:showDialogdefaults to the app's rootNavigator, so the popup/barrier always covered the entire app regardless of where the widget was mounted. Both now passuseRootNavigator: false, matchingshowModalBottomSheet's existing default, so the dialog is scoped to the nearestNavigatorinstead — host apps with nested navigators (e.g. a per-tabNavigator) will now see the dialog confined to that navigator's bounds rather than covering the whole app. - Redesign
SearchWidget's floating search bar: a rounded, shadowed pill bar with a leading search icon and a rounded,theme.primaryColorbutton, replacing the flush white bar and squaresecondaryColorbutton. The bar height, button height and shared corner radius are now overridable per-instance viaparams:bar_height,button_height,radius.
1.1.4 #
- Fix
ModalWidget: it was missing the circular white "X" close button, the dimmed barrier and the max-height constraint that the original design used, so the popup image had no way to be dismissed without tapping it.ModalWidgetalso never accepted anEcommerceWidgetTheme, unlike every other catalog widget — it now takestheme(wired automatically throughWidgetCatalog.getScreen(theme:)) and the close button's background/icon colors followtheme.surfaceColor/theme.textPrimaryColorinstead of being hardcoded white/black. - Fix
SliderWidget: slides rendered full-bleed instead of the original carousel's "peek" effect (adjacent slides partially visible at the edges);PageController(viewportFraction: 0.8)restores it. - Fix
StoryWidget: the swipe-up CTA at the bottom of a story was a small outlined button instead of the original full-width, translucent-black bar with an up-chevron above the text. - Fix
FastRegisterWidget: the WhatsApp header used a generic chat icon; replaced with a dependency-free WhatsApp-style glyph. - Fix
MixedCarouselWidget:item_type: "image"pages silently droppedtitle/description— they now render inside the same colored card shell asproductspages, matching the original design.- The mini product grid's photos weren't square (no
imageSizewas passed toMiniProductTile), so thumbnails rendered at the source image's aspect ratio instead of a uniform square like every other product card.
- Fix a crash ("Looking up a deactivated widget's ancestor is unsafe")
that could happen in
FlashSaleWidgetandFavoriteButton: both built theirAnimationControllers via a lazylate finalfield initializer, which — ifbuild()never touched the field before the widget was disposed (e.g. an already-expired flash sale short-circuits its ownbuild()) — ran thevsynclookup duringdispose()against a deactivated element. Controllers are now created eagerly ininitState(). - Fix
SearchWidget's background imageBoxFit: it usedcoverinstead of the originalfitWidth, cropping the image differently than the source design.
1.1.3 #
- Add the remaining hardcoded, non-backend UI strings to
EcommerceWidgetThemeso host apps can localize/re-brand them, matchingviewPricesLabel:notAvailableForSaleLabel,addToCartLabel,variantColorLabel,recentlyViewedLabel,searchHintLabel,searchButtonLabel,flashSaleTitleLabel,flashSaleTimeUpLabel, and the FASTREGISTER card'sfastRegisterHeaderLabel,fastRegisterSendLabel,fastRegisterTitleLabel,fastRegisterSubtitleLabel,fastRegisterStep1Label,fastRegisterStep2Label,fastRegisterStep3Label(FASTREGISTER now also acceptsthemeviaWidgetCatalog.getScreen).
1.1.2 #
- Add
EcommerceWidgetTheme.viewPricesLabelso host apps can localize/ override the "View Prices" text shown instead of a hidden price when the viewer is logged out (RichProductCard,MiniProductTile). - Fix:
MiniProductTile(MIXEDCAROUSEL's mini 2x2 product grid) rendered with no card background, unlike every other product card in the catalog. It now wraps its content in atheme.surfaceColorcard, matchingRichProductCard.
1.1.1 #
- Fix: numeric
params(height,height_percent,radius,padding,padding_horizontal,padding_vertical,bottom,limit,page,item_count,fontsize_title,fontsize_subtitle, plusprice,price_old,package_qty,qty_in_packageon product data) crashed with aTypeCastExceptionwhen a backend sent them as numeric strings (e.g."20") instead of JSON numbers. All catalog widgets and contracts now parse these tolerantly, matching the numbers-or-numeric-strings behavior most backends actually send.
1.1.0 #
- Add
EcommerceWidgetTheme: an optionalthemeparameter onWidgetCatalog.getScreenthat lets a host app override the colors, text styles, radii and spacing used across the catalog (product cards, badges, buttons, flash sale, search, text, visited products) instead of the package's built-in look. Omitting it keeps the previous defaults. - Export the standalone building blocks the catalog composes internally —
AddToCartButton,FavoriteButton,DiscountBadge,QuantityPicker,RichProductCard— so they can be used directly outsideWidgetCatalog.
1.0.0 #
- Initial release: a backend-driven dynamic widget system for e-commerce home/category screens.
- Supported widget types: TEXT, IMAGE, SLIDER, DIVIDER, CAROUSEL, GRID, IMAGECAROUSEL, IMAGELIST, VIDEOLIST, FASTREGISTER, STORY, VISITEDPRODUCTS, TIMEIMAGE, YOUTUBE, SEARCH, PRODUCTCARD, FLASHSALE, MODAL, MIXEDCAROUSEL.