Преглед изворни кода

P2-15: horeca-dropdown selecteert zichzelf voor bij 1 zaak

Nieuwe custom function horecaVoorselectie(mijnHoreca, paramNid): geeft de
page parameter terug als die gezet is, anders het nid als de gebruiker
precies 1 horecagelegenheid heeft, anders null.

Op twee plekken gebruikt, omdat de lijst alleen binnen de FutureBuilder van
de dropdown bestaat terwijl de zichtbaarheid van de verzendknop aan de page
state hangt:
- dropdown Initial Option Value = functie over de eigen backend response;
- On Page Load = Backend Call MijnHorecagelegenheden gevolgd door Update
  Page State met dezelfde functie, zodat de knop opnieuw evalueert.

Verder in deze commit: tekstlabel "Uw Horecagelegenheid" boven de dropdown
en de "Hello World"-restplaceholder onderaan de pagina weg (beide door Bob).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bob пре 1 недеља
родитељ
комит
c204c5c076

+ 28 - 0
CLAUDE.md

@@ -914,6 +914,34 @@ staat het gewoon in beeld). Noem daarbij letterlijk de doelwaarde en géén
 alternatieven in dezelfde zin — een terzijde in een keuzevraag ("X… nee, Y")
 leverde 2026-09-03 prompt de verkeerde binding op.
 
+**Een dropdown die zichzelf moet voorselecteren: de waarde moet op TWEE
+plekken gezet worden, want de lijst leeft alleen binnen de FutureBuilder.**
+Bevestigd 2026-09-03 (`DropDownHorecagelegenheid` op
+`uitgaansevenementAanmaken`). De data waar je op wilt voorselecteren zit in de
+Backend Query van de dropdown zelf; een widget daarbuiten (bv. de verzendknop
+met een Visibility-conditie op page state) ziet die nooit. Bovendien rebuildt
+bij het klaarkomen van die future **alleen de FutureBuilder-subtree** — een
+sibling-widget hoger in de Column evalueert zijn conditie niet opnieuw, dus
+"bind de knop gewoon aan Widget State van de dropdown" werkt in de praktijk
+niet. Werkend patroon:
+1. één custom function die de voorselectie bepaalt (bv. page parameter als die
+   gezet is, anders het enige item uit de lijst, anders `null`);
+2. **Dropdown → Initial Option Value** = die functie over de **eigen** backend
+   response (API Response Options: JSON Body, Available Options: *No Further
+   Changes* — niet JSON Path, je wilt de hele array). Dit genereert
+   `_model.dropDownXValue ??= <functie>` en vult dus ook de widget state;
+3. **On Page Load** = een losse **Backend Call** naar hetzelfde endpoint +
+   Update Page State met dezelfde functie over die action-output. Die keten
+   eindigt op `safeSetState`, waardoor de knop wél opnieuw evalueert.
+Dat kost één extra GET. `cache: true` op de call zetten helpt daar niet tegen:
+beide calls vertrekken vrijwel gelijktijdig, dus de in-memory cache is nog leeg
+als de tweede uitgaat — het levert alleen staleness op.
+
+**Initial Option Value hoort aan de PAGE PARAMETER te hangen, niet aan een page
+state die je in On Page Load vult** — On Page Load draait in een
+`addPostFrameCallback`, dus ná de eerste build; de `FormFieldController` is dan
+al met de oude (lege) waarde geïnitialiseerd.
+
 **"Insert Before"/"Insert After" in het widget-tree-contextmenu is GEEN
 widgetkiezer — het dupliceert de buur-widget.** Bevestigd 2026-09-03: "Insert
 Before" op een DropDown voegde een kopie van de dropdown erbóven toe (een derde

+ 28 - 18
TASKS.md

@@ -3629,23 +3629,33 @@ paneel en is daar niet bereikbaar (collapsen van alle andere argumenten,
 muiswiel-scrollen, scrollbar slepen en Page Down helpen geen van alle) — die
 laatste rij moet Bob zetten. Zie ook de CLAUDE.md-notitie hierover.
 
