created content boxes
This commit is contained in:
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 }
|
||||
Reference in New Issue
Block a user