...@@ -110,7 +110,7 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -110,7 +110,7 @@ class _LoginScreenState extends State<LoginScreen> {
height: double.infinity, height: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage("assets/images/background_png.png"), image: AssetImage("assets/images/bg_image_new.png"),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
......
import 'dart:ui'; import 'dart:ui';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:gen_service/Screens/AuthScreen/LoginScreen.dart'; import 'package:gen_service/Screens/AuthScreen/LoginScreen.dart';
import 'package:gen_service/Screens/deleteAccountScreen.dart';
import 'package:gen_service/Utility/CustomSnackbar.dart'; import 'package:gen_service/Utility/CustomSnackbar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
...@@ -17,11 +18,8 @@ class ProfileScreen extends StatefulWidget { ...@@ -17,11 +18,8 @@ class ProfileScreen extends StatefulWidget {
final String accId; final String accId;
final String sessionId; final String sessionId;
const ProfileScreen({ const ProfileScreen({Key? key, required this.accId, required this.sessionId})
Key? key, : super(key: key);
required this.accId,
required this.sessionId,
}) : super(key: key);
@override @override
State<ProfileScreen> createState() => _ProfileScreenState(); State<ProfileScreen> createState() => _ProfileScreenState();
...@@ -29,16 +27,19 @@ class ProfileScreen extends StatefulWidget { ...@@ -29,16 +27,19 @@ class ProfileScreen extends StatefulWidget {
class _ProfileScreenState extends State<ProfileScreen> { class _ProfileScreenState extends State<ProfileScreen> {
bool _stretch = true; bool _stretch = true;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
Future.microtask(() { Future.microtask(() {
final profileProvider = Provider.of<DashboardProvider>(context, listen: false); final profileProvider = Provider.of<DashboardProvider>(
context,
listen: false,
);
profileProvider.fetchProfile(widget.accId, widget.sessionId); profileProvider.fetchProfile(widget.accId, widget.sessionId);
}); });
} }
Future<void> onLogout(BuildContext context) async { Future<void> onLogout(BuildContext context) async {
final provider = Provider.of<AuthProvider>(context, listen: false); final provider = Provider.of<AuthProvider>(context, listen: false);
...@@ -224,12 +225,8 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -224,12 +225,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
}, },
); );
try { try {
final success = await provider.logout( final success = await provider.logout(widget.accId, widget.sessionId);
widget.accId,
widget.sessionId,
);
// Close loading dialog // Close loading dialog
if (context.mounted) Navigator.pop(context); if (context.mounted) Navigator.pop(context);
...@@ -241,8 +238,8 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -241,8 +238,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (context.mounted) { if (context.mounted) {
CustomSnackBar.showSuccess( CustomSnackBar.showSuccess(
context: context, context: context,
message: "Logged out successfully" message: "Logged out successfully",
); );
await Future.delayed(const Duration(milliseconds: 1500)); await Future.delayed(const Duration(milliseconds: 1500));
...@@ -250,15 +247,15 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -250,15 +247,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute(builder: (_) => const LoginScreen()), MaterialPageRoute(builder: (_) => const LoginScreen()),
(route) => false, (route) => false,
); );
} }
} else { } else {
// ❌ Logout failed — show error snackbar // ❌ Logout failed — show error snackbar
if (context.mounted) { if (context.mounted) {
CustomSnackBar.showError( CustomSnackBar.showError(
context: context, context: context,
message: "Logout failed. Please try again." message: "Logout failed. Please try again.",
); );
} }
} }
...@@ -284,19 +281,14 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -284,19 +281,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
duration: const Duration(seconds: 3), duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
borderRadius: BorderRadius.circular(8),
),
), ),
); );
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final profileProvider = Provider.of<DashboardProvider>(context); final profileProvider = Provider.of<DashboardProvider>(context);
final authProvider = Provider.of<AuthProvider>(context); final authProvider = Provider.of<AuthProvider>(context);
...@@ -308,7 +300,7 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -308,7 +300,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
return const Scaffold( return const Scaffold(
backgroundColor: AppColors.backgroundRegular, backgroundColor: AppColors.backgroundRegular,
body: Center( body: Center(
child: CircularProgressIndicator(color: AppColors.buttonColor,), child: CircularProgressIndicator(color: AppColors.buttonColor),
), ),
); );
} }
...@@ -375,10 +367,14 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -375,10 +367,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
await Future.delayed(const Duration(milliseconds: 300)); await Future.delayed(const Duration(milliseconds: 300));
// Retry fetching data // Retry fetching data
final dashboardProvider = final dashboardProvider = await Future.delayed(
await Future.delayed(const Duration(milliseconds: 600)); const Duration(milliseconds: 600),
);
Provider.of<DashboardProvider>(context, listen: false); Provider.of<DashboardProvider>(context, listen: false);
profileProvider.fetchDashboard(widget.accId, widget.sessionId); profileProvider.fetchDashboard(
widget.accId,
widget.sessionId,
);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor, backgroundColor: AppColors.buttonColor,
...@@ -430,9 +426,7 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -430,9 +426,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (data == null) { if (data == null) {
return const Scaffold( return const Scaffold(
backgroundColor: AppColors.backgroundRegular, backgroundColor: AppColors.backgroundRegular,
body: Center( body: Center(child: Text("No data found.")),
child: Text("No data found."),
),
); );
} }
...@@ -443,268 +437,313 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -443,268 +437,313 @@ class _ProfileScreenState extends State<ProfileScreen> {
Provider.of<DashboardProvider>(context, listen: false); Provider.of<DashboardProvider>(context, listen: false);
profileProvider.fetchDashboard(widget.accId, widget.sessionId); profileProvider.fetchDashboard(widget.accId, widget.sessionId);
}, },
child: Scaffold( child: SafeArea(
backgroundColor: Color(0xFF4076FF), maintainBottomViewPadding: true,
top: false,
body: CustomScrollView( bottom: Platform.isAndroid,
physics: ClampingScrollPhysics(), child: Scaffold(
slivers: <Widget>[ backgroundColor: Color(0xFF4076FF),
SliverAppBar(
leading: Container(), body: CustomScrollView(
stretch: _stretch, physics: ClampingScrollPhysics(),
backgroundColor: Color(0xFF4076FF), slivers: <Widget>[
onStretchTrigger: () async { SliverAppBar(
// Refresh data when pulled down leading: Container(),
final profileProvider = stretch: _stretch,
Provider.of<DashboardProvider>(context, listen: false); backgroundColor: Color(0xFF4076FF),
profileProvider.fetchProfile(widget.accId, widget.sessionId); onStretchTrigger: () async {
}, // Refresh data when pulled down
stretchTriggerOffset: 340.0, final profileProvider = Provider.of<DashboardProvider>(
expandedHeight: 300.0, context,
flexibleSpace: LayoutBuilder( listen: false,
builder: (context, constraints) { );
final top = constraints.biggest.height; profileProvider.fetchProfile(widget.accId, widget.sessionId);
return FlexibleSpaceBar( },
stretchModes: const [ stretchTriggerOffset: 340.0,
StretchMode.zoomBackground, expandedHeight: 300.0,
StretchMode.blurBackground, flexibleSpace: LayoutBuilder(
], builder: (context, constraints) {
background: Container( final top = constraints.biggest.height;
width: double.infinity, return FlexibleSpaceBar(
decoration: const BoxDecoration(gradient: AppColors.backgroundGradient), stretchModes: const [
child: SafeArea( StretchMode.zoomBackground,
bottom: false, StretchMode.blurBackground,
child: Padding( ],
padding: const EdgeInsets.only(top: 20, bottom: 25, left: 20, right: 20), background: Container(
child: Column( width: double.infinity,
mainAxisAlignment: MainAxisAlignment.center, decoration: const BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.center, gradient: AppColors.backgroundGradient,
children: [ ),
Row( child: SafeArea(
mainAxisAlignment: MainAxisAlignment.start, bottom: false,
crossAxisAlignment: CrossAxisAlignment.center, child: Padding(
children: [ padding: const EdgeInsets.only(
InkResponse( top: 20,
onTap: () { bottom: 20,
HapticFeedback.selectionClick(); left: 20,
Navigator.pop(context, true); right: 20,
}, ),
child: SvgPicture.asset( child: Column(
"assets/svg/appbar_back.svg", mainAxisAlignment: MainAxisAlignment.center,
height: 25, crossAxisAlignment: CrossAxisAlignment.center,
), children: [
), Row(
SizedBox(width: 10), mainAxisAlignment: MainAxisAlignment.start,
Expanded( crossAxisAlignment: CrossAxisAlignment.center,
flex: 4, children: [
child: InkResponse( InkResponse(
onTap: () { onTap: () {
HapticFeedback.selectionClick(); HapticFeedback.selectionClick();
Navigator.pop(context, true); Navigator.pop(context, true);
}, },
child: Text( child: SvgPicture.asset(
"Profile", "assets/svg/appbar_back.svg",
overflow: TextOverflow.ellipsis, height: 25,
maxLines: 1, ),
style: TextStyle( ),
fontSize: 16, SizedBox(width: 10),
color: Colors.white, Expanded(
height: 1.1, flex: 4,
child: InkResponse(
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(context, true);
},
child: Text(
"Profile",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: 16,
color: Colors.white,
height: 1.1,
),
), ),
), ),
), ),
), if(widget.accId=="7175")...[
], Spacer(),
), IconButton(
// Profile Image onPressed: () {
Container( Navigator.push(
height: 80, context,
width: 80, MaterialPageRoute(
decoration: const BoxDecoration( builder:
color: Color(0xFFE6F6FF), (context) =>
shape: BoxShape.circle, DeleteAccountScreen(
), accId: widget.accId,
clipBehavior: Clip.antiAlias, sessionId:
child: (data.profileImg?.isNotEmpty == true) widget.sessionId,
? Image.network( ),
data.profileImg.toString(), ),
fit: BoxFit.cover, );
errorBuilder: (context, error, stackTrace) => },
CircleAvatar( icon: Icon(
radius: 40, Icons.more_vert,
backgroundColor: const Color(0xFFE0F4FF), color: Colors.white,
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
fit: BoxFit.contain,
), ),
), ),
) ]
: CircleAvatar(
radius: 40, ],
backgroundColor: const Color(0xFFE0F4FF), ),
child: SvgPicture.asset( // Profile Image
height: 40, Container(
"assets/svg/person_ic.svg", height: 80,
fit: BoxFit.contain, width: 80,
decoration: const BoxDecoration(
color: Color(0xFFE6F6FF),
shape: BoxShape.circle,
), ),
clipBehavior: Clip.antiAlias,
child:
(data.profileImg?.isNotEmpty == true)
? Image.network(
data.profileImg.toString(),
fit: BoxFit.cover,
errorBuilder:
(
context,
error,
stackTrace,
) => CircleAvatar(
radius: 40,
backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
fit: BoxFit.contain,
),
),
)
: CircleAvatar(
radius: 40,
backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
fit: BoxFit.contain,
),
),
), ),
), const SizedBox(height: 16),
const SizedBox(height: 16), Text(
Text( data.name.toString(),
data.name.toString(), style: const TextStyle(
style: const TextStyle( color: Colors.white,
color: Colors.white, fontSize: 22,
fontSize: 22, fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, ),
maxLines: 1,
overflow: TextOverflow.ellipsis,
), ),
maxLines: 1, const SizedBox(height: 8),
overflow: TextOverflow.ellipsis, Text(
), '+91 ${data.mobNum}',
const SizedBox(height: 8), style: TextStyle(
Text( fontWeight: FontWeight.w400,
'+91 ${data.mobNum}', color: Colors.white.withOpacity(0.9),
style: TextStyle( fontSize: 16,
fontWeight: FontWeight.w400, ),
color: Colors.white.withOpacity(0.9), maxLines: 1,
fontSize: 16, overflow: TextOverflow.ellipsis,
), ),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 12,), SizedBox(height: 12),
InkResponse( InkResponse(
onTap: () => onLogout(context), onTap: () => onLogout(context),
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8), padding: const EdgeInsets.symmetric(
decoration: BoxDecoration( horizontal: 20,
color: Colors.white, vertical: 8,
borderRadius: BorderRadius.circular(20), ),
), decoration: BoxDecoration(
child: const Text( color: Colors.white,
" Logout ", borderRadius: BorderRadius.circular(20),
style: TextStyle( ),
color: AppColors.normalText, child: const Text(
fontWeight: FontWeight.w600, " Logout ",
fontSize: 14, style: TextStyle(
overflow: TextOverflow.ellipsis, color: AppColors.normalText,
fontWeight: FontWeight.w600,
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
), ),
), ),
), ),
),
SizedBox(height: 2,), SizedBox(height: 2),
], ],
),
), ),
), ),
), ),
), );
); },
}, ),
), ),
),
// Body content // Body content
SliverFillRemaining( SliverFillRemaining(
hasScrollBody: false, hasScrollBody: false,
child: Container(
padding: const EdgeInsets.only(top: 1, bottom: 0),
color: Colors.transparent,
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 0), padding: const EdgeInsets.only(top: 1, bottom: 0),
decoration: const BoxDecoration( color: Colors.transparent,
color: AppColors.backgroundRegular, child: Container(
borderRadius: BorderRadius.only( padding: const EdgeInsets.symmetric(horizontal: 0),
topLeft: Radius.circular(30), decoration: const BoxDecoration(
topRight: Radius.circular(30), color: AppColors.backgroundRegular,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
), ),
), child: Padding(
child: Padding( padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ const SizedBox(height: 20),
const SizedBox(height: 20),
// email
// email if (data.email != "" && data.email != null)
if (data.email != "" && data.email != null) _buildItemRow(
_buildItemRow( icon: "assets/svg/message_ic.svg",
icon: "assets/svg/message_ic.svg", iconBg: Color(0xFFDFF8FF),
iconBg: Color(0xFFDFF8FF), title: "Email ID",
title: "Email ID", subTitle: data.email.toString(),
subTitle: data.email.toString() ),
), // address
// address _buildItemRow(
_buildItemRow(
icon: "assets/svg/lolipop_ic.svg", icon: "assets/svg/lolipop_ic.svg",
iconBg: Color(0xFFFFE5E5), iconBg: Color(0xFFFFE5E5),
title: "Address", title: "Address",
subTitle: data.address.toString() subTitle: data.address.toString(),
), ),
// state // state
_buildItemRow( _buildItemRow(
icon: "assets/svg/pay_card_ic.svg", icon: "assets/svg/pay_card_ic.svg",
iconBg: Color(0xFFDFF8FF), iconBg: Color(0xFFDFF8FF),
title: "State", title: "State",
subTitle: data.state.toString() subTitle: data.state.toString(),
), ),
// sub local // sub local
_buildItemRow( _buildItemRow(
icon: "assets/svg/pay_card_ic.svg", icon: "assets/svg/pay_card_ic.svg",
iconBg: Color(0xFFDFF8FF), iconBg: Color(0xFFDFF8FF),
title: "Sub Locality", title: "Sub Locality",
subTitle: data.locality.toString() subTitle: data.locality.toString(),
), ),
Spacer(), Spacer(),
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
"assets/svg/gensis_latest_logo.svg", "assets/svg/genservice_full.svg",
height: 58, height: 50,
color: AppColors.buttonColor, ),
), SizedBox(height: 12),
SizedBox(height: 12,), Text(
Text( 'Genesis Poweronics Pvt. Ltd.',
'Genesis Poweronics Pvt. Ltd.', style: TextStyle(
style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: AppColors.subtitleText), color: AppColors.subtitleText,
), ),
Text( ),
'App Version 1.0', Text(
style: TextStyle( 'App Version 1.0',
style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: AppColors.subtitleText), color: AppColors.subtitleText,
), ),
),
], ],
),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
), ],
], ),
), ),
), ),
); );
} }
Widget _buildItemRow({ Widget _buildItemRow({
required String icon, required String icon,
required Color iconBg, required Color iconBg,
...@@ -713,24 +752,23 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -713,24 +752,23 @@ class _ProfileScreenState extends State<ProfileScreen> {
}) { }) {
final isShow = title != "Sub Locality" && title != "State"; final isShow = title != "Sub Locality" && title != "State";
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 16,vertical: 8), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row( child: Row(
children: [ children: [
Container( Container(
padding: EdgeInsets.all(title =="Address" ? 8 :12), padding: EdgeInsets.all(title == "Address" ? 8 : 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isShow ? iconBg : Colors.transparent, color: isShow ? iconBg : Colors.transparent,
borderRadius: BorderRadius.circular(18) borderRadius: BorderRadius.circular(18),
), ),
child: SvgPicture.asset( child: SvgPicture.asset(
height: title =="Address" ? 34: 26, height: title == "Address" ? 34 : 26,
icon, icon,
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
SizedBox(width: 14,), SizedBox(width: 14),
Expanded( Expanded(
flex: 7, flex: 7,
child: Column( child: Column(
...@@ -762,9 +800,4 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -762,9 +800,4 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
); );
} }
} }
...@@ -371,9 +371,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt ...@@ -371,9 +371,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
child: SizedBox( child: SizedBox(
height: 170, height: 170,
width: 170, width: 170,
child: SvgPicture.asset( child: Image.asset(
"assets/svg/gen_logo.svg", "assets/images/genservice.png",
color: Color(0xFFFFFFFF),
), ),
), ),
), ),
......
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:gen_service/Notifiers/AuthProvider.dart';
import 'package:provider/provider.dart';
import '../Utility/AppColors.dart';
import '../Utility/CustomSnackbar.dart';
import '../Utility/SharedpreferencesService.dart';
import 'AuthScreen/LoginScreen.dart';
class DeleteAccountScreen extends StatefulWidget {
final accId;
final sessionId;
const DeleteAccountScreen({super.key,required this.accId,required this.sessionId});
@override
State<DeleteAccountScreen> createState() => _DeleteAccountScreenState();
}
class _DeleteAccountScreenState extends State<DeleteAccountScreen> {
bool _stretch = true;
late List<String> reasons = [
"Don’t plan to use My Gen anymore",
"Already have another account",
"Concerned about my privacy",
"The app isn’t working as expected",
"I want to Opt-out.",
];
var selectedDeleteValue;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return SafeArea(
maintainBottomViewPadding: true,
top: false,
bottom: Platform.isAndroid,
child: Scaffold(
backgroundColor: Color(0xFF4076FF),
body: CustomScrollView(
physics: ClampingScrollPhysics(),
slivers: <Widget>[
SliverAppBar(
leading: Container(),
stretch: _stretch,
backgroundColor: Color(0xFF4076FF),
onStretchTrigger: () async {},
stretchTriggerOffset: 100.0,
expandedHeight: 70.0,
flexibleSpace: LayoutBuilder(
builder: (context, constraints) {
final top = constraints.biggest.height;
return FlexibleSpaceBar(
stretchModes: const [
StretchMode.zoomBackground,
StretchMode.blurBackground,
],
background: Container(
width: double.infinity,
decoration: const BoxDecoration(
gradient: AppColors.backgroundGradient,
),
child: SafeArea(
bottom: false,
child: Padding(
padding: const EdgeInsets.only(
top: 20,
bottom: 20,
left: 20,
right: 20,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkResponse(
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(context, true);
},
child: SvgPicture.asset(
"assets/svg/appbar_back.svg",
height: 25,
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: InkResponse(
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(context, true);
},
child: Text(
"Delete Account",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: 16,
color: Colors.white,
height: 1.1,
),
),
),
),
],
),
SizedBox(height: 2),
],
),
),
),
),
);
},
),
),
// Body content
SliverFillRemaining(
hasScrollBody: false,
child: Container(
padding: const EdgeInsets.only(top: 1, bottom: 0),
color: Colors.transparent,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 0),
decoration: const BoxDecoration(
color: AppColors.backgroundRegular,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 20),
// email
Text(
"Do you want to Delete Your Account",
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 5),
Text(
"select your reason to delete your account",
style: TextStyle(
fontSize: 12,
color: AppColors.subtitleText,
),
),
const SizedBox(height: 15),
...List.generate(reasons.length, (index) {
return InkWell(
onTap: () {
setState(() {
selectedDeleteValue = reasons[index];
});
_showDeleteConfirmationBottomSheet(context);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(height: 5),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
(selectedDeleteValue == reasons[index])
? SvgPicture.asset(
"assets/svg/checkbox-checked.svg",
height: 17,
)
: SvgPicture.asset(
"assets/svg/checkbox.svg",
height: 17,
),
SizedBox(width: 10),
SizedBox(
child: Text(
reasons[index]!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.nearDarkText,
fontWeight: FontWeight.w500,
fontSize: 12,
),
),
),
// Spacer(),
// SvgPicture.asset(
// "assets/images/next_button.svg",
// height: 13,
// ),
],
),
SizedBox(height: 5),
],
),
);
}),
Spacer(),
Align(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SvgPicture.asset(
"assets/svg/genservice_full.svg",
height: 50,
),
SizedBox(height: 12),
Text(
'Genesis Poweronics Pvt. Ltd.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.subtitleText,
),
),
Text(
'App Version 1.0',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.subtitleText,
),
),
],
),
),
],
),
),
),
),
),
],
),
),
);
}
Future<void> _showDeleteConfirmationBottomSheet(context) async {
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(15.0)),
),
isScrollControlled: true,
builder: (BuildContext context) {
return SafeArea(
child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
top: 16,
left: 16,
right: 16,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Center(
child: Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(4),
),
),
),
const SizedBox(height: 16),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
width: MediaQuery.of(context).size.width * 0.8,
child: Text(
"Uh-oh! Are you sure you want to delete your account?",
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: AppColors.nearDarkText,
overflow: TextOverflow.ellipsis,
),
),
),
SizedBox(height: 10),
Text(
"All your data will be permanently deleted",
style: TextStyle(
color: AppColors.subtitleText,
fontSize: 12,
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
width: 170,
height: 38,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: AppColors.subtitleText,
width: 0.3,
),
borderRadius: BorderRadius.circular(10),
),
child: TextButton(
style: ButtonStyle(
overlayColor: MaterialStatePropertyAll(
Colors.transparent,
),
),
onPressed: () {
Navigator.pop(context);
showDialog(
context: context,
builder:
(_) => AlertDialog.adaptive(
title: Text("Request Received"),
content: Text(
"Your account deletion request has been recorded. "
"We will process it within 24–48 hours.",
),
actions: [
TextButton(
onPressed: () async {
// Navigator.pop(context);
final provider = Provider.of<AuthProvider>(
context,
listen: false,
);
try {
final success = await provider
.logout(
widget.accId,
widget.sessionId,
);
if (context.mounted) {
Navigator.pop(context);
}
if (success) {
final prefs =
SharedPreferencesService
.instance;
await prefs.clearPreferences();
if (context.mounted) {
CustomSnackBar.showSuccess(
context: context,
message:
"Logged out successfully",
);
await Future.delayed(
const Duration(
milliseconds: 1500,
),
);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder:
(_) =>
const LoginScreen(),
),
(route) => false,
);
}
} else {
if (context.mounted) {
CustomSnackBar.showError(
context: context,
message:
"Logout failed. Please try again.",
);
}
}
} catch (e) {
if (context.mounted) {
CustomSnackBar.showError(
context: context,
message:
"An error occurred. Please try again.",
);
}
}
},
child: Text("OK"),
),
],
),
);
},
child: Text(
"Yep, delete me!",
style: TextStyle(
fontSize: 12,
color: AppColors.nearDarkText,
fontWeight: FontWeight.w600,
),
),
),
),
Container(
width: 170,
height: 38,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: AppColors.buttonColor,
),
child: TextButton(
style: ButtonStyle(
overlayColor: MaterialStatePropertyAll(
Colors.transparent,
),
),
onPressed: () {
Navigator.pop(context);
},
child: const Text(
"Nope, take me back!",
style: TextStyle(
fontSize: 13,
fontFamily: "MontserratSemiBold",
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
const SizedBox(height: 10),
],
),
);
},
),
);
},
);
}
}