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(
onTap: () {
List<TranslationDTO> newValues = <TranslationDTO>[];
// Make a copy
initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
});
showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context);
if(initialValue.isNotEmpty) {
// Make a copy
initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
});
showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context);
}
},
child: Container(
decoration: BoxDecoration(

View File

@ -9,10 +9,11 @@ class PDFHelper {
static downloadPDF(List<SectionDTO> sections) async {
var sectionsArticle = sections.where((section) => section.type == SectionType.article);
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 pdf = pw.Document();
pdf.addPage(pw.MultiPage(
pageFormat: PdfPageFormat.a4,
build: (pw.Context context) {
@ -22,7 +23,7 @@ class PDFHelper {
child:
pw.Column(
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.BarcodeWidget(
data: section.id,

View File

@ -141,6 +141,11 @@ class _ArticleConfigState extends State<ArticleConfig> {
testToSend = testToSend.where((element) => element.source_ != null).toList();
var articleToSend = new ArticleDTO();
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());
});
}