2023-06-08 23:29:01 +02:00
|
|
|
import 'package:cpd_ss23/Search/profile_company.dart';
|
2023-06-08 21:30:25 +02:00
|
|
|
import 'package:cpd_ss23/Search/search_companies.dart';
|
2023-06-08 23:29:01 +02:00
|
|
|
import 'package:cpd_ss23/jobs/upload_job.dart';
|
|
|
|
import 'package:cpd_ss23/user_state.dart';
|
2023-06-08 21:30:25 +02:00
|
|
|
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
|
2023-06-08 23:29:01 +02:00
|
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
2023-06-08 21:30:25 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-06-20 03:23:54 +02:00
|
|
|
|
2023-06-08 21:30:25 +02:00
|
|
|
import '../jobs/jobs_screen.dart';
|
|
|
|
|
|
|
|
class BottomNavigationBarForApp extends StatelessWidget {
|
|
|
|
int indexNum = 0;
|
|
|
|
|
|
|
|
BottomNavigationBarForApp({required this.indexNum});
|
|
|
|
|
2023-06-08 23:29:01 +02:00
|
|
|
void _logout(context) {
|
|
|
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
2023-06-23 12:12:02 +02:00
|
|
|
builder: (context) {
|
2023-06-08 23:29:01 +02:00
|
|
|
return AlertDialog(
|
|
|
|
backgroundColor: Colors.black54,
|
|
|
|
title: const Row(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(8.0),
|
2023-06-23 12:12:02 +02:00
|
|
|
child: Icon(Icons.logout, color: Colors.white, size: 36),
|
2023-06-08 23:29:01 +02:00
|
|
|
),
|
|
|
|
Padding(
|
2023-06-23 12:12:02 +02:00
|
|
|
padding: EdgeInsets.all(8.0),
|
2023-06-08 23:29:01 +02:00
|
|
|
child: Text(
|
|
|
|
"Sign Out",
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 28),
|
2023-06-23 12:12:02 +02:00
|
|
|
),
|
2023-06-08 23:29:01 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-06-23 12:12:02 +02:00
|
|
|
content: const Text(
|
|
|
|
"Do you want to Log Out?",
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 20),
|
|
|
|
),
|
2023-06-08 23:29:01 +02:00
|
|
|
actions: [
|
|
|
|
TextButton(
|
2023-06-23 12:12:02 +02:00
|
|
|
onPressed: () {
|
2023-06-08 23:29:01 +02:00
|
|
|
Navigator.canPop(context) ? Navigator.pop(context) : null;
|
|
|
|
},
|
2023-06-23 12:12:02 +02:00
|
|
|
child: const Text(
|
|
|
|
"No",
|
|
|
|
style: TextStyle(color: Colors.green, fontSize: 18),
|
|
|
|
),
|
2023-06-08 23:29:01 +02:00
|
|
|
),
|
|
|
|
TextButton(
|
2023-06-23 12:12:02 +02:00
|
|
|
onPressed: () {
|
2023-06-08 23:29:01 +02:00
|
|
|
_auth.signOut();
|
|
|
|
Navigator.canPop(context) ? Navigator.pop(context) : null;
|
2023-06-23 12:12:02 +02:00
|
|
|
Navigator.pushReplacement(
|
|
|
|
context, MaterialPageRoute(builder: (_) => UserState()));
|
2023-06-08 23:29:01 +02:00
|
|
|
},
|
2023-06-23 12:12:02 +02:00
|
|
|
child: const Text(
|
|
|
|
"Yes",
|
|
|
|
style: TextStyle(color: Colors.green, fontSize: 18),
|
|
|
|
),
|
2023-06-08 23:29:01 +02:00
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
2023-06-23 12:12:02 +02:00
|
|
|
});
|
2023-06-08 23:29:01 +02:00
|
|
|
}
|
|
|
|
|
2023-06-08 21:30:25 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return CurvedNavigationBar(
|
2023-06-09 20:38:31 +02:00
|
|
|
color: Colors.cyan,
|
2023-06-23 12:12:02 +02:00
|
|
|
backgroundColor: Colors.black,
|
|
|
|
buttonBackgroundColor: Colors.white,
|
|
|
|
height: 50,
|
|
|
|
index: indexNum,
|
|
|
|
items: const [
|
|
|
|
Icon(
|
|
|
|
Icons.list,
|
|
|
|
size: 19,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.search,
|
|
|
|
size: 19,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.add,
|
|
|
|
size: 19,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.person_pin,
|
|
|
|
size: 19,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.exit_to_app,
|
|
|
|
size: 19,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
],
|
2023-06-08 21:30:25 +02:00
|
|
|
animationDuration: const Duration(
|
|
|
|
milliseconds: 300,
|
|
|
|
),
|
|
|
|
animationCurve: Curves.bounceInOut,
|
2023-06-23 12:12:02 +02:00
|
|
|
onTap: (index) {
|
|
|
|
if (index == 0) {
|
|
|
|
Navigator.pushReplacement(
|
|
|
|
context, MaterialPageRoute(builder: (_) => JobScreen()));
|
|
|
|
} else if (index == 1) {
|
|
|
|
Navigator.pushReplacement(
|
|
|
|
context, MaterialPageRoute(builder: (_) => AllWorkersScreen()));
|
|
|
|
} else if (index == 2) {
|
|
|
|
Navigator.pushReplacement(
|
|
|
|
context, MaterialPageRoute(builder: (_) => UploadJobNow()));
|
|
|
|
} else if (index == 3) {
|
|
|
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
2023-06-20 03:23:54 +02:00
|
|
|
final User? user = _auth.currentUser;
|
|
|
|
final String uid = user!.uid;
|
|
|
|
Navigator.pushReplacement(context,
|
|
|
|
MaterialPageRoute(builder: (_) => ProfileScreen(userID: uid)));
|
2023-06-23 12:12:02 +02:00
|
|
|
} else if (index == 4) {
|
|
|
|
_logout(context);
|
2023-06-20 03:23:54 +02:00
|
|
|
}
|
2023-06-08 21:30:25 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|