-**Kleinere restpunten op deze pagina:**
-1. De horeca-dropdown heeft **geen los tekstlabel** boven zich (alle andere
-   velden wel) — alleen de hint "Kies je horecagelegenheid". Een `Text` ertussen
-   krijgen lukte niet: "Insert Before"/"Insert After" in het tree-contextmenu
-   voegt een **kopie van de buur-widget** toe, geen widgetkiezer. Optie voor
-   later: een `Text` dupliceren en in de tree naar de juiste plek slepen.
-2. **Auto-select bij precies 1 horecagelegenheid** (uit de oorspronkelijke spec)
-   is nog niet gebouwd. Mogelijke aanpak: custom function
-   `horecaAutoSelect(mijnHorecaJson, paramNid)` die de nid teruggeeft als de
-   lijst precies 1 item heeft, gebonden aan de dropdown's Initial Option Value
-   (die kan de eigen Backend-Query-response als bron gebruiken).
-3. Onderaan de pagina staat nog een `Container` > `Text` met de tekst
-   **"Hello World"** — restant van de duplicatie, moet weg of een zinnige
-   toelichting worden.
-4. `mijnProfiel`'s "+ Voeg toe"-knop bij Mijn horecagelegenheden wijst nog naar
-   een placeholder-snackbar; die kan nu naar `/uitgaansevenementAanmaken` met
-   `horecagelegenheidNid` als parameter.
+**Restpunten 1-3 zijn afgerond (2026-09-03b, Bob + Claude samen):**
+1. De horeca-dropdown heeft nu een eigen tekstlabel "Uw Horecagelegenheid"
+   erboven; het categorie-label staat weer bij de categorie-dropdown.
+2. **Auto-select bij precies 1 horecagelegenheid is gebouwd.** Nieuwe custom
+   function `horecaVoorselectie(mijnHoreca, paramNid)` (Json + String? in,
+   String? uit): geeft de page parameter terug als die gezet is, anders het
+   `nid` als de lijst precies 1 zaak bevat, anders `null`. Op twee plekken
+   gebruikt, want de lijst leeft alleen bínnen de `FutureBuilder` van de
+   dropdown terwijl de knop-zichtbaarheid aan de page state hangt:
+   - **Dropdown → Initial Option Value** = `horecaVoorselectie(<eigen backend
+     response, JSON Body, No Further Changes>, <page parameter>)`. Vult zowel
+     het zichtbare veld als `_model.dropDownHorecagelegenheidValue`.
+   - **On Page Load** = Backend Call `MijnHorecagelegenheden` (output
+     `mijnHorecaResp`, sessievars gebonden) → Update Page State
+     `createHorecagelegenheidNid` = dezelfde functie over die response.
+     Nodig omdat de verzendknop een sibling van de FutureBuilder is: als die
+     future klaar is rebuildt alléén de FutureBuilder-subtree, niet de knop.
+   Kost één extra lichte GET bij het openen van de pagina. **Bewust géén
+   `cache: true` op `MijnHorecagelegenheden` gezet:** beide calls vertrekken
+   vrijwel gelijktijdig, dus de cache dedupliceert ze toch niet, en het zou
+   alleen staleness introduceren.
+3. De "Hello World"-restplaceholder onderaan de pagina is verwijderd.
+
+**Enige echt openstaande punt op deze pagina:** `mijnProfiel`'s "+ Voeg
+toe"-knop bij Mijn horecagelegenheden wijst nog naar een placeholder-snackbar;
+die kan nu naar `/uitgaansevenementAanmaken` met `horecagelegenheidNid` als
+parameter. Daarna is bouwstap 5 compleet en is P2-15 klaar op een live test na.
 
 **Nieuwe FlutterFlow-valkuil, gevonden tijdens deze stap (geldt straks
 óók voor de formulierpagina):** een **List-typed custom-action-argument
@@ -3745,7 +3755,7 @@ kaarttitels op afbreken/overlopen nakijken. Ook een legitieme uitkomst:
 niet doen — dan is de app herkenbaar op kleur maar mist hij de
 kranten-uitstraling.
 
-**P2-21 · Eigenaar: Claude. Punten 1 t/m 4 zijn op 2026-09-01/02
+**P2-21 · Eigenaar: Claude — bezig (sessie 2026-09-03, punt 5 sliderband). Punten 1 t/m 4 zijn op 2026-09-01/02
 AFGEROND en met verse export geverifieerd. Alleen punt 5 (sliderband)
 staat nog open, en dat wacht op P1-38.** Tabletweergave herschikken
 i.p.v. uitrekken.

+ 4 - 4
ios/Runner.xcodeproj/project.pbxproj

@@ -49,8 +49,8 @@
 		97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
-		6436409D27A31CD100820AF7 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = "<group>"; };
-		6436409327A31CDA00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		6436409927A31CD600820AF7 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		6436409827A31CD400820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		A9C17DEFA21738E5FBD7F54A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
 		B8285832C7E7A3262A5A897C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -317,8 +317,8 @@
 		6436409C27A31CD800820AF7 /* InfoPlist.strings */ = {
 			isa = PBXVariantGroup;
 			children = (
-				6436409D27A31CD100820AF7 /* nl */,
-				6436409327A31CDA00820AF7 /* en */,
+				6436409927A31CD600820AF7 /* nl */,
+				6436409827A31CD400820AF7 /* en */,
 			);
 			name = InfoPlist.strings;
 			sourceTree = "<group>";

+ 16 - 0
lib/flutter_flow/custom_functions.dart

@@ -241,3 +241,19 @@ List<String>? categorieSubLabels(dynamic respons) {
   }
   return uit;
 }
+
+String? horecaVoorselectie(
+  dynamic mijnHoreca,
+  String? paramNid,
+) {
+  if (paramNid != null && paramNid.trim().isNotEmpty) {
+    return paramNid.trim();
+  }
+  if (mijnHoreca is List && mijnHoreca.length == 1) {
+    final eerste = mijnHoreca[0];
+    if (eerste is Map && eerste['nid'] != null) {
+      return eerste['nid'].toString();
+    }
+  }
+  return null;
+}

+ 332 - 307
lib/stadsactiviteit_aanmaken/stadsactiviteit_aanmaken_widget.dart

@@ -211,28 +211,31 @@ class _StadsactiviteitAanmakenWidgetState
                         child: Column(
                           mainAxisSize: MainAxisSize.max,
                           children: [
-                            Text(
-                              FFLocalizations.of(context).getText(
-                                'hu7xw8pm' /* Wat */,
-                              ),
-                              style: FlutterFlowTheme.of(context)
-                                  .bodyMedium
-                                  .override(
-                                    font: GoogleFonts.roboto(
+                            Align(
+                              alignment: AlignmentDirectional(-1.0, 0.0),
+                              child: Text(
+                                FFLocalizations.of(context).getText(
+                                  'hu7xw8pm' /* Wat */,
+                                ),
+                                style: FlutterFlowTheme.of(context)
+                                    .bodyMedium
+                                    .override(
+                                      font: GoogleFonts.roboto(
+                                        fontWeight: FontWeight.w600,
+                                        fontStyle: FlutterFlowTheme.of(context)
+                                            .bodyMedium
+                                            .fontStyle,
+                                      ),
+                                      color: FlutterFlowTheme.of(context)
+                                          .primaryText,
+                                      fontSize: 16.0,
+                                      letterSpacing: 0.0,
                                       fontWeight: FontWeight.w600,
                                       fontStyle: FlutterFlowTheme.of(context)
                                           .bodyMedium
                                           .fontStyle,
                                     ),
-                                    color: FlutterFlowTheme.of(context)
-                                        .primaryText,
-                                    fontSize: 16.0,
-                                    letterSpacing: 0.0,
-                                    fontWeight: FontWeight.w600,
-                                    fontStyle: FlutterFlowTheme.of(context)
-                                        .bodyMedium
-                                        .fontStyle,
-                                  ),
+                              ),
                             ),
                             Align(
                               alignment: AlignmentDirectional(-1.0, 0.0),
@@ -707,26 +710,29 @@ class _StadsactiviteitAanmakenWidgetState
                         child: Column(
                           mainAxisSize: MainAxisSize.max,
                           children: [
-                            Text(
-                              FFLocalizations.of(context).getText(
-                                'dq3j79df' /* Wanneer */,
-                              ),
-                              style: FlutterFlowTheme.of(context)
-                                  .bodyMedium
-                                  .override(
-                                    font: GoogleFonts.roboto(
+                            Align(
+                              alignment: AlignmentDirectional(-1.0, 0.0),
+                              child: Text(
+                                FFLocalizations.of(context).getText(
+                                  'dq3j79df' /* Wanneer */,
+                                ),
+                                style: FlutterFlowTheme.of(context)
+                                    .bodyMedium
+                                    .override(
+                                      font: GoogleFonts.roboto(
+                                        fontWeight: FontWeight.w600,
+                                        fontStyle: FlutterFlowTheme.of(context)
+                                            .bodyMedium
+                                            .fontStyle,
+                                      ),
+                                      fontSize: 16.0,
+                                      letterSpacing: 0.0,
                                       fontWeight: FontWeight.w600,
                                       fontStyle: FlutterFlowTheme.of(context)
                                           .bodyMedium
                                           .fontStyle,
                                     ),
-                                    fontSize: 16.0,
-                                    letterSpacing: 0.0,
-                                    fontWeight: FontWeight.w600,
-                                    fontStyle: FlutterFlowTheme.of(context)
-                                        .bodyMedium
-                                        .fontStyle,
-                                  ),
+                              ),
                             ),
                             InkWell(
                               splashColor: Colors.transparent,
@@ -1295,26 +1301,29 @@ class _StadsactiviteitAanmakenWidgetState
                         child: Column(
                           mainAxisSize: MainAxisSize.max,
                           children: [
-                            Text(
-                              FFLocalizations.of(context).getText(
-                                'go2ky4mu' /* Waar */,
-                              ),
-                              style: FlutterFlowTheme.of(context)
-                                  .bodyMedium
-                                  .override(
-                                    font: GoogleFonts.roboto(
+                            Align(
+                              alignment: AlignmentDirectional(-1.0, 0.0),
+                              child: Text(
+                                FFLocalizations.of(context).getText(
+                                  'go2ky4mu' /* Waar */,
+                                ),
+                                style: FlutterFlowTheme.of(context)
+                                    .bodyMedium
+                                    .override(
+                                      font: GoogleFonts.roboto(
+                                        fontWeight: FontWeight.w600,
+                                        fontStyle: FlutterFlowTheme.of(context)
+                                            .bodyMedium
+                                            .fontStyle,
+                                      ),
+                                      fontSize: 16.0,
+                                      letterSpacing: 0.0,
                                       fontWeight: FontWeight.w600,
                                       fontStyle: FlutterFlowTheme.of(context)
                                           .bodyMedium
                                           .fontStyle,
                                     ),
-                                    fontSize: 16.0,
-                                    letterSpacing: 0.0,
-                                    fontWeight: FontWeight.w600,
-                                    fontStyle: FlutterFlowTheme.of(context)
-                                        .bodyMedium
-                                        .fontStyle,
-                                  ),
+                              ),
                             ),
                             Align(
                               alignment: AlignmentDirectional(-1.0, 0.0),
@@ -2237,7 +2246,7 @@ class _StadsactiviteitAanmakenWidgetState
                                   ),
                                   filled: true,
                                   fillColor: FlutterFlowTheme.of(context)
-                                      .secondaryBackground,
+                                      .primaryBackground,
                                 ),
                                 style: FlutterFlowTheme.of(context)
                                     .bodyMedium
@@ -2289,26 +2298,29 @@ class _StadsactiviteitAanmakenWidgetState
                         child: Column(
                           mainAxisSize: MainAxisSize.max,
                           children: [
-                            Text(
-                              FFLocalizations.of(context).getText(
-                                '90c9lm1u' /* Organisatie */,
-                              ),
-                              style: FlutterFlowTheme.of(context)
-                                  .bodyMedium
-                                  .override(
-                                    font: GoogleFonts.roboto(
+                            Align(
+                              alignment: AlignmentDirectional(-1.0, 0.0),
+                              child: Text(
+                                FFLocalizations.of(context).getText(
+                                  '90c9lm1u' /* Organisatie */,
+                                ),
+                                style: FlutterFlowTheme.of(context)
+                                    .bodyMedium
+                                    .override(
+                                      font: GoogleFonts.roboto(
+                                        fontWeight: FontWeight.w600,
+                                        fontStyle: FlutterFlowTheme.of(context)
+                                            .bodyMedium
+                                            .fontStyle,
+                                      ),
+                                      fontSize: 16.0,
+                                      letterSpacing: 0.0,
                                       fontWeight: FontWeight.w600,
                                       fontStyle: FlutterFlowTheme.of(context)
                                           .bodyMedium
                                           .fontStyle,
                                     ),
-                                    fontSize: 16.0,
-                                    letterSpacing: 0.0,
-                                    fontWeight: FontWeight.w600,
-                                    fontStyle: FlutterFlowTheme.of(context)
-                                        .bodyMedium
-                                        .fontStyle,
-                                  ),
+                              ),
                             ),
                             Container(
                               width: double.infinity,
@@ -3201,28 +3213,39 @@ class _StadsactiviteitAanmakenWidgetState
                       ),
                     ),
                   ),
-                  Container(
-                    width: double.infinity,
-                    decoration: BoxDecoration(
-                      color: FlutterFlowTheme.of(context).secondaryBackground,
-                      border: Border.all(
-                        color: FlutterFlowTheme.of(context).alternate,
-                        width: 3.0,
+                  Padding(
+                    padding: EdgeInsets.all(16.0),
+                    child: Container(
+                      width: double.infinity,
+                      decoration: BoxDecoration(
+                        color: FlutterFlowTheme.of(context).secondaryBackground,
+                        border: Border.all(
+                          color: FlutterFlowTheme.of(context).alternate,
+                          width: 3.0,
+                        ),
                       ),
-                    ),
-                    child: Column(
-                      mainAxisSize: MainAxisSize.max,
-                      children: [
-                        Align(
-                          alignment: AlignmentDirectional(-1.0, 0.0),
-                          child: Text(
-                            FFLocalizations.of(context).getText(
-                              'nfxdqk4i' /* Media */,
-                            ),
-                            style: FlutterFlowTheme.of(context)
-                                .headlineSmall
-                                .override(
-                                  font: GoogleFonts.roboto(
+                      child: Column(
+                        mainAxisSize: MainAxisSize.max,
+                        children: [
+                          Align(
+                            alignment: AlignmentDirectional(-1.0, 0.0),
+                            child: Text(
+                              FFLocalizations.of(context).getText(
+                                'nfxdqk4i' /* Media */,
+                              ),
+                              style: FlutterFlowTheme.of(context)
+                                  .headlineSmall
+                                  .override(
+                                    font: GoogleFonts.roboto(
+                                      fontWeight: FlutterFlowTheme.of(context)
+                                          .headlineSmall
+                                          .fontWeight,
+                                      fontStyle: FlutterFlowTheme.of(context)
+                                          .headlineSmall
+                                          .fontStyle,
+                                    ),
+                                    fontSize: 16.0,
+                                    letterSpacing: 0.0,
                                     fontWeight: FlutterFlowTheme.of(context)
                                         .headlineSmall
                                         .fontWeight,
@@ -3230,168 +3253,11 @@ class _StadsactiviteitAanmakenWidgetState
                                         .headlineSmall
                                         .fontStyle,
                                   ),
-                                  fontSize: 16.0,
-                                  letterSpacing: 0.0,
-                                  fontWeight: FlutterFlowTheme.of(context)
-                                      .headlineSmall
-                                      .fontWeight,
-                                  fontStyle: FlutterFlowTheme.of(context)
-                                      .headlineSmall
-                                      .fontStyle,
-                                ),
-                          ),
-                        ),
-                        Row(
-                          mainAxisSize: MainAxisSize.max,
-                          children: [
-                            Align(
-                              alignment: AlignmentDirectional(-1.0, 0.0),
-                              child: FFButtonWidget(
-                                onPressed: () async {
-                                  final selectedMedia =
-                                      await selectMediaWithSourceBottomSheet(
-                                    context: context,
-                                    allowPhoto: true,
-                                  );
-                                  if (selectedMedia != null &&
-                                      selectedMedia.every((m) =>
-                                          validateFileFormat(
-                                              m.storagePath, context))) {
-                                    safeSetState(() => _model
-                                            .isDataUploading_uploadDatalogoUpload =
-                                        true);
-                                    var selectedUploadedFiles =
-                                        <FFUploadedFile>[];
-
-                                    try {
-                                      selectedUploadedFiles = selectedMedia
-                                          .map((m) => FFUploadedFile(
-                                                name: m.storagePath
-                                                    .split('/')
-                                                    .last,
-                                                bytes: m.bytes,
-                                                height: m.dimensions?.height,
-                                                width: m.dimensions?.width,
-                                                blurHash: m.blurHash,
-                                                originalFilename:
-                                                    m.originalFilename,
-                                              ))
-                                          .toList();
-                                    } finally {
-                                      _model.isDataUploading_uploadDatalogoUpload =
-                                          false;
-                                    }
-                                    if (selectedUploadedFiles.length ==
-                                        selectedMedia.length) {
-                                      safeSetState(() {
-                                        _model.uploadedLocalFile_uploadDatalogoUpload =
-                                            selectedUploadedFiles.first;
-                                      });
-                                    } else {
-                                      safeSetState(() {});
-                                      return;
-                                    }
-                                  }
-
-                                  _model.logouploadResult =
-                                      await actions.bestandUpload(
-                                    _model
-                                        .uploadedLocalFile_uploadDatalogoUpload,
-                                    '/en/flutterdrup/bestand_upload/upload.json',
-                                    FFAppState().userSessionname,
-                                    FFAppState().userSessionid,
-                                    FFAppState().userToken,
-                                  );
-                                  if (getJsonField(
-                                    _model.logouploadResult,
-                                    r'''$.success''',
-                                  )) {
-                                    _model.createLogoFid = getJsonField(
-                                      _model.logouploadResult,
-                                      r'''$.fid''',
-                                    ).toString();
-                                    _model.createLogoUrl = getJsonField(
-                                      _model.logouploadResult,
-                                      r'''$.url''',
-                                    ).toString();
-                                    safeSetState(() {});
-                                  } else {
-                                    ScaffoldMessenger.of(context).showSnackBar(
-                                      SnackBar(
-                                        content: Text(
-                                          getJsonField(
-                                            _model.logouploadResult,
-                                            r'''$.error''',
-                                          ).toString(),
-                                          style: TextStyle(
-                                            color: FlutterFlowTheme.of(context)
-                                                .primaryText,
-                                          ),
-                                        ),
-                                        duration: Duration(milliseconds: 4000),
-                                        backgroundColor:
-                                            FlutterFlowTheme.of(context)
-                                                .secondary,
-                                      ),
-                                    );
-                                  }
-
-                                  safeSetState(() {});
-                                },
-                                text: FFLocalizations.of(context).getText(
-                                  'r6ckp0e0' /* Logo kiezen */,
-                                ),
-                                options: FFButtonOptions(
-                                  height: 40.0,
-                                  padding: EdgeInsetsDirectional.fromSTEB(
-                                      16.0, 0.0, 16.0, 0.0),
-                                  iconPadding: EdgeInsetsDirectional.fromSTEB(
-                                      0.0, 0.0, 0.0, 0.0),
-                                  color: FlutterFlowTheme.of(context).secondary,
-                                  textStyle: FlutterFlowTheme.of(context)
-                                      .titleSmall
-                                      .override(
-                                        font: GoogleFonts.roboto(
-                                          fontWeight:
-                                              FlutterFlowTheme.of(context)
-                                                  .titleSmall
-                                                  .fontWeight,
-                                          fontStyle:
-                                              FlutterFlowTheme.of(context)
-                                                  .titleSmall
-                                                  .fontStyle,
-                                        ),
-                                        color: Colors.white,
-                                        letterSpacing: 0.0,
-                                        fontWeight: FlutterFlowTheme.of(context)
-                                            .titleSmall
-                                            .fontWeight,
-                                        fontStyle: FlutterFlowTheme.of(context)
-                                            .titleSmall
-                                            .fontStyle,
-                                      ),
-                                  elevation: 0.0,
-                                  borderRadius: BorderRadius.circular(0.0),
-                                ),
-                              ),
                             ),
-                            if (_model.createLogoUrl != null &&
-                                _model.createLogoUrl != '')
-                              ClipRRect(
-                                borderRadius: BorderRadius.circular(0.0),
-                                child: Image.network(
-                                  _model.createLogoUrl!,
-                                  width: 80.0,
-                                  height: 80.0,
-                                  fit: BoxFit.cover,
-                                ),
-                              ),
-                          ],
-                        ),
-                        Row(
-                          mainAxisSize: MainAxisSize.max,
-                          children: [
-                            if (_model.createFotosFids.length < 5)
+                          ),
+                          Row(
+                            mainAxisSize: MainAxisSize.max,
+                            children: [
                               Align(
                                 alignment: AlignmentDirectional(-1.0, 0.0),
                                 child: FFButtonWidget(
@@ -3406,7 +3272,7 @@ class _StadsactiviteitAanmakenWidgetState
                                             validateFileFormat(
                                                 m.storagePath, context))) {
                                       safeSetState(() => _model
-                                              .isDataUploading_uploadDataFotoos2 =
+                                              .isDataUploading_uploadDatalogoUpload =
                                           true);
                                       var selectedUploadedFiles =
                                           <FFUploadedFile>[];
@@ -3426,13 +3292,13 @@ class _StadsactiviteitAanmakenWidgetState
                                                 ))
                                             .toList();
                                       } finally {
-                                        _model.isDataUploading_uploadDataFotoos2 =
+                                        _model.isDataUploading_uploadDatalogoUpload =
                                             false;
                                       }
                                       if (selectedUploadedFiles.length ==
                                           selectedMedia.length) {
                                         safeSetState(() {
-                                          _model.uploadedLocalFile_uploadDataFotoos2 =
+                                          _model.uploadedLocalFile_uploadDatalogoUpload =
                                               selectedUploadedFiles.first;
                                         });
                                       } else {
@@ -3441,27 +3307,27 @@ class _StadsactiviteitAanmakenWidgetState
                                       }
                                     }
 
-                                    _model.fotouploadResult =
+                                    _model.logouploadResult =
                                         await actions.bestandUpload(
                                       _model
-                                          .uploadedLocalFile_uploadDataFotoos2,
+                                          .uploadedLocalFile_uploadDatalogoUpload,
                                       '/en/flutterdrup/bestand_upload/upload.json',
                                       FFAppState().userSessionname,
                                       FFAppState().userSessionid,
                                       FFAppState().userToken,
                                     );
                                     if (getJsonField(
-                                      _model.fotouploadResult,
+                                      _model.logouploadResult,
                                       r'''$.success''',
                                     )) {
-                                      _model.addToCreateFotosFids(getJsonField(
-                                        _model.fotouploadResult,
+                                      _model.createLogoFid = getJsonField(
+                                        _model.logouploadResult,
                                         r'''$.fid''',
-                                      ).toString());
-                                      _model.addToCreateFotosUrls(getJsonField(
-                                        _model.fotouploadResult,
+                                      ).toString();
+                                      _model.createLogoUrl = getJsonField(
+                                        _model.logouploadResult,
                                         r'''$.url''',
-                                      ).toString());
+                                      ).toString();
                                       safeSetState(() {});
                                     } else {
                                       ScaffoldMessenger.of(context)
@@ -3469,8 +3335,8 @@ class _StadsactiviteitAanmakenWidgetState
                                         SnackBar(
                                           content: Text(
                                             getJsonField(
-                                              _model.fotouploadResult,
-                                              r'''$.success''',
+                                              _model.logouploadResult,
+                                              r'''$.error''',
                                             ).toString(),
                                             style: TextStyle(
                                               color:
@@ -3490,7 +3356,7 @@ class _StadsactiviteitAanmakenWidgetState
                                     safeSetState(() {});
                                   },
                                   text: FFLocalizations.of(context).getText(
-                                    '41moeajb' /* Foto's kiezen */,
+                                    'r6ckp0e0' /* Logo kiezen */,
                                   ),
                                   options: FFButtonOptions(
                                     height: 40.0,
@@ -3529,55 +3395,214 @@ class _StadsactiviteitAanmakenWidgetState
                                   ),
                                 ),
                               ),
-                            if (_model.createFotosUrls.length > 0)
-                              Builder(
-                                builder: (context) {
-                                  final fotoItem =
-                                      _model.createFotosUrls.toList();
-                                  _model.debugGeneratorVariables[
-                                          'fotoItem${fotoItem.length > 100 ? ' (first 100)' : ''}'] =
-                                      debugSerializeParam(
-                                    fotoItem.take(100),
-                                    ParamType.String,
-                                    isList: true,
-                                    link:
-                                        'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=stadsactiviteitAanmaken',
-                                    name: 'String',
-                                    nullable: false,
-                                  );
-                                  debugLogWidgetClass(_model);
+                              if (_model.createLogoUrl != null &&
+                                  _model.createLogoUrl != '')
+                                ClipRRect(
+                                  borderRadius: BorderRadius.circular(0.0),
+                                  child: Image.network(
+                                    _model.createLogoUrl!,
+                                    width: 80.0,
+                                    height: 80.0,
+                                    fit: BoxFit.cover,
+                                  ),
+                                ),
+                            ],
+                          ),
+                          Row(
+                            mainAxisSize: MainAxisSize.max,
+                            children: [
+                              if (_model.createFotosFids.length < 5)
+                                Align(
+                                  alignment: AlignmentDirectional(-1.0, 0.0),
+                                  child: FFButtonWidget(
+                                    onPressed: () async {
+                                      final selectedMedia =
+                                          await selectMediaWithSourceBottomSheet(
+                                        context: context,
+                                        allowPhoto: true,
+                                      );
+                                      if (selectedMedia != null &&
+                                          selectedMedia.every((m) =>
+                                              validateFileFormat(
+                                                  m.storagePath, context))) {
+                                        safeSetState(() => _model
+                                                .isDataUploading_uploadDataFotoos2 =
+                                            true);
+                                        var selectedUploadedFiles =
+                                            <FFUploadedFile>[];
 
-                                  return Wrap(
-                                    spacing: 8.0,
-                                    runSpacing: 8.0,
-                                    alignment: WrapAlignment.start,
-                                    crossAxisAlignment:
-                                        WrapCrossAlignment.start,
-                                    direction: Axis.horizontal,
-                                    runAlignment: WrapAlignment.start,
-                                    verticalDirection: VerticalDirection.down,
-                                    clipBehavior: Clip.none,
-                                    children: List.generate(fotoItem.length,
-                                        (fotoItemIndex) {
-                                      final fotoItemItem =
-                                          fotoItem[fotoItemIndex];
-                                      return ClipRRect(
-                                        borderRadius:
-                                            BorderRadius.circular(0.0),
-                                        child: Image.network(
-                                          fotoItemItem,
-                                          width: 80.0,
-                                          height: 80.0,
-                                          fit: BoxFit.cover,
-                                        ),
+                                        try {
+                                          selectedUploadedFiles = selectedMedia
+                                              .map((m) => FFUploadedFile(
+                                                    name: m.storagePath
+                                                        .split('/')
+                                                        .last,
+                                                    bytes: m.bytes,
+                                                    height:
+                                                        m.dimensions?.height,
+                                                    width: m.dimensions?.width,
+                                                    blurHash: m.blurHash,
+                                                    originalFilename:
+                                                        m.originalFilename,
+                                                  ))
+                                              .toList();
+                                        } finally {
+                                          _model.isDataUploading_uploadDataFotoos2 =
+                                              false;
+                                        }
+                                        if (selectedUploadedFiles.length ==
+                                            selectedMedia.length) {
+                                          safeSetState(() {
+                                            _model.uploadedLocalFile_uploadDataFotoos2 =
+                                                selectedUploadedFiles.first;
+                                          });
+                                        } else {
+                                          safeSetState(() {});
+                                          return;
+                                        }
+                                      }
+
+                                      _model.fotouploadResult =
+                                          await actions.bestandUpload(
+                                        _model
+                                            .uploadedLocalFile_uploadDataFotoos2,
+                                        '/en/flutterdrup/bestand_upload/upload.json',
+                                        FFAppState().userSessionname,
+                                        FFAppState().userSessionid,
+                                        FFAppState().userToken,
                                       );
-                                    }),
-                                  );
-                                },
-                              ),
-                          ],
-                        ),
-                      ],
+                                      if (getJsonField(
+                                        _model.fotouploadResult,
+                                        r'''$.success''',
+                                      )) {
+                                        _model
+                                            .addToCreateFotosFids(getJsonField(
+                                          _model.fotouploadResult,
+                                          r'''$.fid''',
+                                        ).toString());
+                                        _model
+                                            .addToCreateFotosUrls(getJsonField(
+                                          _model.fotouploadResult,
+                                          r'''$.url''',
+                                        ).toString());
+                                        safeSetState(() {});
+                                      } else {
+                                        ScaffoldMessenger.of(context)
+                                            .showSnackBar(
+                                          SnackBar(
+                                            content: Text(
+                                              getJsonField(
+                                                _model.fotouploadResult,
+                                                r'''$.success''',
+                                              ).toString(),
+                                              style: TextStyle(
+                                                color:
+                                                    FlutterFlowTheme.of(context)
+                                                        .primaryText,
+                                              ),
+                                            ),
+                                            duration:
+                                                Duration(milliseconds: 4000),
+                                            backgroundColor:
+                                                FlutterFlowTheme.of(context)
+                                                    .secondary,
+                                          ),
+                                        );
+                                      }
+
+                                      safeSetState(() {});
+                                    },
+                                    text: FFLocalizations.of(context).getText(
+                                      '41moeajb' /* Foto's kiezen */,
+                                    ),
+                                    options: FFButtonOptions(
+                                      height: 40.0,
+                                      padding: EdgeInsetsDirectional.fromSTEB(
+                                          16.0, 0.0, 16.0, 0.0),
+                                      iconPadding:
+                                          EdgeInsetsDirectional.fromSTEB(
+                                              0.0, 0.0, 0.0, 0.0),
+                                      color: FlutterFlowTheme.of(context)
+                                          .secondary,
+                                      textStyle: FlutterFlowTheme.of(context)
+                                          .titleSmall
+                                          .override(
+                                            font: GoogleFonts.roboto(
+                                              fontWeight:
+                                                  FlutterFlowTheme.of(context)
+                                                      .titleSmall
+                                                      .fontWeight,
+                                              fontStyle:
+                                                  FlutterFlowTheme.of(context)
+                                                      .titleSmall
+                                                      .fontStyle,
+                                            ),
+                                            color: Colors.white,
+                                            letterSpacing: 0.0,
+                                            fontWeight:
+                                                FlutterFlowTheme.of(context)
+                                                    .titleSmall
+                                                    .fontWeight,
+                                            fontStyle:
+                                                FlutterFlowTheme.of(context)
+                                                    .titleSmall
+                                                    .fontStyle,
+                                          ),
+                                      elevation: 0.0,
+                                      borderRadius: BorderRadius.circular(0.0),
+                                    ),
+                                  ),
+                                ),
+                              if (_model.createFotosUrls.length > 0)
+                                Builder(
+                                  builder: (context) {
+                                    final fotoItem =
+                                        _model.createFotosUrls.toList();
+                                    _model.debugGeneratorVariables[
+                                            'fotoItem${fotoItem.length > 100 ? ' (first 100)' : ''}'] =
+                                        debugSerializeParam(
+                                      fotoItem.take(100),
+                                      ParamType.String,
+                                      isList: true,
+                                      link:
+                                          'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=stadsactiviteitAanmaken',
+                                      name: 'String',
+                                      nullable: false,
+                                    );
+                                    debugLogWidgetClass(_model);
+
+                                    return Wrap(
+                                      spacing: 8.0,
+                                      runSpacing: 8.0,
+                                      alignment: WrapAlignment.start,
+                                      crossAxisAlignment:
+                                          WrapCrossAlignment.start,
+                                      direction: Axis.horizontal,
+                                      runAlignment: WrapAlignment.start,
+                                      verticalDirection: VerticalDirection.down,
+                                      clipBehavior: Clip.none,
+                                      children: List.generate(fotoItem.length,
+                                          (fotoItemIndex) {
+                                        final fotoItemItem =
+                                            fotoItem[fotoItemIndex];
+                                        return ClipRRect(
+                                          borderRadius:
+                                              BorderRadius.circular(0.0),
+                                          child: Image.network(
+                                            fotoItemItem,
+                                            width: 80.0,
+                                            height: 80.0,
+                                            fit: BoxFit.cover,
+                                          ),
+                                        );
+                                      }),
+                                    );
+                                  },
+                                ),
+                            ],
+                          ),
+                        ],
+                      ),
                     ),
                   ),
                   if (_model.createPlaatsID != null &&

+ 19 - 0
lib/uitgaansevenement_aanmaken/uitgaansevenement_aanmaken_model.dart

@@ -1,10 +1,12 @@
 import '/backend/api_requests/api_calls.dart';
+import '/backend/api_requests/api_streaming.dart';
 import '/flutter_flow/flutter_flow_drop_down.dart';
 import '/flutter_flow/flutter_flow_theme.dart';
 import '/flutter_flow/flutter_flow_util.dart';
 import '/flutter_flow/flutter_flow_widgets.dart';
 import '/flutter_flow/form_field_controller.dart';
 import '/flutter_flow/upload_data.dart';
+import 'dart:convert';
 import 'dart:ui';
 import '/custom_code/actions/index.dart' as actions;
 import '/flutter_flow/custom_functions.dart' as functions;
@@ -116,6 +118,15 @@ class UitgaansevenementAanmakenModel
 
   ///  State fields for stateful widgets in this page.
 
+  // Stores action output result for [Backend Call - API (MijnHorecagelegenheden)] action in uitgaansevenementAanmaken widget.
+  ApiCallResponse? _mijnHorecaResp;
+  set mijnHorecaResp(ApiCallResponse? value) {
+    _mijnHorecaResp = value;
+    debugLogWidgetClass(this);
+  }
+
+  ApiCallResponse? get mijnHorecaResp => _mijnHorecaResp;
+
   // State field(s) for TextFieldTitel widget.
   FocusNode? textFieldTitelFocusNode;
   TextEditingController? textFieldTitelTextController;
@@ -445,6 +456,14 @@ class UitgaansevenementAanmakenModel
           )
         }.entries,
         actionOutputs: {
+          'mijnHorecaResp': debugSerializeParam(
+            mijnHorecaResp,
+            ParamType.ApiResponse,
+            link:
+                'https://app.flutterflow.io/project/uitgaanskrant-1qhvtd?tab=uiBuilder&page=uitgaansevenementAanmaken',
+            name: 'ApiCallResponse',
+            nullable: true,
+          ),
           'logoevenementuploadResult': debugSerializeParam(
             logoevenementuploadResult,
             ParamType.JSON,

+ 14 - 2
lib/uitgaansevenement_aanmaken/uitgaansevenement_aanmaken_widget.dart

@@ -1,10 +1,12 @@
 import '/backend/api_requests/api_calls.dart';
+import '/backend/api_requests/api_streaming.dart';
 import '/flutter_flow/flutter_flow_drop_down.dart';
 import '/flutter_flow/flutter_flow_theme.dart';
 import '/flutter_flow/flutter_flow_util.dart';
 import '/flutter_flow/flutter_flow_widgets.dart';
 import '/flutter_flow/form_field_controller.dart';
 import '/flutter_flow/upload_data.dart';
+import 'dart:convert';
 import 'dart:ui';
 import '/custom_code/actions/index.dart' as actions;
 import '/flutter_flow/custom_functions.dart' as functions;
@@ -46,7 +48,14 @@ class _UitgaansevenementAanmakenWidgetState
 
     // On page load action.
     SchedulerBinding.instance.addPostFrameCallback((_) async {
-      _model.createHorecagelegenheidNid = widget!.horecagelegenheidNid;
+      _model.mijnHorecaResp = await MijnHorecagelegenhedenCall.call(
+        sessionName: FFAppState().userSessionname,
+        sessid: FFAppState().userSessionid,
+      );
+
+      _model.createHorecagelegenheidNid = functions.horecaVoorselectie(
+          (_model.mijnHorecaResp?.jsonBody ?? ''),
+          widget!.horecagelegenheidNid);
       safeSetState(() {});
     });
 
@@ -548,7 +557,10 @@ class _UitgaansevenementAanmakenWidgetState
                                             .dropDownHorecagelegenheidValueController ??=
                                         FormFieldController<String>(
                                       _model.dropDownHorecagelegenheidValue ??=
-                                          widget!.horecagelegenheidNid,
+                                          functions.horecaVoorselectie(
+                                              dropDownHorecagelegenheidMijnHorecagelegenhedenResponse
+                                                  .jsonBody,
+                                              widget!.horecagelegenheidNid),
                                     ),
                                     options: List<String>.from((getJsonField(
                                       dropDownHorecagelegenheidMijnHorecagelegenhedenResponse

+ 14 - 1
lib/uitgaanspaginas/p_uitgaan_slider_component/p_uitgaan_slider_component_widget.dart

@@ -277,7 +277,20 @@ class _PUitgaanSliderComponentWidgetState
                           CarouselSliderController(),
                       options: CarouselOptions(
                         initialPage: max(0, min(1, homeslider.length - 1)),
-                        viewportFraction: 0.75,
+                        viewportFraction: () {
+                          if (MediaQuery.sizeOf(context).width <
+                              kBreakpointSmall) {
+                            return 0.0;
+                          } else if (MediaQuery.sizeOf(context).width <
+                              kBreakpointMedium) {
+                            return 0.0;
+                          } else if (MediaQuery.sizeOf(context).width <
+                              kBreakpointLarge) {
+                            return 0.0;
+                          } else {
+                            return 0.0;
+                          }
+                        }(),
                         disableCenter: true,
                         enlargeCenterPage: true,
                         enlargeFactor: 0.25,