Fix bugs pdf + article missing information..

This commit is contained in:
Fransolet Thomas 2022-10-23 12:02:21 +02:00
parent e6e20d1a0e
commit 0f4fd94735
3 changed files with 16 additions and 8 deletions

View File

@ -51,11 +51,13 @@ class MultiStringContainer extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
List<TranslationDTO> newValues = <TranslationDTO>[]; List<TranslationDTO> newValues = <TranslationDTO>[];
if(initialValue.isNotEmpty) {
// Make a copy // Make a copy
initialValue.forEach((value) { initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value)))); newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
}); });
showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context); showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context);
}
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -9,10 +9,11 @@ class PDFHelper {
static downloadPDF(List<SectionDTO> sections) async { static downloadPDF(List<SectionDTO> sections) async {
var sectionsArticle = sections.where((section) => section.type == SectionType.article); var sectionsArticle = sections.where((section) => section.type == SectionType.article);
if(sectionsArticle.length > 0) { if(sectionsArticle.length > 0) {
final font = await rootBundle.load("fonts/OpenSans-Medium.ttf"); //final font = await rootBundle.load("fonts/OpenSans-Medium.ttf");
//Uint8List byteData = new File("fonts/OpenSans-Medium.ttf").readAsBytesSync();
//ByteData font = ByteData.view(byteData.buffer);
//final ttf = pw.Font.ttf(font); //final ttf = pw.Font.ttf(font);
final pdf = pw.Document(); final pdf = pw.Document();
pdf.addPage(pw.MultiPage( pdf.addPage(pw.MultiPage(
pageFormat: PdfPageFormat.a4, pageFormat: PdfPageFormat.a4,
build: (pw.Context context) { build: (pw.Context context) {
@ -22,7 +23,7 @@ class PDFHelper {
child: child:
pw.Column( pw.Column(
children: [ children: [
pw.Text(section.label, style: pw.TextStyle(fontSize: 30)), //font: ttf, pw.Text(section.label), //style: pw.TextStyle(font: ttf, fontSize: 30)
pw.Padding(padding: const pw.EdgeInsets.only(top: 20)), pw.Padding(padding: const pw.EdgeInsets.only(top: 20)),
pw.BarcodeWidget( pw.BarcodeWidget(
data: section.id, data: section.id,

View File

@ -141,6 +141,11 @@ class _ArticleConfigState extends State<ArticleConfig> {
testToSend = testToSend.where((element) => element.source_ != null).toList(); testToSend = testToSend.where((element) => element.source_ != null).toList();
var articleToSend = new ArticleDTO(); var articleToSend = new ArticleDTO();
articleToSend.images = testToSend; articleToSend.images = testToSend;
articleToSend.audioId = articleDTO.audioId;
articleToSend.isContentTop = articleDTO.isContentTop;
articleToSend.content = articleDTO.content;
articleToSend.isReadAudioAuto = articleDTO.isReadAudioAuto;
articleToSend.qrCode = articleDTO.qrCode;
widget.onChanged(jsonEncode(articleToSend).toString()); widget.onChanged(jsonEncode(articleToSend).toString());
}); });
} }