2026-04-11
This commit is contained in:
commit
27e27fb70b
270 files changed
+30296
No files matched your search
@@ -0,0 +1,260 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:taxglide/consts/app_asstes.dart';
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
|
||||
class EmployeeProfileList extends ConsumerStatefulWidget {
|
||||
const EmployeeProfileList({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<EmployeeProfileList> createState() =>
|
||||
_EmployeeProfileListState();
|
||||
}
|
||||
|
||||
class _EmployeeProfileListState extends ConsumerState<EmployeeProfileList> {
|
||||
String yesNo(dynamic value) {
|
||||
return value == 1 ? "Yes" : "No";
|
||||
}
|
||||
|
||||
String statusText(dynamic value) {
|
||||
return value == 1 ? "Active" : "Inactive";
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
final profileAsync = ref.watch(employeeProfileProvider);
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(AppAssets.backgroundimages),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: profileAsync.when(
|
||||
data: (profile) {
|
||||
final data = profile.data;
|
||||
|
||||
if (data == null) {
|
||||
return const Center(
|
||||
child: Text(
|
||||
"No profile data found",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/// ---------------- HEADER ----------------
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 21),
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"KYC Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight
|
||||
.w600, // equivalent to 400 (Normal)
|
||||
fontStyle: FontStyle.normal,
|
||||
fontSize: 24,
|
||||
height: 1.3, // line-height: 130%
|
||||
letterSpacing:
|
||||
0.04 * 24, // 4% of font size = 0.96px
|
||||
color: Color(0xFF111827), // background: #111827
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: const Icon(Icons.arrow_back_ios_rounded),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
/// ---------------- CARD ----------------
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
"Personal Details",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontSize: 20,
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
|
||||
_buildDetailRow("Name : ", data.name),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow("Mobile : ", data.mobile),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow("Email : ", data.email),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow(
|
||||
"Company Name : ",
|
||||
data.company?.companyName ?? "N/A",
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow(
|
||||
"Service : ",
|
||||
yesNo(data.createService),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow("Status : ", statusText(data.status)),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildDetailRow(
|
||||
"General Chat : ",
|
||||
yesNo(data.generalChat),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 30),
|
||||
|
||||
/// ---------------- COMPANY LOGO ----------------
|
||||
if (data.company?.companyLogo != null)
|
||||
GridView.count(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 15,
|
||||
mainAxisSpacing: 15,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
_buildImageBox(
|
||||
"Company Logo",
|
||||
data.company!.companyLogo!,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
loading: () => const Center(
|
||||
child: CircularProgressIndicator(color: Colors.white),
|
||||
),
|
||||
error: (e, _) => Center(
|
||||
child: Text(
|
||||
"Error loading profile: $e",
|
||||
style: const TextStyle(color: Colors.redAccent),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// ---------------- TEXT ROW ----------------
|
||||
Widget _buildDetailRow(String title, String value) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
letterSpacing: 0.64,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
value,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-Regular',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
letterSpacing: 0.64,
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// ---------------- IMAGE BOX ----------------
|
||||
Widget _buildImageBox(String label, String imageUrl) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: Image.network(
|
||||
imageUrl,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (_, __, ___) => const Icon(Icons.broken_image),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:taxglide/consts/app_asstes.dart';
|
||||
import 'package:taxglide/consts/app_colors.dart';
|
||||
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
import 'package:taxglide/controller/api_repository.dart';
|
||||
import 'package:taxglide/main.dart';
|
||||
import 'package:taxglide/router/consts_routers.dart';
|
||||
|
||||
class EmployeeProfileScreen extends ConsumerStatefulWidget {
|
||||
const EmployeeProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<EmployeeProfileScreen> createState() =>
|
||||
_EmployeeProfileScreenState();
|
||||
}
|
||||
|
||||
class _EmployeeProfileScreenState extends ConsumerState<EmployeeProfileScreen> {
|
||||
String? selectedItem;
|
||||
bool _isLoggingOut = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final profileAsync = ref.watch(employeeProfileProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: profileAsync.when(
|
||||
data: (profile) {
|
||||
final data = profile.data;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(50),
|
||||
bottomRight: Radius.circular(50),
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(140),
|
||||
bottomRight: Radius.circular(0),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Image.asset(
|
||||
AppAssets.profilebanner,
|
||||
fit: BoxFit.cover,
|
||||
height: 200,
|
||||
width: MediaQuery.of(context).size.width * 1.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: -50,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 4),
|
||||
),
|
||||
child:
|
||||
(data?.company?.companyLogo != null &&
|
||||
data!.company!.companyLogo!.isNotEmpty)
|
||||
? CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: NetworkImage(
|
||||
data.company!.companyLogo!,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black87,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
(data?.name != null &&
|
||||
data!.name.isNotEmpty)
|
||||
? data.name[0].toUpperCase()
|
||||
: "M",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
Text(
|
||||
data?.name ?? 'No Company Name',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
children: [
|
||||
_buildMenuItem(
|
||||
id: 'profile',
|
||||
icon: Icons.person_outline,
|
||||
title: 'Profile',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'profile';
|
||||
});
|
||||
|
||||
ref.invalidate(employeeProfileProvider);
|
||||
|
||||
Get.toNamed(ConstRouters.employeekycdetailslist);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'terms',
|
||||
icon: Icons.description_outlined,
|
||||
title: 'Terms and Conditions',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'terms';
|
||||
});
|
||||
ref.invalidate(termsProvider);
|
||||
Get.toNamed(ConstRouters.terms);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'policy',
|
||||
icon: Icons.policy_outlined,
|
||||
title: 'Policy',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'policy';
|
||||
});
|
||||
ref.invalidate(termsProvider);
|
||||
Get.toNamed(ConstRouters.policy);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'logout',
|
||||
icon: Icons.logout,
|
||||
title: 'Log out',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'logout';
|
||||
});
|
||||
_showLogoutPopup(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (err, _) => Center(child: Text('Error: $err')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- LOGOUT POPUP ---------------------
|
||||
void _showLogoutPopup(BuildContext context) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierLabel: 'Logout',
|
||||
barrierColor: Colors.black.withOpacity(0.2),
|
||||
transitionDuration: const Duration(milliseconds: 300),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
final offsetAnimation =
|
||||
Tween<Offset>(begin: const Offset(0, -1), end: Offset.zero).animate(
|
||||
CurvedAnimation(parent: animation, curve: Curves.easeOutBack),
|
||||
);
|
||||
|
||||
return SlideTransition(
|
||||
position: offsetAnimation,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 60.0),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(7.75),
|
||||
border: Border.all(color: Colors.white, width: 3.87),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x7A5E5E5E),
|
||||
offset: Offset(0, 2.32),
|
||||
blurRadius: 9.14,
|
||||
spreadRadius: 3.1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 16,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
"Note",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
"Are you sure you want to log out?",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text(
|
||||
"Cancel",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF535A5B),
|
||||
fontSize: 16,
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: _isLoggingOut
|
||||
? null
|
||||
: () async {
|
||||
Navigator.pop(context);
|
||||
|
||||
setState(() {
|
||||
_isLoggingOut = true;
|
||||
});
|
||||
|
||||
try {
|
||||
await ApiRepository().logout();
|
||||
_showSnackBar("Logout successful");
|
||||
|
||||
await Future.delayed(
|
||||
const Duration(milliseconds: 800),
|
||||
);
|
||||
Get.offAllNamed(
|
||||
ConstRouters.employeelogin,
|
||||
);
|
||||
} catch (e) {
|
||||
_showSnackBar(
|
||||
e.toString(),
|
||||
isError: true,
|
||||
);
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoggingOut = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: _isLoggingOut
|
||||
? const SizedBox(
|
||||
height: 18,
|
||||
width: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Color(0xFF5F297B),
|
||||
),
|
||||
)
|
||||
: const Text(
|
||||
"Log Out",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF5F297B),
|
||||
fontSize: 16,
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- MENU ITEM ---------------------
|
||||
Widget _buildMenuItem({
|
||||
required String id,
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
final isSelected = selectedItem == id;
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 24,
|
||||
height: 48,
|
||||
child: isSelected
|
||||
? CustomPaint(
|
||||
size: const Size(24, 48),
|
||||
painter: BeveledTrianglePainter(),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 58,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? const Color(0xFFEEFAFF)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 24, color: Colors.black87),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-Medium',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- SNACK BAR ---------------------
|
||||
void _showSnackBar(String msg, {bool isError = false}) {
|
||||
rootScaffoldMessengerKey.currentState?.showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: isError ? Colors.red : AppColors.commanbutton,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 70, vertical: 25),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
content: Row(
|
||||
children: [
|
||||
Image.asset(AppAssets.taxgildelogoauth, height: 18, width: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
msg,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BeveledTrianglePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = const Color(0xFF5E2976)
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
final path = Path()
|
||||
..moveTo(0, 4)
|
||||
..lineTo(size.width - 6, size.height / 2)
|
||||
..lineTo(0, size.height - 4)
|
||||
..close();
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,449 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:taxglide/consts/app_asstes.dart';
|
||||
import 'package:taxglide/consts/download_helper.dart';
|
||||
import 'package:taxglide/controller/api_consts.dart';
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
import 'package:taxglide/router/consts_routers.dart';
|
||||
|
||||
class KycDetailsList extends ConsumerStatefulWidget {
|
||||
const KycDetailsList({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<KycDetailsList> createState() => _KycDetailsListState();
|
||||
}
|
||||
|
||||
class _KycDetailsListState extends ConsumerState<KycDetailsList> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
final profileAsync = ref.watch(profileProvider);
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(AppAssets.backgroundimages),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: profileAsync.when(
|
||||
data: (profile) {
|
||||
final data = profile.data;
|
||||
|
||||
if (data == null) {
|
||||
return const Center(
|
||||
child: Text(
|
||||
"No KYC data found",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 21),
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"KYC Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight
|
||||
.w600, // equivalent to 400 (Normal)
|
||||
fontStyle: FontStyle.normal,
|
||||
fontSize: 24,
|
||||
height: 1.3, // line-height: 130%
|
||||
letterSpacing:
|
||||
0.04 * 24, // 4% of font size = 0.96px
|
||||
color: Color(0xFF111827), // background: #111827
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: const Icon(Icons.arrow_back_ios_rounded),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// White Card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 6,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
"Personal Details",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight
|
||||
.w400, // equivalent to 400 (Normal)
|
||||
fontStyle: FontStyle.normal,
|
||||
fontSize: 20,
|
||||
height: 1.3, // line-height: 130%
|
||||
letterSpacing:
|
||||
0.04 * 20, // 4% of font size = 0.8px
|
||||
color: Color(
|
||||
0xFF111827,
|
||||
), // background: #111827
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(ConstRouters.kycdetails);
|
||||
},
|
||||
child: Container(
|
||||
width: 109,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(
|
||||
0xFFFFFFFF,
|
||||
), // background: #FFFFFF
|
||||
borderRadius: BorderRadius.circular(
|
||||
8,
|
||||
), // border-radius: 8px
|
||||
border: Border.all(
|
||||
color: const Color(
|
||||
0xFFE3E3E3,
|
||||
), // border: 1px solid #E3E3E3
|
||||
width: 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF767373)
|
||||
.withOpacity(
|
||||
0.25,
|
||||
), // #76737340 ≈ 25% opacity
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 0),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.center, // center horizontally
|
||||
crossAxisAlignment: CrossAxisAlignment
|
||||
.center, // center vertically
|
||||
children: const [
|
||||
Icon(
|
||||
Icons.edit_outlined,
|
||||
size: 18,
|
||||
color: Color(
|
||||
0xFF111827,
|
||||
), // matches your text color
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
Text(
|
||||
'Edit',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: FontStyle.normal,
|
||||
fontSize: 16,
|
||||
height: 1.3, // 130%
|
||||
letterSpacing: 0.04 * 16, // 4%
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 25),
|
||||
_buildDetailRow('Company Name : ', data.companyName),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('PAN Number : ', data.panNumber),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('GST Number : ', data.gstNumber),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow(
|
||||
'Year of Incorporation : ',
|
||||
data.yearOfIncorporation?.toString(),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('Email : ', data.companyEmail),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow(
|
||||
'Phone Number : ',
|
||||
data.companyMobile,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('Address : ', data.companyAddress),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('Country : ', data.countryName),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('State : ', data.stateName),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('City : ', data.districtName),
|
||||
const SizedBox(height: 24),
|
||||
_buildDetailRow('PinCode : ', data.companyPincode),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 30),
|
||||
|
||||
// 4 Image Containers
|
||||
GridView.count(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 15,
|
||||
mainAxisSpacing: 15,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
_buildImageBox("GST Certificate ", data.gstFile),
|
||||
_buildImageBox("PAN File", data.panFile),
|
||||
|
||||
_buildImageBox(
|
||||
"Incorporation File",
|
||||
data.incorporationFile,
|
||||
),
|
||||
_buildImageBox("Profile Image", data.logo),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
loading: () => const Center(
|
||||
child: CircularProgressIndicator(color: Colors.white),
|
||||
),
|
||||
error: (e, st) => Center(
|
||||
child: Text(
|
||||
"Error loading KYC details: $e",
|
||||
style: const TextStyle(color: Colors.redAccent),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailRow(String title, String? value) {
|
||||
if (value == null || value.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
letterSpacing: 0.64,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Text(
|
||||
value,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-Regular',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
letterSpacing: 0.64,
|
||||
color: Color(0xFF111827),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildImageBox(String label, String? imageUrl) {
|
||||
final fullUrl = imageUrl != null && imageUrl.isNotEmpty
|
||||
? imageUrl.startsWith('http')
|
||||
? imageUrl
|
||||
: "${ConstsApi.baseUrl}/api/$imageUrl"
|
||||
: null;
|
||||
|
||||
final isDocument =
|
||||
label.toLowerCase().contains('gst') ||
|
||||
label.toLowerCase().contains('pan') ||
|
||||
label.toLowerCase().contains('incorporation');
|
||||
|
||||
return Container(
|
||||
width: 175,
|
||||
height: 155,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
/// ✅ LABEL
|
||||
Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Roboto',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
/// ✅ IMAGE / DOCUMENT PREVIEW
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: fullUrl == null
|
||||
? null
|
||||
: () async {
|
||||
await DownloadHelper.downloadFileToReceived(fullUrl);
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: fullUrl != null
|
||||
? isDocument
|
||||
? const Center(
|
||||
child: Icon(
|
||||
Icons.insert_drive_file_rounded,
|
||||
size: 50,
|
||||
color: Colors.blueGrey,
|
||||
),
|
||||
)
|
||||
: Image.network(
|
||||
fullUrl,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
const Center(
|
||||
child: Icon(Icons.broken_image),
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: Icon(Icons.image_not_supported, size: 40),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
/// ✅ DOWNLOAD / VIEW BUTTON
|
||||
if (fullUrl != null)
|
||||
FutureBuilder<String?>(
|
||||
future: DownloadHelper.checkFileExistsInReceived(fullUrl),
|
||||
builder: (context, snapshot) {
|
||||
final existsPath = snapshot.data;
|
||||
|
||||
return SizedBox(
|
||||
height: 36,
|
||||
child: ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 0,
|
||||
backgroundColor: existsPath == null
|
||||
? Colors.blue
|
||||
: Colors.green,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
onPressed: () async {
|
||||
if (existsPath == null) {
|
||||
await DownloadHelper.downloadFileToReceived(fullUrl);
|
||||
setState(() {});
|
||||
} else {
|
||||
await DownloadHelper.openDownloadedFile(existsPath);
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
existsPath == null
|
||||
? Icons.download_rounded
|
||||
: Icons.remove_red_eye_rounded,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
label: Text(
|
||||
existsPath == null ? "Download" : "View",
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
|
||||
class PolicyScreen extends ConsumerStatefulWidget {
|
||||
const PolicyScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<PolicyScreen> createState() => _PolicyScreenState();
|
||||
}
|
||||
|
||||
class _PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final policyAsync = ref.watch(policyProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color.fromARGB(255, 230, 229, 229),
|
||||
body: SafeArea(
|
||||
child: policyAsync.when(
|
||||
data: (policy) => SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 🔹 Header Row with Back Arrow + Centered Title
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios_new,
|
||||
color: Colors.black,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
policy.data?.title ?? 'Privacy Policy',
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Invisible icon to balance the layout
|
||||
const Opacity(
|
||||
opacity: 0,
|
||||
child: Icon(Icons.arrow_back_ios_new, size: 22),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 🔹 Policy Content
|
||||
Text(
|
||||
policy.data?.content ?? '',
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.6,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (err, _) => Center(
|
||||
child: Text(
|
||||
'Error: $err',
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,539 @@
|
||||
import 'dart:math' as math show sqrt;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:taxglide/consts/app_asstes.dart';
|
||||
import 'package:taxglide/consts/app_colors.dart';
|
||||
import 'package:taxglide/consts/local_store.dart';
|
||||
import 'package:taxglide/controller/api_repository.dart';
|
||||
import 'package:taxglide/router/consts_routers.dart';
|
||||
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
import 'package:taxglide/main.dart';
|
||||
|
||||
class ProfileScreen extends ConsumerStatefulWidget {
|
||||
const ProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ProfileScreen> createState() => _ProfileScreenState();
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends ConsumerState<ProfileScreen> {
|
||||
String? selectedItem;
|
||||
bool _isLoggingOut = false;
|
||||
|
||||
String? userRole; // <-- role variable
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadRole(); // <-- load role on start
|
||||
}
|
||||
|
||||
Future<void> _loadRole() async {
|
||||
userRole = await LocalStore().getRole();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final profileAsync = ref.watch(profileProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: profileAsync.when(
|
||||
data: (profile) {
|
||||
final data = profile.data;
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(50),
|
||||
bottomRight: Radius.circular(50),
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(140),
|
||||
bottomRight: Radius.circular(0),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Image.asset(
|
||||
AppAssets.profilebanner,
|
||||
fit: BoxFit.cover,
|
||||
height: 200,
|
||||
width: MediaQuery.of(context).size.width * 1.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: -50,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 4),
|
||||
),
|
||||
child: data?.logo != null && data!.logo!.isNotEmpty
|
||||
? CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: NetworkImage(data.logo!),
|
||||
)
|
||||
: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black87,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
(data?.companyName != null &&
|
||||
data!.companyName!.isNotEmpty)
|
||||
? data.companyName![0].toUpperCase()
|
||||
: "M",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 60),
|
||||
Text(
|
||||
data?.companyName ?? 'No Company Name',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
|
||||
ListView(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
children: [
|
||||
_buildMenuItem(
|
||||
id: 'profile',
|
||||
icon: Icons.person_outline,
|
||||
title: 'Profile',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'profile';
|
||||
});
|
||||
final pan = profile.data?.panNumber ?? '';
|
||||
ref.invalidate(profileProvider);
|
||||
if (pan.isNotEmpty) {
|
||||
Get.toNamed(ConstRouters.kycdetailslist);
|
||||
} else {
|
||||
Get.toNamed(ConstRouters.kycdetails);
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (userRole != "employee")
|
||||
_buildMenuItem(
|
||||
id: 'Staff',
|
||||
icon: Icons.list_alt_outlined,
|
||||
title: 'Sub - Staff List',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'staff';
|
||||
});
|
||||
ref.invalidate(staffListProvider);
|
||||
Get.toNamed(ConstRouters.staff);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'terms',
|
||||
icon: Icons.description_outlined,
|
||||
title: 'Terms and Conditions',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'terms';
|
||||
});
|
||||
ref.invalidate(termsProvider);
|
||||
Get.toNamed(ConstRouters.terms);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'policy',
|
||||
icon: Icons.policy_outlined,
|
||||
title: 'Policy',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'policy';
|
||||
});
|
||||
ref.invalidate(termsProvider);
|
||||
Get.toNamed(ConstRouters.policy);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildMenuItem(
|
||||
id: 'logout',
|
||||
icon: Icons.logout,
|
||||
title: 'Log out',
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedItem = 'logout';
|
||||
});
|
||||
_showLogoutPopup(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 50),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (err, _) => Center(child: Text('Error: $err')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- LOGOUT POPUP ---------------------
|
||||
void _showLogoutPopup(BuildContext context) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierLabel: 'Logout',
|
||||
barrierColor: Colors.black.withOpacity(0.2),
|
||||
transitionDuration: const Duration(milliseconds: 300),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
final offsetAnimation =
|
||||
Tween<Offset>(begin: const Offset(0, -1), end: Offset.zero).animate(
|
||||
CurvedAnimation(parent: animation, curve: Curves.easeOutBack),
|
||||
);
|
||||
|
||||
return SlideTransition(
|
||||
position: offsetAnimation,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 60.0),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(7.75),
|
||||
border: Border.all(color: Colors.white, width: 3.87),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x7A5E5E5E),
|
||||
offset: Offset(0, 2.32),
|
||||
blurRadius: 9.14,
|
||||
spreadRadius: 3.1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 16,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
"Note",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
"Are you sure you want to log out?",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text(
|
||||
"Cancel",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF535A5B),
|
||||
fontSize: 16,
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: _isLoggingOut
|
||||
? null
|
||||
: () async {
|
||||
Navigator.pop(context);
|
||||
|
||||
setState(() {
|
||||
_isLoggingOut = true;
|
||||
});
|
||||
|
||||
try {
|
||||
await ApiRepository().logout();
|
||||
_showSnackBar("Logout successful");
|
||||
|
||||
await Future.delayed(
|
||||
const Duration(milliseconds: 800),
|
||||
);
|
||||
Get.offAllNamed(ConstRouters.login);
|
||||
} catch (e) {
|
||||
_showSnackBar(
|
||||
e.toString(),
|
||||
isError: true,
|
||||
);
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoggingOut = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: _isLoggingOut
|
||||
? const SizedBox(
|
||||
height: 18,
|
||||
width: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Color(0xFF5F297B),
|
||||
),
|
||||
)
|
||||
: const Text(
|
||||
"Log Out",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF5F297B),
|
||||
fontSize: 16,
|
||||
fontFamily: 'Gilroy-SemiBold',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- MENU ITEM ---------------------
|
||||
Widget _buildMenuItem({
|
||||
required String id,
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
final isSelected = selectedItem == id;
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 24,
|
||||
height: 48,
|
||||
child: isSelected
|
||||
? CustomPaint(
|
||||
size: const Size(24, 48),
|
||||
painter: BeveledTrianglePainter(),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 58,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? const Color(0xFFEEFAFF)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 24, color: Colors.black87),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Gilroy-Medium',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// ----------------------- SNACK BAR ---------------------
|
||||
void _showSnackBar(String msg, {bool isError = false}) {
|
||||
rootScaffoldMessengerKey.currentState?.showSnackBar(
|
||||
SnackBar(
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: isError ? Colors.red : AppColors.commanbutton,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 70, vertical: 25),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
content: Row(
|
||||
children: [
|
||||
Image.asset(AppAssets.taxgildelogoauth, height: 18, width: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
msg,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BeveledTrianglePainter extends CustomPainter {
|
||||
final double cornerRadius;
|
||||
|
||||
BeveledTrianglePainter({
|
||||
this.cornerRadius = 4.0, // Adjust this value for more/less rounding
|
||||
});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = const Color(0xFF5E2976)
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
// Triangle vertices
|
||||
final vertices = [
|
||||
Offset(0, cornerRadius), // Top left (adjusted for bevel)
|
||||
Offset(size.width - 6, size.height / 2), // Right point
|
||||
Offset(0, size.height - cornerRadius), // Bottom left (adjusted for bevel)
|
||||
];
|
||||
|
||||
final path = Path();
|
||||
|
||||
for (int i = 0; i < vertices.length; i++) {
|
||||
final current = vertices[i];
|
||||
final next = vertices[(i + 1) % vertices.length];
|
||||
final prev = vertices[(i - 1 + vertices.length) % vertices.length];
|
||||
|
||||
// Calculate direction vectors
|
||||
final toCurrent = Offset(current.dx - prev.dx, current.dy - prev.dy);
|
||||
final toNext = Offset(next.dx - current.dx, next.dy - current.dy);
|
||||
|
||||
// Normalize
|
||||
final lengthToCurrent = math.sqrt(
|
||||
toCurrent.dx * toCurrent.dx + toCurrent.dy * toCurrent.dy,
|
||||
);
|
||||
final lengthToNext = math.sqrt(
|
||||
toNext.dx * toNext.dx + toNext.dy * toNext.dy,
|
||||
);
|
||||
|
||||
final normalizedToCurrent = Offset(
|
||||
toCurrent.dx / lengthToCurrent,
|
||||
toCurrent.dy / lengthToCurrent,
|
||||
);
|
||||
final normalizedToNext = Offset(
|
||||
toNext.dx / lengthToNext,
|
||||
toNext.dy / lengthToNext,
|
||||
);
|
||||
|
||||
// Points before and after the corner
|
||||
final beforeCorner = Offset(
|
||||
current.dx - normalizedToCurrent.dx * cornerRadius,
|
||||
current.dy - normalizedToCurrent.dy * cornerRadius,
|
||||
);
|
||||
final afterCorner = Offset(
|
||||
current.dx + normalizedToNext.dx * cornerRadius,
|
||||
current.dy + normalizedToNext.dy * cornerRadius,
|
||||
);
|
||||
|
||||
if (i == 0) {
|
||||
path.moveTo(beforeCorner.dx, beforeCorner.dy);
|
||||
} else {
|
||||
path.lineTo(beforeCorner.dx, beforeCorner.dy);
|
||||
}
|
||||
|
||||
// Draw rounded corner
|
||||
path.quadraticBezierTo(
|
||||
current.dx,
|
||||
current.dy,
|
||||
afterCorner.dx,
|
||||
afterCorner.dy,
|
||||
);
|
||||
}
|
||||
path.close();
|
||||
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(CustomPainter oldDelegate) => false;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:taxglide/consts/comman_button.dart';
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
|
||||
class StaffListScreen extends ConsumerStatefulWidget {
|
||||
const StaffListScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<StaffListScreen> createState() => _StaffListScreenState();
|
||||
}
|
||||
|
||||
class _StaffListScreenState extends ConsumerState<StaffListScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final staffAsync = ref.watch(staffListProvider);
|
||||
|
||||
const commonTextStyle = TextStyle(
|
||||
fontFamily: "Gilroy-SemiBold",
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14.7,
|
||||
height: 1.30, // 130%
|
||||
letterSpacing: 0.04,
|
||||
color: Color(0xFF111827),
|
||||
);
|
||||
const commonTextStylevalue = TextStyle(
|
||||
fontFamily: "Gilroy-SemiBold",
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14.7,
|
||||
height: 1.30, // 130%
|
||||
letterSpacing: 0.04,
|
||||
color: Color(0xFF111827),
|
||||
);
|
||||
return Scaffold(
|
||||
backgroundColor: const Color.fromARGB(255, 230, 229, 229),
|
||||
body: SafeArea(
|
||||
child: staffAsync.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
|
||||
error: (err, _) => Center(
|
||||
child: Text(
|
||||
'Error: $err',
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
|
||||
data: (staffList) {
|
||||
if (staffList.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"No Staff Found",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: CommanButton(
|
||||
text: 'Go Back',
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios_new,
|
||||
color: Colors.black,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
const Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Sub - Staff List',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Opacity(
|
||||
opacity: 0,
|
||||
child: Icon(Icons.arrow_back_ios_new, size: 22),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 50),
|
||||
|
||||
...staffList.map((staff) {
|
||||
String statusText = staff.status == 1
|
||||
? "Active"
|
||||
: "Inactive";
|
||||
String generalChatText = staff.generalChat == 1
|
||||
? "Yes"
|
||||
: "No";
|
||||
String createServiceText = staff.createService == 1
|
||||
? "Yes"
|
||||
: "No";
|
||||
|
||||
Color statusColor = staff.status == 1
|
||||
? Colors.green
|
||||
: Colors.red;
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/// ✅ Name
|
||||
Row(
|
||||
children: [
|
||||
Text("Name : ", style: commonTextStyle),
|
||||
Expanded(
|
||||
child: Text(
|
||||
staff.name,
|
||||
style: commonTextStylevalue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
/// ✅ Mobile
|
||||
Row(
|
||||
children: [
|
||||
Text("Mobile : ", style: commonTextStyle),
|
||||
Expanded(
|
||||
child: Text(
|
||||
staff.mobile,
|
||||
style: commonTextStylevalue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
/// ✅ Email
|
||||
Row(
|
||||
children: [
|
||||
Text("Email : ", style: commonTextStyle),
|
||||
Expanded(
|
||||
child: Text(
|
||||
staff.email,
|
||||
style: commonTextStylevalue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
/// ✅ Status
|
||||
Row(
|
||||
children: [
|
||||
Text("Status : ", style: commonTextStyle),
|
||||
Text(
|
||||
statusText,
|
||||
style: commonTextStylevalue.copyWith(
|
||||
color: statusColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
/// ✅ General Chat
|
||||
Row(
|
||||
children: [
|
||||
Text("General Chat : ", style: commonTextStyle),
|
||||
Text(
|
||||
generalChatText,
|
||||
style: commonTextStylevalue,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 6),
|
||||
|
||||
/// ✅ Create Service
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"Create Service : ",
|
||||
style: commonTextStyle,
|
||||
),
|
||||
Text(
|
||||
createServiceText,
|
||||
style: commonTextStylevalue,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:taxglide/controller/api_contoller.dart';
|
||||
|
||||
class TermsAndConditionScreen extends ConsumerStatefulWidget {
|
||||
const TermsAndConditionScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<TermsAndConditionScreen> createState() =>
|
||||
_TermsAndConditionScreenState();
|
||||
}
|
||||
|
||||
class _TermsAndConditionScreenState
|
||||
extends ConsumerState<TermsAndConditionScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final termsAsync = ref.watch(termsProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color.fromARGB(255, 230, 229, 229),
|
||||
body: SafeArea(
|
||||
child: termsAsync.when(
|
||||
data: (terms) => SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 🔹 Header Row with Back Arrow + Centered Title
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios_new,
|
||||
color: Colors.black,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
terms.data?.title ?? 'Terms & Conditions',
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// To balance layout so title stays centered
|
||||
const Opacity(
|
||||
opacity: 0,
|
||||
child: Icon(Icons.arrow_back_ios_new, size: 22),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 🔹 Terms Content
|
||||
Text(
|
||||
terms.data?.content ?? '',
|
||||
textAlign: TextAlign.start,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
height: 1.6,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (err, _) => Center(
|
||||
child: Text(
|
||||
'Error: $err',
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user