2025-05-15 17:20:34 +02:00

58 lines
1.4 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/pdf_file_input_container.dart';
import 'package:manager_app/Components/resource_input_container.dart';
import 'package:manager_api_new/api.dart';
import 'dart:convert';
import 'package:manager_app/constants.dart';
class PDFConfig extends StatefulWidget {
final String? color;
final String? label;
final PdfDTO initialValue;
final ValueChanged<PdfDTO> onChanged;
const PDFConfig({
Key? key,
this.color,
this.label,
required this.initialValue,
required this.onChanged,
}) : super(key: key);
@override
_PDFConfigState createState() => _PDFConfigState();
}
class _PDFConfigState extends State<PDFConfig> {
late PdfDTO pdfDTO;
@override
void initState() {
PdfDTO test = widget.initialValue;
pdfDTO = test;
super.initState();
}
@override
Widget build(BuildContext context) {
return Center(
child: Container(
height: 70,
width: 425,
child: PDFFileInputContainer(
label: "Fichiers PDF :",
initialValue: pdfDTO.pdfs != null ? pdfDTO.pdfs! : [],
color: kPrimaryColor,
onChanged: (List<OrderedTranslationAndResourceDTO>? value) {
if(value != null) {
pdfDTO.pdfs = value;
widget.onChanged(pdfDTO);
}
},
),
),
);
}
}