import 'dart:io'; import 'package:dartboard_resume/dartboard_parser.dart'; import 'package:dartboard_resume/dartboard_widgets.dart'; import 'package:pdf/pdf.dart'; import 'package:pdf/widgets.dart'; Page generatePdfPage({required DartboardData dartboardData, required int renderNs}) { final List groupedExperienceList = dartboardData.groupedExperiences.entries.map( (entry) { final String subsection = entry.key; final List experiences = entry.value; return Column( children: [ Row( children: [ Text( subsection, style: dartboardData.subheaderTextStyle .merge(const TextStyle(fontSize: 18)) .apply(color: const PdfColorGrey(0.2)), ), ], ), Container(height: 2, width: 200, color: const PdfColorGrey(0.7)), ...experiences.map( (DartboardExperience exp) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(exp.title, style: dartboardData.subheaderTextStyle.apply(color: const PdfColorGrey(0.3))), Text( exp.range.toString(), style: dartboardData.subheaderTextStyle.apply(color: const PdfColorGrey(0.42)), ), ], ), ...exp.attributes.map( (a) => Text( "${dartboardData.dartboardTheme.bulletPoint} $a", style: dartboardData.defaultTextStyle.apply( color: const PdfColorGrey(0.55), ), ), ), SizedBox(height: 20), ], ), ), DartboardFooter(dartboardData: dartboardData, renderNs: renderNs), ], ); }, ).toList(); return Page( pageTheme: const PageTheme(pageFormat: PdfPageFormat.standard), build: (Context context) { return Column( children: [ SizedBox( height: 120, width: double.infinity, child: Stack( children: [ Positioned( left: 0, child: Container( height: 100, width: 100, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( fit: BoxFit.contain, image: MemoryImage( File(dartboardData.imagePath).readAsBytesSync(), ), ), ), ), ), Center( child: Column( children: [ Text(dartboardData.fullName, style: dartboardData.headerTextStyle), Text(dartboardData.phoneNumber, style: dartboardData.headerTextStyle), Text(dartboardData.email, style: dartboardData.headerTextStyle), ], ), ), ], ), ), Container(height: 20), ...groupedExperienceList, ], ); }, ); }