...@@ -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);
...@@ -242,7 +239,7 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -242,7 +239,7 @@ 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));
...@@ -258,7 +255,7 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -258,7 +255,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
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,6 +437,10 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -443,6 +437,10 @@ 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: SafeArea(
maintainBottomViewPadding: true,
top: false,
bottom: Platform.isAndroid,
child: Scaffold( child: Scaffold(
backgroundColor: Color(0xFF4076FF), backgroundColor: Color(0xFF4076FF),
...@@ -455,8 +453,10 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -455,8 +453,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
backgroundColor: Color(0xFF4076FF), backgroundColor: Color(0xFF4076FF),
onStretchTrigger: () async { onStretchTrigger: () async {
// Refresh data when pulled down // Refresh data when pulled down
final profileProvider = final profileProvider = Provider.of<DashboardProvider>(
Provider.of<DashboardProvider>(context, listen: false); context,
listen: false,
);
profileProvider.fetchProfile(widget.accId, widget.sessionId); profileProvider.fetchProfile(widget.accId, widget.sessionId);
}, },
stretchTriggerOffset: 340.0, stretchTriggerOffset: 340.0,
...@@ -471,11 +471,18 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -471,11 +471,18 @@ class _ProfileScreenState extends State<ProfileScreen> {
], ],
background: Container( background: Container(
width: double.infinity, width: double.infinity,
decoration: const BoxDecoration(gradient: AppColors.backgroundGradient), decoration: const BoxDecoration(
gradient: AppColors.backgroundGradient,
),
child: SafeArea( child: SafeArea(
bottom: false, bottom: false,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 20, bottom: 25, left: 20, right: 20), padding: const EdgeInsets.only(
top: 20,
bottom: 20,
left: 20,
right: 20,
),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -515,6 +522,30 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -515,6 +522,30 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
), ),
), ),
if(widget.accId=="7175")...[
Spacer(),
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
DeleteAccountScreen(
accId: widget.accId,
sessionId:
widget.sessionId,
),
),
);
},
icon: Icon(
Icons.more_vert,
color: Colors.white,
),
),
]
], ],
), ),
// Profile Image // Profile Image
...@@ -526,14 +557,21 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -526,14 +557,21 @@ class _ProfileScreenState extends State<ProfileScreen> {
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: (data.profileImg?.isNotEmpty == true) child:
(data.profileImg?.isNotEmpty == true)
? Image.network( ? Image.network(
data.profileImg.toString(), data.profileImg.toString(),
fit: BoxFit.cover, fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => errorBuilder:
CircleAvatar( (
context,
error,
stackTrace,
) => CircleAvatar(
radius: 40, radius: 40,
backgroundColor: const Color(0xFFE0F4FF), backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset( child: SvgPicture.asset(
height: 40, height: 40,
"assets/svg/person_ic.svg", "assets/svg/person_ic.svg",
...@@ -543,7 +581,9 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -543,7 +581,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
) )
: CircleAvatar( : CircleAvatar(
radius: 40, radius: 40,
backgroundColor: const Color(0xFFE0F4FF), backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset( child: SvgPicture.asset(
height: 40, height: 40,
"assets/svg/person_ic.svg", "assets/svg/person_ic.svg",
...@@ -574,11 +614,14 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -574,11 +614,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
overflow: TextOverflow.ellipsis, 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(
horizontal: 20,
vertical: 8,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
...@@ -595,7 +638,7 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -595,7 +638,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
), ),
SizedBox(height: 2,), SizedBox(height: 2),
], ],
), ),
), ),
...@@ -634,28 +677,28 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -634,28 +677,28 @@ class _ProfileScreenState extends State<ProfileScreen> {
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(),
...@@ -665,26 +708,26 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -665,26 +708,26 @@ class _ProfileScreenState extends State<ProfileScreen> {
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( Text(
'App Version 1.0', 'App Version 1.0',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: AppColors.subtitleText), color: AppColors.subtitleText,
),
), ),
], ],
), ),
), ),
...@@ -697,14 +740,10 @@ class _ProfileScreenState extends State<ProfileScreen> { ...@@ -697,14 +740,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
], ],
), ),
), ),
),
); );
} }
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),
), ),
), ),
), ),
......
This diff is collapsed.