......@@ -110,7 +110,7 @@ class _LoginScreenState extends State<LoginScreen> {
height: double.infinity,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/background_png.png"),
image: AssetImage("assets/images/bg_image_new.png"),
fit: BoxFit.cover,
),
),
......
import 'dart:ui';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.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:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
......@@ -17,11 +18,8 @@ class ProfileScreen extends StatefulWidget {
final String accId;
final String sessionId;
const ProfileScreen({
Key? key,
required this.accId,
required this.sessionId,
}) : super(key: key);
const ProfileScreen({Key? key, required this.accId, required this.sessionId})
: super(key: key);
@override
State<ProfileScreen> createState() => _ProfileScreenState();
......@@ -29,16 +27,19 @@ class ProfileScreen extends StatefulWidget {
class _ProfileScreenState extends State<ProfileScreen> {
bool _stretch = true;
@override
void initState() {
super.initState();
Future.microtask(() {
final profileProvider = Provider.of<DashboardProvider>(context, listen: false);
final profileProvider = Provider.of<DashboardProvider>(
context,
listen: false,
);
profileProvider.fetchProfile(widget.accId, widget.sessionId);
});
}
Future<void> onLogout(BuildContext context) async {
final provider = Provider.of<AuthProvider>(context, listen: false);
......@@ -224,12 +225,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
},
);
try {
final success = await provider.logout(
widget.accId,
widget.sessionId,
);
final success = await provider.logout(widget.accId, widget.sessionId);
// Close loading dialog
if (context.mounted) Navigator.pop(context);
......@@ -242,7 +239,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (context.mounted) {
CustomSnackBar.showSuccess(
context: context,
message: "Logged out successfully"
message: "Logged out successfully",
);
await Future.delayed(const Duration(milliseconds: 1500));
......@@ -258,7 +255,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (context.mounted) {
CustomSnackBar.showError(
context: context,
message: "Logout failed. Please try again."
message: "Logout failed. Please try again.",
);
}
}
......@@ -284,19 +281,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
);
}
}
@override
Widget build(BuildContext context) {
final profileProvider = Provider.of<DashboardProvider>(context);
final authProvider = Provider.of<AuthProvider>(context);
......@@ -308,7 +300,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: CircularProgressIndicator(color: AppColors.buttonColor,),
child: CircularProgressIndicator(color: AppColors.buttonColor),
),
);
}
......@@ -375,10 +367,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
await Future.delayed(const Duration(milliseconds: 300));
// Retry fetching data
final dashboardProvider =
await Future.delayed(const Duration(milliseconds: 600));
final dashboardProvider = await Future.delayed(
const Duration(milliseconds: 600),
);
Provider.of<DashboardProvider>(context, listen: false);
profileProvider.fetchDashboard(widget.accId, widget.sessionId);
profileProvider.fetchDashboard(
widget.accId,
widget.sessionId,
);
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor,
......@@ -430,9 +426,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (data == null) {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: Text("No data found."),
),
body: Center(child: Text("No data found.")),
);
}
......@@ -443,6 +437,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
Provider.of<DashboardProvider>(context, listen: false);
profileProvider.fetchDashboard(widget.accId, widget.sessionId);
},
child: SafeArea(
maintainBottomViewPadding: true,
top: false,
bottom: Platform.isAndroid,
child: Scaffold(
backgroundColor: Color(0xFF4076FF),
......@@ -455,8 +453,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
backgroundColor: Color(0xFF4076FF),
onStretchTrigger: () async {
// Refresh data when pulled down
final profileProvider =
Provider.of<DashboardProvider>(context, listen: false);
final profileProvider = Provider.of<DashboardProvider>(
context,
listen: false,
);
profileProvider.fetchProfile(widget.accId, widget.sessionId);
},
stretchTriggerOffset: 340.0,
......@@ -471,11 +471,18 @@ class _ProfileScreenState extends State<ProfileScreen> {
],
background: Container(
width: double.infinity,
decoration: const BoxDecoration(gradient: AppColors.backgroundGradient),
decoration: const BoxDecoration(
gradient: AppColors.backgroundGradient,
),
child: SafeArea(
bottom: false,
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(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
......@@ -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
......@@ -526,14 +557,21 @@ class _ProfileScreenState extends State<ProfileScreen> {
shape: BoxShape.circle,
),
clipBehavior: Clip.antiAlias,
child: (data.profileImg?.isNotEmpty == true)
child:
(data.profileImg?.isNotEmpty == true)
? Image.network(
data.profileImg.toString(),
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) =>
CircleAvatar(
errorBuilder:
(
context,
error,
stackTrace,
) => CircleAvatar(
radius: 40,
backgroundColor: const Color(0xFFE0F4FF),
backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
......@@ -543,7 +581,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
)
: CircleAvatar(
radius: 40,
backgroundColor: const Color(0xFFE0F4FF),
backgroundColor: const Color(
0xFFE0F4FF,
),
child: SvgPicture.asset(
height: 40,
"assets/svg/person_ic.svg",
......@@ -574,11 +614,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 12,),
SizedBox(height: 12),
InkResponse(
onTap: () => onLogout(context),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 8,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
......@@ -595,7 +638,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
),
SizedBox(height: 2,),
SizedBox(height: 2),
],
),
),
......@@ -634,28 +677,28 @@ class _ProfileScreenState extends State<ProfileScreen> {
icon: "assets/svg/message_ic.svg",
iconBg: Color(0xFFDFF8FF),
title: "Email ID",
subTitle: data.email.toString()
subTitle: data.email.toString(),
),
// address
_buildItemRow(
icon: "assets/svg/lolipop_ic.svg",
iconBg: Color(0xFFFFE5E5),
title: "Address",
subTitle: data.address.toString()
subTitle: data.address.toString(),
),
// state
_buildItemRow(
icon: "assets/svg/pay_card_ic.svg",
iconBg: Color(0xFFDFF8FF),
title: "State",
subTitle: data.state.toString()
subTitle: data.state.toString(),
),
// sub local
_buildItemRow(
icon: "assets/svg/pay_card_ic.svg",
iconBg: Color(0xFFDFF8FF),
title: "Sub Locality",
subTitle: data.locality.toString()
subTitle: data.locality.toString(),
),
Spacer(),
......@@ -665,26 +708,26 @@ class _ProfileScreenState extends State<ProfileScreen> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
SvgPicture.asset(
"assets/svg/gensis_latest_logo.svg",
height: 58,
color: AppColors.buttonColor,
"assets/svg/genservice_full.svg",
height: 50,
),
SizedBox(height: 12,),
SizedBox(height: 12),
Text(
'Genesis Poweronics Pvt. Ltd.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.subtitleText),
color: AppColors.subtitleText,
),
),
Text(
'App Version 1.0',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.subtitleText),
color: AppColors.subtitleText,
),
),
],
),
),
......@@ -697,14 +740,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
],
),
),
),
);
}
Widget _buildItemRow({
required String icon,
required Color iconBg,
......@@ -713,24 +752,23 @@ class _ProfileScreenState extends State<ProfileScreen> {
}) {
final isShow = title != "Sub Locality" && title != "State";
return Container(
padding: EdgeInsets.symmetric(horizontal: 16,vertical: 8),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Container(
padding: EdgeInsets.all(title =="Address" ? 8 :12),
padding: EdgeInsets.all(title == "Address" ? 8 : 12),
decoration: BoxDecoration(
color: isShow ? iconBg : Colors.transparent,
borderRadius: BorderRadius.circular(18)
borderRadius: BorderRadius.circular(18),
),
child: SvgPicture.asset(
height: title =="Address" ? 34: 26,
height: title == "Address" ? 34 : 26,
icon,
fit: BoxFit.contain,
),
),
SizedBox(width: 14,),
SizedBox(width: 14),
Expanded(
flex: 7,
child: Column(
......@@ -762,9 +800,4 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
);
}
}
......@@ -371,9 +371,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
child: SizedBox(
height: 170,
width: 170,
child: SvgPicture.asset(
"assets/svg/gen_logo.svg",
color: Color(0xFFFFFFFF),
child: Image.asset(
"assets/images/genservice.png",
),
),
),
......
This diff is collapsed.