created content boxes
This commit is contained in:
30
lib/widgets/content_list_tile.dart
Normal file
30
lib/widgets/content_list_tile.dart
Normal 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
56
lib/widgets/content_widget.dart
Normal file
56
lib/widgets/content_widget.dart
Normal 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 }
|
||||
30
lib/widgets/skill_list_tile.dart
Normal file
30
lib/widgets/skill_list_tile.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user