passo_mobile_app/lib/screens/profile/voluntary_works.dart

64 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:intl/intl.dart';
import 'package:unit2/model/profile/voluntary_works.dart';
import 'package:unit2/theme-data.dart/colors.dart';
class VolunataryWorkScreen extends StatefulWidget {
final List<VoluntaryWork> voluntaryWorks;
const VolunataryWorkScreen({super.key, required this.voluntaryWorks});
@override
State<VolunataryWorkScreen> createState() => _VolunataryWorkScreenState();
}
class _VolunataryWorkScreenState extends State<VolunataryWorkScreen> {
DateFormat dteFormat2 = DateFormat.yMMMMd('en_US');
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Volunatary Work & Civic Services"),backgroundColor: primary,),
body: ListView.builder(
itemCount:widget.voluntaryWorks.length ,
itemBuilder: (BuildContext context, int index){
String position = widget.voluntaryWorks[index].position!.title!;
String agency = widget.voluntaryWorks[index].agency!.name!;
String from = dteFormat2.format(widget.voluntaryWorks[index].fromDate!);
String hours = widget.voluntaryWorks[index].totalHours.toString();
String? to = widget.voluntaryWorks[index].toDate == null? "Present" : dteFormat2.format(widget.voluntaryWorks[index].toDate!);
return Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: const BorderRadius.all(Radius.circular(12))),
padding: const EdgeInsets.symmetric(horizontal: 12,vertical: 8),
child: Row(
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(position),
Text(agency),
Text("$from to $to"),
Text("Worked/Involved for: $hours hours"),
]),
),
IconButton(onPressed: (){}, icon: const Icon(Icons.more_vert))
],
),
),
const SizedBox(height: 5,),
],
);
}),
);
}
}