created content boxes

This commit is contained in:
2024-12-02 17:50:31 +01:00
parent d715b4b201
commit 7a1bbfe365
3 changed files with 116 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
class ContentListTile extends StatelessWidget {
const ContentListTile({
super.key,
this.name,
this.location,
this.title,
this.description,
});
final String? name;
final String? location;
final String? title;
final String? description;
@override
Widget build(BuildContext context) {
return ListTile(
title: Row(
children: [
if (name != null) Text(name!),
if (location != null) Text(', $location'),
if (title != null) Text(' - $title'),
],
),
subtitle: description != null ? Text(description!) : null,
);
}
}

View File

@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:resume/widgets/content_list_tile.dart';
import 'package:resume/widgets/skill_list_tile.dart';
class ContentBox extends StatelessWidget {
const ContentBox({
super.key,
required this.title,
required this.content,
required this.contentType,
});
final ContentType contentType;
final List<dynamic> content;
final String title;
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.max,
children: [
Text(title),
ListView.builder(
shrinkWrap: true,
itemCount: content.length,
itemBuilder: (context, index) => _buildListTile(content[index]),
),
],
);
}
Widget _buildListTile(Map data) {
switch (contentType) {
case ContentType.experience:
return ContentListTile(
name: data['name'],
location: data['location'],
title: data['title'],
description: data['description'],
);
case ContentType.education:
return ContentListTile(
name: data['name'],
location: data['location'],
title: data['title'],
);
case ContentType.skills:
return SkillListTile(
name: data['name'],
percentage: data['percentage'],
);
}
}
}
enum ContentType { experience, education, skills }

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
class SkillListTile extends StatelessWidget {
const SkillListTile({
super.key,
required this.name,
this.percentage,
});
final String name;
final String? percentage;
@override
Widget build(BuildContext context) {
return ListTile(
title: Row(
children: [
Expanded(flex: 2, child: Text(name)),
if (percentage != null)
Expanded(
flex: 5,
child: LinearProgressIndicator(
value: double.parse(percentage!) / 100,
),
),
],
),
);
}
}