Commit c92f4c79 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

ios changes in Navigation swipe gestures.

parent ee178d55
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:generp/screens/order/ordersDetailsByModes.dart';
import 'package:provider/provider.dart';
......@@ -10,17 +12,24 @@ import '../../Utils/commonWidgets.dart';
class ProspectOrderDetails extends StatefulWidget {
final leadID;
const ProspectOrderDetails({super.key,required this.leadID});
const ProspectOrderDetails({super.key, required this.leadID});
@override
State<ProspectOrderDetails> createState() => _ProspectOrderDetailsState();
}
class _ProspectOrderDetailsState extends State<ProspectOrderDetails> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
// TODO: implement initState
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
......@@ -29,150 +38,182 @@ class _ProspectOrderDetailsState extends State<ProspectOrderDetails> {
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.ordersList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Order Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Order Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(4, (j) {
final textheads = [
"Order Id",
"Date Created",
"Order Status",
"View Details",
];
final textSubheads = [
customerDetails[index].id ?? "-",
customerDetails[index].createdDatetime ?? "-",
customerDetails[index].status ?? "-",
"View",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Order Details"),
backgroundColor: AppColors.scaffold_bg_color,
body:
customerDetails.isNotEmpty
? SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// TextWidget(context, "Order Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(4, (j) {
final textheads = [
"Order Id",
"Date Created",
"Order Status",
"View Details",
];
final textSubheads = [
customerDetails[index].id ?? "-",
customerDetails[index].createdDatetime ??
"-",
customerDetails[index].status ?? "-",
"View",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
if (textSubheads[j] == "View") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Ordersdetailsbymodes(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if (textSubheads[j] == "View") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Ordersdetailsbymodes(
mode: "",
pageTitleName:
"Order Details",
orderId:
widget.leadID,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration
.underline,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration.underline,
),
),
),
),
] else ...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
] else ...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
),
),
],
],
),
);
}),
),
);
},
),
SizedBox(height: 75),
],
),
),
),
],
],
),
);
}),
),
);
},
),
),
),
SizedBox(height: 75),
],
),
),
)
: Emptywidget(context),
);
},
);
......
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:generp/Utils/commonServices.dart';
import 'package:generp/screens/order/paymentDetailsByMode.dart';
import 'package:provider/provider.dart';
......@@ -18,10 +20,17 @@ class ProspectPaymentDetails extends StatefulWidget {
}
class _ProspectPaymentDetailsState extends State<ProspectPaymentDetails> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
// TODO: implement initState
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final provider = Provider.of<crmProspectDetailsProvider>(
context,
......@@ -30,156 +39,188 @@ class _ProspectPaymentDetailsState extends State<ProspectPaymentDetails> {
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<crmProspectDetailsProvider>(
builder: (context, provider, child) {
var customerDetails = provider.paymentsList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Payment Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Payment Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(6, (j) {
final textheads = [
"Mode of Payment",
"Payment Reference",
"Amount",
"Entered By Employee",
"Payment Received Date",
"Action"
];
final textSubheads = [
customerDetails[index].paymentType ?? "-",
customerDetails[index].refNo ?? "-",
customerDetails[index].amount ?? "-",
customerDetails[index].employeeName ?? "-",
customerDetails[index].paymentDate ?? "-",
"View Details",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Payment Details"),
backgroundColor: AppColors.scaffold_bg_color,
body:
customerDetails.isNotEmpty
? SizedBox(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// TextWidget(context, "Payment Details"),
ListView.builder(
itemCount: customerDetails.length,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(6, (j) {
final textheads = [
"Mode of Payment",
"Payment Reference",
"Amount",
"Entered By Employee",
"Payment Received Date",
"Action",
];
final textSubheads = [
customerDetails[index].paymentType ?? "-",
customerDetails[index].refNo ?? "-",
customerDetails[index].amount ?? "-",
customerDetails[index].employeeName ??
"-",
customerDetails[index].paymentDate ?? "-",
"View Details",
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 6,
horizontal: 0,
),
if (textSubheads[j] == "View Details") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Paymentdetailsbymode(
mode: "",
pageTitleName:
"Payment Details",
paymentId:
customerDetails[index]
.id,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
textheads[j].toString(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration.underline,
),
),
),
),
] else
...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
if (textSubheads[j] ==
"View Details") ...[
Expanded(
flex: 3,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Paymentdetailsbymode(
mode: "",
pageTitleName:
"Payment Details",
paymentId:
customerDetails[index]
.id,
),
),
);
if (res == true) {
provider
.crmProspectDetailsAPIFunction(
context,
widget.leadID,
);
}
},
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.app_blue,
decorationColor:
AppColors.app_blue,
decoration:
TextDecoration
.underline,
),
),
),
),
),
] else ...[
Expanded(
flex: 3,
child: Text(
textSubheads[j] == ""
? "-"
: textSubheads[j],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF818181),
),
),
),
],
],
],
),
);
}),
),
);
},
),
),
);
}),
),
);
},
),
SizedBox(height: 75),
],
),
),
),
),
),
SizedBox(height: 75),
],
),
),
)
: Emptywidget(context),
);
},
);
......
......@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/financeProvider/RequestionListProvider.dart';
import 'package:generp/Utils/GlobalConstants.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonWidgets.dart';
import 'package:generp/screens/finance/FileViewer.dart';
......@@ -32,7 +33,6 @@ class Allpaymentrequesitionlistsbymodes extends StatefulWidget {
class _AllpaymentrequesitionlistsbymodesState
extends State<Allpaymentrequesitionlistsbymodes> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -56,9 +56,9 @@ class _AllpaymentrequesitionlistsbymodesState
start: DateTime(now.year, now.month, now.day),
end: DateTime(now.year, now.month, now.day),
);
final dateRange = cf.getFormattedDateRange(range);
// print(dateRange);
provider.paymentRequestionListsAPIFunction(context, widget.mode, "","");
final dateRange = cf.getFormattedDateRange(range);
// print(dateRange);
provider.paymentRequestionListsAPIFunction(context, widget.mode, "", "");
});
}
......@@ -82,336 +82,372 @@ class _AllpaymentrequesitionlistsbymodesState
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Requestionlistprovider>(
return connection == "Online"
? Platform.isAndroid
? WillPopScope(
onWillPop: () {
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Requestionlistprovider>(
builder: (context, provider, child) {
final requestLists = provider.requisitionList;
return WillPopScope(
onWillPop: () {
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(context);
if (result != null) {
var dateRange = result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(context);
if (result != null) {
var dateRange = result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
var formatted = result['formatted'] as List<String>;
print("formatted: $formatted");
var formatted = result['formatted'] as List<String>;
print("formatted: $formatted");
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentRequestionListsAPIFunction(
context,
widget.mode,
fromDate,
toDate,
);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child:SvgPicture.asset("assets/svg/filter_ic.svg",height: 25,),
),
],
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentRequestionListsAPIFunction(
context,
widget.mode,
fromDate,
toDate,
);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
),
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue)
))
: requestLists.isNotEmpty?SizedBox(
child: Scrollbar(
thumbVisibility: false,
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
if (requestLists.isEmpty) {
return SizedBox(
child: Center(
child: Text("No Data Available"),
),
);
}
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius:
BorderRadius.circular(8),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
requestLists[index]
.accountName!,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.semi_black,
),
),
Text(
"₹"
"${requestLists[index].amount}",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
requestLists[index].status!,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
),
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(4, (j) {
final headings = [
"Requesting Propose",
"Attachment",
"Requested Date",
"Note",
];
final subHeadings = [
requestLists[index].requestingPurpose,
"View",
// requestLists[index].attachmentDirFilePath
requestLists[index].date,
requestLists[index].description,
];
if(j==1&&requestLists[index]
.attachmentViewFileName==""){
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Fileviewer(
fileName:
requestLists[index]
.attachmentViewFileName!,
fileUrl:
requestLists[index]
.attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j]!,
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors
.app_blue
: Color(
0xFF818181,
),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration
.none,
decorationColor:
j == 1
? AppColors
.app_blue
: AppColors.white,
),
),
),
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Paymentrequestionlistdetails(
pageName:
widget
.pageTitleName,
mode: widget.mode,
paymentRequestId:
requestLists[index]
.id,
),
),
);
if(res==true){
provider.paymentRequestionListsAPIFunction(context, widget.mode, "","");
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
);
},
),
),
):Emptywidget(context)
],
),
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: requestLists.isNotEmpty
? SizedBox(
child: Scrollbar(
thumbVisibility: false,
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
if (requestLists.isEmpty) {
return SizedBox(
child: Center(child: Text("No Data Available")),
);
}
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
requestLists[index].accountName!,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
"₹"
"${requestLists[index].amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
8,
),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
requestLists[index].status!,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
),
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(4, (j) {
final headings = [
"Requesting Propose",
"Attachment",
"Requested Date",
"Note",
];
final subHeadings = [
requestLists[index].requestingPurpose,
"View",
// requestLists[index].attachmentDirFilePath
requestLists[index].date,
requestLists[index].description,
];
if (j == 1 &&
requestLists[index]
.attachmentViewFileName ==
"") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Fileviewer(
fileName:
requestLists[index]
.attachmentViewFileName!,
fileUrl:
requestLists[index]
.attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j]!,
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors.app_blue
: Color(0xFF818181),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration.none,
decorationColor:
j == 1
? AppColors.app_blue
: AppColors.white,
),
),
),
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Paymentrequestionlistdetails(
pageName:
widget.pageTitleName,
mode: widget.mode,
paymentRequestId:
requestLists[index].id,
),
settings: RouteSettings(
name: "Paymentrequestionlistdetails",
),
),
);
if (routeSettingName ==
"Paymentrequestionlistdetails") {
print("croos refresh");
provider
.paymentRequestionListsAPIFunction(
context,
widget.mode,
"",
"",
);
}
// if (res == true) {
// print("android refresh");
// provider
// .paymentRequestionListsAPIFunction(
// context,
// widget.mode,
// "",
// "",
// );
// }
// if (Platform.isIOS) {
// print("IOS Refresh");
// if (didPushed == "true" ||
// didPopped == "true") {
// provider
// .paymentRequestionListsAPIFunction(
// context,
// widget.mode,
// "",
// "",
// );
// }
// }
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
);
},
),
),
)
: Emptywidget(context),
);
},
):NoNetwork(context);
);
}
Future<void> _showOptionsSheet(BuildContext context) {
......@@ -436,7 +472,9 @@ class _AllpaymentrequesitionlistsbymodesState
right: 15,
top: 10,
),
padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
......
......@@ -35,12 +35,10 @@ class Paymentrequestionlistdetails extends StatefulWidget {
class _PaymentrequestionlistdetailsState
extends State<Paymentrequestionlistdetails> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
List<FocusNode> focusNodes = List.generate(10, (index) => FocusNode(),);
List<FocusNode> focusNodes = List.generate(10, (index) => FocusNode());
Dropdowntheme ddtheme = Dropdowntheme();
TextEditingController approvedAmount = TextEditingController();
TextEditingController remarks = TextEditingController();
......@@ -87,7 +85,7 @@ class _PaymentrequestionlistdetailsState
@override
void dispose() {
// TODO: implement dispose
focusNodes.map((e)=>e.dispose());
focusNodes.map((e) => e.dispose());
_connectivity.disposeStream();
super.dispose();
}
......@@ -105,7 +103,22 @@ class _PaymentrequestionlistdetailsState
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Requesitionlidtdetailsprovider>(
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Requesitionlidtdetailsprovider>(
builder: (context, provider, child) {
var req_det = provider.requestsDetails;
isLevel1Finalized = [
......@@ -136,468 +149,447 @@ class _PaymentrequestionlistdetailsState
"Level 2 Approved",
"Level 2 approved",
].contains(req_det.status);
}else if(widget.mode == "self_apr_lvl2"){
shouldShowButtons = [
"Requested"
].contains(req_det.status);
} else if (widget.mode == "self_apr_lvl2") {
shouldShowButtons = ["Requested"].contains(req_det.status);
}
return WillPopScope(
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageName,
provider.resetAll,
SizedBox(width: 0),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageName,
provider.resetAll,
SizedBox(width: 0),
),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
children: [
Row(
children: [
Row(
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
),
child: SvgPicture.asset("assets/svg/fin_ic.svg"),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
req_det.accountName == ""
? "-"
: req_det.accountName ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
req_det.amount == ""
? "-"
: "₹${req_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
req_det.status ?? "-",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if (provider.Headings[j] == "Attachment" &&
req_det.attachmentViewFileName == "") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
req_det.accountName == ""
? "-"
: req_det.accountName ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
child: InkResponse(
onTap: () {
if (provider.Headings[j] == "Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
fileName:
req_det
.attachmentViewFileName ??
"",
fileUrl:
req_det
.attachmentDirFilePath ??
"",
),
),
),
Text(
req_det.amount == ""
? "-"
: "₹${req_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
);
} else if (provider.Headings[j] ==
"Requested Account") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Accountslistdetails(
accountID:
provider
.requestsDetails
.accountId,
),
),
),
],
);
}
},
child: Text(
["Attachment"].contains(provider.Headings[j])
? "View"
: provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j],
style: TextStyle(
fontSize: 14,
color:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? AppColors.app_blue
: Color(0xFF818181),
decoration:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? TextDecoration.underline
: TextDecoration.none,
decorationColor:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? AppColors.app_blue
: AppColors.white,
),
),
),
),
Expanded(
flex: 2,
],
),
);
}),
SizedBox(height: 80),
],
),
),
),
),
bottomNavigationBar:
(["admin", "self"].contains(widget.mode) || !shouldShowButtons)
? Container(height: 0)
: Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
alignment: Alignment.bottomCenter,
height: 60,
child: Container(
margin: EdgeInsets.only(bottom: 10),
alignment: Alignment.center,
height: 45,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: InkResponse(
onTap: () {
print(provider.requestsDetails.id);
_showLevelRejectionSheet(
context,
provider.requestsDetails.id,
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE3FFE0),
color: Color(0xFFFFEFEF),
border: Border.all(
color: Color(0xFFED3424),
width: 0.5,
),
),
child: Center(
child: Text(
req_det.status ?? "-",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
"Reject",
style: TextStyle(color: Color(0xFFED3424)),
),
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if (provider.Headings[j] == "Attachment" &&
req_det.attachmentViewFileName == "") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
SizedBox(width: 10),
if ([
"apr_lvl1",
"apr_lvl2",
"self_apr_lvl2",
].contains(widget.mode)) ...[
Expanded(
child: InkResponse(
onTap: () {
provider
.approveRejectPaymentRequestAPIFunction(
context,
provider.requestsDetails.id,
);
_showLevelApprovalSheet(
context,
provider.requestsDetails.id,
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE7FFE5),
border: Border.all(
color: Color(0xFF0D9C00),
width: 0.5,
),
),
),
Expanded(
child: InkResponse(
onTap: () {
if (provider.Headings[j] ==
"Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
fileName:
req_det
.attachmentViewFileName ??
"",
fileUrl:
req_det
.attachmentDirFilePath ??
"",
),
),
);
} else if (provider.Headings[j] ==
"Requested Account") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Accountslistdetails(
accountID:
provider
.requestsDetails
.accountId,
),
),
);
}
},
child: Center(
child: Text(
[
"Attachment",
].contains(provider.Headings[j])
? "View"
: provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j],
"Approve",
style: TextStyle(
fontSize: 14,
color:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? AppColors.app_blue
: Color(0xFF818181),
decoration:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? TextDecoration.underline
: TextDecoration.none,
decorationColor:
[
"Attachment",
"Requested Account",
].contains(provider.Headings[j])
? AppColors.app_blue
: AppColors.white,
),
),
),
),
],
),
);
}),
SizedBox(height: 80,)
],
),
),
),
),
bottomNavigationBar:
(["admin", "self"].contains(widget.mode) || !shouldShowButtons)
? Container(height: 0)
: Container(
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
alignment: Alignment.bottomCenter,
height: 60,
child: Container(
margin: EdgeInsets.only(bottom: 10),
alignment: Alignment.center,
height: 45,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: InkResponse(
onTap: () {
print(provider.requestsDetails.id);
_showLevelRejectionSheet(
context,
provider.requestsDetails.id,
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFFFEFEF),
border: Border.all(
color: Color(0xFFED3424),
width: 0.5,
),
),
child: Center(
child: Text(
"Reject",
style: TextStyle(
color: Color(0xFFED3424),
),
color: Color(0xFF0D9C00),
),
),
),
),
),
SizedBox(width: 10),
if ([
"apr_lvl1",
"apr_lvl2",
"self_apr_lvl2"
].contains(widget.mode)) ...[
Expanded(
child: InkResponse(
onTap: () {
provider
.approveRejectPaymentRequestAPIFunction(
context,
provider.requestsDetails.id,
);
_showLevelApprovalSheet(
),
] else if (widget.mode == "process") ...[
Expanded(
child: InkResponse(
onTap: () {
provider
.approveRejectPaymentRequestAPIFunction(
context,
provider.requestsDetails.id,
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE7FFE5),
border: Border.all(
color: Color(0xFF0D9C00),
width: 0.5,
),
),
child: Center(
child: Text(
"Approve",
style: TextStyle(
color: Color(0xFF0D9C00),
),
),
),
provider.preValues();
_showAddPaymentSheet(
context,
provider.requestsDetails.id,
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE7FFE5),
border: Border.all(
color: Color(0xFF0D9C00),
width: 0.5,
),
),
),
] else if (widget.mode == "process") ...[
Expanded(
child: InkResponse(
onTap: () {
provider
.approveRejectPaymentRequestAPIFunction(
context,
provider.requestsDetails.id,
);
provider.preValues();
_showAddPaymentSheet(
context,
provider.requestsDetails.id,
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE7FFE5),
border: Border.all(
color: Color(0xFF0D9C00),
width: 0.5,
),
),
child: Center(
child: Text(
"Add Payment",
style: TextStyle(
color: Color(0xFF0D9C00),
),
),
child: Center(
child: Text(
"Add Payment",
style: TextStyle(
color: Color(0xFF0D9C00),
),
),
),
),
],
],
),
),
),
),
],
],
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
// bottomNavigationBar:
// (["admin", "self"].contains(widget.mode))
// ? Container(height: 0)
// : ([
// "Level 1 Approved",
// "Level 1 Rejected",
// "Level 1 approved",
// "Level 1 rejected",
// "Level 2 Approved",
// "Level 2 Rejected",
// "Level 2 approved",
// "Level 2 rejected",
// ]).contains(req_det.status)
// ? SizedBox(height: 0)
// : Container(
// margin: EdgeInsets.symmetric(horizontal: 10),
// alignment: Alignment.bottomCenter,
// height: 60,
// child: Container(
// margin: EdgeInsets.only(bottom: 10),
// alignment: Alignment.center,
// height: 45,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(
// child: InkResponse(
// onTap: () {
// _showLevelRejectionSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFFFEFEF),
// border: Border.all(
// color: Color(0xFFED3424),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Reject",
// style: TextStyle(
// color: Color(0xFFED3424),
// ),
// ),
// ),
// ),
// ),
// ),
// SizedBox(width: 10),
// if ([
// "apr_lvl1",
// "apr_lvl2",
// ].contains(widget.mode)) ...[
// Expanded(
// child: InkResponse(
// onTap: () {
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
// _showLevelApprovalSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE7FFE5),
// border: Border.all(
// color: Color(0xFF0D9C00),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Approve",
// style: TextStyle(
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
// ),
// ] else if (widget.mode == "process") ...[
// Expanded(
// child: InkResponse(
// onTap: () {
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
// _showAddPaymentSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE7FFE5),
// border: Border.all(
// color: Color(0xFF0D9C00),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Add Payment",
// style: TextStyle(
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ],
// ),
// ),
// ),
),
),
onWillPop: () {
provider.resetAll();
return onBackPressed(context);
},
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
// bottomNavigationBar:
// (["admin", "self"].contains(widget.mode))
// ? Container(height: 0)
// : ([
// "Level 1 Approved",
// "Level 1 Rejected",
// "Level 1 approved",
// "Level 1 rejected",
// "Level 2 Approved",
// "Level 2 Rejected",
// "Level 2 approved",
// "Level 2 rejected",
// ]).contains(req_det.status)
// ? SizedBox(height: 0)
// : Container(
// margin: EdgeInsets.symmetric(horizontal: 10),
// alignment: Alignment.bottomCenter,
// height: 60,
// child: Container(
// margin: EdgeInsets.only(bottom: 10),
// alignment: Alignment.center,
// height: 45,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(
// child: InkResponse(
// onTap: () {
// _showLevelRejectionSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFFFEFEF),
// border: Border.all(
// color: Color(0xFFED3424),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Reject",
// style: TextStyle(
// color: Color(0xFFED3424),
// ),
// ),
// ),
// ),
// ),
// ),
// SizedBox(width: 10),
// if ([
// "apr_lvl1",
// "apr_lvl2",
// ].contains(widget.mode)) ...[
// Expanded(
// child: InkResponse(
// onTap: () {
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
// _showLevelApprovalSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE7FFE5),
// border: Border.all(
// color: Color(0xFF0D9C00),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Approve",
// style: TextStyle(
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
// ),
// ] else if (widget.mode == "process") ...[
// Expanded(
// child: InkResponse(
// onTap: () {
// provider
// .approveRejectPaymentRequestAPIFunction(
// context,
// provider.requestsDetails.id,
// );
// _showAddPaymentSheet(context);
// },
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE7FFE5),
// border: Border.all(
// color: Color(0xFF0D9C00),
// width: 0.5,
// ),
// ),
// child: Center(
// child: Text(
// "Add Payment",
// style: TextStyle(
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ],
// ),
// ),
// ),
);
},
):NoNetwork(context);
);
}
Future<void> _showLevelApprovalSheet(BuildContext context, paymentID) {
......@@ -672,7 +664,7 @@ class _PaymentrequestionlistdetailsState
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next
TextInputAction.next,
),
errorWidget(context, provider.ApprovedAmountError),
textControllerWidget(
......@@ -684,9 +676,9 @@ class _PaymentrequestionlistdetailsState
TextInputType.text,
false,
null,
focusNodes[1],
null,
TextInputAction.done
focusNodes[1],
null,
TextInputAction.done,
),
errorWidget(context, provider.remarksError),
TextWidget(context, "Proposed Payment Account"),
......@@ -911,7 +903,9 @@ class _PaymentrequestionlistdetailsState
TextInputType.text,
false,
null,
focusNodes[2],null,TextInputAction.done
focusNodes[2],
null,
TextInputAction.done,
),
errorWidget(context, provider.remarksError),
InkWell(
......@@ -978,7 +972,6 @@ class _PaymentrequestionlistdetailsState
builder: (context, provider, child) {
return Scaffold(
body: Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
......@@ -996,7 +989,8 @@ class _PaymentrequestionlistdetailsState
Expanded(
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
......@@ -1017,40 +1011,53 @@ class _PaymentrequestionlistdetailsState
(p0) {},
),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentAccounts>(
child: DropdownButton2<
PaymentAccounts
>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
items:
provider.paymentsAccounts
.map(
(paymenents) => DropdownMenuItem<
(
paymenents,
) => DropdownMenuItem<
PaymentAccounts
>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
paymenents.name ??
'',
style:
const TextStyle(
fontSize:
14,
),
overflow:
TextOverflow.ellipsis,
TextOverflow
.ellipsis,
),
),
)
.toList(),
value: provider.selectedPaymentAccounts,
onChanged: (PaymentAccounts? value) {
value:
provider
.selectedPaymentAccounts,
onChanged: (
PaymentAccounts? value,
) {
if (value != null) {
if (provider
.paymentsAccounts
......@@ -1060,11 +1067,14 @@ class _PaymentrequestionlistdetailsState
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedID = value.id!;
provider.selectedValue = value.name!;
provider.selectedID =
value.id!;
provider.selectedValue =
value.name!;
print(
"hfjkshfg" +
provider.selectedID.toString(),
provider.selectedID
.toString(),
);
}
}
......@@ -1072,35 +1082,43 @@ class _PaymentrequestionlistdetailsState
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider
.paymentAccountSearchController,
provider
.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
padding:
const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.paymentAccountSearchController,
provider
.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText:
'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (item, searchValue) {
searchMatchFn: (
item,
searchValue,
) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
false;
},
......@@ -1108,12 +1126,15 @@ class _PaymentrequestionlistdetailsState
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.paymentAccountSearchController
provider
.paymentAccountSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
buttonStyleData:
ddtheme.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
......@@ -1128,7 +1149,7 @@ class _PaymentrequestionlistdetailsState
context,
provider.approvedAmountReadonly,
"Approved Amount",
(p0) {},
(p0) {},
),
textControllerWidget(
......@@ -1136,20 +1157,30 @@ class _PaymentrequestionlistdetailsState
provider.approvedAmount,
"Payment Amount",
"Enter Payment Amount",
(p0) {
if(numberFormat.parse(provider.approvedAmountReadonly.text)<numberFormat.parse(provider.approvedAmount.text)){
provider.proposedAmountError = "Amount Should not be greater than Approved amount";
}else{
provider.proposedAmountError = "";
}
},
(p0) {
if (numberFormat.parse(
provider
.approvedAmountReadonly
.text,
) <
numberFormat.parse(
provider.approvedAmount.text,
)) {
provider.proposedAmountError =
"Amount Should not be greater than Approved amount";
} else {
provider.proposedAmountError = "";
}
},
TextInputType.numberWithOptions(),
false,
null
null,
),
errorWidget(context, provider.proposedAmountError),
errorWidget(
context,
provider.proposedAmountError,
),
textControllerWidget(
context,
......@@ -1160,7 +1191,9 @@ class _PaymentrequestionlistdetailsState
TextInputType.text,
false,
null,
focusNodes[3],focusNodes[4],TextInputAction.next
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
textControllerWidget(
......@@ -1172,7 +1205,9 @@ class _PaymentrequestionlistdetailsState
TextInputType.text,
false,
null,
focusNodes[4],null,TextInputAction.done
focusNodes[4],
null,
TextInputAction.done,
),
InkResponse(
......@@ -1180,12 +1215,17 @@ class _PaymentrequestionlistdetailsState
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
margin: EdgeInsets.symmetric(
vertical: 10,
),
height: 45,
width: MediaQuery.of(context).size.width,
width:
MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(
12,
),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
......@@ -1311,24 +1351,20 @@ class _PaymentrequestionlistdetailsState
"Bank UPI ID",
(p0) {},
),
],
),
),
),
],
),
],
),
),
bottomNavigationBar: Align(
bottomNavigationBar: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () {
provider
.paymentrequisitionProcessSubmitAPIFunction(
provider.paymentrequisitionProcessSubmitAPIFunction(
context,
widget.mode,
paymentReferenceNumber.text,
......@@ -1373,6 +1409,7 @@ class _PaymentrequestionlistdetailsState
},
);
}
Future<void> _showAddPaymentSheet(BuildContext context, paymentID) {
return showModalBottomSheet(
useSafeArea: true,
......@@ -1411,7 +1448,8 @@ class _PaymentrequestionlistdetailsState
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
bottom:
MediaQuery.of(context).viewInsets.bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,
......@@ -1420,7 +1458,8 @@ class _PaymentrequestionlistdetailsState
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
......@@ -1437,76 +1476,147 @@ class _PaymentrequestionlistdetailsState
context,
provider.proposedPaymentAccount,
"Enter Proposed Payment Account",
(p0) {},
(p0) {},
),
TextWidget(
context,
"Payment Account",
),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentAccounts>(
child: DropdownButton2<
PaymentAccounts
>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items: provider.paymentsAccounts
.map(
(paymenents) => DropdownMenuItem<PaymentAccounts>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
style: TextStyle(
fontSize: 14,
),
)
.toList(),
value: provider.selectedPaymentAccounts,
onChanged: (PaymentAccounts? value) {
if (value != null && provider.paymentsAccounts.isNotEmpty) {
overflow:
TextOverflow
.ellipsis,
),
items:
provider
.paymentsAccounts
.map(
(
paymenents,
) => DropdownMenuItem<
PaymentAccounts
>(
value:
paymenents,
child: Text(
paymenents
.name ??
'',
style: TextStyle(
fontSize:
14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value:
provider
.selectedPaymentAccounts,
onChanged: (
PaymentAccounts? value,
) {
if (value != null &&
provider
.paymentsAccounts
.isNotEmpty) {
setState(() {
provider.selectedPaymentAccounts = value;
provider.selectedID = value.id!;
provider.selectedValue = value.name!;
print("Selected Account: ${value.name}, ID: ${value.id}");
provider.selectedPaymentAccounts =
value;
provider.selectedID =
value.id!;
provider.selectedValue =
value.name!;
print(
"Selected Account: ${value.name}, ID: ${value.id}",
);
});
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController: provider.paymentAccountSearchController,
searchInnerWidgetHeight:
50,
searchController:
provider
.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
padding:
const EdgeInsets.all(
8,
),
child: TextFormField(
controller: provider.paymentAccountSearchController,
controller:
provider
.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
contentPadding:
EdgeInsets.symmetric(
horizontal:
10,
vertical: 8,
),
hintText:
'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderRadius:
BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(searchValue.toLowerCase()) ?? false;
searchMatchFn: (
item,
searchValue,
) {
return item
.value
?.name
?.toLowerCase()
.contains(
searchValue
.toLowerCase(),
) ??
false;
},
),
onMenuStateChange: (isOpen) {
onMenuStateChange: (
isOpen,
) {
if (!isOpen) {
provider.paymentAccountSearchController.clear();
provider
.paymentAccountSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
buttonStyleData:
ddtheme
.buttonStyleData,
iconStyleData:
ddtheme.iconStyleData,
menuItemStyleData:
ddtheme
.menuItemStyleData,
dropdownStyleData:
ddtheme
.dropdownStyleData,
),
),
],
......@@ -1516,32 +1626,45 @@ class _PaymentrequestionlistdetailsState
context,
provider.approvedAmountReadonly,
"Approved Amount",
(p0) {},
(p0) {},
),
textControllerWidget(
context,
provider.approvedAmount,
"Payment Amount",
"Enter Payment Amount",
(p0) {
if (numberFormat.parse(provider.approvedAmountReadonly.text) <
numberFormat.parse(provider.approvedAmount.text)) {
provider.proposedAmountError = "Amount should not be greater than Approved amount";
(p0) {
if (numberFormat.parse(
provider
.approvedAmountReadonly
.text,
) <
numberFormat.parse(
provider
.approvedAmount
.text,
)) {
provider.proposedAmountError =
"Amount should not be greater than Approved amount";
} else {
provider.proposedAmountError = "";
provider.proposedAmountError =
"";
}
},
TextInputType.numberWithOptions(),
false,
null,
),
errorWidget(context, provider.proposedAmountError),
errorWidget(
context,
provider.proposedAmountError,
),
textControllerWidget(
context,
paymentReferenceNumber,
"Enter Payment Reference Number",
"Payment Reference Number",
(p0) {},
(p0) {},
TextInputType.text,
false,
null,
......@@ -1554,7 +1677,7 @@ class _PaymentrequestionlistdetailsState
remarks,
"Remarks",
"Enter Remarks",
(p0) {},
(p0) {},
TextInputType.text,
false,
null,
......@@ -1567,12 +1690,18 @@ class _PaymentrequestionlistdetailsState
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
margin: EdgeInsets.symmetric(
vertical: 10,
),
height: 45,
width: MediaQuery.of(context).size.width,
width:
MediaQuery.of(
context,
).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
borderRadius:
BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
......@@ -1582,33 +1711,46 @@ class _PaymentrequestionlistdetailsState
child: Text(
"Add Attachment",
style: TextStyle(
fontFamily: "JakartaMedium",
fontFamily:
"JakartaMedium",
color: AppColors.app_blue,
),
),
),
),
),
if (provider.imagePicked == 1 && provider.imagePath != null) ...[
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
padding:
const EdgeInsets.symmetric(
vertical: 4.0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
"${provider.imagePath}",
style: TextStyle(
color: AppColors.semi_black,
color:
AppColors
.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
fontWeight:
FontWeight.w600,
),
),
InkResponse(
onTap: () {
setState(() {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
provider.imagePicked =
0;
provider.imagePath =
null;
provider.imageFilePath =
null;
});
},
child: SvgPicture.asset(
......@@ -1621,18 +1763,78 @@ class _PaymentrequestionlistdetailsState
),
),
],
textControllerReadonlyWidget(context, provider.accountName, "Enter Account Name", (p0) {}),
textControllerReadonlyWidget(context, provider.branch, "Enter Branch Name", (p0) {}),
textControllerReadonlyWidget(context, provider.requestingPurpose, "Enter Requesting Purpose", (p0) {}),
textControllerReadonlyWidget(context, provider.description, "Enter Description", (p0) {}),
textControllerReadonlyWidget(context, provider.amount, "Enter Amount", (p0) {}),
textControllerReadonlyWidget(context, provider.paymentMode, "Enter Payment Mode", (p0) {}),
textControllerReadonlyWidget(context, provider.bankHolderName, "Bank Account Holder Name", (p0) {}),
textControllerReadonlyWidget(context, provider.bankAccountNumber, "Bank Account Number", (p0) {}),
textControllerReadonlyWidget(context, provider.bankName, "Bank Name", (p0) {}),
textControllerReadonlyWidget(context, provider.bankBranchName, "Bank Branch Name", (p0) {}),
textControllerReadonlyWidget(context, provider.bankIfscCode, "Bank IFSC Code", (p0) {}),
textControllerReadonlyWidget(context, provider.bankUpiID, "Bank UPI ID", (p0) {}),
textControllerReadonlyWidget(
context,
provider.accountName,
"Enter Account Name",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.branch,
"Enter Branch Name",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.requestingPurpose,
"Enter Requesting Purpose",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.description,
"Enter Description",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.amount,
"Enter Amount",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.paymentMode,
"Enter Payment Mode",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankHolderName,
"Bank Account Holder Name",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankAccountNumber,
"Bank Account Number",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankName,
"Bank Name",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankBranchName,
"Bank Branch Name",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankIfscCode,
"Bank IFSC Code",
(p0) {},
),
textControllerReadonlyWidget(
context,
provider.bankUpiID,
"Bank UPI ID",
(p0) {},
),
],
),
),
......@@ -1653,16 +1855,17 @@ class _PaymentrequestionlistdetailsState
),
child: InkWell(
onTap: () {
provider.paymentrequisitionProcessSubmitAPIFunction(
context,
widget.mode,
paymentReferenceNumber.text,
provider.approvedAmount.text,
paymentID,
provider.selectedID,
remarks.text,
provider.imagePath,
);
provider
.paymentrequisitionProcessSubmitAPIFunction(
context,
widget.mode,
paymentReferenceNumber.text,
provider.approvedAmount.text,
paymentID,
provider.selectedID,
remarks.text,
provider.imagePath,
);
},
child: Container(
height: 45,
......@@ -1691,6 +1894,7 @@ class _PaymentrequestionlistdetailsState
},
);
}
Future<void> _showAttachmentSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
......
......@@ -71,609 +71,589 @@ class _AddpaymentreceiptlistState extends State<Addpaymentreceiptlist> {
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Paymentreceiptsprovider>(
builder: (context, provider, child) {
return WillPopScope(
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar2(
context,
"${widget.pageTitleName}",
provider.resetForm,
SizedBox(width: 0),
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Accounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items: [
...provider.receiptAccounts
.map(
(accs) => DropdownMenuItem<Accounts>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
],
value: provider.selectreceiptAccounts,
onChanged: (Accounts? value) {
if (value != null) {
if (provider.receiptAccounts.isNotEmpty) {
provider.selectreceiptAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptAccountId = value.id!;
provider.receiptAccountValue =
value.name!;
print(
"hfjkshfg" +
provider.receiptAccountId
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
8,
),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Paymentreceiptsprovider>(
builder: (context, provider, child) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar2(
context,
"${widget.pageTitleName}",
provider.resetForm,
SizedBox(width: 0),
),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Accounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items: [
...provider.receiptAccounts
.map(
(accs) => DropdownMenuItem<Accounts>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
],
value: provider.selectreceiptAccounts,
onChanged: (Accounts? value) {
if (value != null) {
if (provider.receiptAccounts.isNotEmpty) {
provider.selectreceiptAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptAccountId = value.id!;
provider.receiptAccountValue = value.name!;
print(
"hfjkshfg" +
provider.receiptAccountId.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller: provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
],
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
),
errorWidget(context, provider.selectAccountError),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<ReceiptAccounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.receiptPaymentAccounts
.map(
(accs) =>
DropdownMenuItem<ReceiptAccounts>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
],
),
),
errorWidget(context, provider.selectAccountError),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<ReceiptAccounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.receiptPaymentAccounts
.map(
(accs) =>
DropdownMenuItem<ReceiptAccounts>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(
fontSize: 14,
),
)
.toList(),
value: provider.selectreceiptPaymentAccounts,
onChanged: (ReceiptAccounts? value) {
if (value != null) {
if (provider
.receiptPaymentAccounts
.isNotEmpty) {
provider.selectreceiptPaymentAccounts =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptPaymentAccountsID =
value.id!;
provider.receiptPaymentAccountsValue =
value.name!;
print(
"hfjkshfg" +
provider.receiptPaymentAccountsID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
overflow: TextOverflow.ellipsis,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
8,
),
),
),
)
.toList(),
value: provider.selectreceiptPaymentAccounts,
onChanged: (ReceiptAccounts? value) {
if (value != null) {
if (provider
.receiptPaymentAccounts
.isNotEmpty) {
provider.selectreceiptPaymentAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptPaymentAccountsID = value.id!;
provider.receiptPaymentAccountsValue =
value.name!;
print(
"hfjkshfg" +
provider.receiptPaymentAccountsID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.paymentAccountSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
],
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.paymentAccountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
),
errorWidget(context, provider.selectPaymentAccountError),
],
),
),
errorWidget(context, provider.selectPaymentAccountError),
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
errorWidget(context, provider.amountError),
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
errorWidget(context, provider.amountError),
///payment date toBE
TextWidget(context, "Receipt Date"),
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
///payment date toBE
TextWidget(context, "Receipt Date"),
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller: provider.dateController,
keyboardType: TextInputType.text,
enabled: false,
maxLines: 1,
readOnly: true,
onChanged: (value) {},
focusNode: focusNodes[1],
onTapUpOutside: (event) {
if (focusNodes[1].hasFocus) {
focusNodes[1].unfocus();
}
},
textInputAction: TextInputAction.done,
onEditingComplete: () {
focusNodes[1].unfocus();
},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
color: Color(0xFFB4BEC0),
fontSize: 14,
),
child: TextFormField(
controller: provider.dateController,
keyboardType: TextInputType.text,
enabled: false,
maxLines: 1,
readOnly: true,
onChanged: (value) {},
focusNode: focusNodes[1],
onTapUpOutside: (event) {
if (focusNodes[1].hasFocus) {
focusNodes[1].unfocus();
}
},
textInputAction: TextInputAction.done,
onEditingComplete: () {
focusNodes[1].unfocus();
},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
color: Color(0xFFB4BEC0),
fontSize: 14,
),
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
),
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
),
),
],
),
),
),
errorWidget(context, provider.dateError),
],
),
),
errorWidget(context, provider.dateError),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.receiptPaymentModes
.map(
(paymenents) =>
DropdownMenuItem<PaymentModes>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectreceiptPaymentModes,
onChanged: (PaymentModes? value) {
if (value != null) {
if (provider
.receiptPaymentModes
.isNotEmpty) {
provider.selectreceiptPaymentModes =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptPaymentModesID =
value.id!;
provider.receiptPaymentModesValues =
value.name!;
print(
"hfjkshfg" +
provider.receiptPaymentModesID
.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
],
),
),
errorWidget(context, provider.paymentModeError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.paymentModeValue)) ...[
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[2],
focusNodes[3],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.paymentModeValue == "UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[7],
focusNodes[8],
TextInputAction.next,
items:
provider.receiptPaymentModes
.map(
(paymenents) =>
DropdownMenuItem<PaymentModes>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectreceiptPaymentModes,
onChanged: (PaymentModes? value) {
if (value != null) {
if (provider.receiptPaymentModes.isNotEmpty) {
provider.selectreceiptPaymentModes = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.receiptPaymentModesID = value.id!;
provider.receiptPaymentModesValues =
value.name!;
print(
"hfjkshfg" +
provider.receiptPaymentModesID
.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
errorWidget(context, provider.UPIError),
],
textControllerWidget(
context,
provider.paymentReferenceController,
"Payment Reference Number",
"Enter Payment Reference Number",
provider.updatereference,
TextInputType.text,
false,
null,
focusNodes[8],
focusNodes[9],
TextInputAction.next,
),
errorWidget(context, provider.paymentreferenceError),
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[9],
focusNodes[10],
TextInputAction.done,
),
),
errorWidget(context, provider.paymentModeError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.paymentModeValue)) ...[
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[2],
focusNodes[3],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.paymentModeValue == "UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[7],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.UPIError),
],
textControllerWidget(
context,
provider.paymentReferenceController,
"Payment Reference Number",
"Enter Payment Reference Number",
provider.updatereference,
TextInputType.text,
false,
null,
focusNodes[8],
focusNodes[9],
TextInputAction.next,
),
errorWidget(context, provider.paymentreferenceError),
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[9],
focusNodes[10],
TextInputAction.done,
),
errorWidget(context, provider.descriptionError),
InkResponse(
onTap: () {
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
),
errorWidget(context, provider.descriptionError),
InkResponse(
onTap: () {
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
child: Center(
child: Text(
"File Attachment",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
child: Center(
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 5,
child: Text(
"File Attachment",
"${provider.imagePath}",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 5,
child: Text(
"${provider.imagePath}",
style: TextStyle(
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
],
),
),
],
SizedBox(height: 75),
],
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addReceiptPaymentRequestionSubmitAPI(
context,
provider.formattedDate,
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(AppColors.white),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
],
),
),
],
SizedBox(height: 75),
],
),
),
),
onWillPop: () {
provider.resetForm();
return onBackPressed(context);
},
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addReceiptPaymentRequestionSubmitAPI(
context,
provider.formattedDate,
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(AppColors.white),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
);
},
):NoNetwork(context);
);
}
// void _showDialog(Widget child) {
......
......@@ -76,142 +76,54 @@ class _DirectpaymentrequesitionlistState
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Requestionlistprovider>(
builder: (context, provider, child) {
return WillPopScope(
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar(context, "${widget.pageTitleName}"),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectAccounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.directAccounts
.map(
(accs) =>
DropdownMenuItem<DirectAccounts>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectDirectAccounts,
onChanged: (DirectAccounts? value) {
if (value != null) {
if (provider.directAccounts.isNotEmpty) {
provider.selectDirectAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directAccountId = value.id!;
provider.directAccountValue = value.name!;
print(
"hfjkshfg" +
provider.directAccountId.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
8,
),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
Widget _scaffold(BuildContext context) {
return Consumer<Requestionlistprovider>(
builder: (context, provider, child) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar(context, "${widget.pageTitleName}"),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectAccounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
],
),
),
errorWidget(context, provider.selectDirectAccountError),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectPaymentAccounts>(
isExpanded: true,
hint: Text(
'Select Account Type',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.directPaymentAccounts
.map(
(accs) => DropdownMenuItem<
DirectPaymentAccounts
>(
items:
provider.directAccounts
.map(
(accs) =>
DropdownMenuItem<DirectAccounts>(
value: accs,
child: Text(
accs.name ?? '',
......@@ -221,181 +133,259 @@ class _DirectpaymentrequesitionlistState
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectDirectPaymentAccounts,
onChanged: (DirectPaymentAccounts? value) {
if (value != null) {
if (provider
.directPaymentAccounts
.isNotEmpty) {
provider.selectDirectPaymentAccounts =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directPaymentAccountsID =
value.id!;
provider.directPaymentAccountsValue =
value.name!;
print(
"hfjkshfg" +
provider.directPaymentAccountsID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider
.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(
8,
),
),
),
)
.toList(),
value: provider.selectDirectAccounts,
onChanged: (DirectAccounts? value) {
if (value != null) {
if (provider.directAccounts.isNotEmpty) {
provider.selectDirectAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directAccountId = value.id!;
provider.directAccountValue = value.name!;
print(
"hfjkshfg" +
provider.directAccountId.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller: provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.paymentAccountSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
],
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
),
errorWidget(
context,
provider.selectDirectPaymentAccountError,
),
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
errorWidget(context, provider.amountError),
],
),
),
///payment date toBE
TextWidget(context, "Enter Date"),
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller: provider.dateController,
keyboardType: TextInputType.text,
enabled: false,
maxLines: 1,
readOnly: true,
onChanged: (value) {},
focusNode: focusNodes[1],
onTapUpOutside: (event) {
if (focusNodes[1].hasFocus) {
focusNodes[1].unfocus();
}
},
textInputAction: TextInputAction.done,
onEditingComplete: () {
focusNodes[1].unfocus();
},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
color: Color(0xFFB4BEC0),
fontSize: 14,
errorWidget(context, provider.selectDirectAccountError),
TextWidget(context, "Payment Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectPaymentAccounts>(
isExpanded: true,
hint: Text(
'Select Account Type',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.directPaymentAccounts
.map(
(accs) => DropdownMenuItem<
DirectPaymentAccounts
>(
value: accs,
child: Text(
accs.name ?? '',
style: const TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
)
.toList(),
value: provider.selectDirectPaymentAccounts,
onChanged: (DirectPaymentAccounts? value) {
if (value != null) {
if (provider.directPaymentAccounts.isNotEmpty) {
provider.selectDirectPaymentAccounts = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directPaymentAccountsID = value.id!;
provider.directPaymentAccountsValue =
value.name!;
print(
"hfjkshfg" +
provider.directPaymentAccountsID
.toString(),
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.paymentAccountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.paymentAccountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
],
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.paymentAccountSearchController.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
),
errorWidget(context, provider.dateError),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectPaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
],
),
),
errorWidget(
context,
provider.selectDirectPaymentAccountError,
),
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
errorWidget(context, provider.amountError),
///payment date toBE
TextWidget(context, "Enter Date"),
GestureDetector(
onTap: () {
provider.showDatePickerDialog(context);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
0,
),
child: TextFormField(
controller: provider.dateController,
keyboardType: TextInputType.text,
enabled: false,
maxLines: 1,
readOnly: true,
onChanged: (value) {},
focusNode: focusNodes[1],
onTapUpOutside: (event) {
if (focusNodes[1].hasFocus) {
focusNodes[1].unfocus();
}
},
textInputAction: TextInputAction.done,
onEditingComplete: () {
focusNodes[1].unfocus();
},
decoration: InputDecoration(
hintText: "Enter Date",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
color: Color(0xFFB4BEC0),
fontSize: 14,
),
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
items:
provider.directPaymentModes
.map(
(paymenents) => DropdownMenuItem<
DirectPaymentModes
>(
),
),
),
),
],
),
),
errorWidget(context, provider.dateError),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<DirectPaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.directPaymentModes
.map(
(paymenents) =>
DropdownMenuItem<DirectPaymentModes>(
value: paymenents,
child: Text(
paymenents.name ?? '',
......@@ -405,276 +395,265 @@ class _DirectpaymentrequesitionlistState
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectDirectPaymentModes,
onChanged: (DirectPaymentModes? value) {
if (value != null) {
if (provider
.directPaymentModes
.isNotEmpty) {
provider.selectDirectPaymentModes = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directPaymentModesID = value.id!;
provider.directPaymentModesValues =
value.name!;
print(
"hfjkshfg" +
provider.directPaymentModesID
.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.selectDirectPaymentError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.directPaymentModesValues)) ...[
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[2],
focusNodes[3],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.directPaymentModesValues ==
"UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[7],
focusNodes[8],
TextInputAction.next,
)
.toList(),
value: provider.selectDirectPaymentModes,
onChanged: (DirectPaymentModes? value) {
if (value != null) {
if (provider.directPaymentModes.isNotEmpty) {
provider.selectDirectPaymentModes = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.directPaymentModesID = value.id!;
provider.directPaymentModesValues =
value.name!;
print(
"hfjkshfg" +
provider.directPaymentModesID
.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
errorWidget(context, provider.UPIError),
],
textControllerWidget(
context,
provider.paymentReferenceController,
"Payment Reference Number",
"Enter Payment Reference Number",
provider.updateReference,
TextInputType.text,
false,
null,
focusNodes[8],
focusNodes[9],
TextInputAction.next,
),
errorWidget(context, provider.paymentreferenceerror),
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[9],
focusNodes[10],
TextInputAction.done,
),
),
errorWidget(context, provider.selectDirectPaymentError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.directPaymentModesValues)) ...[
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[2],
focusNodes[3],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.directPaymentModesValues == "UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[7],
focusNodes[8],
TextInputAction.next,
),
errorWidget(context, provider.UPIError),
],
textControllerWidget(
context,
provider.paymentReferenceController,
"Payment Reference Number",
"Enter Payment Reference Number",
provider.updateReference,
TextInputType.text,
false,
null,
focusNodes[8],
focusNodes[9],
TextInputAction.next,
),
errorWidget(context, provider.paymentreferenceerror),
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[9],
focusNodes[10],
TextInputAction.done,
),
errorWidget(context, provider.descriptionError),
InkResponse(
onTap: () {
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
),
errorWidget(context, provider.descriptionError),
InkResponse(
onTap: () {
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
child: Center(
child: Text(
"File Attachment",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
child: Center(
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 4,
child: Text(
"File Attachment",
"${provider.imagePath}",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 4,
child: Text(
"${provider.imagePath}",
style: TextStyle(
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
],
),
),
],
],
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addDirectPaymentRequestionSubmitAPI(
context,
provider.formattedDate,
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.app_blue,
),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
],
),
),
],
],
),
),
),
onWillPop: () {
provider.resetForm();
return onBackPressed(context);
},
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addDirectPaymentRequestionSubmitAPI(
context,
provider.formattedDate,
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(AppColors.app_blue),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
);
},
):NoNetwork(context);
);
}
// void _showDialog(Widget child) {
......
......@@ -3,7 +3,11 @@ import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/commonProvider/accountsListProvider.dart';
import 'package:generp/Notifiers/financeProvider/DashboardProvider.dart';
import 'package:generp/Notifiers/financeProvider/RequestionListProvider.dart';
import 'package:generp/Notifiers/financeProvider/paymentReceiptsProvider.dart';
import 'package:generp/Utils/GlobalConstants.dart';
import 'package:generp/Utils/app_colors.dart';
import 'package:generp/Utils/commonWidgets.dart';
import 'package:generp/screens/screensExports.dart';
......@@ -28,7 +32,6 @@ class _FinancedashboardState extends State<Financedashboard> {
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
......@@ -37,6 +40,7 @@ class _FinancedashboardState extends State<Financedashboard> {
provider.addFormfinanceFormAccessPagesAPIFunction(context);
});
}
@override
void dispose() {
// TODO: implement dispose
......@@ -97,7 +101,10 @@ class _FinancedashboardState extends State<Financedashboard> {
case "apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
final icons = ["comm_ic_1", "comm_ic_2"];
// final icons = ["comm_ic_1", "comm_ic_2"];
case "self_apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
default:
SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg");
break;
......@@ -302,6 +309,9 @@ class _FinancedashboardState extends State<Financedashboard> {
.accessiblePagesList2[index]
.pageName!,
),
settings: RouteSettings(
name: "Directpaymentrequesitionlist",
),
),
);
} else if (provider
......@@ -318,6 +328,9 @@ class _FinancedashboardState extends State<Financedashboard> {
.accessiblePagesList2[index]
.pageName!,
),
settings: RouteSettings(
name: "Addpaymentreceiptlist",
),
),
);
} else if (provider
......@@ -331,6 +344,9 @@ class _FinancedashboardState extends State<Financedashboard> {
(context) => Addcommonpayment(
from: "Dashboard",
),
settings: RouteSettings(
name: "Addcommonpayment",
),
),
);
} else {
......@@ -344,9 +360,40 @@ class _FinancedashboardState extends State<Financedashboard> {
pageTitleName:
"${pages2[index].pageName}",
),
settings: RouteSettings(
name:
"Submitpaymentrequestionlistsbymode",
),
),
);
}
switch (routeSettingName) {
case "Submitpaymentrequestionlistsbymode":
print("here");
Provider.of<Requestionlistprovider>(
context,
listen: false,
).resetForm();
break;
case "Addcommonpayment":
Provider.of<Accountslistprovider>(
context,
listen: false,
).resetValues();
break;
case "Addpaymentreceiptlist":
Provider.of<Paymentreceiptsprovider>(
context,
listen: false,
).resetForm();
break;
case "Directpaymentrequesitionlist":
Provider.of<Requestionlistprovider>(
context,
listen: false,
).resetForm();
break;
}
Navigator.pop(context);
},
leading: SvgPicture.asset(
......
......@@ -28,8 +28,6 @@ class Paymentdetailspaymentrequisition extends StatefulWidget {
class _PaymentdetailspaymentrequisitionState
extends State<Paymentdetailspaymentrequisition> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -70,177 +68,184 @@ class _PaymentdetailspaymentrequisitionState
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Paymentrequisitionpaymentslistprovider>(
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Paymentrequisitionpaymentslistprovider>(
builder: (context, provider, child) {
var payment_det = provider.paymentDetails;
return WillPopScope(
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, widget.pageName),
backgroundColor: AppColors.scaffold_bg_color,
body: SizedBox(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, widget.pageName),
backgroundColor: AppColors.scaffold_bg_color,
body: SizedBox(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
children: [
Row(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
),
child: SvgPicture.asset("assets/svg/fin_ic.svg"),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
payment_det.accountName ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
child: SvgPicture.asset("assets/svg/fin_ic.svg"),
),
Text(
"₹${payment_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
payment_det.accountName ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
"₹${payment_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
payment_det.refType ?? "-",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if (provider.Headings[j] == "Attachment" &&
payment_det.attachmentViewFileName == "") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
payment_det.refType??"-",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if(provider.Headings[j] == "Attachment" && payment_det.attachmentViewFileName==""){
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap: () {
if (provider.Headings[j] == "Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
Expanded(
child: InkResponse(
onTap: () {
if (provider.Headings[j] == "Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
fileName:
payment_det
.attachmentViewFileName!,
payment_det
.attachmentViewFileName!,
fileUrl:
payment_det
.attachmentDirFilePath!,
payment_det
.attachmentDirFilePath!,
),
),
);
}
},
child: Text(
provider.Headings[j] == "Attachment"
? "View"
:provider.subHeadings[j]==""?"-":provider.subHeadings[j]??"-",
style: TextStyle(
fontSize: 14,
color:
),
);
}
},
child: Text(
provider.Headings[j] == "Attachment"
? "View"
: provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j] ?? "-",
style: TextStyle(
fontSize: 14,
color:
provider.Headings[j] == "Attachment"
? AppColors.app_blue
: Color(0xFF818181),
decoration:
decoration:
provider.Headings[j] == "Attachment"
? TextDecoration.underline
: TextDecoration.none,
decorationColor:
decorationColor:
provider.Headings[j] == "Attachment"
? AppColors.app_blue
: AppColors.white,
),
),
),
),
],
),
),
);
}),
],
),
),
],
),
);
}),
],
),
),
),
),
onWillPop: () {
return onBackPressed(context);
},
);
},
):NoNetwork(context);
);
}
}
......@@ -4,6 +4,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Utils/GlobalConstants.dart';
import 'package:generp/screens/finance/paymentDetailsPaymentRequisition.dart';
import 'package:provider/provider.dart';
import '../../Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart';
......@@ -74,355 +75,337 @@ class _PaymentlistpaymentrequisitionState
default:
connection = 'Offline';
}
return connection == "Online"
? Consumer<Paymentrequisitionpaymentslistprovider>(
builder: (context, provider, child) {
final requestLists = provider.paymentsList;
return WillPopScope(
onWillPop: () {
return onBackPressed(context);
},
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(
context,
);
if (result != null) {
var dateRange =
result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
var formatted =
result['formatted'] as List<String>;
print("formatted: $formatted");
Widget _scaffold(BuildContext context) {
return Consumer<Paymentrequisitionpaymentslistprovider>(
builder: (context, provider, child) {
final requestLists = provider.paymentsList;
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(context);
if (result != null) {
var dateRange = result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentsListAPI(
context,
fromDate,
toDate,
);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
),
],
),
var formatted = result['formatted'] as List<String>;
print("formatted: $formatted");
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentsListAPI(context, fromDate, toDate);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: requestLists.isNotEmpty
? SizedBox(
child: Scrollbar(
thumbVisibility: false,
),
],
),
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: requestLists.isNotEmpty
? SizedBox(
child: Scrollbar(
thumbVisibility: false,
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
),
child: Column(
children: [
Row(
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius:
BorderRadius.circular(8),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
Text(
requestLists[index]
.receipientAccount!,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
requestLists[index]
.receipientAccount!,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
Text(
"₹${requestLists[index].amount}",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.app_blue,
),
),
],
),
Text(
"₹${requestLists[index].amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
// Expanded(
// flex: 2,
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 5,
// vertical: 10,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE3FFE0),
// ),
// child: Center(
// child: Text(
// requestLists[index].refType!,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontFamily: "JakartaMedium",
// fontSize: 14,
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final headings = [
"To Account",
"Attachment",
"Request Mode",
),
),
// Expanded(
// flex: 2,
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 5,
// vertical: 10,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: Color(0xFFE3FFE0),
// ),
// child: Center(
// child: Text(
// requestLists[index].refType!,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontFamily: "JakartaMedium",
// fontSize: 14,
// color: Color(0xFF0D9C00),
// ),
// ),
// ),
// ),
// ),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final headings = [
"To Account",
"Attachment",
"Request Mode",
"Payment Date",
"Note",
];
"Payment Date",
"Note",
];
final subHeadings = [
requestLists[index].payAccount,
"View",
requestLists[index].requestMode,
final subHeadings = [
requestLists[index].payAccount,
"View",
requestLists[index].requestMode,
// requestLists[index].attachmentDirFilePath
requestLists[index].paymentDate,
requestLists[index].description,
];
if (headings[j] == "Attachment" &&
requestLists[index]
.attachmentViewFileName ==
"") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,
// requestLists[index].attachmentDirFilePath
requestLists[index].paymentDate,
requestLists[index].description,
];
if (headings[j] == "Attachment" &&
requestLists[index]
.attachmentViewFileName ==
"") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
MaterialPageRoute(
builder:
(
context,
) => Fileviewer(
fileName:
requestLists[index].attachmentViewFileName!,
fileUrl:
requestLists[index].attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j] == ""
? "-"
: subHeadings[j] ??
"-",
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors
.app_blue
: Color(
0xFF818181,
),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration
.none,
decorationColor:
j == 1
? AppColors
.app_blue
: AppColors
.white,
),
),
),
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Paymentdetailspaymentrequisition(
pageName:
widget.pageTitleName,
paymentRequestId:
requestLists[index]
.id,
),
) => Fileviewer(
fileName:
requestLists[index]
.attachmentViewFileName!,
fileUrl:
requestLists[index]
.attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j] == ""
? "-"
: subHeadings[j] ?? "-",
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors.app_blue
: Color(0xFF818181),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration.none,
decorationColor:
j == 1
? AppColors.app_blue
: AppColors.white,
),
);
if (res == true) {
provider.paymentsListAPI(
context,
'',
'',
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
);
},
),
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Paymentdetailspaymentrequisition(
pageName:
widget.pageTitleName,
paymentRequestId:
requestLists[index].id,
),
settings: RouteSettings(
name:
"Paymentdetailspaymentrequisition",
),
),
);
if (routeSettingName ==
"Paymentdetailspaymentrequisition") {
print("pld");
provider.paymentsListAPI(context, '', '');
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
)
: Emptywidget(context),
),
),
);
},
)
: NoNetwork(context);
);
},
),
),
)
: Emptywidget(context),
);
},
);
}
Future<void> _showOptionsSheet(BuildContext context) {
......
......@@ -21,17 +21,13 @@ class Paymentreceiptdetails extends StatefulWidget {
});
@override
State<Paymentreceiptdetails> createState() =>
_PaymentreceiptdetailsState();
State<Paymentreceiptdetails> createState() => _PaymentreceiptdetailsState();
}
class _PaymentreceiptdetailsState
extends State<Paymentreceiptdetails> {
class _PaymentreceiptdetailsState extends State<Paymentreceiptdetails> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
// TODO: implement initState
......@@ -48,6 +44,7 @@ class _PaymentreceiptdetailsState
provider.paymentsListDetailsAPI(context, widget.paymentRequestId);
});
}
@override
void dispose() {
// TODO: implement dispose
......@@ -68,156 +65,161 @@ class _PaymentreceiptdetailsState
default:
connection = 'Offline';
}
return connection=="Online"?
Consumer<Paymentreceiptsprovider>(
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Paymentreceiptsprovider>(
builder: (context, provider, child) {
var payment_det = provider.receiptDetails;
return WillPopScope(
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, widget.pageName),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
return Scaffold(
resizeToAvoidBottomInset: true,
//widget.pageName
appBar: appbar(context, "Payment Receipt Details"),
backgroundColor: AppColors.scaffold_bg_color,
body: Container(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Column(
children: [
Row(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
),
child: SvgPicture.asset("assets/svg/fin_ic.svg"),
),
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(8),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
payment_det.receipientAccount ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
"₹${payment_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
),
],
child: SvgPicture.asset("assets/svg/fin_ic.svg"),
),
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if(provider.Headings[j] ==
"Attachment"&&payment_det.attachmentViewFileName==""){
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
Text(
payment_det.receipientAccount ?? "-",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
Text(
"₹${payment_det.amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
Expanded(
child: InkResponse(
onTap: () {
if (provider.Headings[j] == "Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
],
),
),
),
],
),
Divider(thickness: 0.5, color: Color(0xFFD7D7D7)),
...List.generate(provider.subHeadings.length, (j) {
if (provider.Headings[j] == "Attachment" &&
payment_det.attachmentViewFileName == "") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 7),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
provider.Headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap: () {
if (provider.Headings[j] == "Attachment") {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Fileviewer(
fileName:
payment_det
.attachmentViewFileName!,
payment_det
.attachmentViewFileName!,
fileUrl:
payment_det
.attachmentDirFilePath!,
payment_det
.attachmentDirFilePath!,
),
),
);
}
},
child: Text(
provider.Headings[j] == "Attachment"
? "View"
: provider.subHeadings[j]==""?"-":provider.subHeadings[j]??"-",
style: TextStyle(
fontSize: 14,
color:
),
);
}
},
child: Text(
provider.Headings[j] == "Attachment"
? "View"
: provider.subHeadings[j] == ""
? "-"
: provider.subHeadings[j] ?? "-",
style: TextStyle(
fontSize: 14,
color:
provider.Headings[j] == "Attachment"
? AppColors.app_blue
: Color(0xFF818181),
decoration:
decoration:
provider.Headings[j] == "Attachment"
? TextDecoration.underline
: TextDecoration.none,
decorationColor:
decorationColor:
provider.Headings[j] == "Attachment"
? AppColors.app_blue
: AppColors.white,
),
),
),
),
],
),
),
);
}),
],
),
),
],
),
);
}),
],
),
),
),
),
onWillPop: () {
return onBackPressed(context);
},
);
},
):NoNetwork(context);
);
}
}
......@@ -4,6 +4,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Utils/GlobalConstants.dart';
import 'package:generp/screens/finance/paymentReceiptDetails.dart';
import 'package:provider/provider.dart';
......@@ -58,330 +59,310 @@ class _PaymentreceiptlistState extends State<Paymentreceiptlist> {
default:
connection = 'Offline';
}
return connection == "Online"
? Consumer<Paymentreceiptsprovider>(
builder: (context, provider, child) {
final requestLists = provider.receiptsList;
return WillPopScope(
onWillPop: () {
return onBackPressed(context);
},
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(
context,
);
if (result != null) {
var dateRange =
result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
var formatted =
result['formatted'] as List<String>;
print("formatted: $formatted");
Widget _scaffold(BuildContext context) {
return Consumer<Paymentreceiptsprovider>(
builder: (context, provider, child) {
final requestLists = provider.receiptsList;
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetForm,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg",),
// ),
InkResponse(
onTap: () async {
var cf = Commondaterangefilter();
var result = await cf.showFilterBottomSheet(context);
if (result != null) {
var dateRange = result['dateRange'] as DateTimeRange?;
print("dateRange: $dateRange");
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentsListAPI(
context,
fromDate,
toDate,
);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
),
],
),
var formatted = result['formatted'] as List<String>;
print("formatted: $formatted");
if (formatted.isNotEmpty) {
var fromDate = formatted[0]; // From date
var toDate = formatted[1]; // To date
print("from_date: $fromDate");
print("to_date: $toDate");
provider.paymentsListAPI(context, fromDate, toDate);
// You can now use fromDate and toDate as needed
// For example, store them or pass to another function
} else {
print("No valid date range selected");
}
} else {
print("Bottom sheet closed without selection");
}
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
],
),
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: requestLists.isNotEmpty
? SizedBox(
child: Scrollbar(
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
)
: requestLists.isNotEmpty
? SizedBox(
child: Scrollbar(
child: ListView.builder(
itemCount: requestLists.length,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
),
child: Column(
children: [
Row(
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius:
BorderRadius.circular(8),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
Text(
requestLists[index]
.receipientAccount!,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
requestLists[index]
.receipientAccount!,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
Text(
"₹${requestLists[index].amount}",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.app_blue,
),
),
],
),
Text(
"₹${requestLists[index].amount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final headings = [
"Receipt Account",
"Attachment",
"Request Mode",
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final headings = [
"Receipt Account",
"Attachment",
"Request Mode",
"Receipt Date",
"Note",
];
"Receipt Date",
"Note",
];
final subHeadings = [
requestLists[index]
.receipientAccount,
"View",
requestLists[index].requestMode,
final subHeadings = [
requestLists[index].receipientAccount,
"View",
requestLists[index].requestMode,
// requestLists[index].attachmentDirFilePath
requestLists[index].receiptDate,
requestLists[index].description,
];
if (headings[j] == "Attachment" &&
requestLists[index]
.attachmentViewFileName ==
"") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,
// requestLists[index].attachmentDirFilePath
requestLists[index].receiptDate,
requestLists[index].description,
];
if (headings[j] == "Attachment" &&
requestLists[index]
.attachmentViewFileName ==
"") {
return SizedBox.shrink();
}
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
),
),
Expanded(
child: InkResponse(
onTap:
j != 1
? null
: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
MaterialPageRoute(
builder:
(
context,
) => Fileviewer(
fileName:
requestLists[index].attachmentViewFileName!,
fileUrl:
requestLists[index].attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j] == ""
? "-"
: subHeadings[j] ??
"-",
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors
.app_blue
: Color(
0xFF818181,
),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration
.none,
decorationColor:
j == 1
? AppColors
.app_blue
: AppColors
.white,
),
),
),
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Paymentreceiptdetails(
pageName:
widget.pageTitleName,
paymentRequestId:
requestLists[index]
.id,
),
) => Fileviewer(
fileName:
requestLists[index]
.attachmentViewFileName!,
fileUrl:
requestLists[index]
.attachmentDirFilePath!,
),
),
);
},
child: Text(
subHeadings[j] == ""
? "-"
: subHeadings[j] ?? "-",
style: TextStyle(
fontSize: 14,
color:
j == 1
? AppColors.app_blue
: Color(0xFF818181),
decoration:
j == 1
? TextDecoration
.underline
: TextDecoration.none,
decorationColor:
j == 1
? AppColors.app_blue
: AppColors.white,
),
);
if (res == true) {
provider.paymentsListAPI(
context,
'',
'',
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
);
},
),
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Paymentreceiptdetails(
pageName: widget.pageTitleName,
paymentRequestId:
requestLists[index].id,
),
settings: RouteSettings(
name: "Paymentreceiptdetails",
),
),
);
if (routeSettingName ==
"Paymentreceiptdetails") {
debugPrint("prd");
provider.paymentsListAPI(context, '', '');
}
// if (res == true) {
// provider.paymentsListAPI(context, '', '');
// }
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
)
: Emptywidget(context),
),
),
);
},
)
: NoNetwork(context);
);
},
),
),
)
: Emptywidget(context),
);
},
);
}
Future<void> _showOptionsSheet(BuildContext context) {
......
......@@ -34,7 +34,8 @@ class Submitpaymentrequestionlistsbymode extends StatefulWidget {
}
class _SubmitpaymentrequestionlistsbymodeState
extends State<Submitpaymentrequestionlistsbymode> {
extends State<Submitpaymentrequestionlistsbymode>
with RouteAware {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -83,11 +84,31 @@ class _SubmitpaymentrequestionlistsbymodeState
});
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
// Subscribe to route changes
}
@override
void didPop() {
// Called when the route is popped (including by swipe gesture)
if (mounted) {
var provider = Provider.of<Requestionlistprovider>(
context,
listen: false,
);
provider.resetForm();
}
super.didPop();
}
@override
void dispose() {
scrollcontroller.dispose();
focusNodes.map((e) => e.dispose());
_connectivity.disposeStream();
super.dispose();
}
......@@ -123,689 +144,647 @@ class _SubmitpaymentrequestionlistsbymodeState
default:
connection = 'Offline';
}
return connection == "Online"
? Consumer<Requestionlistprovider>(
builder: (context, provider, child) {
return WillPopScope(
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () {
Provider.of<Requestionlistprovider>(
context,
listen: false,
).resetForm();
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar2(
context,
"${widget.pageTitleName}",
provider.resetForm,
SizedBox(width: 0),
),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
controller: scrollcontroller,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Select Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
flex: 5,
child: DropdownButton2<Accounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.accounts
.map(
(accs) =>
DropdownMenuItem<Accounts>(
value: accs,
child: Text(
"${accs.name}",
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedAccount,
onChanged:
(widget.mode == "self" &&
provider.accounts.length == 1)
? null
: (Accounts? value) {
if (value != null) {
if (provider
.accounts
.isNotEmpty) {
provider.selectedAccount =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.accountId =
value.id!;
print(
"hfjkshfg" +
provider.accountId
.toString(),
);
provider
.paymentRequestionBankDetailsAPIFunction(
context,
provider.accountId,
);
}
}
},
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller:
provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value?.name
?.toLowerCase()
.contains(
searchValue.toLowerCase(),
) ??
false;
},
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController
.clear();
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
if (widget.mode == "other") ...[
SizedBox(width: 5),
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Addcommonpayment(
from: "Requesition",
),
),
);
print("return Response: ${res}");
if (res != true) {
provider.addPaymentRequestionViewAPI(
context,
widget.mode,
);
if (res != null) {
print("true");
Future.delayed(
Durations.long4,
() async {
print("Long411");
autofill(res);
},
);
}
}
},
child: Container(
height: 45,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/add_account.svg",
color: Colors.white,
),
),
),
),
],
],
),
),
errorWidget(context, provider.selectAccountError),
if (["self", "admin"].contains(widget.mode)) ...[
TextWidget(context, "Select Requisition Type"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: Text(
'Select Request Type',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.requestingPurposes
.map(
(accs) =>
DropdownMenuItem<String>(
value: accs,
child: Text(
accs ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value: provider.selectReqPurpose,
onChanged: (String? value) {
if (value != null) {
provider.selectReqPurpose = value;
print(
"Selected Complaint Type: ${value},",
);
print(
"hfjkshfg" +
provider.selectReqPurpose
.toString(),
);
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
] else ...[
textControllerWidget(
context,
provider.reqPurposeController,
"Request Purpose",
"Enter Request Purpose",
provider.updateReqPupose,
TextInputType.text,
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
],
errorWidget(context, provider.reqPurposeError),
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[1],
focusNodes[2],
TextInputAction.next,
),
errorWidget(context, provider.descriptionError),
@override
void deactivate() {
// TODO: implement deactivate
super.deactivate();
}
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[2],
null,
TextInputAction.done,
),
errorWidget(context, provider.amountError),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.paymentModes
.map(
(paymenents) => DropdownMenuItem<
PaymentModes
>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedPayment,
onChanged: (PaymentModes? value) {
Widget _scaffold(BuildContext context) {
return Consumer<Requestionlistprovider>(
builder: (context, provider, child) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.white,
appBar: appbar2(
context,
"${widget.pageTitleName}",
provider.resetForm,
SizedBox(width: 0),
),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: SingleChildScrollView(
controller: scrollcontroller,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextWidget(context, "Select Account"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
flex: 5,
child: DropdownButton2<Accounts>(
isExpanded: true,
hint: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.accounts
.map(
(accs) => DropdownMenuItem<Accounts>(
value: accs,
child: Text(
"${accs.name}",
style: const TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedAccount,
onChanged:
(widget.mode == "self" &&
provider.accounts.length == 1)
? null
: (Accounts? value) {
if (value != null) {
if (provider.paymentModes.isNotEmpty) {
provider.selectedPayment = value;
if (provider.accounts.isNotEmpty) {
provider.selectedAccount = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.paymentModeId = value.id!;
provider.paymentModeValue =
value.name!;
provider.accountId = value.id!;
print(
"hfjkshfg" +
provider.paymentModeId
.toString(),
provider.accountId.toString(),
);
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(
provider.paymentModeValue,
)) {
WidgetsBinding.instance
.addPostFrameCallback((_) {
final context =
_globalKey.currentContext;
if (context != null) {
Scrollable.ensureVisible(
context,
duration: Duration(
milliseconds: 300,
),
curve: Curves.easeInOut,
);
}
});
}
provider
.paymentRequestionBankDetailsAPIFunction(
context,
provider.accountId,
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.selectPaymentError),
if (widget.mode == "other") ...[
TextWidget(context, "Select Approval Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Employees>(
isExpanded: true,
hint: Text(
'Select Approval Employee',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.approvalEmployee
.map(
(paymenents) =>
DropdownMenuItem<Employees>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow:
TextOverflow
.ellipsis,
),
),
)
.toList(),
value: provider.selectedApprovalEmployee,
onChanged: (Employees? value) {
if (value != null) {
if (provider
.approvalEmployee
.isNotEmpty) {
provider.selectedApprovalEmployee =
value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedApprovalEmployeeID =
value.id!;
provider.selectedApprovalEmployeeValue =
value.name!;
print(
"hfjkshfg" +
provider.paymentModeId
.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData:
ddtheme.menuItemStyleData,
dropdownStyleData:
ddtheme.dropdownStyleData,
dropdownSearchData: DropdownSearchData(
searchInnerWidgetHeight: 50,
searchController:
provider.accountSearchController,
searchInnerWidget: Padding(
padding: const EdgeInsets.all(8),
child: TextFormField(
controller: provider.accountSearchController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: 'Search account...',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
],
),
),
),
errorWidget(context, provider.selectPaymentError),
],
searchMatchFn: (item, searchValue) {
return item.value?.name?.toLowerCase().contains(
searchValue.toLowerCase(),
) ??
false;
},
InkResponse(
onTap: () {
_showAttachmentSheet(context);
// Optional: clear search text when dropdown closes
),
onMenuStateChange: (isOpen) {
if (!isOpen) {
provider.accountSearchController.clear();
}
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
if (widget.mode == "other") ...[
SizedBox(width: 5),
Expanded(
flex: 1,
child: InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Addcommonpayment(
from: "Requesition",
),
),
);
print("return Response: ${res}");
if (res != true) {
provider.addPaymentRequestionViewAPI(
context,
widget.mode,
);
if (res != null) {
print("true");
Future.delayed(Durations.long4, () async {
print("Long411");
autofill(res);
});
}
}
},
child: Container(
height: 45,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppColors.app_blue,
width: 0.5,
borderRadius: BorderRadius.circular(8),
),
),
child: Center(
child: Text(
"File Attachment",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
child: SvgPicture.asset(
"assets/svg/add_account.svg",
color: Colors.white,
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(
vertical: 4.0,
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 4,
child: Text(
"${provider.imagePath}",
style: TextStyle(
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
),
),
],
],
],
),
),
errorWidget(context, provider.selectAccountError),
if (["self", "admin"].contains(widget.mode)) ...[
TextWidget(context, "Select Requisition Type"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<String>(
isExpanded: true,
hint: Text(
'Select Request Type',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.requestingPurposes
.map(
(accs) => DropdownMenuItem<String>(
value: accs,
child: Text(
accs ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectReqPurpose,
onChanged: (String? value) {
if (value != null) {
provider.selectReqPurpose = value;
print("Selected Complaint Type: ${value},");
print(
"hfjkshfg" +
provider.selectReqPurpose.toString(),
);
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
],
errorWidget(context, provider.FileError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.paymentModeValue)) ...[
SizedBox(height: 3, key: _globalKey),
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[7],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
],
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
"UPI",
].contains(provider.paymentModeValue)) ...[
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[7],
null,
TextInputAction.done,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.paymentModeValue == "UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[8],
null,
TextInputAction.done,
),
errorWidget(context, provider.UPIError),
],
),
],
),
),
] else ...[
textControllerWidget(
context,
provider.reqPurposeController,
"Request Purpose",
"Enter Request Purpose",
provider.updateReqPupose,
TextInputType.text,
false,
null,
focusNodes[0],
focusNodes[1],
TextInputAction.next,
),
],
errorWidget(context, provider.reqPurposeError),
textControllerWidget(
context,
provider.descController,
"Description",
"Enter Description",
provider.updateDescription,
TextInputType.text,
false,
null,
focusNodes[1],
focusNodes[2],
TextInputAction.next,
),
errorWidget(context, provider.descriptionError),
textControllerWidget(
context,
provider.amountController,
"Amount",
"Enter Amount",
provider.updateAmount,
TextInputType.numberWithOptions(),
false,
null,
focusNodes[2],
null,
TextInputAction.done,
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addPaymentRequestionSubmitAPI(
context,
widget.mode,
provider.selectedApprovalEmployeeID,
);
errorWidget(context, provider.amountError),
TextWidget(context, "Select Payment Mode"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<PaymentModes>(
isExpanded: true,
hint: Text(
'Select Payment mode',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.paymentModes
.map(
(paymenents) =>
DropdownMenuItem<PaymentModes>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedPayment,
onChanged: (PaymentModes? value) {
if (value != null) {
if (provider.paymentModes.isNotEmpty) {
provider.selectedPayment = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.paymentModeId = value.id!;
provider.paymentModeValue = value.name!;
print(
"hfjkshfg" +
provider.paymentModeId.toString(),
);
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.paymentModeValue)) {
WidgetsBinding.instance
.addPostFrameCallback((_) {
final context =
_globalKey.currentContext;
if (context != null) {
Scrollable.ensureVisible(
context,
duration: Duration(
milliseconds: 300,
),
curve: Curves.easeInOut,
);
}
});
}
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.selectPaymentError),
if (widget.mode == "other") ...[
TextWidget(context, "Select Approval Employee"),
DropdownButtonHideUnderline(
child: Row(
children: [
Expanded(
child: DropdownButton2<Employees>(
isExpanded: true,
hint: Text(
'Select Approval Employee',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
items:
provider.approvalEmployee
.map(
(paymenents) =>
DropdownMenuItem<Employees>(
value: paymenents,
child: Text(
paymenents.name ?? '',
style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
value: provider.selectedApprovalEmployee,
onChanged: (Employees? value) {
if (value != null) {
if (provider.approvalEmployee.isNotEmpty) {
provider.selectedApprovalEmployee = value;
print(
"Selected Complaint Type: ${value.name}, ID: ${value.id}",
);
provider.selectedApprovalEmployeeID =
value.id!;
provider.selectedApprovalEmployeeValue =
value.name!;
print(
"hfjkshfg" +
provider.paymentModeId.toString(),
);
}
}
},
buttonStyleData: ddtheme.buttonStyleData,
iconStyleData: ddtheme.iconStyleData,
menuItemStyleData: ddtheme.menuItemStyleData,
dropdownStyleData: ddtheme.dropdownStyleData,
),
),
],
),
),
errorWidget(context, provider.selectPaymentError),
],
InkResponse(
onTap: () {
_showAttachmentSheet(context);
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: AppColors.app_blue,
width: 0.5,
),
),
child: Center(
child: Text(
"File Attachment",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.white,
),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
),
if (provider.imagePicked == 1 &&
provider.imagePath != null) ...[
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 4,
child: Text(
"${provider.imagePath}",
style: TextStyle(
color: AppColors.semi_black,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
flex: 1,
child: InkResponse(
onTap: () {
provider.imagePicked = 0;
provider.imagePath = null;
provider.imageFilePath = null;
},
child: SvgPicture.asset(
"assets/svg/ic_close.svg",
width: 15,
height: 15,
),
),
),
],
),
),
],
errorWidget(context, provider.FileError),
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
].contains(provider.paymentModeValue)) ...[
SizedBox(height: 3, key: _globalKey),
textControllerWidget(
context,
provider.bankNameController,
"Bank Name",
"Enter Bank Name",
provider.updateBankName,
TextInputType.text,
false,
null,
focusNodes[3],
focusNodes[4],
TextInputAction.next,
),
errorWidget(context, provider.bankNameError),
textControllerWidget(
context,
provider.bankBranchController,
"Bank Branch",
"Enter Bank Branch",
provider.updateBankBranch,
TextInputType.text,
false,
null,
focusNodes[4],
focusNodes[5],
TextInputAction.next,
),
errorWidget(context, provider.bankBranchError),
textControllerWidget(
context,
provider.bankAccNumberController,
"Account Number",
"Enter Account Number",
provider.updateNumber,
TextInputType.number,
false,
FilteringTextInputFormatter.digitsOnly,
focusNodes[5],
focusNodes[6],
TextInputAction.next,
),
errorWidget(context, provider.bankNumberError),
textControllerWidget(
context,
provider.bankIfscController,
"Bank IFSC",
"Enter Bank IFSC",
provider.updateIFSC,
TextInputType.text,
false,
null,
focusNodes[6],
focusNodes[7],
TextInputAction.next,
),
errorWidget(context, provider.bankIFSCError),
],
if ([
"Cheque",
"RTGS",
"IMPS",
"NEFT",
"UPI",
].contains(provider.paymentModeValue)) ...[
textControllerWidget(
context,
provider.bankAcHolderController,
"Bank Account Holder Name",
"Enter Bank Account Holder Name",
provider.updateHolder,
TextInputType.text,
false,
null,
focusNodes[7],
null,
TextInputAction.done,
),
errorWidget(context, provider.bankHolderError),
] else if (provider.paymentModeValue == "UPI") ...[
textControllerWidget(
context,
provider.bankUpiController,
"UPI ID",
"Enter UPI ID",
provider.updateUPI,
TextInputType.text,
false,
null,
focusNodes[8],
null,
TextInputAction.done,
),
errorWidget(context, provider.UPIError),
],
],
),
onWillPop: () {
provider.resetForm();
return onBackPressed(context);
},
);
},
)
: NoNetwork(context);
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
bottomNavigationBar: InkResponse(
onTap:
provider.submitClicked
? null
: () {
provider.submitClicked = true;
provider.addPaymentRequestionSubmitAPI(
context,
widget.mode,
provider.selectedApprovalEmployeeID,
);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child:
provider.submitClicked
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(AppColors.white),
)
: Text(
"Submit",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
);
},
);
}
Future<void> _showAttachmentSheet(BuildContext context) {
......
......@@ -20,18 +20,15 @@ class Ordermoduledashboard extends StatefulWidget {
}
class _OrdermoduledashboardState extends State<Ordermoduledashboard> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
// TODO: implement initState
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
......@@ -43,12 +40,14 @@ class _OrdermoduledashboardState extends State<Ordermoduledashboard> {
provider.ordersAccessiblePagesAPIFunction(context);
});
}
@override
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -62,12 +61,18 @@ class _OrdermoduledashboardState extends State<Ordermoduledashboard> {
default:
connection = 'Offline';
}
return (connection == 'Online')? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context):NoNetwork(context);
return (connection == 'Online')
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
......@@ -82,101 +87,108 @@ class _OrdermoduledashboardState extends State<Ordermoduledashboard> {
child: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
height: MediaQuery.of(context).size.height * 0.28,
child: GridView.builder(
padding: EdgeInsets.symmetric(horizontal: 0, vertical: 5),
itemCount: provider.ordersgain.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: AlwaysScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 0.65,
if (provider.ordersgain.length > 0) ...[
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
itemBuilder: (context, jndex) {
final icons = ["comm_ic_1", "comm_ic_2"];
final leadTitles = [
'Order Gain',
'Dispatched',
'Pending Tasks',
'Quote',
];
final colors = [
0xFFE7FFE5,
0xFFF3EDFF,
0xFFFFFCD5,
0xFFFFF6F0,
];
final textcolors = [
0xFF0D9C00,
0xFF493272,
0xFF605C00,
0xFF91481B,
];
return InkResponse(
onTap: () async {
if (provider.ordersgain[jndex].filter!.pageName !=
"") {
if (provider.ordersgain[jndex].filter!.pageName!
.contains("Order List")) {
// await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => OrderslistbyModes(
// pageTitleName:
// provider
// .ordersgain[jndex]
// .filter!
// .pageName!,
// mode:
// provider.ordersgain[jndex].filter!.mode,
// filter: provider.ordersgain[jndex].filter!,
// ),
// ),
// );
height: MediaQuery.of(context).size.height * 0.28,
child: GridView.builder(
padding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 5,
),
itemCount: provider.ordersgain.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: AlwaysScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 0.65,
),
itemBuilder: (context, jndex) {
final icons = ["comm_ic_1", "comm_ic_2"];
final leadTitles = [
'Order Gain',
'Dispatched',
'Pending Tasks',
'Quote',
];
final colors = [
0xFFE7FFE5,
0xFFF3EDFF,
0xFFFFFCD5,
0xFFFFF6F0,
];
final textcolors = [
0xFF0D9C00,
0xFF493272,
0xFF605C00,
0xFF91481B,
];
return InkResponse(
onTap: () async {
if (provider.ordersgain[jndex].filter!.pageName !=
"") {
if (provider.ordersgain[jndex].filter!.pageName!
.contains("Order List")) {
// await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => OrderslistbyModes(
// pageTitleName:
// provider
// .ordersgain[jndex]
// .filter!
// .pageName!,
// mode:
// provider.ordersgain[jndex].filter!.mode,
// filter: provider.ordersgain[jndex].filter!,
// ),
// ),
// );
}
}
}
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 13),
decoration: BoxDecoration(
color: Color(colors[jndex]),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
provider.ordersgain[jndex].count!,
style: TextStyle(
fontSize: 30,
fontFamily: "JakartaMedium",
color: Color(textcolors[jndex]),
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 13),
decoration: BoxDecoration(
color: Color(colors[jndex]),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
provider.ordersgain[jndex].count!,
style: TextStyle(
fontSize: 30,
fontFamily: "JakartaMedium",
color: Color(textcolors[jndex]),
),
),
),
Text(
leadTitles[jndex],
style: TextStyle(color: Color(0xFF818181)),
),
],
Text(
leadTitles[jndex],
style: TextStyle(color: Color(0xFF818181)),
),
],
),
),
),
);
},
);
},
),
),
),
],
ListView.builder(
itemCount: pages.length,
shrinkWrap: true,
......
......@@ -73,327 +73,295 @@ class _OrderslistbyModesState extends State<OrderslistbyModes> {
default:
connection = 'Offline';
}
return connection == "Online"
? Consumer<Pagesdashboardprovider>(
builder: (context, provider, child) {
final ordersList = provider.ordersList;
return WillPopScope(
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () {
provider.resetAll();
Provider.of<Pagesdashboardprovider>(context).resetAll();
return onBackPressed(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetAll,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg"),
// ),
InkResponse(
onTap: () async {
_showFilterSheet(context);
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
),
],
),
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Pagesdashboardprovider>(
builder: (context, provider, child) {
final ordersList = provider.ordersList;
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar2(
context,
widget.pageTitleName,
provider.resetAll,
Row(
children: [
// InkResponse(
// onTap: () {
// _showOptionsSheet(context);
// },
// child: SvgPicture.asset("assets/svg/ic_download.svg"),
// ),
InkResponse(
onTap: () async {
_showFilterSheet(context);
},
child: SvgPicture.asset(
"assets/svg/filter_ic.svg",
height: 25,
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
],
),
),
backgroundColor: AppColors.scaffold_bg_color,
body:
provider.isLoading
? Center(
child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue,
),
),
)
: ordersList.isNotEmpty
? SingleChildScrollView(
child: Column(
children: [
ListView.builder(
itemCount: ordersList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
if (ordersList.isEmpty) {
return SizedBox(
child: Center(child: Text("No Data Available")),
);
}
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
),
)
: ordersList.isNotEmpty
? SingleChildScrollView(
child: Column(
children: [
ListView.builder(
itemCount: ordersList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
if (ordersList.isEmpty) {
return SizedBox(
child: Center(
child: Text("No Data Available"),
),
);
}
if (ordersList[index].orderNumber ==
"GP20252605448")
return Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
16,
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius: BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
child: Column(
children: [
Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 35,
padding: EdgeInsets.all(
8.0,
),
decoration: BoxDecoration(
color: Color(0xFFFFF3CE),
borderRadius:
BorderRadius.circular(
8,
),
),
child: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
ordersList[index]
.accountName!,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
Text(
"₹"
"${ordersList[index].balanceAmount}",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.app_blue,
),
),
],
),
),
),
SizedBox(width: 10),
Expanded(
flex: 4,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
ordersList[index].accountName!,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
Expanded(
flex: 2,
child: Container(
padding:
EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
8,
),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
ordersList[index]
.status!,
textAlign:
TextAlign.center,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color: Color(
0xFF0D9C00,
),
),
),
),
),
),
Text(
"₹"
"${ordersList[index].balanceAmount}",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
],
),
],
),
),
),
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
8,
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
color: Color(0xFFE3FFE0),
),
child: Center(
child: Text(
ordersList[index].status!,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF0D9C00),
),
),
...List.generate(5, (j) {
final headings = [
"Order Number",
"Entered Employee",
"Sales Person",
// "Date",
"Paid Amount",
"Balance Amount",
];
),
),
),
],
),
Divider(
thickness: 0.5,
color: Color(0xFFD7D7D7),
),
...List.generate(5, (j) {
final headings = [
"Order Number",
"Entered Employee",
"Sales Person",
// "Date",
"Paid Amount",
"Balance Amount",
];
final subHeadings = [
ordersList[index].orderNumber,
ordersList[index]
.enteredEmpName,
ordersList[index]
.salesPersonEmpName,
// ordersList[index].createdDatetime,
ordersList[index].paidAmount,
ordersList[index].balanceAmount,
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors
.semi_black,
),
),
),
Expanded(
child: InkResponse(
child: Text(
subHeadings[j]!,
style: TextStyle(
fontSize: 14,
color: Color(
0xFF818181,
),
decoration:
TextDecoration
.none,
decorationColor:
AppColors.white,
),
),
),
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => Ordersdetailsbymodes(
pageTitleName:
widget
.pageTitleName,
orderId:
ordersList[index]
.orderId,
mode: widget.mode,
),
),
);
if (res == true) {
provider
.ordersListByModeFilterAPIFunction(
context,
widget.mode,
);
provider
.ordersListByModeAPIFunction(
context,
widget.mode,
"",
"",
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 14,
color:
AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
final subHeadings = [
ordersList[index].orderNumber,
ordersList[index].enteredEmpName,
ordersList[index].salesPersonEmpName,
// ordersList[index].createdDatetime,
ordersList[index].paidAmount,
ordersList[index].balanceAmount,
];
return Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
headings[j],
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
child: InkResponse(
child: Text(
subHeadings[j]!,
style: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
decoration:
TextDecoration.none,
decorationColor:
AppColors.white,
),
),
),
],
),
],
),
);
}),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Ordersdetailsbymodes(
pageTitleName:
widget.pageTitleName,
orderId:
ordersList[index].orderId,
mode: widget.mode,
),
),
);
},
),
],
),
)
: Emptywidget(context),
),
),
);
},
)
: NoNetwork(context);
if (res == true) {
provider
.ordersListByModeFilterAPIFunction(
context,
widget.mode,
);
provider.ordersListByModeAPIFunction(
context,
widget.mode,
"",
"",
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
"View Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
),
],
),
);
},
),
],
),
)
: Emptywidget(context),
);
},
);
}
Future<void> _showOptionsSheet(BuildContext context) {
......
......@@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: async
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev"
source: hosted
version: "2.12.0"
version: "2.13.0"
auto_size_text:
dependency: "direct main"
description:
......@@ -301,10 +301,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
url: "https://pub.dev"
source: hosted
version: "1.3.2"
version: "1.3.3"
ffi:
dependency: transitive
description:
......@@ -948,26 +948,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
url: "https://pub.dev"
source: hosted
version: "10.0.8"
version: "11.0.1"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.dev"
source: hosted
version: "3.0.9"
version: "3.0.10"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
lints:
dependency: transitive
description:
......@@ -1673,10 +1673,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
url: "https://pub.dev"
source: hosted
version: "14.3.1"
version: "15.0.0"
web:
dependency: transitive
description:
......
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