I have found a solution to workarrounf the generation of PDF (Gemini helped me), but when i've done everything, an bizard issu occur :
A custom widget which i created to recieve widget as parameter is displaying widget but i unroll the parameter section, it shows "icon" type.
And even when i integrate the custom widget in the UI , the parameter still waiting an "icon" type data.
Here is the custom widget code 'if you want) :
// Automatic FlutterFlow imports
import '/backend/backend.dart';
import '/backend/schema/structs/index.dart';
import '/backend/schema/enums/enums.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:screenshot/screenshot.dart';
import 'dart:typed_data';
import 'dart:convert'; // Import for Base64 encoding
class CapturablePDFContent extends StatefulWidget {
const CapturablePDFContent({
Key? key,
this.width,
this.height,
required this.contentToCapture,
this.onCaptureCompleted,
}) : super(key: key);
final double? width;
final double? height;
final Widget contentToCapture;
// The callback now expects a String (Base64 encoded)
final Future<dynamic> Function(String? imageBytesBase64)? onCaptureCompleted;
@override
_CapturablePDFContentState createState() => _CapturablePDFContentState();
}
class _CapturablePDFContentState extends State<CapturablePDFContent> {
final ScreenshotController screenshotController = ScreenshotController();
Future<void> captureContent() async {
try {
final Uint8List? capturedImage = await screenshotController.capture();
if (capturedImage != null && widget.onCaptureCompleted != null) {
// Encode Uint8List to Base64 String before passing
final String imageBase64 = base64Encode(capturedImage);
await widget.onCaptureCompleted!(imageBase64);
}
} catch (e) {
print('Error capturing content for PDF: $e');
}
}
@override
Widget build(BuildContext context) {
return Screenshot(
controller: screenshotController,
child: SizedBox(
width: widget.width,
height: widget.height,
child: widget.contentToCapture,
),
);
}
}
// Set your widget name, define your parameter, and then add the
// boilerplate code using the green button on the right!