Created
June 6, 2025 19:52
-
-
Save ben953/b8160639bdabc1ce4e534db61a9781d0 to your computer and use it in GitHub Desktop.
Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:google_fonts/google_fonts.dart'; | |
final bool includeHeadshot = true; | |
typedef EducationEntry = ({ | |
String? degree, | |
String? dates, | |
String? school, | |
String? description, | |
}); | |
typedef WorkExperienceEntry = ({ | |
String? company, | |
String? location, | |
String? dates, | |
String? position, | |
String? description, // Assumed to be a multi-line string for bullet points | |
}); | |
typedef ContactInfo = ({ | |
String? phone, | |
String? address2, | |
String? address1, | |
String? lastName, | |
String? firstName, | |
String? email, | |
String? website, | |
List<({String? type, String? url})> socialLinks, | |
}); | |
typedef SimpleEntry = ({String? itemTitle, String? itemDescription}); | |
typedef AdditionalSectionEntry = ({ | |
String? sectionTitle, | |
List<SimpleEntry> content, | |
}); | |
typedef AdditionalExperienceItemEntry = ({ | |
String? title, | |
String? subtitle, | |
String? location, | |
String? dates, | |
String? description, | |
}); | |
typedef AdditionalExperienceSectionEntry = ({ | |
String? sectionTitle, | |
List<AdditionalExperienceItemEntry> content, | |
}); | |
class ResumeData { | |
final String? professionalHeadline; | |
final String? professionalSummary; | |
final List<EducationEntry> education; | |
final List<WorkExperienceEntry> work; | |
final ContactInfo contact; | |
final List<SimpleEntry> skills; | |
final List<AdditionalSectionEntry> additionalSimpleSections; | |
final List<AdditionalExperienceSectionEntry> additionalExperiences; | |
ResumeData({ | |
required this.professionalHeadline, | |
required this.professionalSummary, | |
required this.education, | |
required this.work, | |
required this.contact, | |
required this.skills, | |
required this.additionalSimpleSections, | |
required this.additionalExperiences, | |
}); | |
} | |
final sample = ResumeData( | |
professionalHeadline: 'Senior Software Engineer & Cloud Architect', | |
professionalSummary: | |
'Innovative senior software engineer with 8+ years of experience building scalable distributed systems and cloud-native applications. Expert in microservices architecture, cloud platforms (AWS/GCP), and machine learning engineering. Strong track record of leading engineering teams, mentoring developers, and delivering high-impact projects. Passionate about solving complex technical challenges and driving engineering excellence.', | |
education: [ | |
( | |
degree: 'Ph.D. in Computer Science', | |
dates: '2022 - Present', | |
school: 'Stanford University', | |
description: | |
'Research focus on distributed systems and cloud computing. Published 3 papers in top-tier conferences. Teaching assistant for Advanced Algorithms course.', | |
), | |
( | |
degree: 'M.S. Computer Science', | |
dates: '2020 - 2022', | |
school: 'University of Washington', | |
description: | |
'Specialized in machine learning and artificial intelligence. Completed thesis on neural network optimization techniques.', | |
), | |
( | |
degree: 'B.S. Computer Science', | |
dates: '2016 - 2020', | |
school: 'University of Michigan', | |
description: | |
'Graduated summa cum laude with 3.95 GPA. Led undergraduate research project on parallel computing algorithms.', | |
), | |
], | |
work: [ | |
( | |
description: | |
'Lead architect for cloud-native microservices platform serving millions of users. Designed and implemented scalable distributed systems using Kubernetes and AWS. Reduced infrastructure costs by 40% through optimization.\n\nManaged team of 8 engineers across 3 time zones. Established agile development practices and CI/CD pipelines that increased deployment frequency by 300%. Mentored junior developers and conducted technical interviews.', | |
company: 'Amazon Web Services', | |
location: 'Seattle, WA', | |
dates: '2022 - Present', | |
position: 'Senior Software Engineer', | |
), | |
( | |
description: | |
'Developed machine learning models for fraud detection that reduced fraudulent transactions by 60%. Built real-time data processing pipeline handling 10K+ events per second.\n\nLed migration from monolithic to microservices architecture, improving system reliability and reducing deployment time by 75%. Implemented comprehensive monitoring and alerting using Prometheus and Grafana.', | |
company: 'Stripe', | |
location: 'San Francisco, CA', | |
dates: '2020 - 2022', | |
position: 'Software Engineer', | |
), | |
( | |
description: | |
'Created React/Node.js web applications for enterprise clients. Implemented responsive UI components and RESTful APIs. Optimized database queries resulting in 40% performance improvement.\n\nCollaborated with product and design teams to deliver features on schedule. Conducted code reviews and maintained documentation. Mentored 2 junior developers.', | |
company: 'Microsoft', | |
location: 'Redmond, WA', | |
dates: '2018 - 2020', | |
position: 'Software Engineer', | |
), | |
( | |
description: | |
'Built full-stack web applications using Python/Django and React. Implemented automated testing suite that achieved 90% code coverage. Optimized front-end performance reducing load times by 50%.', | |
company: 'Tech Solutions Inc.', | |
location: 'Ann Arbor, MI', | |
dates: '2016 - 2018', | |
position: 'Software Engineer', | |
), | |
], | |
contact: ( | |
phone: '555-123-4567', | |
address2: 'Apt 4B', | |
address1: '123 Main St', | |
lastName: 'Doe', | |
firstName: 'John', | |
email: 'john.doe@example.com', | |
website: 'johndoe.dev', | |
socialLinks: [ | |
(type: 'LinkedIn', url: 'linkedin.com/in/johndoe'), | |
(type: 'GitHub', url: 'github.com/johndoe'), | |
], | |
), | |
skills: [ | |
( | |
itemTitle: 'Cloud Platforms', | |
itemDescription: 'AWS, Google Cloud Platform, Azure', | |
), | |
( | |
itemTitle: 'Programming Languages', | |
itemDescription: 'Python, Java, JavaScript, Go, C++', | |
), | |
( | |
itemTitle: 'Web Technologies', | |
itemDescription: 'React, Node.js, Django, GraphQL', | |
), | |
( | |
itemTitle: 'DevOps & Infrastructure', | |
itemDescription: 'Kubernetes, Docker, Terraform, Jenkins', | |
), | |
( | |
itemTitle: 'Databases', | |
itemDescription: 'PostgreSQL, MongoDB, Redis, Elasticsearch', | |
), | |
( | |
itemTitle: 'Machine Learning', | |
itemDescription: 'TensorFlow, PyTorch, Scikit-learn', | |
), | |
( | |
itemTitle: 'System Design', | |
itemDescription: 'Microservices, Distributed Systems', | |
), | |
(itemTitle: 'Development Practices', itemDescription: 'Agile, CI/CD, TDD'), | |
( | |
itemTitle: 'Team Leadership', | |
itemDescription: 'Technical Leadership, Mentoring', | |
), | |
( | |
itemTitle: 'Problem Solving', | |
itemDescription: 'Algorithm Design, Performance Optimization', | |
), | |
], | |
additionalSimpleSections: [ | |
( | |
sectionTitle: 'Awards & Recognition', | |
content: [ | |
(itemTitle: 'Dean\'s List', itemDescription: 'Spring 2021, Fall 2021'), | |
(itemTitle: 'Innovation Award', itemDescription: null), | |
( | |
itemTitle: 'Best Technical Solution', | |
itemDescription: 'Company Hackathon 2022', | |
), | |
( | |
itemTitle: 'Distinguished Engineer', | |
itemDescription: 'Microsoft 2019', | |
), | |
( | |
itemTitle: 'Top Contributor', | |
itemDescription: 'Open Source Community 2021', | |
), | |
], | |
), | |
( | |
sectionTitle: 'Publications', | |
content: [ | |
( | |
itemTitle: 'Scalable Machine Learning Systems', | |
itemDescription: 'IEEE Conference 2022', | |
), | |
( | |
itemTitle: 'Microservices Architecture Patterns', | |
itemDescription: 'ACM Journal 2021', | |
), | |
], | |
), | |
( | |
sectionTitle: 'Certifications', | |
content: [ | |
( | |
itemTitle: 'AWS Solutions Architect Professional', | |
itemDescription: '2022', | |
), | |
( | |
itemTitle: 'Google Cloud Professional Architect', | |
itemDescription: '2021', | |
), | |
(itemTitle: 'Kubernetes Administrator (CKA)', itemDescription: '2020'), | |
], | |
), | |
], | |
additionalExperiences: [ | |
( | |
sectionTitle: 'Projects', | |
content: [ | |
( | |
title: 'Distributed Machine Learning Platform', | |
subtitle: 'Open Source Project', | |
location: 'GitHub', | |
dates: '2021 - Present', | |
description: | |
'Created open-source platform for distributed ML training. 1000+ GitHub stars, 50+ contributors.', | |
), | |
( | |
title: 'Real-time Analytics Engine', | |
subtitle: 'Personal Project', | |
location: 'Seattle, WA', | |
dates: '2020', | |
description: | |
'Built scalable analytics engine processing 1M+ events/day using Kafka and Spark.', | |
), | |
], | |
), | |
], | |
); | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: MyResume( | |
resumeData: sample, | |
pageMargin: 100, | |
professionalHeadshot: includeHeadshot | |
? Container(width: 100, height: 100, color: Colors.blue) | |
: null, | |
), | |
), | |
); | |
} | |
} | |
class CustomText extends StatelessWidget { | |
final String text; | |
final TextStyle style; | |
final TextAlign textAlign; | |
final bool bulletedList; | |
const CustomText( | |
this.text, { | |
super.key, | |
required this.style, | |
this.bulletedList = false, | |
this.textAlign = TextAlign.left, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return Text(text, style: style, textAlign: textAlign); | |
} | |
} | |
class CustomTextWithDescription extends StatelessWidget { | |
final String? itemTitle; | |
final String? itemDescription; | |
final TextStyle? itemTitleStyle; | |
final TextStyle? itemDescriptionStyle; | |
final bool showBullet; | |
final bool oneLine; | |
final TextAlign textAlign; | |
const CustomTextWithDescription({ | |
super.key, | |
this.itemTitle, | |
this.itemDescription, | |
this.itemTitleStyle, | |
this.itemDescriptionStyle, | |
this.showBullet = false, | |
this.oneLine = false, | |
this.textAlign = TextAlign.left, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
if (itemTitle != null) | |
Text(itemTitle!, style: itemTitleStyle, textAlign: textAlign), | |
if (itemDescription != null) | |
Text( | |
itemDescription!, | |
style: itemDescriptionStyle, | |
textAlign: textAlign, | |
), | |
], | |
); | |
} | |
} | |
final Map<String, Color> myResumeColors = { | |
'primaryColor': const Color(0xFFC72C3A), | |
'accentColor': Colors.black, | |
'lightTextColor': Colors.white, | |
'darkTextColor': const Color.fromARGB(255, 30, 30, 30), | |
'secondaryTextColor': const Color.fromARGB(255, 80, 80, 80), | |
}; | |
final Map<String, TextStyle> myResumeTextStyles = { | |
'nameStyle': GoogleFonts.montserrat( | |
fontSize: 48, | |
fontWeight: FontWeight.w700, | |
color: myResumeColors['accentColor'], | |
height: 1.0, | |
), | |
'nameHighlightStyle': GoogleFonts.montserrat( | |
fontSize: 48, | |
fontWeight: FontWeight.w700, | |
color: myResumeColors['primaryColor'], | |
height: 1.0, | |
), | |
'professionalHeadlineStyle': GoogleFonts.lato( | |
fontSize: 18, | |
fontWeight: FontWeight.w500, | |
color: myResumeColors['darkTextColor'], | |
), | |
'contactInfoStyle': GoogleFonts.lato( | |
fontSize: 13, | |
color: myResumeColors['lightTextColor'], | |
fontWeight: FontWeight.w500, | |
), | |
'sectionTitleStyle': GoogleFonts.montserrat( | |
fontSize: 20, | |
fontWeight: FontWeight.bold, | |
color: myResumeColors['darkTextColor'], | |
), | |
'bodyStyle': GoogleFonts.lato( | |
fontSize: 14, | |
color: myResumeColors['secondaryTextColor'], | |
height: 1.5, | |
), | |
'jobTitleStyle': GoogleFonts.lato( | |
fontSize: 16, | |
fontWeight: FontWeight.bold, | |
color: myResumeColors['darkTextColor'], | |
), | |
'jobMetaStyle': GoogleFonts.lato( | |
fontSize: 15, | |
fontWeight: FontWeight.w500, | |
color: myResumeColors['darkTextColor'], | |
), | |
'dateStyle': GoogleFonts.lato( | |
fontSize: 14, | |
color: myResumeColors['secondaryTextColor'], | |
), | |
'itemTitleStyle': GoogleFonts.lato( | |
fontSize: 14, | |
color: myResumeColors['darkTextColor'], | |
), | |
'itemDescriptionStyle': GoogleFonts.lato( | |
fontSize: 13, | |
fontStyle: FontStyle.italic, | |
color: myResumeColors['secondaryTextColor'], | |
), | |
}; | |
class MyResume extends StatelessWidget { | |
final ResumeData resumeData; | |
final double pageMargin; | |
final Widget? professionalHeadshot; | |
static final Color primaryColor = myResumeColors['primaryColor']!; | |
static final Color accentColor = myResumeColors['accentColor']!; | |
static final Color lightTextColor = myResumeColors['lightTextColor']!; | |
static final Color darkTextColor = myResumeColors['darkTextColor']!; | |
static final Color secondaryTextColor = myResumeColors['secondaryTextColor']!; | |
static final TextStyle nameStyle = myResumeTextStyles['nameStyle']!; | |
static final TextStyle nameHighlightStyle = | |
myResumeTextStyles['nameHighlightStyle']!; | |
static final TextStyle professionalHeadlineStyle = | |
myResumeTextStyles['professionalHeadlineStyle']!; | |
static final TextStyle contactInfoStyle = | |
myResumeTextStyles['contactInfoStyle']!; | |
static final TextStyle sectionTitleStyle = | |
myResumeTextStyles['sectionTitleStyle']!; | |
static final TextStyle bodyStyle = myResumeTextStyles['bodyStyle']!; | |
static final TextStyle jobTitleStyle = myResumeTextStyles['jobTitleStyle']!; | |
static final TextStyle jobMetaStyle = myResumeTextStyles['jobMetaStyle']!; | |
static final TextStyle dateStyle = myResumeTextStyles['dateStyle']!; | |
static final TextStyle itemTitleStyle = myResumeTextStyles['itemTitleStyle']!; | |
static final TextStyle itemDescriptionStyle = | |
myResumeTextStyles['itemDescriptionStyle']!; | |
static const double sectionSpacing = 24.0; | |
static const double itemSpacing = 16.0; | |
const MyResume({ | |
super.key, | |
required this.resumeData, | |
required this.pageMargin, | |
this.professionalHeadshot, | |
}); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: EdgeInsets.all(pageMargin), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
_buildHeader(resumeData), | |
if (resumeData.professionalSummary != null && | |
resumeData.professionalSummary!.isNotEmpty) ...[ | |
const SizedBox(height: sectionSpacing), | |
_buildSection( | |
title: 'Professional Summary', | |
child: CustomText( | |
resumeData.professionalSummary!, | |
style: bodyStyle, | |
), | |
), | |
], | |
if (resumeData.skills.isNotEmpty) ...[ | |
const SizedBox(height: sectionSpacing), | |
_buildSkillsSection(resumeData.skills), | |
], | |
if (resumeData.work.isNotEmpty) ...[ | |
const SizedBox(height: sectionSpacing), | |
_buildWorkSection(resumeData.work), | |
], | |
if (resumeData.education.isNotEmpty) ...[ | |
const SizedBox(height: sectionSpacing), | |
_buildEducationSection(resumeData.education), | |
], | |
..._buildAdditionalExperiencesSection( | |
resumeData.additionalExperiences), | |
..._buildAdditionalSimpleSections( | |
resumeData.additionalSimpleSections), | |
], | |
), | |
); | |
} | |
Widget _buildHeader(ResumeData data) { | |
final c = data.contact; | |
final address = [c.address1, c.address2] | |
.whereType<String>() | |
.where((s) => s.isNotEmpty) | |
.join(', '); | |
final socialLinks = | |
c.socialLinks.map((s) => s.url).whereType<String>().join(' | '); | |
final contactItems = [ | |
if (address.isNotEmpty) address, | |
if (c.phone != null) c.phone, | |
if (c.email != null) c.email, | |
if (c.website != null) c.website, | |
if (socialLinks.isNotEmpty) socialLinks, | |
]; | |
final contactString = contactItems.join(' | '); | |
final headerTextContent = Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.end, | |
children: [ | |
if (c.firstName != null) | |
CustomText(c.firstName!.toUpperCase(), style: nameStyle), | |
if (c.firstName != null && c.lastName != null) | |
const SizedBox(width: 12), | |
if (c.lastName != null) | |
CustomText(c.lastName!.toUpperCase(), style: nameHighlightStyle), | |
], | |
), | |
if (data.professionalHeadline != null && | |
data.professionalHeadline!.isNotEmpty) ...[ | |
const SizedBox(height: 8), | |
CustomText(data.professionalHeadline!, | |
style: professionalHeadlineStyle), | |
], | |
], | |
); | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Expanded(child: headerTextContent), | |
if (professionalHeadshot != null) ...[ | |
const SizedBox(width: 24), | |
professionalHeadshot!, | |
] | |
], | |
), | |
const SizedBox(height: 16), | |
Container( | |
color: accentColor, | |
width: double.infinity, | |
padding: const EdgeInsets.all(8.0), | |
child: CustomText( | |
contactString, | |
style: contactInfoStyle, | |
textAlign: professionalHeadshot != null | |
? TextAlign.left | |
: TextAlign.center, | |
), | |
), | |
], | |
); | |
} | |
Widget _buildSection({required String title, required Widget child}) { | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
CustomText(title, style: sectionTitleStyle), | |
const SizedBox(height: 4), | |
Container(height: 2, width: double.infinity, color: primaryColor), | |
const SizedBox(height: itemSpacing), | |
child, | |
], | |
); | |
} | |
Widget _buildSkillsSection(List<SimpleEntry> skills) { | |
final validSkills = skills | |
.where((s) => s.itemTitle != null && s.itemTitle!.isNotEmpty) | |
.toList(); | |
if (validSkills.isEmpty) return const SizedBox.shrink(); | |
final half = (validSkills.length / 2).ceil(); | |
final firstHalf = validSkills.sublist(0, half); | |
final secondHalf = validSkills.sublist(half); | |
Widget buildSkillColumn(List<SimpleEntry> skillList) { | |
return Expanded( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: skillList | |
.map((skill) => Padding( | |
padding: const EdgeInsets.only(bottom: 8.0), | |
child: CustomTextWithDescription( | |
itemTitle: skill.itemTitle, | |
itemDescription: skill.itemDescription, | |
itemTitleStyle: itemTitleStyle, | |
itemDescriptionStyle: itemDescriptionStyle, | |
), | |
)) | |
.toList(), | |
), | |
); | |
} | |
return _buildSection( | |
title: 'Skills', | |
child: Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
buildSkillColumn(firstHalf), | |
const SizedBox(width: 24), | |
buildSkillColumn(secondHalf), | |
], | |
), | |
); | |
} | |
Widget _buildWorkSection(List<WorkExperienceEntry> work) { | |
final validWork = work | |
.where((job) => job.position != null || job.company != null) | |
.toList(); | |
if (validWork.isEmpty) return const SizedBox.shrink(); | |
return _buildSection( | |
title: 'Work History', | |
child: Column( | |
children: validWork | |
.map((job) => Padding( | |
padding: const EdgeInsets.only(bottom: itemSpacing), | |
child: _buildWorkItem(job), | |
)) | |
.toList(), | |
), | |
); | |
} | |
Widget _buildWorkItem(WorkExperienceEntry job) { | |
final metaString = | |
[job.company, job.location].whereType<String>().join(' – '); | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Expanded( | |
child: (job.position != null) | |
? CustomText(job.position!, style: jobTitleStyle) | |
: const SizedBox.shrink(), | |
), | |
const SizedBox(width: 16), | |
if (job.dates != null) CustomText(job.dates!, style: dateStyle), | |
], | |
), | |
if (metaString.isNotEmpty) ...[ | |
const SizedBox(height: 4), | |
CustomText(metaString, style: jobMetaStyle), | |
], | |
if (job.description != null && job.description!.isNotEmpty) ...[ | |
const SizedBox(height: 8), | |
CustomText( | |
job.description!, | |
style: bodyStyle, | |
bulletedList: true, | |
), | |
] | |
], | |
); | |
} | |
Widget _buildEducationSection(List<EducationEntry> education) { | |
final validEducation = education | |
.where((edu) => edu.degree != null || edu.school != null) | |
.toList(); | |
if (validEducation.isEmpty) return const SizedBox.shrink(); | |
return _buildSection( | |
title: 'Education', | |
child: Column( | |
children: validEducation | |
.map((edu) => Padding( | |
padding: const EdgeInsets.only(bottom: itemSpacing), | |
child: _buildEducationItem(edu), | |
)) | |
.toList(), | |
), | |
); | |
} | |
Widget _buildEducationItem(EducationEntry edu) { | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Row( | |
children: [ | |
Expanded( | |
child: (edu.degree != null) | |
? CustomText(edu.degree!, style: jobTitleStyle) | |
: const SizedBox.shrink(), | |
), | |
if (edu.dates != null) CustomText(edu.dates!, style: dateStyle), | |
], | |
), | |
if (edu.school != null) ...[ | |
const SizedBox(height: 4), | |
CustomText(edu.school!, style: jobMetaStyle), | |
], | |
if (edu.description != null && edu.description!.isNotEmpty) ...[ | |
const SizedBox(height: 8), | |
CustomText( | |
edu.description!, | |
style: bodyStyle, | |
), | |
], | |
], | |
); | |
} | |
List<Widget> _buildAdditionalSimpleSections( | |
List<AdditionalSectionEntry> sections) { | |
final validSections = sections | |
.where((s) => | |
s.sectionTitle != null && | |
s.sectionTitle!.isNotEmpty && | |
s.content.any((item) => item.itemTitle != null)) | |
.toList(); | |
if (validSections.isEmpty) return [const SizedBox.shrink()]; | |
return validSections.asMap().entries.map((entry) { | |
final section = entry.value; | |
final validContent = | |
section.content.where((item) => item.itemTitle != null).toList(); | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
if (entry.key > 0) const SizedBox(height: sectionSpacing), | |
_buildSection( | |
title: section.sectionTitle!, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: validContent | |
.map((item) => Padding( | |
padding: const EdgeInsets.only(bottom: 8.0), | |
child: CustomTextWithDescription( | |
itemTitle: item.itemTitle, | |
itemDescription: item.itemDescription, | |
itemTitleStyle: itemTitleStyle, | |
itemDescriptionStyle: itemDescriptionStyle, | |
), | |
)) | |
.toList(), | |
), | |
), | |
], | |
); | |
}).toList(); | |
} | |
List<Widget> _buildAdditionalExperiencesSection( | |
List<AdditionalExperienceSectionEntry> sections) { | |
final validSections = sections | |
.where((s) => | |
s.sectionTitle != null && | |
s.sectionTitle!.isNotEmpty && | |
s.content.any((item) => item.title != null)) | |
.toList(); | |
if (validSections.isEmpty) return [const SizedBox.shrink()]; | |
return validSections.asMap().entries.map((entry) { | |
final section = entry.value; | |
final validContent = | |
section.content.where((item) => item.title != null).toList(); | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
if (entry.key > 0) const SizedBox(height: sectionSpacing), | |
_buildSection( | |
title: section.sectionTitle!, | |
child: Column( | |
children: validContent | |
.map((item) => Padding( | |
padding: const EdgeInsets.only(bottom: itemSpacing), | |
child: _buildAdditionalExperienceItem(item), | |
)) | |
.toList(), | |
), | |
), | |
], | |
); | |
}).toList(); | |
} | |
Widget _buildAdditionalExperienceItem(AdditionalExperienceItemEntry item) { | |
final metaString = | |
[item.subtitle, item.location].whereType<String>().join(' – '); | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Expanded( | |
child: (item.title != null) | |
? CustomText(item.title!, style: jobTitleStyle) | |
: const SizedBox.shrink(), | |
), | |
const SizedBox(width: 16), | |
if (item.dates != null) CustomText(item.dates!, style: dateStyle), | |
], | |
), | |
if (metaString.isNotEmpty) ...[ | |
const SizedBox(height: 4), | |
CustomText( | |
metaString, | |
style: jobMetaStyle, | |
), | |
], | |
if (item.description != null && item.description!.isNotEmpty) ...[ | |
const SizedBox(height: 8), | |
CustomText( | |
item.description!, | |
style: bodyStyle, | |
bulletedList: true, | |
), | |
] | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment