[go: up one dir, main page]

0% found this document useful (0 votes)
11 views4 pages

Home Bode Seekrs

The document defines classes for job offer posts and a home page that fetches offer data from Firebase and displays it. The offer post class stores listing details and the home page class gets offer data, builds cards for each, and allows filtering the results.

Uploaded by

darealsubhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Home Bode Seekrs

The document defines classes for job offer posts and a home page that fetches offer data from Firebase and displays it. The offer post class stores listing details and the home page class gets offer data, builds cards for each, and allows filtering the results.

Uploaded by

darealsubhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

import 'package:cloud_firestore/cloud_firestore.

dart';
import 'package:flutter/material.dart';
import 'package:one_project/Screens/job%20seekers/filter_items.dart';
import 'Firebase Services/retrive_data.dart';

class OfferPost {
List<String> Location = [];
List<String> Nationality = [];
List<String> WorkplaceEnvironment = [];
List<String> Major = [];
List<String> Gender = [];
List<String> Experiences = [];
List<String> SalaryRange = [];
String SpecialNeeds = ""; // Default value
String EmployerName = "";
//String EndingDate = "";
List<String> EndingDate = [];

// make a constructor in one line


OfferPost({
required this.Location,
required this.Nationality,
required this.WorkplaceEnvironment,
required this.Major,
required this.Gender,
required this.Experiences,
required this.SalaryRange,
required this.SpecialNeeds,
required this.EmployerName,
required this.EndingDate,
});
}

class HomebodyPageJS extends StatefulWidget {


const HomebodyPageJS({Key? key}) : super(key: key);

@override
_HomebodyPageJSState createState() => _HomebodyPageJSState();
}

class _HomebodyPageJSState extends State<HomebodyPageJS> {


final TextEditingController searchController = TextEditingController();
String filterCriteria = 'All'; // Default filter criteria

final FirebaseService _firebaseService = FirebaseService(); // from another pages

List<Category> categories = [];


List<Category> filteredCategories = [];
List<OfferPost> _offers = [];

@override
void initState() {
super.initState();
fetchOffers();
}

void fetchOffers() async {


var offers = await _firebaseService.getOffers();
setState(() {
_offers = offers;
// categories = fetchedCategories;
// filteredCategories = List.from(categories);
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(10),
child: Row(
children: [
Expanded(
child: TextField(
controller: searchController,
decoration: const InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
labelStyle: TextStyle(
color: Color.fromARGB(255, 125, 125, 125),
),
labelText: 'Search Companies and Location or Majors',
prefixIcon: Icon(
Icons.search,
color: Color.fromARGB(255, 125, 125, 125),
),
),
onChanged: (query) {
filterCompanies(query);
},
),
),
const SizedBox(width: 10),
IconButton(
icon: Icon(
Icons.filter_list_outlined,
size: 30,
color: Colors.black,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => filters_screen()));
},
),
],
),
),
Expanded(
child: ListView.builder(
itemCount: _offers.length,
itemBuilder: (context, index) {
var item = _offers[index];
return PostOfferWidget(
offerPost: item,
);
},
),
),
],
),
);
}
}

class PostOfferWidget extends StatelessWidget {


final OfferPost offerPost;

PostOfferWidget({required this.offerPost});

@override
Widget build(BuildContext context) {
return Card(
elevation: 3,
margin: EdgeInsets.all(10),
child: Padding(
padding: EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Employer: ${offerPost.EmployerName}',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
Container(
height: 20,
),
Text(
'Location: ${offerPost.Location.join(", ")}',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text('Nationality: ${offerPost.Nationality.join(", ")}'),
Text(
'Workplace Environment: ${offerPost.WorkplaceEnvironment.join(",
")}'),
Text('Major: ${offerPost.Major.join(", ")}'),
Text('Gender: ${offerPost.Gender.join(", ")}'),
Text('Experiences: ${offerPost.Experiences.join(", ")}'),
Text('Salary Range: ${offerPost.SalaryRange.join(", ")}'),
SizedBox(height: 10),
Text('Special Needs: ${offerPost.SpecialNeeds}'),
SizedBox(height: 10),
//Text('Ending Date: ${offerPost.EndingDate}'),
Text(
'Ending Date: ${offerPost.EndingDate.isNotEmpty ?
offerPost.EndingDate[0] : ""}'),
],
),
),
);
}
}

You might also like