| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- import '/backend/api_requests/api_calls.dart';
- import '/components/header_buttons_component_widget.dart';
- import '/flutter_flow/flutter_flow_theme.dart';
- import '/flutter_flow/flutter_flow_util.dart';
- import '/flutter_flow/flutter_flow_widgets.dart';
- import '/shared/drawer_component/drawer_component_widget.dart';
- import 'dart:ui';
- import '/flutter_flow/custom_functions.dart' as functions;
- import '/index.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
- import 'package:provider/provider.dart';
- import 'mijn_aanmeldingen_model.dart';
- export 'mijn_aanmeldingen_model.dart';
- class MijnAanmeldingenWidget extends StatefulWidget {
- const MijnAanmeldingenWidget({
- super.key,
- this.type,
- });
- final String? type;
- static String routeName = 'MijnAanmeldingen';
- static String routePath = '/mijnAanmeldingen';
- @override
- State<MijnAanmeldingenWidget> createState() => _MijnAanmeldingenWidgetState();
- }
- class _MijnAanmeldingenWidgetState extends State<MijnAanmeldingenWidget>
- with RouteAware {
- late MijnAanmeldingenModel _model;
- final scaffoldKey = GlobalKey<ScaffoldState>();
- @override
- void initState() {
- super.initState();
- _model = createModel(context, () => MijnAanmeldingenModel());
- }
- @override
- void dispose() {
- routeObserver.unsubscribe(this);
- _model.dispose();
- super.dispose();
- }
- @override
- void didUpdateWidget(MijnAanmeldingenWidget oldWidget) {
- super.didUpdateWidget(oldWidget);
- _model.widget = widget;
- }
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- final route = DebugModalRoute.of(context);
- if (route != null) {
- routeObserver.subscribe(this, route);
- }
- debugLogGlobalProperty(context);
- }
- @override
- void didPopNext() {
- if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
- setState(() => _model.isRouteVisible = true);
- debugLogWidgetClass(_model);
- }
- }
- @override
- void didPush() {
- if (mounted && DebugFlutterFlowModelContext.maybeOf(context) == null) {
- setState(() => _model.isRouteVisible = true);
- debugLogWidgetClass(_model);
- }
- }
- @override
- void didPop() {
- _model.isRouteVisible = false;
- }
- @override
- void didPushNext() {
- _model.isRouteVisible = false;
- }
- @override
- Widget build(BuildContext context) {
- DebugFlutterFlowModelContext.maybeOf(context)
- ?.parentModelCallback
- ?.call(_model);
- context.watch<FFAppState>();
- return GestureDetector(
- onTap: () {
- FocusScope.of(context).unfocus();
- FocusManager.instance.primaryFocus?.unfocus();
- },
- child: Scaffold(
- key: scaffoldKey,
- backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
- drawer: Drawer(
- elevation: 16.0,
- child: wrapWithModel(
- model: _model.drawerComponentModel,
- updateCallback: () => safeSetState(() {}),
- child: Builder(builder: (_) {
- return DebugFlutterFlowModelContext(
- rootModel: _model.rootModel,
- child: DrawerComponentWidget(),
- );
- }),
- ),
- ),
- appBar: PreferredSize(
- preferredSize: Size.fromHeight(80.0),
- child: AppBar(
- backgroundColor: FlutterFlowTheme.of(context).primaryText,
- automaticallyImplyLeading: false,
- actions: [],
- flexibleSpace: FlexibleSpaceBar(
- background: wrapWithModel(
- model: _model.headerButtonsComponentModel,
- updateCallback: () => safeSetState(() {}),
- child: Builder(builder: (_) {
- return DebugFlutterFlowModelContext(
- rootModel: _model.rootModel,
- child: HeaderButtonsComponentWidget(
- showBackButton: true,
- landelijk: false,
- ),
- );
- }),
- ),
- centerTitle: true,
- expandedTitleScale: 1.0,
- ),
- bottom: PreferredSize(
- preferredSize: Size.fromHeight(70.0),
- child: Container(),
- ),
- toolbarHeight: MediaQuery.sizeOf(context).height * 0.25,
- elevation: 2.0,
- ),
- ),
- body: SafeArea(
- top: true,
- child: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Expanded(
- child: PagedMasonryGridView<ApiPagingParams, dynamic>.count(
- pagingController: _model.setStaggeredViewController(
- (nextPageMarker) => MijnAanmeldingenCall.call(
- sessionName: FFAppState().userSessionname,
- sessid: FFAppState().userSessionid,
- page: nextPageMarker.nextPageNumber,
- type: widget!.type,
- ),
- ),
- crossAxisCount: () {
- if (MediaQuery.sizeOf(context).width < kBreakpointSmall) {
- return 1;
- } else if (MediaQuery.sizeOf(context).width <
- kBreakpointMedium) {
- return 1;
- } else if (MediaQuery.sizeOf(context).width <
- kBreakpointLarge) {
- return 2;
- } else {
- return 3;
- }
- }(),
- crossAxisSpacing: 10.0,
- mainAxisSpacing: 10.0,
- builderDelegate: PagedChildBuilderDelegate<dynamic>(
- // Customize what your widget looks like when it's loading the first page.
- firstPageProgressIndicatorBuilder: (_) => Center(
- child: SizedBox(
- width: 80.0,
- height: 80.0,
- child: SpinKitFadingCircle(
- color: FlutterFlowTheme.of(context).primary,
- size: 80.0,
- ),
- ),
- ),
- // Customize what your widget looks like when it's loading another page.
- newPageProgressIndicatorBuilder: (_) => Center(
- child: SizedBox(
- width: 80.0,
- height: 80.0,
- child: SpinKitFadingCircle(
- color: FlutterFlowTheme.of(context).primary,
- size: 80.0,
- ),
- ),
- ),
- noItemsFoundIndicatorBuilder: (_) => Center(
- child: Image.asset(
- 'assets/images/uitgaanskrant.com-applogo.jpg',
- ),
- ),
- itemBuilder: (context, _, aanmeldingItemIndex) {
- final aanmeldingItemItem = _model
- .staggeredViewPagingController!
- .itemList![aanmeldingItemIndex];
- return Padding(
- padding: EdgeInsets.all(12.0),
- child: Container(
- decoration: BoxDecoration(
- color: FlutterFlowTheme.of(context)
- .secondaryBackground,
- borderRadius: BorderRadius.circular(8.0),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- Padding(
- padding: EdgeInsets.all(12.0),
- child: InkWell(
- splashColor: Colors.transparent,
- focusColor: Colors.transparent,
- hoverColor: Colors.transparent,
- highlightColor: Colors.transparent,
- onTap: () async {
- if (functions
- .isOngepubliceerd(aanmeldingItemItem)) {
- ScaffoldMessenger.of(context)
- .showSnackBar(
- SnackBar(
- content: Text(
- 'Dit item staat nog in beoordeling en is nog niet online.',
- style: TextStyle(
- color:
- FlutterFlowTheme.of(context)
- .primaryText,
- ),
- ),
- duration:
- Duration(milliseconds: 4000),
- backgroundColor:
- FlutterFlowTheme.of(context)
- .secondary,
- ),
- );
- } else {
- context.pushNamed(
- EventCurrentWidget.routeName,
- queryParameters: {
- 'nid': serializeParam(
- getJsonField(
- aanmeldingItemItem,
- r'''$.nid''',
- ).toString(),
- ParamType.String,
- ),
- 'horecaid': serializeParam(
- getJsonField(
- aanmeldingItemItem,
- r'''$.horecagelegenheidnid''',
- ).toString(),
- ParamType.String,
- ),
- }.withoutNulls,
- );
- }
- },
- child: Column(
- mainAxisSize: MainAxisSize.max,
- children: [
- if (getJsonField(
- aanmeldingItemItem,
- r'''$.logo''',
- ) !=
- null)
- ClipRRect(
- borderRadius:
- BorderRadius.circular(8.0),
- child: Image.network(
- getJsonField(
- aanmeldingItemItem,
- r'''$.logo''',
- ).toString(),
- width: double.infinity,
- height: 120.0,
- fit: BoxFit.cover,
- ),
- ),
- Text(
- getJsonField(
- aanmeldingItemItem,
- r'''$.title''',
- ).toString(),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- ),
- Text(
- getJsonField(
- aanmeldingItemItem,
- r'''$.datum_start''',
- ).toString(),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- ),
- Text(
- getJsonField(
- aanmeldingItemItem,
- r'''$.status_label''',
- ).toString(),
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- letterSpacing: 0.0,
- fontWeight:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .bodyMedium
- .fontStyle,
- ),
- ),
- ],
- ),
- ),
- ),
- FFButtonWidget(
- onPressed: () async {
- _model.apiResulttzz =
- await AanmeldingKloonbronCall.call(
- sessionName: FFAppState().userSessionname,
- sessid: FFAppState().userSessionid,
- nid: getJsonField(
- aanmeldingItemItem,
- r'''$.nid''',
- ).toString(),
- );
- if ((_model.apiResulttzz?.succeeded ??
- true)) {
- FFAppState().kloonBron =
- (_model.apiResulttzz?.jsonBody ?? '');
- safeSetState(() {});
- if (widget!.type == 'go_out_event') {
- context.pushNamed(
- UitgaansevenementAanmakenWidget
- .routeName,
- queryParameters: {
- 'horecagelegenheidNid':
- serializeParam(
- getJsonField(
- aanmeldingItemItem,
- r'''$.horecagelegenheidnid''',
- ).toString(),
- ParamType.String,
- ),
- }.withoutNulls,
- );
- } else {
- context.pushNamed(
- StadsactiviteitAanmakenWidget.routeName,
- queryParameters: {
- 'gemeenteTid': serializeParam(
- getJsonField(
- (_model.apiResulttzz?.jsonBody ??
- ''),
- r'''$.gemeente_tid''',
- ).toString(),
- ParamType.String,
- ),
- }.withoutNulls,
- );
- }
- }
- safeSetState(() {});
- },
- text: FFLocalizations.of(context).getText(
- 'g4pbs1et' /* Kopie */,
- ),
- 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)
- .secondaryBackground,
- textStyle: FlutterFlowTheme.of(context)
- .titleSmall
- .override(
- font: GoogleFonts.roboto(
- fontWeight:
- FlutterFlowTheme.of(context)
- .titleSmall
- .fontWeight,
- fontStyle:
- FlutterFlowTheme.of(context)
- .titleSmall
- .fontStyle,
- ),
- color: FlutterFlowTheme.of(context)
- .primaryText,
- letterSpacing: 0.0,
- fontWeight: FlutterFlowTheme.of(context)
- .titleSmall
- .fontWeight,
- fontStyle: FlutterFlowTheme.of(context)
- .titleSmall
- .fontStyle,
- ),
- elevation: 0.0,
- borderRadius: BorderRadius.circular(8.0),
- ),
- ),
- ],
- ),
- ),
- );
- },
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|