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.
When to rebuild it
Section titled “When to rebuild it”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 toRapidBrand.configure(...)at the start ofmain()inpackages/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.
Rebuild
Section titled “Rebuild”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.
- From the folder that holds
backend/,apps/andpackages/, run:It runsTerminal window packages/screen_preview/build.shflutter pub get, builds the web app and replacesbackend/public/screen-preview/with the new build. It takes a few minutes. - Upload the new
backend/public/screen-preview/folder to your server, replacing the old one. - 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:
PREVIEW_OUT=/path/to/backend/public/screen-preview packages/screen_preview/build.shAfter updating RapidMart
Section titled “After updating RapidMart”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).