2022-12-05 08:06:45 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-02-01 08:03:05 +00:00
|
|
|
import 'package:unit2/model/login_data/employee_info/employee_info.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import 'package:unit2/model/login_data/user_info/user_data.dart';
|
2022-12-13 06:56:09 +00:00
|
|
|
import 'package:unit2/utils/alerts.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import '../../../../theme-data.dart/colors.dart';
|
|
|
|
|
|
|
|
Widget getTile(
|
2023-01-23 03:02:59 +00:00
|
|
|
IconData icondata, String title, String route, BuildContext context,UserData userData) {
|
2022-12-05 08:06:45 +00:00
|
|
|
return ListTile(
|
|
|
|
dense: true,
|
|
|
|
leading: Icon(
|
|
|
|
icondata,
|
|
|
|
color: primary,
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
title,
|
|
|
|
style: const TextStyle(color: Colors.black),
|
|
|
|
),
|
|
|
|
onTap: () async {
|
2022-12-13 06:56:09 +00:00
|
|
|
if (title.toLowerCase() == "logout") {
|
|
|
|
confirmAlert(context, () {
|
2023-01-23 08:27:44 +00:00
|
|
|
Navigator.pushReplacementNamed (context,"/");
|
2023-02-15 05:23:06 +00:00
|
|
|
|
|
|
|
},"Logout","Are You sure you want to logout?");
|
2023-02-01 08:03:05 +00:00
|
|
|
}if(title.toLowerCase() == 'profile'){
|
|
|
|
ProfileArguments profileArguments = ProfileArguments(token: userData.user!.login!.token!, userID:userData.user!.login!.user!.profileId!);
|
|
|
|
Navigator.pushNamed(context, route,arguments: profileArguments);
|
|
|
|
}
|
|
|
|
else {
|
2023-01-23 08:23:20 +00:00
|
|
|
Navigator.pushNamed(context, route);
|
2022-12-13 06:56:09 +00:00
|
|
|
}
|
2022-12-05 08:06:45 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
2023-02-01 08:03:05 +00:00
|
|
|
|
|
|
|
class ProfileArguments{
|
|
|
|
final int userID;
|
|
|
|
final String token;
|
|
|
|
const ProfileArguments({required this.token, required this.userID});
|
|
|
|
}
|