Skip to content

Screen Builder preview

The phone preview in Screen Builder is a small web build of the customer app’s screens (packages/screen_preview). A ready build ships in backend/public/screen-preview/, so the preview works straight after install.

The preview draws the same widgets as the customer app, compiled at build time. Rebuild it when you change how the screens look in code, so the preview matches your app:

  • the home or module screen widgets in packages/rapidmart_screens
  • shared styling, colours or fonts in packages/rapidmart_ui
  • the preview’s own fonts or assets in packages/screen_preview
  • the customer app’s colours or fonts in apps/customer/lib/core/config/rapidmart_brand.dart: the preview doesn’t read that file, so pass the same values to RapidBrand.configure(...) at the start of main() in packages/screen_preview/lib/main.dart, then rebuild

You don’t need to rebuild for what you change in Screen Builder itself: screens, sections, banners and schedules come from your server, and the preview shows them live.

You need Flutter 3.38 (the same version as the apps) and the package folders as they ship: backend/, apps/ and packages/ side by side.

  1. From the folder that holds backend/, apps/ and packages/, run:
    Terminal window
    packages/screen_preview/build.sh
    It runs flutter pub get, builds the web app and replaces backend/public/screen-preview/ with the new build. It takes a few minutes.
  2. Upload the new backend/public/screen-preview/ folder to your server, replacing the old one.
  3. Open Screen Builder and reload the page. Each build gets new file addresses, so browsers load it fresh, with no cache to clear.

If your backend is somewhere else, point the script at its folder:

Terminal window
PREVIEW_OUT=/path/to/backend/public/screen-preview packages/screen_preview/build.sh

An update’s backend/ folder contains our build of the preview, so uploading it replaces yours. If you changed the app screens, run the script again after each update and upload the new backend/public/screen-preview/ folder (see Updating).