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

ios changes in Navigation swipe gestures.

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