Commit 97403192 authored by Sai Srinivas's avatar Sai Srinivas Committed by Sai Srinivas
Browse files

Icon inserted and few changes

parent 5a62c920
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import '../../Notifiers/serviceAndJobCardListProvier.dart';
import '../../Utility/AppColors.dart';
class serviceListScreen extends StatefulWidget {
final accId;
final sessionId;
final complaintId;
const serviceListScreen({super.key,required this.accId,required this.sessionId,required this.complaintId});
@override
State<serviceListScreen> createState() => _serviceListScreenState();
}
class _serviceListScreenState extends State<serviceListScreen> {
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<ServiceAndJobCardListProvider>(
context,
listen: false,
);
provider.fetchServiceDetailsAPI(widget.accId, widget.sessionId,widget.complaintId);
});
}
@override
Widget build(BuildContext context) {
return Consumer<ServiceAndJobCardListProvider>(
builder: (context, provider, child) {
final isLoading = provider.isLoading;
final error = provider.errorMessage;
final response = provider.allServiceResponse;
final data = response?.allServiceList??[];
List<String> serviceHeadings = [
"Date",
"In/Out Time",
"Running Hrs.",
"FSR File",
"FSR Number",
"Feedback",
];
if (isLoading) {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: CircularProgressIndicator(color: AppColors.buttonColor),
),
);
}
if (error != null) {
return Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: Text(
error,
style: const TextStyle(color: Colors.red, fontSize: 16),
),
),
);
}
if (data == null) {
return const Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(child: Text("No data found.")),
);
}
return RefreshIndicator.adaptive(
color: AppColors.amountText,
onRefresh: () async {
await Future.delayed(const Duration(milliseconds: 600));
},
child: Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: CustomScrollView(
physics: const BouncingScrollPhysics(),
slivers: [
SliverAppBar(
stretch: true,
pinned: true,
expandedHeight: 75,
backgroundColor: AppColors.backgroundRegular,
elevation: 0,
// Remove shadow
automaticallyImplyLeading: false,
toolbarHeight: 0,
// Remove toolbar space
collapsedHeight: 0,
// Completely collapse to 0 height
flexibleSpace: FlexibleSpaceBar(
stretchModes: const [StretchMode.fadeTitle],
background: Container(
decoration: BoxDecoration(
gradient: AppColors.balanceBarGradientA,
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 20,
),
child: SizedBox(
child: 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(
"Service Details List",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: 16,
color: Colors.white,
height: 1.1,
),
),
),
),
],
),
),
),
),
),
),
),
SliverToBoxAdapter(
child: Container(
color: Color(0xFF4076FF),
child: Container(
decoration: const BoxDecoration(
color: AppColors.backgroundRegular,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 4),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: data!.length,
itemBuilder: (context, j) {
List<String> serviceSubHeadings = [
data[j].date ?? "-",
data[j].inOrOutTime ?? "-",
data[j].runningHrs ?? "-",
data[j].fsrExt ?? "-",
data[j].fsrNo ?? "-",
data[j].feedback ?? "-",
];
return Container(
margin: const EdgeInsets.all(5),
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: const Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
...List.generate(serviceHeadings.length, (
i,
) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 3,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
serviceHeadings[i] ?? "-",
style: const TextStyle(
fontSize: 14,
color: AppColors.subtitleText,
),
),
),
Expanded(
child: Text(
serviceSubHeadings[i].isEmpty
? "-"
: serviceSubHeadings[i] ??
"-",
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
style: const TextStyle(
fontSize: 14,
color: AppColors.nearDarkText,
),
),
),
],
),
);
}),
SizedBox(
height: 5,
),
Container(
padding: EdgeInsets.symmetric(horizontal: 0,vertical: 15),
decoration: BoxDecoration(
color: Color(0xFFE8F6FF),
borderRadius: BorderRadius.circular(16),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 1,
child: CircleAvatar(
backgroundImage: data[j].profileImg=="https://erp.gengroup.in/"?
AssetImage("assets/images/user_img.png"):
NetworkImage(
data[j].profileImg!,
),
),
),
Expanded(
flex: 2,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"${data[j].empName}",
maxLines: 2,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color:
AppColors.nearDarkText,
fontSize: 14,
),
),
Text(
"${data[j].techRoleName}",
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color:
AppColors.subtitleText,
fontSize: 12,
),
),
],
),
),
),
Expanded(
flex: 2,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(5, (index) {
final serviceId = data[j].id?.toString() ?? data[j].id.toString();
final rating = provider.getRating(serviceId);
final starStates = provider.getStarStates(serviceId);
return InkWell(
onTap: () async {
final newRating = index + 1;
provider.setRating(serviceId, newRating);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Submitting rating..."), duration: Duration(seconds: 1)),
);
await provider.updateRatingForTechnician(widget.accId,widget.sessionId,serviceId,newRating);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: Icon(
Icons.star_rate_rounded,
color: starStates[index]
? const Color(0xffFFB703)
: const Color(0xffCECECE),
size: 24,
),
),
);
}),
),
Text(
"Your Rating",
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color:
AppColors.subtitleText,
fontSize: 12,
),
),
],
),
),
),
],
),
),
],
),
);
},
),
],
),
),
),
),
],
),
),
);
},
);
}
}
This diff is collapsed.
......@@ -316,9 +316,111 @@ class _ProfileScreenState extends State<ProfileScreen> {
return Scaffold(
backgroundColor: AppColors.backgroundRegular,
body: Center(
child: Text(
error,
style: const TextStyle(color: Colors.red, fontSize: 16),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Error Icon
Container(
width: 120,
height: 120,
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.1),
shape: BoxShape.circle,
),
child: const Icon(
Icons.error_outline_rounded,
size: 60,
color: Colors.red,
),
),
const SizedBox(height: 24),
// Error Title
const Text(
"Oops! Something went wrong",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.black87,
fontFamily: "Poppins",
),
),
const SizedBox(height: 12),
// Error Message
Text(
error,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 14,
color: Colors.grey,
fontFamily: "Poppins",
height: 1.4,
),
),
const SizedBox(height: 32),
// Retry Button
ElevatedButton.icon(
onPressed: () async {
// Show loading state
setState(() {});
await Future.delayed(const Duration(milliseconds: 300));
// Retry fetching data
final dashboardProvider =
await Future.delayed(const Duration(milliseconds: 600));
Provider.of<DashboardProvider>(context, listen: false);
profileProvider.fetchDashboard(widget.accId, widget.sessionId);
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.buttonColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
elevation: 2,
),
icon: const Icon(Icons.refresh_rounded, size: 20),
label: const Text(
"Try Again",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
fontFamily: "Poppins",
),
),
),
const SizedBox(height: 16),
// Alternative Action
TextButton(
onPressed: () {
// Go back or navigate to home
Navigator.maybePop(context);
},
child: const Text(
"Go Back",
style: TextStyle(
fontSize: 14,
color: Colors.grey,
fontFamily: "Poppins",
),
),
),
],
),
),
),
);
......
......@@ -372,8 +372,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
height: 170,
width: 170,
child: SvgPicture.asset(
"assets/svg/genesis_logo_2io.svg",
color: Color(0xFF4076FF),
"assets/svg/gen_logo.svg",
color: Color(0xFFFFFFFF),
),
),
),
......
......@@ -271,8 +271,8 @@ class _BillDetailScreenState extends State<BillDetailScreen> {
padding: const EdgeInsets.symmetric(vertical: 2),
child: _buildProductItem(
product.partName.toString(),
product.price.toString(),
product.qty.toString(),
product.price.toString(),
product.totalPrice.toString()
)
),
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -31,4 +31,9 @@ const getPaymentStatusUrl = "${baseUrl}get_payment_status";
const addComplaintUrl = "${baseUrl}add_complaint";
const generatorListUrl = "${baseUrl}generator_list";
const complaintDropdownsUrl = "${baseUrl}complaint_dropdowns";
const getInTouchListUrl = "${baseUrl}get_in_touch_list";
\ No newline at end of file
const getInTouchListUrl = "${baseUrl}get_in_touch_list";
const complaintDetailsUrl = "${baseUrl}complaint_details";
const allJobCardsListUrl = "${baseUrl}all_job_card_list";
const allServiceListUrl = "${baseUrl}all_service_list";
const jobCardProductsUrl = "${baseUrl}job_card_products";
const updateTechRatingUrl = "${baseUrl}update_tech_rating";
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -48,6 +48,11 @@ dependencies:
url_launcher: ^6.3.2
path_provider: ^2.1.5
open_filex: ^4.7.0
google_maps_flutter: ^2.14.0
geolocator: ^14.0.2
location: ^8.0.1
permission_handler: ^12.0.1
geocoding: ^4.0.0
razorpay_flutter: ^1.4.0
dev_dependencies:
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment