more fixes and features

This commit is contained in:
2024-06-23 17:02:19 -05:00
parent 03abc1191d
commit b860ae52f6
7 changed files with 205 additions and 152 deletions
+17 -18
View File
@@ -225,25 +225,22 @@ class _BusinessesOverviewState extends State<BusinessesOverview> {
});
}
List<Padding> chips = [];
List<Widget> chips = [];
for (var type in BusinessType.values) {
chips.add(Padding(
padding: const EdgeInsets.all(4),
child: FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromBusinessType(type)),
selected: selectedChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedChips.add(type);
} else {
selectedChips.remove(type);
}
setDialogState(filters);
}),
));
chips.add(FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromBusinessType(type)),
selected: selectedChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedChips.add(type);
} else {
selectedChips.remove(type);
}
setDialogState(filters);
}));
}
return AlertDialog(
@@ -251,6 +248,8 @@ class _BusinessesOverviewState extends State<BusinessesOverview> {
content: SizedBox(
width: 400,
child: Wrap(
spacing: 6,
runSpacing: 6,
children: chips,
),
),
+12 -2
View File
@@ -141,8 +141,18 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold)),
subtitle: Text(
listing.description,
subtitle: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
getNameFromJobType(listing.type!),
style: const TextStyle(fontSize: 18),
),
Text(
listing.description,
),
],
),
contentPadding: const EdgeInsets.only(
bottom: 8, left: 16),
+45 -21
View File
@@ -45,27 +45,53 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
child: Column(
children: [
ListTile(
minVerticalPadding: 0,
titleAlignment: ListTileTitleAlignment.titleHeight,
title: Text(listing.name,
style: const TextStyle(
fontSize: 24, fontWeight: FontWeight.bold)),
subtitle: Text(
listing.description,
title: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
'${listing.name} (${getNameFromOfferType(listing.offerType!)})',
style: const TextStyle(
fontSize: 24, fontWeight: FontWeight.bold)),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
getNameFromJobType(listing.type!),
style: const TextStyle(fontSize: 18),
),
Text(
listing.description,
),
],
),
contentPadding:
const EdgeInsets.only(bottom: 8, left: 16),
leading: ClipRRect(
borderRadius: BorderRadius.circular(6.0),
child: Image.network(
'$apiAddress/logos/${listing.businessId}',
width: 48,
height: 48, errorBuilder: (BuildContext context,
Object exception, StackTrace? stackTrace) {
return Icon(
getIconFromJobType(
listing.type ?? JobType.other),
size: 48);
}),
leading: Badge(
label: Text(
getLetterFromOfferType(listing.offerType!),
style: const TextStyle(fontSize: 16),
),
largeSize: 26,
offset: const Offset(15, -5),
textColor: Colors.white,
backgroundColor:
getColorFromOfferType(listing.offerType!),
child: ClipRRect(
borderRadius: BorderRadius.circular(6.0),
child: Image.network(
'$apiAddress/logos/${listing.businessId}',
width: 48,
height: 48, errorBuilder:
(BuildContext context, Object exception,
StackTrace? stackTrace) {
return Icon(
getIconFromJobType(
listing.type ?? JobType.other),
size: 48);
}),
),
),
),
if (listing.link != null && listing.link != '')
@@ -87,16 +113,14 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
),
),
// Wage
Visibility(
visible: listing.wage != null && listing.wage != '',
child: Card(
if (listing.wage != null && listing.wage != '')
Card(
child: ListTile(
leading: const Icon(Icons.attach_money),
subtitle: Text(listing.wage!),
title: const Text('Wage Information'),
),
),
),
Card(
clipBehavior: Clip.antiAlias,
child: Column(
+37 -38
View File
@@ -242,46 +242,40 @@ class _JobsOverviewState extends State<JobsOverview> {
}
}
List<Padding> jobTypeChips = [];
List<Widget> jobTypeChips = [];
for (JobType type in JobType.values) {
jobTypeChips.add(Padding(
padding: const EdgeInsets.all(4),
child: FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromJobType(type)),
selected: selectedJobTypeChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedJobTypeChips.add(type);
} else {
selectedJobTypeChips.remove(type);
}
setDialogState(selectedJobTypeChips, null);
}),
));
jobTypeChips.add(FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromJobType(type)),
selected: selectedJobTypeChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedJobTypeChips.add(type);
} else {
selectedJobTypeChips.remove(type);
}
setDialogState(selectedJobTypeChips, null);
}));
}
List<Padding> offerTypeChips = [];
List<Widget> offerTypeChips = [];
for (OfferType type in OfferType.values) {
offerTypeChips.add(Padding(
padding: const EdgeInsets.all(4),
child: FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromOfferType(type)),
selected: selectedOfferTypeChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedOfferTypeChips.add(type);
} else {
selectedOfferTypeChips.remove(type);
}
setDialogState(null, selectedOfferTypeChips);
}),
));
offerTypeChips.add(FilterChip(
showCheckmark: false,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)),
label: Text(getNameFromOfferType(type)),
selected: selectedOfferTypeChips.contains(type),
onSelected: (bool selected) {
if (selected) {
selectedOfferTypeChips.add(type);
} else {
selectedOfferTypeChips.remove(type);
}
setDialogState(null, selectedOfferTypeChips);
}));
}
return AlertDialog(
@@ -295,6 +289,8 @@ class _JobsOverviewState extends State<JobsOverview> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Wrap(
spacing: 6,
runSpacing: 6,
children: jobTypeChips,
),
),
@@ -302,6 +298,8 @@ class _JobsOverviewState extends State<JobsOverview> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Wrap(
spacing: 6,
runSpacing: 6,
children: offerTypeChips,
),
),
@@ -515,8 +513,9 @@ class _JobHeaderState extends State<_JobHeader> {
),
largeSize: 26,
offset: const Offset(15, -5),
textColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
textColor: Colors.white,
backgroundColor: getColorFromOfferType(
business.listings![0].offerType!),
child: ClipRRect(
borderRadius: BorderRadius.circular(6.0),
child: Image.network(
+21 -22
View File
@@ -87,31 +87,28 @@ class _FilterBusinessDataTypeChipsState
extends State<_FilterBusinessDataTypeChips> {
@override
Widget build(BuildContext context) {
List<Padding> chips = [];
List<Widget> chips = [];
for (var type in DataTypeBusiness.values) {
chips.add(Padding(
padding:
const EdgeInsets.only(left: 3.0, right: 3.0, bottom: 3.0, top: 3.0),
child: FilterChip(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side:
BorderSide(color: Theme.of(context).colorScheme.secondary)),
label: Text(dataTypeFriendlyBusiness[type]!),
showCheckmark: false,
selected: widget.selectedDataTypesBusiness.contains(type),
onSelected: (bool selected) {
setState(() {
if (selected) {
widget.selectedDataTypesBusiness.add(type);
} else {
widget.selectedDataTypesBusiness.remove(type);
}
});
}),
));
chips.add(FilterChip(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: BorderSide(color: Theme.of(context).colorScheme.secondary)),
label: Text(dataTypeFriendlyBusiness[type]!),
showCheckmark: false,
selected: widget.selectedDataTypesBusiness.contains(type),
onSelected: (bool selected) {
setState(() {
if (selected) {
widget.selectedDataTypesBusiness.add(type);
} else {
widget.selectedDataTypesBusiness.remove(type);
}
});
}));
}
return Wrap(
spacing: 6,
runSpacing: 6,
children: chips,
);
}
@@ -155,6 +152,8 @@ class _FilterJobDataTypeChipsState extends State<_FilterJobDataTypeChips> {
));
}
return Wrap(
spacing: 6,
runSpacing: 6,
children: chips,
);
}
+24 -12
View File
@@ -5,12 +5,12 @@ enum DataTypeBusiness {
logo,
name,
description,
type,
website,
contactName,
contactEmail,
contactPhone,
notes,
type,
}
enum DataTypeJob {
@@ -42,19 +42,20 @@ class JobListing {
String name;
String description;
JobType? type;
OfferType? offerType;
String? wage;
String? link;
OfferType? offerType;
JobListing(
{this.id,
this.businessId,
required this.name,
required this.description,
this.type,
this.wage,
this.link,
this.offerType});
JobListing({
this.id,
this.businessId,
required this.name,
required this.description,
this.type,
this.offerType,
this.wage,
this.link,
});
factory JobListing.copy(JobListing input) {
return JobListing(
@@ -63,9 +64,9 @@ class JobListing {
name: input.name,
description: input.description,
type: input.type,
offerType: input.offerType,
wage: input.wage,
link: input.link,
offerType: input.offerType,
);
}
}
@@ -261,6 +262,17 @@ String getLetterFromOfferType(OfferType type) {
}
}
Color getColorFromOfferType(OfferType type) {
switch (type) {
case OfferType.job:
return Colors.blue;
case OfferType.internship:
return Colors.green.shade800;
case OfferType.apprenticeship:
return Colors.red;
}
}
IconData getIconFromThemeMode(ThemeMode theme) {
switch (theme) {
case ThemeMode.dark: