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

19-06-2025 By Sai Srinivas

Finance Module Test cases & Safe Area
parent 4807bee4
...@@ -186,64 +186,82 @@ class Requesitionlidtdetailsprovider extends ChangeNotifier { ...@@ -186,64 +186,82 @@ class Requesitionlidtdetailsprovider extends ChangeNotifier {
_paymentDetails = _paymentDetails =
data.paymentDetails ?? data.paymentDetails ??
PaymentDetails( PaymentDetails(
accountId: "", accountId: "-",
accountName: "", accountName: "-",
amount: "", amount: "-",
attachmentDirFilePath: "", attachmentDirFilePath: "-",
attachmentViewFileName: "", attachmentViewFileName: "-",
bankAccountHolderName: "", bankAccountHolderName: "-",
bankAccountNumber: "", bankAccountNumber: "-",
bankBranchName: "", bankBranchName: "-",
bankIfscCode: "", bankIfscCode: "-",
bankName: "", bankName: "-",
bankUpiId: "", bankUpiId: "-",
createdDatetime: "", createdDatetime: "-",
createdEmployeeId: "", createdEmployeeId: "-",
description: "", description: "-",
id: "", id: "-",
isExists: "", isExists: "-",
mode: "", mode: "-",
paymentAccountId: "", paymentAccountId: "-",
paymentAccountName: "", paymentAccountName: "-",
paymentDate: "", paymentDate: "-",
paymentEmployeeName: "", paymentEmployeeName: "-",
paymentModeId: "", paymentModeId: "-",
paymentReferenceNumber: "", paymentReferenceNumber: "-",
paymentRemarks: "", paymentRemarks: "-",
refId: "", refId: "-",
refType: "", refType: "-",
updatedDatetime: "", updatedDatetime: "-",
); );
_requestDetails = _requestDetails =
data.requestDetails ?? data.requestDetails ??
RequestDetails( RequestDetails(
updatedDatetime: "", updatedDatetime: "-",
id: "", id: "-",
description: "", description: "-",
createdDatetime: "", createdDatetime: "-",
attachmentViewFileName: "", attachmentViewFileName: "-",
attachmentDirFilePath: "", attachmentDirFilePath: "-",
amount: "", amount: "-",
accountName: "", accountName: "-",
accountId: "", accountId: "-",
branch: "", branch: "-",
createdEmployee: "", createdEmployee: "-",
date: "", date: "-",
isProcessedPaymentRequest: "", isProcessedPaymentRequest: "-",
level1ApprovalRemarks: "", level1ApprovalRemarks: "-",
level1Employee: "", level1Employee: "-",
level2ApprovalRemarks: "", level2ApprovalRemarks: "-",
level2Employee: "", level2Employee: "-",
proposedAccount: "", proposedAccount: "-",
proposedAccountId: "", proposedAccountId: "-",
requestedAmount: "", requestedAmount: "-",
requestingPurpose: "", requestingPurpose: "-",
requestMode: "", requestMode: "-",
status: "", status: "-",
transDis: "", transDis: "-",
); );
_subHeadings = [
_requestDetails.accountName ?? "-",
_requestDetails.proposedAccount ?? "-",
_requestDetails.branch ?? "-",
_requestDetails.requestingPurpose ?? "-",
_requestDetails.requestMode ?? "-",
_requestDetails.createdEmployee ?? "-",
_requestDetails.attachmentViewFileName ?? "-",
_requestDetails.date ?? "-",
_requestDetails.description ?? "-",
_requestDetails.level1ApprovalRemarks ?? "-",
_requestDetails.level1Employee ?? "-",
_requestDetails.level2ApprovalRemarks ?? "-",
_requestDetails.level2Employee ?? "-",
_requestDetails.createdDatetime ?? "-",
_requestDetails.updatedDatetime ?? "-",
];
print("here 2121"); print("here 2121");
preValues(); preValues();
notifyListeners(); notifyListeners();
......
...@@ -359,17 +359,8 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -359,17 +359,8 @@ class Requestionlistprovider extends ChangeNotifier {
_paymentModes = data.paymentModes!; _paymentModes = data.paymentModes!;
_requestingPurposes = data.requestingPurposes!; _requestingPurposes = data.requestingPurposes!;
if (_selectedAccounts != null && checkDropdownselected();
!_accounts.contains(_selectedAccounts)) { notifyListeners();
_selectedAccounts = null;
_accountId = "";
}
if (_selectedPayment != null &&
!_paymentModes.contains(_selectedPayment)) {
_selectedPayment = null;
_paymentModeId = "";
}
} else {} } else {}
} }
} catch (e, s) {} } catch (e, s) {}
...@@ -434,26 +425,8 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -434,26 +425,8 @@ class Requestionlistprovider extends ChangeNotifier {
_directPaymentAccounts = data.paymentAccounts!; _directPaymentAccounts = data.paymentAccounts!;
_directPaymentModes = data.paymentModes!; _directPaymentModes = data.paymentModes!;
_directAccounts = data.accounts!; _directAccounts = data.accounts!;
checkdirectPaymentDropDownsSlected();
if (_selectedDirectAccounts != null &&
!_directAccounts.contains(_selectedDirectAccounts)) {
_selectedDirectAccounts = null;
_directAccountID = "";
_directAccountValue = "";
}
if (_selectDirectPaymentModes != null &&
!_directPaymentModes.contains(_selectDirectPaymentModes)) {
_selectDirectPaymentModes = null;
_directPaymentModesID = "";
_directPaymentModesValues = "";
}
if (_selectDirectPaymentAccounts != null &&
!_directPaymentAccounts.contains(_selectDirectPaymentAccounts)) {
_selectDirectPaymentAccounts = null;
_directPaymentAccountsID = "";
_directPaymentAccountsValue = "";
}
notifyListeners(); notifyListeners();
} else {} } else {}
} }
...@@ -890,9 +863,48 @@ class Requestionlistprovider extends ChangeNotifier { ...@@ -890,9 +863,48 @@ class Requestionlistprovider extends ChangeNotifier {
UPIError = null; UPIError = null;
FileError = null; FileError = null;
buttonEnabled = false; buttonEnabled = false;
checkDropdownselected();
checkdirectPaymentDropDownsSlected();
notifyListeners(); notifyListeners();
} }
void checkdirectPaymentDropDownsSlected(){
if (_selectedDirectAccounts != null &&
!_directAccounts.contains(_selectedDirectAccounts)) {
_selectedDirectAccounts = null;
_directAccountID = "";
_directAccountValue = "";
}
if (_selectDirectPaymentModes != null &&
!_directPaymentModes.contains(_selectDirectPaymentModes)) {
_selectDirectPaymentModes = null;
_directPaymentModesID = "";
_directPaymentModesValues = "";
}
if (_selectDirectPaymentAccounts != null &&
!_directPaymentAccounts.contains(_selectDirectPaymentAccounts)) {
_selectDirectPaymentAccounts = null;
_directPaymentAccountsID = "";
_directPaymentAccountsValue = "";
}
}
void checkDropdownselected() {
if (_selectedAccounts != null &&
!_accounts.contains(_selectedAccounts)) {
_selectedAccounts = null;
_accountId = "";
}
if (_selectedPayment != null &&
!_paymentModes.contains(_selectedPayment)) {
_selectedPayment = null;
_paymentModeId = "";
}
if (_selectReqPurpose != null &&
!_requestingPurposes.contains(_selectReqPurpose)) {
_selectReqPurpose = null;
}
}
bool validateForm(BuildContext context, String mode) { bool validateForm(BuildContext context, String mode) {
// Reset all errors // Reset all errors
......
...@@ -441,28 +441,8 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -441,28 +441,8 @@ class Paymentreceiptsprovider extends ChangeNotifier {
_receiptPaymentAccounts = data.receiptAccounts!; _receiptPaymentAccounts = data.receiptAccounts!;
_receiptPaymentModes = data.paymentModes!; _receiptPaymentModes = data.paymentModes!;
_receiptAccounts = data.accounts!; _receiptAccounts = data.accounts!;
checkDropDownSelected();
if (_selectedreceiptAccounts != null &&
!_receiptAccounts.contains(_selectedreceiptAccounts)) {
_selectedreceiptAccounts = null;
_receiptAccountID = "";
_receiptAccountValue = "";
}
if (_selectreceiptPaymentModes != null &&
!_receiptPaymentModes.contains(_selectreceiptPaymentModes)) {
_selectreceiptPaymentModes = null;
_receiptPaymentModesID = "";
_receiptPaymentModesValues = "";
}
if (_selectreceiptPaymentAccounts != null &&
!_receiptPaymentAccounts.contains(
_selectreceiptPaymentAccounts,
)) {
_selectreceiptPaymentAccounts = null;
_receiptPaymentAccountsID = "";
_receiptPaymentAccountsValue = "";
}
notifyListeners(); notifyListeners();
} else {} } else {}
} }
...@@ -751,9 +731,32 @@ class Paymentreceiptsprovider extends ChangeNotifier { ...@@ -751,9 +731,32 @@ class Paymentreceiptsprovider extends ChangeNotifier {
FileError = null; FileError = null;
buttonEnabled = false; buttonEnabled = false;
dateError = null; dateError = null;
checkDropDownSelected();
notifyListeners(); notifyListeners();
} }
void checkDropDownSelected(){
if (_selectedreceiptAccounts != null &&
!_receiptAccounts.contains(_selectedreceiptAccounts)) {
_selectedreceiptAccounts = null;
_receiptAccountID = "";
_receiptAccountValue = "";
}
if (_selectreceiptPaymentModes != null &&
!_receiptPaymentModes.contains(_selectreceiptPaymentModes)) {
_selectreceiptPaymentModes = null;
_receiptPaymentModesID = "";
_receiptPaymentModesValues = "";
}
if (_selectreceiptPaymentAccounts != null &&
!_receiptPaymentAccounts.contains(
_selectreceiptPaymentAccounts,
)) {
_selectreceiptPaymentAccounts = null;
_receiptPaymentAccountsID = "";
_receiptPaymentAccountsValue = "";
}
}
bool validatereceiptForm(BuildContext context) { bool validatereceiptForm(BuildContext context) {
selectAccountError = null; selectAccountError = null;
......
...@@ -58,7 +58,18 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ ...@@ -58,7 +58,18 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{
final data = await ApiCalling.paymentRequisitionPaymentDetailsAPI(prov.empId, prov.session,paymentId); final data = await ApiCalling.paymentRequisitionPaymentDetailsAPI(prov.empId, prov.session,paymentId);
if(data!=null){ if(data!=null){
if(data.error=="0"){ if(data.error=="0"){
_paymentDetails = data.paymentDetails!; _paymentDetails = data.paymentDetails??PaymentDetails(
accountId: "-",
accountName: "-",
amount: "-",
attachmentDirFilePath: "-",
attachmentViewFileName: "-",
createdDatetime: "-",
description: "-",
id: "-",
updatedDatetime: "-",
refType: "-",refId: "-",paymentRemarks: "-",paymentReferenceNumber: "-",paymentModeId: "-",paymentEmployeeName: "-",paymentDate: "-",paymentAccountName: "-",paymentAccountId: "-",mode: "-",isExists: "-",createdEmployeeId: "-",bankUpiId: "-",bankName: "-",bankIfscCode:"-",bankBranchName: "-",bankAccountNumber: "-",bankAccountHolderName:"-" ,
);
_headings = [ _headings = [
"From Account", "From Account",
"Payment Mode", "Payment Mode",
......
...@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; ...@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_ringtone_player/flutter_ringtone_player.dart'; import 'package:flutter_ringtone_player/flutter_ringtone_player.dart';
import 'package:generp/Utils/app_colors.dart';
import 'screens/notifierExports.dart'; import 'screens/notifierExports.dart';
import 'package:generp/Utils/SharedpreferencesService.dart'; import 'package:generp/Utils/SharedpreferencesService.dart';
import 'package:generp/screens/splash.dart'; import 'package:generp/screens/splash.dart';
...@@ -262,6 +263,13 @@ class MyApp extends StatelessWidget { ...@@ -262,6 +263,13 @@ class MyApp extends StatelessWidget {
colorScheme: const ColorScheme.light( colorScheme: const ColorScheme.light(
background: Colors.white, background: Colors.white,
).copyWith(background: Colors.white), ).copyWith(background: Colors.white),
scrollbarTheme: ScrollbarThemeData(
minThumbLength: 20,
interactive: true,
radius: Radius.circular(6),
thickness: WidgetStatePropertyAll(10),
thumbColor: WidgetStateProperty.all(AppColors.grey_semi.withOpacity(0.6))
)
), ),
home: const Splash(), home: const Splash(),
); );
......
...@@ -105,551 +105,553 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -105,551 +105,553 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Attendance"), appBar: appbar(context, "Attendance"),
body: Container( body: SafeArea(
child: SingleChildScrollView( child: Container(
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
margin: EdgeInsets.only(top: 15, bottom: 15), Container(
decoration: BoxDecoration( margin: EdgeInsets.only(top: 15, bottom: 15),
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), color: Colors.white,
), borderRadius: BorderRadius.circular(16),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
padding: EdgeInsets.only( Container(
left: 15, padding: EdgeInsets.only(
right: 10, left: 15,
top: 15, right: 10,
), top: 15,
child: Row( ),
children: [ child: Row(
Expanded(child: Text("Check-in")), children: [
Expanded(child: Text("Check-out")), Expanded(child: Text("Check-in")),
], Expanded(child: Text("Check-out")),
],
),
), ),
), SizedBox(
SizedBox( child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( child: Container(
child: Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), margin: EdgeInsets.symmetric(
margin: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFFEFEF),
color: Color(0xFFFFEFEF), borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16), ),
), child: Column(
child: Column( crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ RichText(
RichText( text: TextSpan(
text: TextSpan( children: [
children: [ TextSpan(
TextSpan( text: formattedTime,
text: formattedTime, style: TextStyle(
style: TextStyle( color: Color(0xFFED3424),
color: Color(0xFFED3424), fontFamily:
fontFamily: "JakartaRegular",
"JakartaRegular", fontSize: 30,
fontSize: 30, ),
), ),
), TextSpan(
TextSpan( text: period,
text: period, style: TextStyle(
style: TextStyle( color: Color(0xFFED3424),
color: Color(0xFFED3424), fontFamily:
fontFamily: "JakartaRegular",
"JakartaRegular", ),
), ),
), ],
], ),
), ),
), Text(
Text( "${attendance.attendanceHistory.firstOrNull?['check_in_location']}",
"${attendance.attendanceHistory.firstOrNull?['check_in_location']}", style: TextStyle(
style: TextStyle( color: Color(0xFF818181),
color: Color(0xFF818181), ),
), ),
), ],
], ),
), ),
), ),
), Expanded(
Expanded( child: Container(
child: Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), margin: EdgeInsets.symmetric(
margin: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFFEFEF),
color: Color(0xFFFFEFEF), borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16), ),
), child: Column(
child: Column( crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ RichText(
RichText( text: TextSpan(
text: TextSpan( children: [
children: [ TextSpan(
TextSpan( text: formattedTime2,
text: formattedTime2, style: TextStyle(
style: TextStyle( color: Color(0xFFED3424),
color: Color(0xFFED3424), fontFamily:
fontFamily: "JakartaRegular",
"JakartaRegular", fontSize: 30,
fontSize: 30, ),
), ),
), TextSpan(
TextSpan( text: period2,
text: period2, style: TextStyle(
style: TextStyle( color: Color(0xFFED3424),
color: Color(0xFFED3424), fontFamily:
fontFamily: "JakartaRegular",
"JakartaRegular", ),
), ),
), ],
], ),
), ),
), Text(
Text( "${attendance.attendanceHistory.firstOrNull?['check_out_location']}",
"${attendance.attendanceHistory.firstOrNull?['check_out_location']}", style: TextStyle(
style: TextStyle( color: Color(0xFF818181),
color: Color(0xFF818181), ),
), ),
), ],
], ),
), ),
), ),
), ],
], ),
), ),
), ],
],
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
child: Text(
"Attendance Details",
style: TextStyle(
fontFamily: "JakartaSemiBold",
fontSize: 14,
color: Color(0xFF818181),
), ),
), ),
), Container(
Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 10,
vertical: 10, ),
), child: Text(
decoration: BoxDecoration( "Attendance Details",
color: Colors.white, style: TextStyle(
borderRadius: BorderRadius.circular(16), fontFamily: "JakartaSemiBold",
fontSize: 14,
color: Color(0xFF818181),
),
),
), ),
child: GridView.builder( Container(
itemCount: 4, padding: EdgeInsets.symmetric(
shrinkWrap: true, horizontal: 10,
physics: NeverScrollableScrollPhysics(), vertical: 10,
gridDelegate: ),
SliverGridDelegateWithFixedCrossAxisCount( decoration: BoxDecoration(
crossAxisCount: 2, color: Colors.white,
crossAxisSpacing: 10, borderRadius: BorderRadius.circular(16),
mainAxisSpacing: 10, ),
childAspectRatio: 20 / 10, child: GridView.builder(
), itemCount: 4,
itemBuilder: (context, index) { shrinkWrap: true,
final numbers = [ physics: NeverScrollableScrollPhysics(),
attendance.presentDays, gridDelegate:
attendance.absentDays, SliverGridDelegateWithFixedCrossAxisCount(
attendance.holidays, crossAxisCount: 2,
attendance.latePenalties, crossAxisSpacing: 10,
]; mainAxisSpacing: 10,
final names = [ childAspectRatio: 20 / 10,
"Present Days", ),
"Absent Days", itemBuilder: (context, index) {
"Holidays", final numbers = [
"Late Points", attendance.presentDays,
]; attendance.absentDays,
final colors = [ attendance.holidays,
0xFFE7FFE5, attendance.latePenalties,
0xFFFFEFEF, ];
0xFFF3EDFF, final names = [
0xFFFFF6F0, "Present Days",
]; "Absent Days",
final textcolors = [ "Holidays",
0xFF0D9C00, "Late Points",
0xFFFF0000, ];
0xFF493272, final colors = [
0xFF91481B, 0xFFE7FFE5,
]; 0xFFFFEFEF,
return Container( 0xFFF3EDFF,
padding: EdgeInsets.symmetric(horizontal: 13), 0xFFFFF6F0,
decoration: BoxDecoration( ];
color: Color(colors[index]), final textcolors = [
borderRadius: BorderRadius.circular(12), 0xFF0D9C00,
), 0xFFFF0000,
child: Column( 0xFF493272,
crossAxisAlignment: CrossAxisAlignment.start, 0xFF91481B,
mainAxisAlignment: MainAxisAlignment.center, ];
children: [ return Container(
Text( padding: EdgeInsets.symmetric(horizontal: 13),
numbers[index].toString(), decoration: BoxDecoration(
style: TextStyle( color: Color(colors[index]),
fontSize: 30, borderRadius: BorderRadius.circular(12),
fontFamily: "JakartaMedium", ),
color: Color(textcolors[index]), child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
numbers[index].toString(),
style: TextStyle(
fontSize: 30,
fontFamily: "JakartaMedium",
color: Color(textcolors[index]),
),
), ),
), Text(
Text( names[index],
names[index], style: TextStyle(color: Color(0xFF818181)),
style: TextStyle(color: Color(0xFF818181)), ),
), ],
], ),
), );
); },
}, ),
), ),
),
///calendar ///calendar
Container( Container(
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5), // padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
vertical: 5, vertical: 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
color: Colors.white, color: Colors.white,
), ),
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(30, 10, 30, 0), padding: const EdgeInsets.fromLTRB(30, 10, 30, 0),
child: Container( child: Container(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
SizedBox( SizedBox(
child: Row( child: Row(
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
attendance.setPreviousMonth( attendance.setPreviousMonth(
homeProvider, homeProvider,
context, context,
); );
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/arrow_left.svg", "assets/svg/arrow_left.svg",
),
), ),
), Text(
Text( monthLabel,
monthLabel, style: TextStyle(
style: TextStyle( overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", color: Color(0xFF2D2D2D),
color: Color(0xFF2D2D2D), ),
), ),
), GestureDetector(
GestureDetector( onTap: () {
onTap: () { attendance.setNextMonth(
attendance.setNextMonth( homeProvider,
homeProvider, context,
context, );
); },
}, child: SvgPicture.asset(
child: SvgPicture.asset( "assets/svg/arrow_right_new.svg",
"assets/svg/arrow_right_new.svg", ),
), ),
), ],
], ),
), ),
),
InkResponse( InkResponse(
onTap: () { onTap: () {
_showInfoBottomSheet(context); _showInfoBottomSheet(context);
}, },
child: SizedBox( child: SizedBox(
width: 20,
height: 20,
child: SvgPicture.asset(
"assets/svg/ic_info_new.svg",
width: 20, width: 20,
height: 20, height: 20,
child: SvgPicture.asset(
"assets/svg/ic_info_new.svg",
width: 20,
height: 20,
),
), ),
), ),
), ],
], ),
), ),
), ),
), SizedBox(height: 5),
SizedBox(height: 5), Padding(
Padding( padding: const EdgeInsets.fromLTRB(8, 10, 8, 0),
padding: const EdgeInsets.fromLTRB(8, 10, 8, 0), child: Container(
child: Container( child: Row(
child: Row( children: [
children: [ for (
for ( var i = 0;
var i = 0; i <
i < [
[ 'S',
'S', 'M',
'M', 'T',
'T', 'W',
'W', 'T',
'T', 'F',
'F', 'S',
'S', ].length;
].length; i++
i++ )
) Expanded(
Expanded( child: Text(
child: Text( [
[ 'S',
'S', 'M',
'M', 'T',
'T', 'W',
'W', 'T',
'T', 'F',
'F', 'S',
'S', ][i],
][i], textAlign: TextAlign.center,
textAlign: TextAlign.center, style: TextStyle(
style: TextStyle( overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, color:
color: i == 0
i == 0 ? Color(0xFFFF0000)
? Color(0xFFFF0000) : AppColors.semi_black,
: AppColors.semi_black, ),
), ),
), ),
), ],
], ),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 10), padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
child: Container( child: Container(
child: GridView.builder( child: GridView.builder(
itemCount: daysInPeriod + startingIndex, itemCount: daysInPeriod + startingIndex,
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount( SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7, crossAxisCount: 7,
crossAxisSpacing: 2, crossAxisSpacing: 2,
mainAxisSpacing: 1, mainAxisSpacing: 1,
childAspectRatio: (255 / 245), childAspectRatio: (255 / 245),
), ),
padding: const EdgeInsets.fromLTRB( padding: const EdgeInsets.fromLTRB(
0, 0,
0, 0,
0, 0,
0, 0,
), ),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index < startingIndex) { if (index < startingIndex) {
return SizedBox.shrink(); return SizedBox.shrink();
} }
final dayIndex = index - startingIndex; final dayIndex = index - startingIndex;
final currentDateInPeriod = startDate.add( final currentDateInPeriod = startDate.add(
Duration(days: dayIndex), Duration(days: dayIndex),
); );
final currentDay = currentDateInPeriod.day; final currentDay = currentDateInPeriod.day;
final isFutureDate = currentDateInPeriod final isFutureDate = currentDateInPeriod
.isAfter(currentDate); .isAfter(currentDate);
// Find matching date in dateArrayList // Find matching date in dateArrayList
Map<String, dynamic>? dateMap; Map<String, dynamic>? dateMap;
try { try {
dateMap = dateArrayList[dayIndex]; dateMap = dateArrayList[dayIndex];
} catch (e) { } catch (e) {
dateMap = {}; dateMap = {};
} }
// Find matching penalty // Find matching penalty
Map<String, dynamic>? penaltyMap; Map<String, dynamic>? penaltyMap;
try { try {
penaltyMap = penalityArrayList[dayIndex]; penaltyMap = penalityArrayList[dayIndex];
} catch (e) { } catch (e) {
penaltyMap = {}; penaltyMap = {};
} }
String? dateColor = String? dateColor =
dateMap.isNotEmpty dateMap.isNotEmpty
? dateMap.values.first ? dateMap.values.first
: null; : null;
String? penaltyKey = String? penaltyKey =
penaltyMap.isNotEmpty penaltyMap.isNotEmpty
? penaltyMap.keys.first ? penaltyMap.keys.first
: null; : null;
int? datePenalty = int? datePenalty =
penaltyMap.isNotEmpty penaltyMap.isNotEmpty
? penaltyMap.values.first ? penaltyMap.values.first
: 0; : 0;
// Determine if this is the current day // Determine if this is the current day
final isCurrentDay = final isCurrentDay =
currentDateInPeriod.day == currentDateInPeriod.day ==
currentDate.day && currentDate.day &&
currentDateInPeriod.month == currentDateInPeriod.month ==
currentDate.month && currentDate.month &&
currentDateInPeriod.year == currentDateInPeriod.year ==
currentDate.year; currentDate.year;
return InkWell( return InkWell(
onTap: onTap:
isFutureDate isFutureDate
? null ? null
: () { : () {
selectedIndex = index; selectedIndex = index;
if (penaltyKey != null) { if (penaltyKey != null) {
attendance.dateWiseAttendance( attendance.dateWiseAttendance(
homeProvider, homeProvider,
penaltyKey, penaltyKey,
context,
);
}
attendance.selectedDate =
currentDay.toString();
_showAttDetailsBottomSheet(
context, context,
); );
} },
attendance.selectedDate = child: Card(
currentDay.toString(); elevation: 0,
_showAttDetailsBottomSheet( child: Column(
context, children: [
); // Row(
}, // mainAxisAlignment:
child: Card( // MainAxisAlignment.center,
elevation: 0, // children: [
child: Column( // Text(
children: [ // "($datePenalty)",
// Row( // style: TextStyle(
// mainAxisAlignment: // fontWeight: FontWeight.w400,
// MainAxisAlignment.center, // color: Colors.black,
// children: [ // fontSize: 5
// Text( // ),
// "($datePenalty)", // ),
// style: TextStyle( // ],
// fontWeight: FontWeight.w400, // ),
// color: Colors.black, Center(
// fontSize: 5 child: Container(
// ), decoration: BoxDecoration(
// ), shape: BoxShape.circle,
// ], border: Border.all(
// ),
Center(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color:
(isCurrentDay ||
(selectedIndex ==
index))
? Color(0xFF1487C9)
: Colors
.transparent,
),
color:
isFutureDate
? Colors.transparent
: (isCurrentDay ||
(selectedIndex ==
index))
? Color(0xFFFFFFFF)
: dateColor == 'g'
? Color(0xFFE8FFE6)
: dateColor == 'r'
? Color(0xFFFFEFEF)
: dateColor == 'b'
? Color(0xFFFFE8D0)
: dateColor == 'br'
? Color(0xFFFFE8D0)
: dateColor == 'y'
? Color(0xFFFFF9B2)
: Colors.transparent,
),
child: Center(
child: Text(
currentDay.toString(),
style: TextStyle(
fontSize: 14,
fontWeight:
FontWeight.w400,
color: color:
isFutureDate (isCurrentDay ||
? AppColors
.semi_black
: (isCurrentDay ||
(selectedIndex == (selectedIndex ==
index)) index))
? Color( ? Color(0xFF1487C9)
0xFF2D2D2D,
)
: dateColor == 'g'
? Color(
0xFF6B3A02,
)
: dateColor == 'r'
? Color(
0xFFFF0000,
)
: dateColor == 'b'
? Color(
0xFF493272,
)
: dateColor ==
'br'
? Color(
0xFF6B3A02,
)
: dateColor == 'y'
? Color(
0xFF605C00,
)
: Colors : Colors
.transparent, .transparent,
), ),
color:
isFutureDate
? Colors.transparent
: (isCurrentDay ||
(selectedIndex ==
index))
? Color(0xFFFFFFFF)
: dateColor == 'g'
? Color(0xFFE8FFE6)
: dateColor == 'r'
? Color(0xFFFFEFEF)
: dateColor == 'b'
? Color(0xFFFFE8D0)
: dateColor == 'br'
? Color(0xFFFFE8D0)
: dateColor == 'y'
? Color(0xFFFFF9B2)
: Colors.transparent,
),
child: Center(
child: Text(
currentDay.toString(),
style: TextStyle(
fontSize: 14,
fontWeight:
FontWeight.w400,
color:
isFutureDate
? AppColors
.semi_black
: (isCurrentDay ||
(selectedIndex ==
index))
? Color(
0xFF2D2D2D,
)
: dateColor == 'g'
? Color(
0xFF6B3A02,
)
: dateColor == 'r'
? Color(
0xFFFF0000,
)
: dateColor == 'b'
? Color(
0xFF493272,
)
: dateColor ==
'br'
? Color(
0xFF6B3A02,
)
: dateColor == 'y'
? Color(
0xFF605C00,
)
: Colors
.transparent,
),
),
), ),
), ),
), ),
), ],
], ),
), ),
), );
); },
}, ),
), ),
), ),
), ],
], ),
), ),
), SizedBox(height: 70),
SizedBox(height: 70), ],
], ),
), ),
), ),
), ),
......
...@@ -39,190 +39,192 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> { ...@@ -39,190 +39,192 @@ class _CheckInOutScreenState extends State<CheckInOutScreen> {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, widget.getAttendanceStatus==0? "Check In":"Check Out"), appBar: appbar(context, widget.getAttendanceStatus==0? "Check In":"Check Out"),
body:Container( body:SafeArea(
child: SafeArea( child: Container(
child: Column( child: SafeArea(
children: [ child: Column(
Expanded( children: [
child: Stack( Expanded(
children: [ child: Stack(
GoogleMap( children: [
myLocationEnabled: true, GoogleMap(
zoomGesturesEnabled: true, myLocationEnabled: true,
scrollGesturesEnabled: false, zoomGesturesEnabled: true,
initialCameraPosition: CameraPosition( scrollGesturesEnabled: false,
target: provider.currentLocationLatLng ?? initialCameraPosition: CameraPosition(
provider.startLocation, target: provider.currentLocationLatLng ??
zoom: 20.0, provider.startLocation,
zoom: 20.0,
),
markers: provider.markers.toSet(),
myLocationButtonEnabled: true,
mapType: MapType.normal,
onMapCreated: (controller) {
provider.mapController = controller;
provider.getCurrentLocation();
provider.getLocationPermission(context);
},
onCameraMove: (position) {
provider.onCameraMove(position,context);
},
), ),
markers: provider.markers.toSet(), Positioned(
myLocationButtonEnabled: true, left: 0,
mapType: MapType.normal, right: 0,
onMapCreated: (controller) { bottom: 0,
provider.mapController = controller; child: Container(
provider.getCurrentLocation(); height: size.height * 0.3,
provider.getLocationPermission(context); decoration: BoxDecoration(
}, color: Colors.white,
onCameraMove: (position) { borderRadius: BorderRadius.only(
provider.onCameraMove(position,context); topLeft: Radius.circular(30.0),
}, topRight: Radius.circular(30.0),
), ),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: size.height * 0.3,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.0),
topRight: Radius.circular(30.0),
), ),
), child: Column(
child: Column( crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ SizedBox(height: 25),
SizedBox(height: 25),
Padding(
Padding( padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric( horizontal: 20.0),
horizontal: 20.0), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Text(
Text( "Share Your Details",
"Share Your Details", style: TextStyle(
style: TextStyle( color: AppColors.app_blue,
color: AppColors.app_blue, fontFamily: "JakartaSemiBold"
fontFamily: "JakartaSemiBold" ),
),
),
SizedBox(height: 10,),
Text(
"Location",
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
), ),
), SizedBox(height: 10,),
], Text(
), "Location",
), style: TextStyle(
SizedBox(height: 5), fontFamily: "JakartaMedium",
Padding( color: AppColors.semi_black,
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
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.locationController,
keyboardType:
TextInputType.text,
decoration: InputDecoration(
hintText:
"Enter Check ${widget.getAttendanceStatus==0?"In":"Out"} Location",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181)
), ),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
), ),
],
),
), ),
), ),
), SizedBox(height: 5),
if (provider.validateLocation != null)
Padding( Padding(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(
horizontal: 20.0), horizontal: 20.0),
child: Container( child: Container(
alignment: Alignment.topLeft, height: 50,
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25),
child: Text(
provider.validateLocation!,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.red,
),
),
),
)
else
SizedBox(height: 5.0),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
child: InkWell(
onTap: () async {
if (provider
.locationController
.text
.isEmpty) {
provider.validateLocation =
"Please Enter location";
provider.notifyListeners();
} else {
provider.validateLocation = "";
provider.imgFromCamera(
context,widget.getAttendanceStatus);
}
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.app_blue, color: AppColors.text_field_color,
borderRadius: borderRadius:
BorderRadius.circular(15.0), BorderRadius.circular(14),
), ),
child: Text( child: Padding(
widget.getAttendanceStatus==0? "Check In":"Check Out", padding:
style: TextStyle( const EdgeInsets.fromLTRB(
fontFamily: "JakartaMedium", 10.0, 0.0, 10, 0),
fontSize: 16, child: TextFormField(
color: Colors.white controller:
provider.locationController,
keyboardType:
TextInputType.text,
decoration: InputDecoration(
hintText:
"Enter Check ${widget.getAttendanceStatus==0?"In":"Out"} Location",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181)
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
),
), ),
), ),
), ),
), ),
), if (provider.validateLocation != null)
], Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 20.0),
child: Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(
top: 2.5,
bottom: 2.5,
left: 25),
child: Text(
provider.validateLocation!,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.red,
),
),
),
)
else
SizedBox(height: 5.0),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20.0),
child: InkWell(
onTap: () async {
if (provider
.locationController
.text
.isEmpty) {
provider.validateLocation =
"Please Enter location";
provider.notifyListeners();
} else {
provider.validateLocation = "";
provider.imgFromCamera(
context,widget.getAttendanceStatus);
}
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius:
BorderRadius.circular(15.0),
),
child: Text(
widget.getAttendanceStatus==0? "Check In":"Check Out",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 16,
color: Colors.white
),
),
),
),
),
],
),
), ),
), ),
), ],
], ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -169,342 +169,344 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -169,342 +169,344 @@ class _MyHomePageState extends State<MyHomePage> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: Container( body: SafeArea(
child: Column( child: Container(
children: [ child: Column(
Expanded( children: [
flex: 3, Expanded(
child: Container( flex: 3,
padding: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30),
),
),
child: Container( child: Container(
margin: EdgeInsets.only( padding: EdgeInsets.symmetric(vertical: 10),
bottom: 15,
left: 15,
right: 15,
top: 30,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30), color: Colors.white,
gradient: LinearGradient( borderRadius: BorderRadius.vertical(
colors: [ bottom: Radius.circular(30),
AppColors.profile_card_gradient1,
AppColors.profile_card_gradient2,
],
), ),
), ),
child: Row( child: Container(
crossAxisAlignment: CrossAxisAlignment.center, margin: EdgeInsets.only(
children: [ bottom: 15,
Expanded( left: 15,
flex: 2, right: 15,
child: SizedBox( top: 30,
child: Column( ),
mainAxisAlignment: MainAxisAlignment.center, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
children: [ gradient: LinearGradient(
SizedBox( colors: [
width: 66, AppColors.profile_card_gradient1,
height: 66, AppColors.profile_card_gradient2,
child: ClipRRect( ],
borderRadius: BorderRadius.circular( ),
50, ),
), child: Row(
child: CachedNetworkImage( crossAxisAlignment: CrossAxisAlignment.center,
cacheKey: profile.profileImage, children: [
fit: BoxFit.cover, Expanded(
imageUrl: "${profile.profileImage}", flex: 2,
useOldImageOnUrlChange: false, child: SizedBox(
placeholder: child: Column(
(context, url) => mainAxisAlignment: MainAxisAlignment.center,
CircularProgressIndicator.adaptive(),
errorWidget: children: [
(context, url, error) => SizedBox(
Icon(Icons.error), width: 66,
), height: 66,
), child: ClipRRect(
), borderRadius: BorderRadius.circular(
50,
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
width: 13,
height: 13,
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
homescreen.onlineStatus ==
"Online"
? Colors.green
: Colors.yellow,
), ),
), child: CachedNetworkImage(
SizedBox(width: 6), cacheKey: profile.profileImage,
Text( fit: BoxFit.cover,
"${homescreen.onlineStatus}", imageUrl: "${profile.profileImage}",
style: TextStyle( useOldImageOnUrlChange: false,
fontSize: 16, placeholder:
fontFamily: "JakartaMedium", (context, url) =>
color: Color(0xFF2D2D2D), CircularProgressIndicator.adaptive(),
errorWidget:
(context, url, error) =>
Icon(Icons.error),
), ),
), ),
],
),
],
),
),
),
Expanded(
flex: 3,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${profile.employeeName}",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
fontSize: 18,
), ),
),
Text( Row(
"${profile.designation}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
Text(
"${profile.employeeeID}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
InkResponse(
onTap: () {
_showProfileBottomSheet(context);
},
child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Container(
width: 13,
height: 13,
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
homescreen.onlineStatus ==
"Online"
? Colors.green
: Colors.yellow,
),
),
SizedBox(width: 6),
Text( Text(
"View Profile", "${homescreen.onlineStatus}",
style: TextStyle( style: TextStyle(
color: AppColors.app_blue, fontSize: 16,
fontFamily: "JakartaRegular", fontFamily: "JakartaMedium",
fontSize: 14, color: Color(0xFF2D2D2D),
), ),
), ),
SizedBox(width: 5), ],
SizedBox( ),
width: 15, ],
height: 15, ),
child: Center( ),
child: SvgPicture.asset( ),
"assets/svg/next_button.svg", Expanded(
flex: 3,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${profile.employeeName}",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
fontSize: 18,
),
),
Text(
"${profile.designation}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
Text(
"${profile.employeeeID}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
InkResponse(
onTap: () {
_showProfileBottomSheet(context);
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
"View Profile",
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaRegular",
fontSize: 14,
), ),
), ),
), SizedBox(width: 5),
], SizedBox(
width: 15,
height: 15,
child: Center(
child: SvgPicture.asset(
"assets/svg/next_button.svg",
),
),
),
],
),
), ),
), ],
], ),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
), Expanded(
Expanded( flex: 8,
flex: 8, child: Container(
child: Container( padding: EdgeInsets.only(
padding: EdgeInsets.only( left: 20,
left: 20, right: 20,
right: 20, top: 0,
top: 0, bottom: 10,
bottom: 10, ),
), child: GridView.builder(
child: GridView.builder( itemCount: filteredItems.length,
itemCount: filteredItems.length, gridDelegate:
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2,
crossAxisCount: 2, crossAxisSpacing: 10,
crossAxisSpacing: 10, mainAxisSpacing: 10,
mainAxisSpacing: 10, ),
), itemBuilder: (context, index) {
itemBuilder: (context, index) { final item = filteredItems[index];
final item = filteredItems[index]; return InkResponse(
return InkResponse( onTap: () async {
onTap: () async { var res;
var res; switch (item['name']) {
switch (item['name']) { case "Attendance":
case "Attendance": res = await Navigator.push(
res = await Navigator.push( context,
context, MaterialPageRoute(
MaterialPageRoute( builder:
builder: (context) => AttendanceScreen(),
(context) => AttendanceScreen(), ),
), );
); break;
break; case "ERP":
case "ERP": bool isGpsEnabled =
bool isGpsEnabled = await Geolocator.isLocationServiceEnabled();
await Geolocator.isLocationServiceEnabled(); if (isGpsEnabled) {
if (isGpsEnabled) { if (Platform.isAndroid) {
if (Platform.isAndroid) { res = await Navigator.push(
res = await Navigator.push( context,
context, MaterialPageRoute(
MaterialPageRoute( builder:
builder: (context) => WebErpScreen(
(context) => WebErpScreen( erp_url:
erp_url: homescreen.webPageUrl,
homescreen.webPageUrl, ),
), ),
), );
); } else {
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => WebERPIOS(
url: homescreen.webPageUrl,
),
),
);
}
} else { } else {
requestGpsPermission();
}
break;
case "Gen Tracker":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Gentrackerdashboard(),
),
);
break;
case "Service Engineer":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Serviceengineerdashboard(),
),
);
break;
case "Nearby":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Nearbygenerators(),
),
);
break;
case "Inventory":
res = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InventoryScreen(),
),
);
break;
case "Whizzdom":
bool isGpsEnabled =
await Geolocator.isLocationServiceEnabled();
if (isGpsEnabled) {
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => WebERPIOS( (context) => WebWhizzdomScreen(
url: homescreen.webPageUrl, whizzdom_url:
homescreen.whizzdomPageUrl,
), ),
), ),
); );
} else {
requestGpsPermission();
} }
} else { break;
requestGpsPermission(); case "Common":
} res = await Navigator.push(
context,
break; MaterialPageRoute(
case "Gen Tracker": builder: (context) => Commondashboard(),
res = await Navigator.push( ),
context, );
MaterialPageRoute( break;
builder: case "Finance":
(context) => Gentrackerdashboard(),
),
);
break;
case "Service Engineer":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Serviceengineerdashboard(),
),
);
break;
case "Nearby":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Nearbygenerators(),
),
);
break;
case "Inventory":
res = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InventoryScreen(),
),
);
break;
case "Whizzdom":
bool isGpsEnabled =
await Geolocator.isLocationServiceEnabled();
if (isGpsEnabled) {
res = await Navigator.push( res = await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => WebWhizzdomScreen( (context) => Financedashboard(),
whizzdom_url:
homescreen.whizzdomPageUrl,
),
), ),
); );
} else { break;
requestGpsPermission(); case "Orders":
} res = await Navigator.push(
break; context,
case "Common": MaterialPageRoute(
res = await Navigator.push( builder:
context, (context) => Ordermoduledashboard(),
MaterialPageRoute( ),
builder: (context) => Commondashboard(), );
), default:
); print("111");
break; break;
case "Finance": }
res = await Navigator.push( if (res == true) {
context, homescreen.DashboardApiFunction(context);
MaterialPageRoute( }
builder: },
(context) => Financedashboard(), child: Container(
), decoration: BoxDecoration(
); color: Colors.white,
break; borderRadius: BorderRadius.circular(30),
case "Orders": ),
res = await Navigator.push( child: Column(
context, crossAxisAlignment: CrossAxisAlignment.center,
MaterialPageRoute( mainAxisAlignment: MainAxisAlignment.center,
builder: children: [
(context) => Ordermoduledashboard(), SvgPicture.asset(item['icon']!, height: 45),
), SizedBox(height: 10),
); Text(item['name']!),
default: ],
print("111"); ),
break;
}
if (res == true) {
homescreen.DashboardApiFunction(context);
}
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(item['icon']!, height: 45),
SizedBox(height: 10),
Text(item['name']!),
],
), ),
), );
); },
}, ),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -160,522 +160,524 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -160,522 +160,524 @@ class _LoginScreenState extends State<LoginScreen>
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: KeyboardVisibilityProvider( body: SafeArea(
controller: _keyboardVisibilityController, child: KeyboardVisibilityProvider(
child: Stack( controller: _keyboardVisibilityController,
alignment: Alignment.center, child: Stack(
children: [ alignment: Alignment.center,
// Background scrolling logos children: [
ListView.builder( // Background scrolling logos
controller: _scrollController, ListView.builder(
itemBuilder: (context, index) { controller: _scrollController,
int logoIndex = index % logos.length; itemBuilder: (context, index) {
return Padding( int logoIndex = index % logos.length;
padding: const EdgeInsets.all(3.0), return Padding(
child: CustomGridRow( padding: const EdgeInsets.all(3.0),
logos: logos, child: CustomGridRow(
logoIndex: logoIndex, logos: logos,
), logoIndex: logoIndex,
); ),
}, );
), },
AnimatedPositioned( ),
bottom: 0, AnimatedPositioned(
left: 0, bottom: 0,
right: 0, left: 0,
duration: Duration(milliseconds: 300), right: 0,
child: Container( duration: Duration(milliseconds: 300),
clipBehavior: Clip.antiAlias, child: Container(
decoration: BoxDecoration( clipBehavior: Clip.antiAlias,
gradient: LinearGradient( decoration: BoxDecoration(
begin: Alignment(-0.00, -1.00), gradient: LinearGradient(
end: Alignment(0, 1), begin: Alignment(-0.00, -1.00),
colors: [ end: Alignment(0, 1),
Colors.white.withOpacity(0.0), colors: [
// Fully transparent at the very top Colors.white.withOpacity(0.0),
Colors.white.withOpacity(0.3), // Fully transparent at the very top
// Light fade-in Colors.white.withOpacity(0.3),
Colors.white.withOpacity(0.6), // Light fade-in
// Mid fade Colors.white.withOpacity(0.6),
Colors.white, // Mid fade
// Solid white for the rest Colors.white,
], // Solid white for the rest
stops: [0.0, 0.05, 0.1, 0.15], ],
stops: [0.0, 0.05, 0.1, 0.15],
),
), ),
), child: SingleChildScrollView(
child: SingleChildScrollView( child: Stack(
child: Stack( alignment: Alignment.center,
alignment: Alignment.center, children: [
children: [ Container(
Container( alignment: Alignment.center,
alignment: Alignment.center, padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 15,
horizontal: 15, vertical: 10,
vertical: 10, ),
), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ AnimatedContainer(
AnimatedContainer( duration: const Duration(
duration: const Duration( milliseconds: 1200,
milliseconds: 1200, ),
), curve: Curves.easeInOut,
curve: Curves.easeInOut, child:
child: _isTextFieldFocused
_isTextFieldFocused ? Row(
? Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, children: [
children: [ Expanded(
Expanded( flex: 1,
flex: 1, child: SizedBox(width: 10),
child: SizedBox(width: 10),
),
Expanded(
flex: 2,
child: Image.asset(
"assets/images/gen_logo.png",
), ),
), Expanded(
const SizedBox(width: 10), flex: 2,
Expanded( child: Image.asset(
flex: 3, "assets/images/gen_logo.png",
child: Image.asset( ),
"assets/images/gen_logo_grad.png",
), ),
), const SizedBox(width: 10),
Expanded( Expanded(
flex: 1, flex: 3,
child: SizedBox(width: 10), child: Image.asset(
), "assets/images/gen_logo_grad.png",
], ),
)
: Column(
children: [
Container(
width: 180,
height: 120,
child: Image.asset(
"assets/images/gen_logo.png",
), ),
), Expanded(
Image.asset( flex: 1,
"assets/images/gen_logo_grad.png", child: SizedBox(width: 10),
width: 150, ),
), ],
], )
), : Column(
), children: [
SizedBox(height: 10), Container(
Text( width: 180,
"Login to enter", height: 120,
style: TextStyle( child: Image.asset(
fontSize: 14, "assets/images/gen_logo.png",
fontFamily: "JakartaMedium", ),
color: AppColors.app_blue, ),
), Image.asset(
), "assets/images/gen_logo_grad.png",
Container( width: 150,
padding: EdgeInsets.only( ),
left: 10, ],
bottom: 5, ),
), ),
alignment: Alignment.topLeft, SizedBox(height: 10),
child: Text( Text(
"Email ID", "Login to enter",
style: TextStyle( style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
), ),
), ),
), Container(
Container( padding: EdgeInsets.only(
height: 48, left: 10,
alignment: Alignment.center, bottom: 5,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
border:
_emailFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
15,
0,
), ),
child: TextField( alignment: Alignment.topLeft,
controller: email, child: Text(
keyboardType: "Email ID",
TextInputType.emailAddress, style: TextStyle(
minLines: 1, color: AppColors.semi_black,
focusNode: _emailFocusNode, fontFamily: "JakartaMedium",
style: TextStyle(fontSize: 14), fontSize: 14,
onChanged: (value) {
loginProv.updateEmail(email.text);
},
onTapOutside: (event) {
// Handle onTapOutside
FocusScope.of(context).unfocus();
},
decoration: InputDecoration(
isDense: true,
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181),
),
//contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: 'Enter Your Email',
), ),
), ),
), ),
),
if (loginProv.emailError != null) ...[
Container( Container(
alignment: Alignment.topLeft, height: 48,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
border:
_emailFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 2.5, left: 5.0,
bottom: 2.5, right: 5.0,
left: 25,
), ),
child: Text( child: Padding(
loginProv.emailError, padding: const EdgeInsets.fromLTRB(
textAlign: TextAlign.start, 10.0,
style: TextStyle(color: Colors.red), 0.0,
15,
0,
),
child: TextField(
controller: email,
keyboardType:
TextInputType.emailAddress,
minLines: 1,
focusNode: _emailFocusNode,
style: TextStyle(fontSize: 14),
onChanged: (value) {
loginProv.updateEmail(email.text);
},
onTapOutside: (event) {
// Handle onTapOutside
FocusScope.of(context).unfocus();
},
decoration: InputDecoration(
isDense: true,
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color(0xFF818181),
),
//contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
hintText: 'Enter Your Email',
),
),
), ),
), ),
] else ...[ if (loginProv.emailError != null) ...[
SizedBox(height: 10.0), Container(
], alignment: Alignment.topLeft,
Container( margin: EdgeInsets.only(
padding: EdgeInsets.only( top: 2.5,
left: 10, bottom: 2.5,
bottom: 5, left: 25,
), ),
alignment: Alignment.topLeft, child: Text(
child: Text( loginProv.emailError,
"Password", textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(color: Colors.red),
color: AppColors.semi_black, ),
fontFamily: "JakartaMedium",
fontSize: 14,
), ),
), ] else ...[
), SizedBox(height: 10.0),
Container( ],
height: 48, Container(
alignment: Alignment.center, padding: EdgeInsets.only(
decoration: BoxDecoration( left: 10,
color: AppColors.text_field_color, bottom: 5,
borderRadius: BorderRadius.circular(14),
border:
_passwordFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
10.0,
0.0,
0,
0,
), ),
child: TextField( alignment: Alignment.topLeft,
controller: password, child: Text(
focusNode: _passwordFocusNode, "Password",
obscureText: !loginProv.pwdVisible, style: TextStyle(
keyboardType: color: AppColors.semi_black,
TextInputType.visiblePassword, fontFamily: "JakartaMedium",
style: TextStyle(fontSize: 14), fontSize: 14,
onChanged: (value) {
loginProv.updatePassword(
password.text,
);
},
onEditingComplete: () {},
decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB(
0,
10,
0,
0,
),
hintText: "Enter Password",
suffixIcon: IconButton(
iconSize: 30,
icon:
loginProv.pwdVisible
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
loginProv.visibility_ov();
},
),
hintStyle: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
fontWeight: FontWeight.w400,
),
isDense: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
), ),
), ),
), ),
),
if (loginProv.passwordError != null) ...[
Container( Container(
alignment: Alignment.topLeft, height: 48,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
border:
_passwordFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 2.5, left: 5.0,
bottom: 2.5, right: 5.0,
left: 25,
), ),
child: Text( child: Padding(
loginProv.passwordError, padding: const EdgeInsets.fromLTRB(
textAlign: TextAlign.start, 10.0,
style: TextStyle(color: Colors.red), 0.0,
0,
0,
),
child: TextField(
controller: password,
focusNode: _passwordFocusNode,
obscureText: !loginProv.pwdVisible,
keyboardType:
TextInputType.visiblePassword,
style: TextStyle(fontSize: 14),
onChanged: (value) {
loginProv.updatePassword(
password.text,
);
},
onEditingComplete: () {},
decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB(
0,
10,
0,
0,
),
hintText: "Enter Password",
suffixIcon: IconButton(
iconSize: 30,
icon:
loginProv.pwdVisible
? SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
loginProv.visibility_ov();
},
),
hintStyle: TextStyle(
fontSize: 14,
color: Color(0xFF818181),
fontWeight: FontWeight.w400,
),
isDense: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
),
), ),
), ),
] else ...[ if (loginProv.passwordError != null) ...[
SizedBox(height: 25.0), Container(
], alignment: Alignment.topLeft,
Container(
child: InkWell(
onTap: () {
// LoginApiFunction();
loginProv.LoginApiFunction(
context,
email.text,
password.text,
);
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5.0, top: 2.5,
right: 5.0, bottom: 2.5,
left: 25,
), ),
decoration: BoxDecoration( child: Text(
color: loginProv.passwordError,
loginProv.isButtonEnabled textAlign: TextAlign.start,
? AppColors.app_blue style: TextStyle(color: Colors.red),
: AppColors.button_disabled,
//1487C9
borderRadius: BorderRadius.circular(
15.0,
),
), ),
child: Center( ),
child: Text( ] else ...[
"Login", SizedBox(height: 25.0),
textAlign: TextAlign.center, ],
style: TextStyle( Container(
color: Colors.white, child: InkWell(
fontFamily: "JakartaRegular", onTap: () {
// LoginApiFunction();
loginProv.LoginApiFunction(
context,
email.text,
password.text,
);
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
width: screenWidth,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
),
decoration: BoxDecoration(
color:
loginProv.isButtonEnabled
? AppColors.app_blue
: AppColors.button_disabled,
//1487C9
borderRadius: BorderRadius.circular(
15.0,
),
),
child: Center(
child: Text(
"Login",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaRegular",
),
), ),
), ),
), ),
), ),
), ),
), ],
], ),
), ),
), ],
], ),
), ),
), ),
), ),
), Positioned(
Positioned( top: 50,
top: 50, right: 20,
right: 20, child: InkResponse(
child: InkResponse( child: GestureDetector(
child: GestureDetector( onTap: () async {
onTap: () async { await tooltipcontroller.showTooltip();
await tooltipcontroller.showTooltip(); },
}, child: SuperTooltip(
child: SuperTooltip( controller: tooltipcontroller,
controller: tooltipcontroller, popupDirection: TooltipDirection.down,
popupDirection: TooltipDirection.down, backgroundColor: Colors.white,
backgroundColor: Colors.white, borderColor: Colors.white,
borderColor: Colors.white, showCloseButton: true,
showCloseButton: true, left: 50,
left: 50, right: 30,
right: 30, barrierColor: Colors.transparent,
barrierColor: Colors.transparent, arrowTipDistance: 20.0,
arrowTipDistance: 20.0, minimumOutsideMargin: 120,
minimumOutsideMargin: 120, arrowBaseWidth: 20.0,
arrowBaseWidth: 20.0, arrowLength: 20.0,
arrowLength: 20.0, borderWidth: 2.0,
borderWidth: 2.0, constraints: const BoxConstraints(
constraints: const BoxConstraints( minHeight: 0.0,
minHeight: 0.0, maxHeight: 100,
maxHeight: 100, minWidth: 0.0,
minWidth: 0.0, maxWidth: 100,
maxWidth: 100, ),
), touchThroughAreaShape: ClipAreaShape.rectangle,
touchThroughAreaShape: ClipAreaShape.rectangle, touchThroughAreaCornerRadius: 30,
touchThroughAreaCornerRadius: 30, content: Container(
content: Container( height: 100,
height: 100, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Text(
Text( "Device ID",
"Device ID", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", color: AppColors.app_blue,
color: AppColors.app_blue, ),
), ),
), SizedBox(height: 15),
SizedBox(height: 15), Row(
Row( mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, children: [
children: [ Container(
Container( height: 50,
height: 50, padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 10,
vertical: 10, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(18),
borderRadius: BorderRadius.circular(18), color: AppColors.text_field_color,
color: AppColors.text_field_color, ),
), child: Row(
child: Row( children: [
children: [ Container(
Container( width: 180,
width: 180, height: 45,
height: 45, alignment: Alignment.center,
alignment: Alignment.center, margin: EdgeInsets.only(right: 5.0),
margin: EdgeInsets.only(right: 5.0), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius:
borderRadius: BorderRadius.circular(10.0),
BorderRadius.circular(10.0), ),
), child: Text(
child: Text( '${loginProv.deviceId}',
'${loginProv.deviceId}', style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, color: AppColors.semi_black,
color: AppColors.semi_black, ),
), ),
), ),
), Container(
Container( child: InkWell(
child: InkWell( onTap: () async {
onTap: () async { Clipboard.setData(
Clipboard.setData( ClipboardData(
ClipboardData( text:
text: loginProv.deviceId
loginProv.deviceId .trim(),
.trim(), ),
), );
); toast(
toast( context,
context, "Device ID has been copied!",
"Device ID has been copied!", );
); },
}, child: SvgPicture.asset(
child: SvgPicture.asset( "assets/svg/copy_ic.svg",
"assets/svg/copy_ic.svg", ),
), ),
), ),
), ],
], ),
),
),
Spacer(),
Container(
width: 60,
height: 50,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(18),
), ),
child: InkWell( Spacer(),
onTap: () { Container(
Share.share("${loginProv.deviceId}"); width: 60,
}, height: 50,
child: SvgPicture.asset( decoration: BoxDecoration(
"assets/svg/share_ic.svg", color: AppColors.app_blue,
height: 25, borderRadius: BorderRadius.circular(18),
width: 25, ),
fit: BoxFit.scaleDown, child: InkWell(
onTap: () {
Share.share("${loginProv.deviceId}");
},
child: SvgPicture.asset(
"assets/svg/share_ic.svg",
height: 25,
width: 25,
fit: BoxFit.scaleDown,
),
), ),
), ),
), ],
], ),
), ],
],
),
),
child: Align(
alignment: Alignment.topRight,
child: Container(
width: 100,
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
), ),
decoration: BoxDecoration( ),
color: AppColors.overlay_box_color, child: Align(
borderRadius: BorderRadius.circular(8), alignment: Alignment.topRight,
border: Border.all( child: Container(
color: AppColors.app_blue, width: 100,
width: 0.5, padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
), ),
), decoration: BoxDecoration(
child: Center( color: AppColors.overlay_box_color,
child: Text( borderRadius: BorderRadius.circular(8),
"Device ID", border: Border.all(
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.app_blue, color: AppColors.app_blue,
fontSize: 14, width: 0.5,
),
),
child: Center(
child: Text(
"Device ID",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
), ),
), ),
), ),
...@@ -684,8 +686,8 @@ class _LoginScreenState extends State<LoginScreen> ...@@ -684,8 +686,8 @@ class _LoginScreenState extends State<LoginScreen>
), ),
), ),
), ),
), ],
], ),
), ),
), ),
// bottomNavigationBar: , // bottomNavigationBar: ,
......
...@@ -24,48 +24,50 @@ class _ScannerloginState extends State<Scannerlogin> { ...@@ -24,48 +24,50 @@ class _ScannerloginState extends State<Scannerlogin> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "QR Login"), appBar: appbar(context, "QR Login"),
body: Container( body: SafeArea(
decoration: BoxDecoration(color: Colors.black), child: Container(
child: Column( decoration: BoxDecoration(color: Colors.black),
children: [ child: Column(
Spacer(), children: [
Container( Spacer(),
height: 250, Container(
height: 250,
child: QRView(
child: QRView(
key: provider.scannerKey,
onQRViewCreated: (p0) { key: provider.scannerKey,
provider.onQRViewCreated(p0, context); onQRViewCreated: (p0) {
}, provider.onQRViewCreated(p0, context);
formatsAllowed: [BarcodeFormat.qrcode], },
cameraFacing: CameraFacing.back, formatsAllowed: [BarcodeFormat.qrcode],
cameraFacing: CameraFacing.back,
overlay: QrScannerOverlayShape(
overlay: QrScannerOverlayShape(
borderColor: AppColors.app_blue,
borderRadius: 20, borderColor: AppColors.app_blue,
borderLength: 60, borderRadius: 20,
borderWidth: 10, borderLength: 60,
cutOutSize: 250.0, borderWidth: 10,
cutOutSize: 250.0,
),
), ),
), ),
), SizedBox(height: 25),
SizedBox(height: 25), Text(
Text( "Scan QR",
"Scan QR", textAlign: TextAlign.center,
textAlign: TextAlign.center, style: TextStyle(fontSize: 18, color: Colors.white),
style: TextStyle(fontSize: 18, color: Colors.white), ),
), Text(
Text( "to Login",
"to Login", textAlign: TextAlign.center,
textAlign: TextAlign.center, style: TextStyle(fontSize: 14, color: Colors.white),
style: TextStyle(fontSize: 14, color: Colors.white), ),
), Spacer(),
Spacer(),
SizedBox(height: 50),
SizedBox(height: 50), ],
], ),
), ),
), ),
), ),
......
...@@ -19,124 +19,126 @@ class UpdatePassword extends StatelessWidget { ...@@ -19,124 +19,126 @@ class UpdatePassword extends StatelessWidget {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Update Password"), appBar: appbar(context, "Update Password"),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: Container( body: SafeArea(
child: Column( child: Container(
children: [ child: Column(
Expanded( children: [
child: Container( Expanded(
width: double.infinity, child: Container(
decoration: BoxDecoration( width: double.infinity,
borderRadius: BorderRadius.vertical( decoration: BoxDecoration(
top: Radius.circular(30.0), borderRadius: BorderRadius.vertical(
top: Radius.circular(30.0),
),
), ),
), padding: EdgeInsets.all(10),
padding: EdgeInsets.all(10), child: Column(
child: Column( children: [
children: [ Container(
Container( height: 280,
height: 280, decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, borderRadius: BorderRadius.circular(20.0),
borderRadius: BorderRadius.circular(20.0), ),
), child: Column(
child: Column( children: [
children: [ SizedBox(height: 10),
SizedBox(height: 10), Container(
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("New Password",style: TextStyle(
color: AppColors.semi_black
),)),
SizedBox(height: 5),
_buildTextField(
controller: provider.password,
hintText: "New Password*",
errorText: provider.passwordError,
obscureText: !provider.pwdVisible,
suffixIcon: IconButton(
icon:
provider.pwdVisible
?SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
)
: SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
provider.pwdVisibility();
},
),
onChanged: provider.onChangePassword
),
SizedBox(height: 10),
Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
padding: EdgeInsets.symmetric(horizontal: 10), padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("Confirm Password",style: TextStyle( child: Text("New Password",style: TextStyle(
color: AppColors.semi_black color: AppColors.semi_black
),)), ),)),
SizedBox(height: 5), SizedBox(height: 5),
_buildTextField( _buildTextField(
controller: provider.confPassword,
hintText: "Confirm New Password*", controller: provider.password,
errorText: provider.confirmPasswordError, hintText: "New Password*",
obscureText: !provider.confPwdVisible, errorText: provider.passwordError,
obscureText: !provider.pwdVisible,
suffixIcon: IconButton( suffixIcon: IconButton(
iconSize: 30, icon:
icon: provider.confPwdVisible?SvgPicture.asset( provider.pwdVisible
width: 35, ?SvgPicture.asset(
height: 35, width: 35,
"assets/svg/password_visible.svg", height: 35,
) "assets/svg/password_visible.svg",
: SvgPicture.asset( )
width: 35, : SvgPicture.asset(
height: 35, width: 35,
"assets/svg/password_invisible.svg", height: 35,
), "assets/svg/password_invisible.svg",
),
onPressed: () { onPressed: () {
provider.confPwdVisibility(); provider.pwdVisibility();
}, },
), ),
onChanged: provider.onChangeConfPassword onChanged: provider.onChangePassword
), ),
Spacer(), SizedBox(height: 10),
InkWell( Container(
onTap: () => provider.updatePassword(context), alignment: Alignment.topLeft,
child: Container( padding: EdgeInsets.symmetric(horizontal: 10),
alignment: Alignment.center, child: Text("Confirm Password",style: TextStyle(
height: 45, color: AppColors.semi_black
margin: EdgeInsets.symmetric(horizontal: 15), ),)),
decoration: BoxDecoration( SizedBox(height: 5),
color: AppColors.app_blue, _buildTextField(
borderRadius: BorderRadius.circular(15.0), controller: provider.confPassword,
), hintText: "Confirm New Password*",
child:provider.isLoading errorText: provider.confirmPasswordError,
? CircularProgressIndicator( obscureText: !provider.confPwdVisible,
color: Colors.white, suffixIcon: IconButton(
padding: EdgeInsets.all(7.5), iconSize: 30,
icon: provider.confPwdVisible?SvgPicture.asset(
width: 35,
height: 35,
"assets/svg/password_visible.svg",
) )
: Text( : SvgPicture.asset(
"Update", width: 35,
style: TextStyle(color: Colors.white), height: 35,
"assets/svg/password_invisible.svg",
),
onPressed: () {
provider.confPwdVisibility();
},
),
onChanged: provider.onChangeConfPassword
),
Spacer(),
InkWell(
onTap: () => provider.updatePassword(context),
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child:provider.isLoading
? CircularProgressIndicator(
color: Colors.white,
padding: EdgeInsets.all(7.5),
)
: Text(
"Update",
style: TextStyle(color: Colors.white),
),
), ),
), ),
), SizedBox(height: 10),
SizedBox(height: 10), ],
], ),
), ),
), ],
], ),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -87,190 +87,192 @@ class _WebERPIOSState extends State<WebERPIOS> { ...@@ -87,190 +87,192 @@ class _WebERPIOSState extends State<WebERPIOS> {
}, },
child: Scaffold( child: Scaffold(
appBar: appbar(context, "Web ERP"), appBar: appbar(context, "Web ERP"),
body: Container( body: SafeArea(
child: Column( child: Container(
children: <Widget>[ child: Column(
Expanded( children: <Widget>[
child: Stack( Expanded(
children: [ child: Stack(
InAppWebView( children: [
initialUrlRequest: URLRequest( InAppWebView(
url: WebUri(widget.url.toString()), initialUrlRequest: URLRequest(
), url: WebUri(widget.url.toString()),
androidOnGeolocationPermissionsShowPrompt: ( ),
InAppWebViewController controller, androidOnGeolocationPermissionsShowPrompt: (
String origin, InAppWebViewController controller,
) async { String origin,
return GeolocationPermissionShowPromptResponse( ) async {
origin: origin, return GeolocationPermissionShowPromptResponse(
allow: true, origin: origin,
retain: true, allow: true,
); retain: true,
}, );
initialOptions: InAppWebViewGroupOptions( },
android: AndroidInAppWebViewOptions( initialOptions: InAppWebViewGroupOptions(
useWideViewPort: true, android: AndroidInAppWebViewOptions(
loadWithOverviewMode: true, useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
initialSettings: InAppWebViewSettings(
javaScriptEnabled: true,
allowFileAccess: true,
allowContentAccess: true, allowContentAccess: true,
clearCache: true,
blockNetworkLoads: false,
networkAvailable: true,
useOnLoadResource: true,
thirdPartyCookiesEnabled: true,
supportZoom: false,
geolocationEnabled: true, geolocationEnabled: true,
allowFileAccess: true, safeBrowsingEnabled: false,
databaseEnabled: true, // Enables the WebView database saveFormData: true,
domStorageEnabled: true, // Enables DOM storage allowFileAccessFromFileURLs: true,
builtInZoomControls: useWideViewPort: true,
true, // Enables the built-in zoom controls databaseEnabled: true,
displayZoomControls: domStorageEnabled: true,
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true, allowsBackForwardNavigationGestures: true,
allowUniversalAccessFromFileURLs: true,
allowsLinkPreview: true,
), ),
), onPermissionRequest: (controller, request) async {
return PermissionResponse(
androidOnPermissionRequest: ( resources: request.resources,
InAppWebViewController controller, action: PermissionResponseAction.GRANT,
String origin, );
List<String> resources, },
) async { keepAlive: InAppWebViewKeepAlive(),
return PermissionRequestResponse( // initialData:
resources: resources, // InAppWebViewInitialData(baseUrl: WebUri(widget.url),data: ),
action: PermissionRequestResponseAction.GRANT, onWebViewCreated: (controller) {
); webViewController = controller;
}, _controller.complete(controller);
initialSettings: InAppWebViewSettings( },
javaScriptEnabled: true, pullToRefreshController: pullToRefreshController,
allowFileAccess: true, shouldOverrideUrlLoading: (
allowContentAccess: true, controller,
clearCache: true, navigationAction,
blockNetworkLoads: false, ) async {
networkAvailable: true, var uri = navigationAction.request.url!;
useOnLoadResource: true, print("urib scgefes");
thirdPartyCookiesEnabled: true, print(uri);
supportZoom: false, print(uri.scheme);
geolocationEnabled: true, if (uri.scheme == "tel") {
safeBrowsingEnabled: false, // Launch the phone dialer app with the specified phone number
saveFormData: true, if (await canLaunch(uri.toString())) {
allowFileAccessFromFileURLs: true, await launch(uri.toString());
useWideViewPort: true, return NavigationActionPolicy.CANCEL;
databaseEnabled: true, }
domStorageEnabled: true, } else if (uri.scheme == "mailto") {
allowsBackForwardNavigationGestures: true, if (await canLaunch(uri.toString())) {
allowUniversalAccessFromFileURLs: true, await launch(uri.toString());
allowsLinkPreview: true, return NavigationActionPolicy.CANCEL;
), }
onPermissionRequest: (controller, request) async { } else if (uri.scheme == "whatsapp") {
return PermissionResponse( // Launch WhatsApp with the specified chat or phone number
resources: request.resources, if (await canLaunch(uri.toString())) {
action: PermissionResponseAction.GRANT, await launch(uri.toString());
); return NavigationActionPolicy.CANCEL;
}, }
keepAlive: InAppWebViewKeepAlive(),
// initialData:
// InAppWebViewInitialData(baseUrl: WebUri(widget.url),data: ),
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
} }
} // // Check if the URL is trying to access the camera for image upload
// // Check if the URL is trying to access the camera for image upload // if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) { // // Handle camera image upload here
// // Handle camera image upload here // // You might want to display a custom UI for image selection or directly trigger the camera
// // You might want to display a custom UI for image selection or directly trigger the camera // // You can use platform-specific plugins like image_picker for this purpose
// // You can use platform-specific plugins like image_picker for this purpose // // Once the image is selected, you can pass it to the web view using JavaScript injection
// // Once the image is selected, you can pass it to the web view using JavaScript injection // if (await canLaunch(uri.toString())) {
// if (await canLaunch(uri.toString())) { // await launch(uri.toString());
// await launch(uri.toString()); // return NavigationActionPolicy.CANCEL;
// return NavigationActionPolicy.CANCEL; // }
// } // }
// } return NavigationActionPolicy.ALLOW;
return NavigationActionPolicy.ALLOW; },
},
onLoadStart: (controller, url) {
onLoadStart: (controller, url) { return setState(() {
return setState(() { isLoading = true;
isLoading = true; });
}); },
}, onLoadStop: (controller, url) {
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing(); pullToRefreshController?.endRefreshing();
} return setState(() {
}, isLoading = false;
), });
if (isLoading) ...[ },
Container( onReceivedError: (controller, request, error) {
color: Colors.white.withOpacity(0.7), pullToRefreshController?.endRefreshing();
child: Column( },
crossAxisAlignment: CrossAxisAlignment.center, onProgressChanged: (controller, progress) {
mainAxisAlignment: MainAxisAlignment.center, if (progress == 100) {
children: [ pullToRefreshController?.endRefreshing();
SpinKitRing( }
color: AppColors.app_blue, },
lineWidth: 4, ),
// duration: Duration(seconds: 2), if (isLoading) ...[
size: 50, Container(
), color: Colors.white.withOpacity(0.7),
const SizedBox(height: 15), child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.center,
width: 200, mainAxisAlignment: MainAxisAlignment.center,
child: Text( children: [
"Please wait.......", SpinKitRing(
textAlign: TextAlign.center, color: AppColors.app_blue,
style: TextStyle( lineWidth: 4,
decorationThickness: 0, // duration: Duration(seconds: 2),
fontSize: 15, size: 50,
fontWeight: FontWeight.normal, ),
color: AppColors.app_blue, const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
),
), ),
), ),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
// SvgPicture.asset("/assets/images/NutsLoader.gif") ],
], ),
), ),
), ],
], ],
], ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -117,331 +117,333 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -117,331 +117,333 @@ class _WebErpScreenState extends State<WebErpScreen> {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Web ERP"), appBar: appbar(context, "Web ERP"),
body: Container( body: SafeArea(
child: Column( child: Container(
children: <Widget>[ child: Column(
Expanded( children: <Widget>[
child: Stack( Expanded(
children: [ child: Stack(
InAppWebView( children: [
initialUrlRequest: URLRequest( InAppWebView(
url: WebUri(widget.erp_url), initialUrlRequest: URLRequest(
allowsCellularAccess: true, url: WebUri(widget.erp_url),
allowsConstrainedNetworkAccess: true, allowsCellularAccess: true,
allowsExpensiveNetworkAccess: true, allowsConstrainedNetworkAccess: true,
), allowsExpensiveNetworkAccess: true,
androidOnGeolocationPermissionsShowPrompt: ( ),
InAppWebViewController controller, androidOnGeolocationPermissionsShowPrompt: (
String origin, InAppWebViewController controller,
) async { String origin,
return GeolocationPermissionShowPromptResponse( ) async {
origin: origin, return GeolocationPermissionShowPromptResponse(
allow: true, origin: origin,
retain: true, allow: true,
); retain: true,
}, );
initialOptions: InAppWebViewGroupOptions( },
android: AndroidInAppWebViewOptions( initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
clearSessionCache: true,
loadsImagesAutomatically: true,
thirdPartyCookiesEnabled: true,
blockNetworkImage: false,
supportMultipleWindows: true,
blockNetworkLoads: false,
networkAvailable: true,
useShouldInterceptRequest:true,
hardwareAcceleration: true
// Enable camera access
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
useOnDownloadStart: true,
allowFileAccessFromFileURLs: true,
allowUniversalAccessFromFileURLs: true,
mediaPlaybackRequiresUserGesture: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) {
_webViewController = controller;
_controller.complete(controller);
_webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface',
callback: (args) {
print(
"JavaScript called MobileAppJavascriptInterface with args: $args",
);
return {'status': 'success'};
},
);
_webViewController!.addJavaScriptHandler(
handlerName: 'downloadFile',
callback: (args) async {
if (Platform.isAndroid) {
final url = args[0] as String;
await _handleDownload(
url,
'',
'application/octet-stream',
'',
);
}
},
);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
initialSettings: InAppWebViewSettings(
allowUniversalAccessFromFileURLs: true,
allowFileAccessFromFileURLs: true,
allowFileAccess: true,
allowsInlineMediaPlayback: true,
allowsPictureInPictureMediaPlayback: true,
allowsBackForwardNavigationGestures: true,
iframeAllow: "camera;microphone;files;media;",
domStorageEnabled: true,
allowContentAccess: true,
javaScriptEnabled: true,
supportZoom: true,
builtInZoomControls: true,
displayZoomControls: false,
textZoom: 125,
blockNetworkImage: false,
loadsImagesAutomatically: true,
safeBrowsingEnabled: true,
useWideViewPort: true, useWideViewPort: true,
loadWithOverviewMode: true, loadWithOverviewMode: true,
allowContentAccess: true, javaScriptCanOpenWindowsAutomatically: true,
mediaPlaybackRequiresUserGesture: false,
geolocationEnabled: true, geolocationEnabled: true,
allowFileAccess: true, useOnDownloadStart: true,
allowsLinkPreview: true,
databaseEnabled: true, // Enables the WebView database databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
clearSessionCache: true, clearSessionCache: true,
loadsImagesAutomatically: true, mediaType: "image/*,application/pdf",
thirdPartyCookiesEnabled: true,
blockNetworkImage: false,
supportMultipleWindows: true,
blockNetworkLoads: false,
networkAvailable: true,
useShouldInterceptRequest:true, useShouldInterceptRequest:true,
hardwareAcceleration: true hardwareAcceleration: true
// Enable camera access
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
useOnDownloadStart: true,
allowFileAccessFromFileURLs: true,
allowUniversalAccessFromFileURLs: true,
mediaPlaybackRequiresUserGesture: true,
), ),
), shouldInterceptRequest: (controller, request) async {
final url = request.url.toString();
androidOnPermissionRequest: ( print('Intercepting request: $url, Headers: ${request.headers}');
InAppWebViewController controller, if (url.endsWith('.pdf')) {
String origin, final response = await http.get(Uri.parse(url), headers: {
List<String> resources, 'Accept': 'application/pdf',
) async { });
return PermissionRequestResponse( if (response.statusCode == 200 && response.headers['content-type']?.contains('application/pdf') == true) {
resources: resources, return WebResourceResponse(
action: PermissionRequestResponseAction.GRANT, contentType: 'application/pdf',
); data: response.bodyBytes,
},
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
onWebViewCreated: (controller) {
_webViewController = controller;
_controller.complete(controller);
_webViewController!.addJavaScriptHandler(
handlerName: 'MobileAppJavascriptInterface',
callback: (args) {
print(
"JavaScript called MobileAppJavascriptInterface with args: $args",
);
return {'status': 'success'};
},
);
_webViewController!.addJavaScriptHandler(
handlerName: 'downloadFile',
callback: (args) async {
if (Platform.isAndroid) {
final url = args[0] as String;
await _handleDownload(
url,
'',
'application/octet-stream',
'',
); );
} else {
print('Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}');
} }
},
);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
initialSettings: InAppWebViewSettings(
allowUniversalAccessFromFileURLs: true,
allowFileAccessFromFileURLs: true,
allowFileAccess: true,
allowsInlineMediaPlayback: true,
allowsPictureInPictureMediaPlayback: true,
allowsBackForwardNavigationGestures: true,
iframeAllow: "camera;microphone;files;media;",
domStorageEnabled: true,
allowContentAccess: true,
javaScriptEnabled: true,
supportZoom: true,
builtInZoomControls: true,
displayZoomControls: false,
textZoom: 125,
blockNetworkImage: false,
loadsImagesAutomatically: true,
safeBrowsingEnabled: true,
useWideViewPort: true,
loadWithOverviewMode: true,
javaScriptCanOpenWindowsAutomatically: true,
mediaPlaybackRequiresUserGesture: false,
geolocationEnabled: true,
useOnDownloadStart: true,
allowsLinkPreview: true,
databaseEnabled: true, // Enables the WebView database
clearSessionCache: true,
mediaType: "image/*,application/pdf",
useShouldInterceptRequest:true,
hardwareAcceleration: true
),
shouldInterceptRequest: (controller, request) async {
final url = request.url.toString();
print('Intercepting request: $url, Headers: ${request.headers}');
if (url.endsWith('.pdf')) {
final response = await http.get(Uri.parse(url), headers: {
'Accept': 'application/pdf',
});
if (response.statusCode == 200 && response.headers['content-type']?.contains('application/pdf') == true) {
return WebResourceResponse(
contentType: 'application/pdf',
data: response.bodyBytes,
);
} else {
print('Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}');
}
}
return null;
},
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.toString().contains('file_viewer_n ame.php') && uri.toString().contains('.pdf')) {
final pdfPath = Uri.parse(uri.toString()).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(urlRequest: URLRequest(url: WebUri(pdfUrl)));
return NavigationActionPolicy.CANCEL;
}
}
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
} }
} else if (uri.scheme == "mailto") { return null;
if (await canLaunch(uri.toString())) { },
await launch(uri.toString()); shouldOverrideUrlLoading: (
return NavigationActionPolicy.CANCEL; controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.toString().contains('file_viewer_n ame.php') && uri.toString().contains('.pdf')) {
final pdfPath = Uri.parse(uri.toString()).queryParameters['file_path'];
if (pdfPath != null) {
final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
await controller.loadUrl(urlRequest: URLRequest(url: WebUri(pdfUrl)));
return NavigationActionPolicy.CANCEL;
}
} }
} else if (uri.scheme == "whatsapp") { if (uri.scheme == "tel") {
// Launch WhatsApp with the specified chat or phone number // Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) { if (await canLaunch(uri.toString())) {
await launch(uri.toString()); await launch(uri.toString());
return NavigationActionPolicy.CANCEL; return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} }
} // // Check if the URL is trying to access the camera for image upload
// // Check if the URL is trying to access the camera for image upload // if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) { // // Handle camera image upload here
// // Handle camera image upload here // // You might want to display a custom UI for image selection or directly trigger the camera
// // You might want to display a custom UI for image selection or directly trigger the camera // // You can use platform-specific plugins like image_picker for this purpose
// // You can use platform-specific plugins like image_picker for this purpose // // Once the image is selected, you can pass it to the web view using JavaScript injection
// // Once the image is selected, you can pass it to the web view using JavaScript injection // if (await canLaunch(uri.toString())) {
// if (await canLaunch(uri.toString())) { // await launch(uri.toString());
// await launch(uri.toString()); // return NavigationActionPolicy.CANCEL;
// return NavigationActionPolicy.CANCEL; // }
// } // }
// } return NavigationActionPolicy.ALLOW;
return NavigationActionPolicy.ALLOW; },
},
onLoadStop: (controller, url) async {
onLoadStop: (controller, url) async { if (url.toString().contains('file_viewer_name.php') && url.toString().contains('.pdf')) {
if (url.toString().contains('file_viewer_name.php') && url.toString().contains('.pdf')) { final uri = Uri.parse(url.toString());
final uri = Uri.parse(url.toString()); final pdfPath = uri.queryParameters['file_path'];
final pdfPath = uri.queryParameters['file_path']; if (pdfPath != null) {
if (pdfPath != null) { final pdfUrl = 'https://erp.gengroup.in/$pdfPath';
final pdfUrl = 'https://erp.gengroup.in/$pdfPath'; await controller.evaluateJavascript(source: '''
await controller.evaluateJavascript(source: ''' var pdfjsLib = window.pdfjsLib || document.createElement('script');
var pdfjsLib = window.pdfjsLib || document.createElement('script'); pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js';
pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js'; document.head.appendChild(pdfjsLib);
document.head.appendChild(pdfjsLib); pdfjsLib.onload = function() {
pdfjsLib.onload = function() { pdfjsLib.getDocument('$pdfUrl').promise.then(function(pdf) {
pdfjsLib.getDocument('$pdfUrl').promise.then(function(pdf) { pdf.getPage(1).then(function(page) {
pdf.getPage(1).then(function(page) { var canvas = document.createElement('canvas');
var canvas = document.createElement('canvas'); document.body.appendChild(canvas);
document.body.appendChild(canvas); var context = canvas.getContext('2d');
var context = canvas.getContext('2d'); var viewport = page.getViewport({ scale: 1.0 });
var viewport = page.getViewport({ scale: 1.0 }); canvas.height = viewport.height;
canvas.height = viewport.height; canvas.width = viewport.width;
canvas.width = viewport.width; page.render({
page.render({ canvasContext: context,
canvasContext: context, viewport: viewport
viewport: viewport });
}); });
}).catch(function(error) {
console.error('PDF.js error: ' + error);
}); });
}).catch(function(error) { };
console.error('PDF.js error: ' + error); ''');
}); }
};
''');
} }
}
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing(); pullToRefreshController?.endRefreshing();
} return setState(() {
}, isLoading = false;
onConsoleMessage: (controller, consoleMessage) { });
if (kDebugMode) { },
debugPrint("consoleMessage${consoleMessage}"); onReceivedError: (controller, request, error) {
} pullToRefreshController?.endRefreshing();
debugPrint( return setState(() {
"JavaScript console message: ${consoleMessage.message}", isLoading = false;
); });
}, },
// onDownloadStartRequest: (controller, url) async { onProgressChanged: (controller, progress) {
// await ApiCalling.download_files( if (progress == 100) {
// empId, sessionId, "${url.url}", context) pullToRefreshController?.endRefreshing();
// .then((data) => {debugPrint(data)}); }
// },
// }, onConsoleMessage: (controller, consoleMessage) {
onDownloadStartRequest: ( if (kDebugMode) {
controller, debugPrint("consoleMessage${consoleMessage}");
downloadStartRequest, }
) async { debugPrint(
if (Platform.isAndroid) { "JavaScript console message: ${consoleMessage.message}",
await _handleDownload(
downloadStartRequest.url.toString(),
downloadStartRequest.suggestedFilename!,
downloadStartRequest.mimeType ??
'application/octet-stream',
downloadStartRequest.suggestedFilename ?? '',
); );
} },
}, // onDownloadStartRequest: (controller, url) async {
// await ApiCalling.download_files(
), // empId, sessionId, "${url.url}", context)
if (isLoading) ...[ // .then((data) => {debugPrint(data)});
Container( //
color: Colors.white.withOpacity(0.7), // },
child: Column( onDownloadStartRequest: (
crossAxisAlignment: CrossAxisAlignment.center, controller,
mainAxisAlignment: MainAxisAlignment.center, downloadStartRequest,
children: [ ) async {
SpinKitRing( if (Platform.isAndroid) {
color: AppColors.app_blue, await _handleDownload(
lineWidth: 4, downloadStartRequest.url.toString(),
// duration: Duration(seconds: 2), downloadStartRequest.suggestedFilename!,
size: 50, downloadStartRequest.mimeType ??
), 'application/octet-stream',
const SizedBox(height: 15), downloadStartRequest.suggestedFilename ?? '',
SizedBox( );
width: 200, }
child: Text( },
"Please wait.......",
textAlign: TextAlign.center, ),
style: TextStyle( if (isLoading) ...[
decorationThickness: 0, Container(
fontSize: 15, color: Colors.white.withOpacity(0.7),
fontWeight: FontWeight.normal, child: Column(
color: AppColors.app_blue, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
),
), ),
), ),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
// SvgPicture.asset("/assets/images/NutsLoader.gif") ],
], ),
), ),
), ],
], ],
], ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -80,109 +80,111 @@ class _WebWhizzdomScreenState extends State<WebWhizzdomScreen> { ...@@ -80,109 +80,111 @@ class _WebWhizzdomScreenState extends State<WebWhizzdomScreen> {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Whizzdom"), appBar: appbar(context, "Whizzdom"),
body: Container( body: SafeArea(
child: Column(children: <Widget>[ child: Container(
Expanded( child: Column(children: <Widget>[
child: Stack( Expanded(
children: [ child: Stack(
InAppWebView( children: [
initialUrlRequest: URLRequest( InAppWebView(
url: WebUri(widget.whizzdom_url), initialUrlRequest: URLRequest(
), url: WebUri(widget.whizzdom_url),
androidOnGeolocationPermissionsShowPrompt:
(InAppWebViewController controller, String origin) async {
return GeolocationPermissionShowPromptResponse(
origin: origin, allow: true, retain: true);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
clearSessionCache: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
), ),
), androidOnGeolocationPermissionsShowPrompt:
(InAppWebViewController controller, String origin) async {
return GeolocationPermissionShowPromptResponse(
androidOnPermissionRequest: (InAppWebViewController controller, origin: origin, allow: true, retain: true);
String origin, List<String> resources) async { },
return PermissionRequestResponse( initialOptions: InAppWebViewGroupOptions(
resources: resources, android: AndroidInAppWebViewOptions(
action: PermissionRequestResponseAction.GRANT); useWideViewPort: true,
}, loadWithOverviewMode: true,
onWebViewCreated: (controller) { allowContentAccess: true,
webViewController = controller; geolocationEnabled: true,
_controller.complete(controller); allowFileAccess: true,
}, databaseEnabled: true, // Enables the WebView database
pullToRefreshController: pullToRefreshController, domStorageEnabled: true, // Enables DOM storage
onLoadStart: (controller, url) { builtInZoomControls:
return setState(() { true, // Enables the built-in zoom controls
isLoading = true; displayZoomControls:
}); false, // Disables displaying zoom controls
}, safeBrowsingEnabled: true, // Enables Safe Browsing
onLoadStop: (controller, url) { clearSessionCache: true,
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
),
if (isLoading) ...[Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
), ),
const SizedBox( ios: IOSInAppWebViewOptions(
height: 15, allowsInlineMediaPlayback: true,
),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue),
),
), ),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
androidOnPermissionRequest: (InAppWebViewController controller,
String origin, List<String> resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);
},
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
), ),
)] if (isLoading) ...[Container(
], color: Colors.white.withOpacity(0.7),
)) child: Column(
])), crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(
height: 15,
),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
)]
],
))
])),
),
), ),
); );
} }
......
...@@ -94,11 +94,11 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -94,11 +94,11 @@ class _AccountledgerState extends State<Accountledger> {
), ),
), ),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: provider.isLoading body: SafeArea(child: provider.isLoading
? Center(child: CircularProgressIndicator.adaptive( ? Center(child: CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation<Color>( valueColor: AlwaysStoppedAnimation<Color>(
AppColors.app_blue) AppColors.app_blue)
)):Container( )):SizedBox(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -427,7 +427,7 @@ class _AccountledgerState extends State<Accountledger> { ...@@ -427,7 +427,7 @@ class _AccountledgerState extends State<Accountledger> {
], ],
), ),
), ),
), )),
), ),
onWillPop: () { onWillPop: () {
return _onBackPressed(context); return _onBackPressed(context);
......
...@@ -53,7 +53,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -53,7 +53,7 @@ class _AccountslistState extends State<Accountslist> {
), ),
),), ),),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body:accountList.isNotEmpty? Container( body:SafeArea(child: accountList.isNotEmpty? SizedBox(
child: SingleChildScrollView( child: SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Column( child: Column(
...@@ -117,7 +117,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -117,7 +117,7 @@ class _AccountslistState extends State<Accountslist> {
child: SizedBox( child: SizedBox(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
accountList[index].name!, accountList[index].name!,
...@@ -161,7 +161,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -161,7 +161,7 @@ class _AccountslistState extends State<Accountslist> {
padding: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(vertical: 5),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
...@@ -196,8 +196,8 @@ class _AccountslistState extends State<Accountslist> { ...@@ -196,8 +196,8 @@ class _AccountslistState extends State<Accountslist> {
MaterialPageRoute( MaterialPageRoute(
builder: builder:
(context) => Accountslistdetails( (context) => Accountslistdetails(
accountID: accountList[index].id, accountID: accountList[index].id,
), ),
), ),
); );
}, },
...@@ -205,7 +205,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -205,7 +205,7 @@ class _AccountslistState extends State<Accountslist> {
padding: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(vertical: 5),
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
...@@ -232,7 +232,7 @@ class _AccountslistState extends State<Accountslist> { ...@@ -232,7 +232,7 @@ class _AccountslistState extends State<Accountslist> {
], ],
), ),
), ),
):Emptywidget(context), ):Emptywidget(context),)
), ),
onWillPop: () { onWillPop: () {
provider.pageNum = 1; provider.pageNum = 1;
......
...@@ -68,413 +68,415 @@ class _AccountslistdetailsState extends State<Accountslistdetails> { ...@@ -68,413 +68,415 @@ class _AccountslistdetailsState extends State<Accountslistdetails> {
)), )),
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: Container( body: SafeArea(
child: SingleChildScrollView( child: SizedBox(
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
decoration: BoxDecoration( Container(
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16) color: Colors.white,
), borderRadius: BorderRadius.circular(16)
child: Row( ),
children: [ child: Row(
Expanded( children: [
child: Container( Expanded(
padding: EdgeInsets.symmetric( child: Container(
horizontal: 10, padding: EdgeInsets.symmetric(
vertical: 15, horizontal: 10,
), vertical: 15,
margin: EdgeInsets.symmetric( ),
horizontal: 10, margin: EdgeInsets.symmetric(
vertical: 15, horizontal: 10,
), vertical: 15,
decoration: BoxDecoration( ),
color: Color(0xFFFFEFEF), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), color: Color(0xFFFFEFEF),
), borderRadius: BorderRadius.circular(16),
child: Column( ),
crossAxisAlignment: child: Column(
CrossAxisAlignment.start, crossAxisAlignment:
children: [ CrossAxisAlignment.start,
RichText( children: [
text: TextSpan( RichText(
children: [ text: TextSpan(
TextSpan( children: [
text: "${totalCredit}", TextSpan(
style: TextStyle( text: "${totalCredit}",
color: Color(0xFFED3424), style: TextStyle(
fontFamily: color: Color(0xFFED3424),
"JakartaRegular", fontFamily:
fontSize: 25, "JakartaRegular",
fontSize: 25,
),
), ),
),
], ],
),
), ),
), Text(
Text( "credit",
"credit", style: TextStyle(
style: TextStyle( color: Color(0xFF818181),
color: Color(0xFF818181), ),
), ),
), ],
], ),
), ),
), ),
), Expanded(
Expanded( child: Container(
child: Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), margin: EdgeInsets.symmetric(
margin: EdgeInsets.symmetric( horizontal: 10,
horizontal: 10, vertical: 15,
vertical: 15, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFFEFEF),
color: Color(0xFFFFEFEF), borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(16), ),
), child: Column(
child: Column( crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start, children: [
children: [ RichText(
RichText( text: TextSpan(
text: TextSpan( children: [
children: [ TextSpan(
TextSpan( text: "${totalDebit}",
text: "${totalDebit}", style: TextStyle(
style: TextStyle( color: Color(0xFFED3424),
color: Color(0xFFED3424), fontFamily:
fontFamily: "JakartaRegular",
"JakartaRegular", fontSize: 25,
fontSize: 25, ),
), ),
),
],
], ),
), ),
), Text(
Text( "debit",
"debit", style: TextStyle(
style: TextStyle( color: Color(0xFF818181),
color: Color(0xFF818181), ),
), ),
), ],
], ),
), ),
), ),
), ],
], ),
), ),
), Text(
Text( "Account Details",
"Account Details", style: TextStyle(
style: TextStyle( fontSize: 16,
fontSize: 16, color: AppColors.grey_thick,
color: AppColors.grey_thick, fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", ),
), ),
), Container(
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(
child: Column( children: [
children: [ ...List.generate(12, (j) {
...List.generate(12, (j) { final headings = [
final headings = [ "Name",
"Name", "Address",
"Address", "Date",
"Date", "Bank Name",
"Bank Name", "Bank Branch",
"Bank Branch", "Bank IFSC Code",
"Bank IFSC Code", "Account Holder",
"Account Holder", "Account Number",
"Account Number", "Bank UPI ID",
"Bank UPI ID", "State",
"State", "District",
"District", "Sub Locality",
"Sub Locality", ];
];
final subHeadings = [ final subHeadings = [
provider.accountDetails.name ?? "-", provider.accountDetails.name ?? "-",
provider.accountDetails.address ?? "-", provider.accountDetails.address ?? "-",
provider.accountDetails.createdDatetime ?? "-", provider.accountDetails.createdDatetime ?? "-",
provider.accountDetails.bankName ?? "-", provider.accountDetails.bankName ?? "-",
provider.accountDetails.bankBranchName ?? "-", provider.accountDetails.bankBranchName ?? "-",
provider.accountDetails.bankIfscCode ?? "-", provider.accountDetails.bankIfscCode ?? "-",
provider.accountDetails.bankAccountHolderName ?? provider.accountDetails.bankAccountHolderName ??
"-", "-",
provider.accountDetails.bankAccountNumber ?? "-", provider.accountDetails.bankAccountNumber ?? "-",
provider.accountDetails.bankUpiId ?? "-", provider.accountDetails.bankUpiId ?? "-",
provider.accountDetails.state ?? "-", provider.accountDetails.state ?? "-",
provider.accountDetails.district ?? "-", provider.accountDetails.district ?? "-",
provider.accountDetails.subLocality ?? "-", provider.accountDetails.subLocality ?? "-",
]; ];
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(vertical: 5),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
headings[j], headings[j],
style: TextStyle( style: TextStyle(
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14, fontSize: 14,
color: AppColors.semi_black, color: AppColors.semi_black,
),
), ),
), ),
), SizedBox(width: 15),
SizedBox(width: 15), Expanded(
Expanded( child: Text(
child: Text( subHeadings[j] ?? "-",
subHeadings[j] ?? "-", style: TextStyle(
style: TextStyle( fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", fontSize: 14,
fontSize: 14, color: AppColors.grey_thick,
color: AppColors.grey_thick, ),
), ),
), ),
), ],
], ),
), );
); }),
}), ],
], ),
), ),
), ListView.builder(
ListView.builder( physics: NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(), shrinkWrap: true,
shrinkWrap: true, itemCount: groupedData.keys.length,
itemCount: groupedData.keys.length, itemBuilder: (context, index) {
itemBuilder: (context, index) { String date = groupedData.keys.elementAt(index);
String date = groupedData.keys.elementAt(index); List<LedgerList> items = groupedData[date]!;
List<LedgerList> items = groupedData[date]!;
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(vertical: 5),
margin: EdgeInsets.symmetric(horizontal: 10), margin: EdgeInsets.symmetric(horizontal: 10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.only(bottom: 5), padding: EdgeInsets.only(bottom: 5),
child: Text( child: Text(
date, date,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
color: Color(0xFF818181), color: Color(0xFF818181),
),
), ),
), ),
), ...items.map((item) {
...items.map((item) {
double running_balance = 0; double running_balance = 0;
int currentIndex = provider.ledgerList.indexOf( int currentIndex = provider.ledgerList.indexOf(
item, item,
); );
for (var i = 0; i <= currentIndex; i++) { for (var i = 0; i <= currentIndex; i++) {
var ledgerItem = provider.ledgerList[i]; var ledgerItem = provider.ledgerList[i];
double credit = double credit =
double.tryParse( double.tryParse(
ledgerItem.creditAmount.toString(), ledgerItem.creditAmount.toString(),
) ?? ) ??
0; 0;
double debit = double debit =
double.tryParse( double.tryParse(
ledgerItem.debitAmount.toString(), ledgerItem.debitAmount.toString(),
) ?? ) ??
0; 0;
running_balance += (debit - credit); running_balance += (debit - credit);
} }
return Container( return Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
vertical: 10, vertical: 10,
), ),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
vertical: 5, vertical: 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: SizedBox( child: SizedBox(
child: child:
item.type == "Credit" item.type == "Credit"
? Image.asset( ? Image.asset(
"assets/images/trans_debit.png", "assets/images/trans_debit.png",
height: 45, height: 45,
width: 45, width: 45,
fit: BoxFit.contain, fit: BoxFit.contain,
) )
: Image.asset( : Image.asset(
"assets/images/trans_credit.png", "assets/images/trans_credit.png",
height: 45, height: 45,
width: 45, width: 45,
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
),
),
SizedBox(width: 10),
Expanded(
flex: 5,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
item.description ?? "-",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily:
"JakartaMedium",
fontSize: 12,
),
),
],
), ),
), ),
), SizedBox(width: 10),
Spacer(), Expanded(
Expanded( flex: 5,
flex: 3, child: SizedBox(
child: SizedBox( child: Column(
child: RichText( crossAxisAlignment:
maxLines: 1, CrossAxisAlignment.start,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
text: TextSpan(
children: [ children: [
TextSpan( Text(
text: item.description ?? "-",
item.type == "Credit" maxLines: 2,
? "-" overflow: TextOverflow.ellipsis,
: "+",
style: TextStyle(
color: Color(
0xFF2D2D2D,
),
fontSize: 13,
fontFamily:
"JakartaRegular",
),
),
TextSpan(
text:
"₹${item.type == "Credit" ? "${item.creditAmount}" : "${item.debitAmount}"}",
style: TextStyle( style: TextStyle(
color: Color(
0xFF2D2D2D,
),
fontSize: 13,
fontFamily: fontFamily:
"JakartaMedium", "JakartaMedium",
fontSize: 12,
), ),
), ),
], ],
), ),
), ),
), ),
), Spacer(),
], Expanded(
), flex: 3,
Divider( child: SizedBox(
thickness: 0.5, child: RichText(
color: Color(0xFFd7d7d7), maxLines: 1,
), textAlign: TextAlign.right,
Row( overflow: TextOverflow.ellipsis,
children: [ text: TextSpan(
Expanded(child: Text("Balance",style: TextStyle(
fontSize: 13, children: [
color: Color(0xFF2d2d2d) TextSpan(
),)), text:
Expanded( item.type == "Credit"
child: Text( ? "-"
textAlign:TextAlign.right, : "+",
"${running_balance.toString()}" ?? style: TextStyle(
"-",style: TextStyle( color: Color(
color: Color(0xFF818181), 0xFF2D2D2D,
fontSize: 13 ),
), fontSize: 13,
fontFamily:
"JakartaRegular",
),
),
TextSpan(
text:
"₹${item.type == "Credit" ? "${item.creditAmount}" : "${item.debitAmount}"}",
style: TextStyle(
color: Color(
0xFF2D2D2D,
),
fontSize: 13,
fontFamily:
"JakartaMedium",
),
),
],
),
),
),
), ),
), ],
], ),
), Divider(
InkResponse( thickness: 0.5,
onTap: () async { color: Color(0xFFd7d7d7),
Navigator.push( ),
context, Row(
MaterialPageRoute( children: [
builder: Expanded(child: Text("Balance",style: TextStyle(
(context) => Transactiondetails( fontSize: 13,
paymentID: item.refId, color: Color(0xFF2d2d2d)
type: item.type, ),)),
Expanded(
child: Text(
textAlign:TextAlign.right,
"${running_balance.toString()}" ??
"-",style: TextStyle(
color: Color(0xFF818181),
fontSize: 13
),
), ),
), ),
); ],
}, ),
child: Container( InkResponse(
padding: EdgeInsets.symmetric(vertical: 5), onTap: () async {
child: Row( Navigator.push(
crossAxisAlignment: context,
CrossAxisAlignment.center, MaterialPageRoute(
mainAxisAlignment: MainAxisAlignment.start, builder:
children: [ (context) => Transactiondetails(
Text( paymentID: item.refId,
"View Details", type: item.type,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
), ),
), ),
SizedBox(width: 5), );
SvgPicture.asset( },
"assets/svg/next_button.svg", 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",
),
],
),
), ),
), ),
), ],
], ),
), );
); }).toList(),
}).toList(), ],
], ),
), );
); },
}, ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -39,557 +39,559 @@ class _AddcommonpaymentState extends State<Addcommonpayment> { ...@@ -39,557 +39,559 @@ class _AddcommonpaymentState extends State<Addcommonpayment> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Add Common Account"), appBar: appbar(context, "Add Common Account"),
backgroundColor: AppColors.white, backgroundColor: AppColors.white,
body: Container( body: SafeArea(
child: SingleChildScrollView( child: SizedBox(
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10), Container(
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10), padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
decoration: BoxDecoration( margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16) color: Colors.white,
), borderRadius: BorderRadius.circular(16)
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Text("Account Details",style: TextStyle( color: AppColors.app_blue, children: [
fontSize: 16, Text("Account Details",style: TextStyle( color: AppColors.app_blue,
fontFamily: "JakartaMedium"),), fontSize: 16,
Text("Account"), fontFamily: "JakartaMedium"),),
DropdownButtonHideUnderline( Text("Account"),
child: Row( DropdownButtonHideUnderline(
children: [ child: Row(
Expanded( children: [
child: DropdownButton2<String>( Expanded(
isExpanded: true, child: DropdownButton2<String>(
hint: const Row( isExpanded: true,
children: [ hint: const Row(
Expanded( children: [
Expanded(
child: Text(
'Select Account',
style: TextStyle(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
items:
provider.accountTypes
.map(
(act) => DropdownMenuItem<String>(
value: act,
child: Text( child: Text(
'Select Account', act,
style: TextStyle(fontSize: 14), style: const TextStyle(
fontSize: 14,
),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
], )
), .toList(),
items: value: provider.selectedAccountType,
provider.accountTypes onChanged: (value) {
.map( if (value != null) {
(act) => DropdownMenuItem<String>( provider.selectedAccountType = value;
value: act, print(
child: Text( "statusId:${provider.selectedAccountType}",
act, );
style: const TextStyle( }
fontSize: 14, },
), buttonStyleData: ButtonStyleData(
overflow: TextOverflow.ellipsis, height: 50,
width: 160,
padding: const EdgeInsets.only(
left: 14,
right: 14,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
), ),
), ),
) iconStyleData: IconStyleData(
.toList(), icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,),
value: provider.selectedAccountType, iconSize: 14,
onChanged: (value) { iconEnabledColor: Color(0xFF2D2D2D),
if (value != null) { iconDisabledColor: Colors.grey,
provider.selectedAccountType = value;
print(
"statusId:${provider.selectedAccountType}",
);
}
},
buttonStyleData: ButtonStyleData(
height: 50,
width: 160,
padding: const EdgeInsets.only(
left: 14,
right: 14,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
), ),
), dropdownStyleData: DropdownStyleData(
iconStyleData: IconStyleData( maxHeight: 200,
icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,), width: 350,
iconSize: 14, decoration: BoxDecoration(
iconEnabledColor: Color(0xFF2D2D2D), borderRadius: BorderRadius.circular(14),
iconDisabledColor: Colors.grey, color: AppColors.text_field_color,
), ),
dropdownStyleData: DropdownStyleData( scrollbarTheme: ScrollbarThemeData(
maxHeight: 200, radius: const Radius.circular(15),
width: 350, thickness: MaterialStateProperty.all<double>(
decoration: BoxDecoration( 6,
borderRadius: BorderRadius.circular(14), ),
color: AppColors.text_field_color, thumbVisibility:
), MaterialStateProperty.all<bool>(true),
scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(15),
thickness: MaterialStateProperty.all<double>(
6,
), ),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
), menuItemStyleData: const MenuItemStyleData(
menuItemStyleData: const MenuItemStyleData( height: 40,
height: 40, padding: EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(left: 14, right: 14), ),
), ),
), ),
), ],
], ),
), ),
), errorWidget(context,provider.accountError),
errorWidget(context,provider.accountError), textControllerWidget(
textControllerWidget( context,
context, provider.nameController,
provider.nameController, "Enter Name",
"Enter Name", (p0) {
(p0) { provider.updateName(p0);
provider.updateName(p0); provider.checkInputsAPI(
provider.checkInputsAPI( context,
context, "name",
"name", provider.nameController.text,
provider.nameController.text, );
); },TextInputType.text,false,null
},TextInputType.text,false,null ),errorWidget(context,provider.nameError),
),errorWidget(context,provider.nameError), textControllerWidget(
textControllerWidget( context,
context, provider.mobileController,
provider.mobileController, "Enter Mobile",
"Enter Mobile", (p0) {
(p0) { provider.updateMobile(p0);
provider.updateMobile(p0); provider.checkInputsAPI(
provider.checkInputsAPI( context,
context, "mob1",
"mob1", provider.mobileController.text,
provider.mobileController.text, );
); },TextInputType.number,false,FilteringTextInputFormatter.digitsOnly
},TextInputType.number,false,FilteringTextInputFormatter.digitsOnly ),
), errorWidget(context,provider.mobileError),
errorWidget(context,provider.mobileError), Text("State"),
Text("State"), DropdownButtonHideUnderline(
DropdownButtonHideUnderline( child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( child: DropdownButton2<States>(
child: DropdownButton2<States>( isExpanded: true,
isExpanded: true, hint: Text(
hint: Text( 'Select State',
'Select State', style: TextStyle(fontSize: 14),
style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, ),
), items:
items: provider.states
provider.states .map(
.map( (states) => DropdownMenuItem<States>(
(states) => DropdownMenuItem<States>( value: states,
value: states, child: Text(
child: Text( states.name ?? '',
states.name ?? '', style: const TextStyle(
style: const TextStyle( fontSize: 14,
fontSize: 14, ),
overflow: TextOverflow.ellipsis,
), ),
overflow: TextOverflow.ellipsis,
), ),
), )
) .toList(),
.toList(), value: provider.selectedState,
value: provider.selectedState, onChanged: (States? value) {
onChanged: (States? value) { if (value != null) {
if (value != null) { if (provider.states.isNotEmpty) {
if (provider.states.isNotEmpty) { provider.selectedState = value;
provider.selectedState = value; print(
print( "Selected Complaint Type: ${value.name}, ID: ${value.id}",
"Selected Complaint Type: ${value.name}, ID: ${value.id}", );
); provider.selectedStateID = value.id!;
provider.selectedStateID = value.id!; print(
print( "hfjkshfg" +
"hfjkshfg" + provider.selectedStateID.toString(),
provider.selectedStateID.toString(), );
); provider.getDistrictAPI(
provider.getDistrictAPI( context,
context, provider.selectedStateID,
provider.selectedStateID, );
); }
} }
} },
}, buttonStyleData: ButtonStyleData(
buttonStyleData: ButtonStyleData( height: 50,
height: 50, width: 160,
width: 160, padding: const EdgeInsets.only(
padding: const EdgeInsets.only( left: 14,
left: 14, right: 14,
right: 14, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(14),
borderRadius: BorderRadius.circular(14), color: AppColors.text_field_color,
color: AppColors.text_field_color, ),
), ),
), iconStyleData: IconStyleData(
iconStyleData: IconStyleData( icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,),
icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,), iconSize: 12,
iconSize: 12, iconEnabledColor: Color(0xFF2D2D2D),
iconEnabledColor: Color(0xFF2D2D2D), iconDisabledColor: Colors.grey,
iconDisabledColor: Colors.grey,
),
dropdownStyleData: DropdownStyleData(
maxHeight: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
), ),
scrollbarTheme: ScrollbarThemeData( dropdownStyleData: DropdownStyleData(
radius: const Radius.circular(15), maxHeight: 200,
thickness: MaterialStateProperty.all<double>( decoration: BoxDecoration(
6, borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
),
scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(15),
thickness: MaterialStateProperty.all<double>(
6,
),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
), menuItemStyleData: const MenuItemStyleData(
menuItemStyleData: const MenuItemStyleData( height: 40,
height: 40, padding: EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(left: 14, right: 14), ),
), ),
), ),
), ],
], ),
), ),
), errorWidget(context,provider.stateError),
errorWidget(context,provider.stateError), Text("District"),
Text("District"), DropdownButtonHideUnderline(
DropdownButtonHideUnderline( child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( child: DropdownButton2<Districts>(
child: DropdownButton2<Districts>( isExpanded: true,
isExpanded: true, hint: Text(
hint: Text( 'Select District',
'Select District', style: TextStyle(fontSize: 14),
style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, ),
), items:
items: provider.districts
provider.districts .map(
.map( (dist) => DropdownMenuItem<Districts>(
(dist) => DropdownMenuItem<Districts>( value: dist,
value: dist, child: Text(
child: Text( dist.district ?? '',
dist.district ?? '', style: const TextStyle(
style: const TextStyle( fontSize: 14,
fontSize: 14, ),
overflow: TextOverflow.ellipsis,
), ),
overflow: TextOverflow.ellipsis,
), ),
), )
) .toList(),
.toList(), value: provider.selectedDistricts,
value: provider.selectedDistricts, onChanged: (Districts? value) {
onChanged: (Districts? value) { if (value != null) {
if (value != null) { if (provider.districts.isNotEmpty) {
if (provider.districts.isNotEmpty) { provider.selectedDistricts = value;
provider.selectedDistricts = value; print("Selected ID: ${value.id}");
print("Selected ID: ${value.id}"); provider.selectedDistrictId = value.id!;
provider.selectedDistrictId = value.id!; provider.selectedDistrictValue =
provider.selectedDistrictValue = value.district!;
value.district!; print(
print( "hfjkshfg" +
"hfjkshfg" + provider.selectedDistrictId
provider.selectedDistrictId .toString(),
.toString(), );
); provider.getSubLocationAPI(
provider.getSubLocationAPI( context,
context, provider.selectedDistrictId,
provider.selectedDistrictId, );
); }
} }
} },
}, buttonStyleData: ButtonStyleData(
buttonStyleData: ButtonStyleData( height: 50,
height: 50, width: 160,
width: 160, padding: const EdgeInsets.only(
padding: const EdgeInsets.only( left: 14,
left: 14, right: 14,
right: 14, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(14),
borderRadius: BorderRadius.circular(14), color: AppColors.text_field_color,
color: AppColors.text_field_color, ),
), ),
), iconStyleData: IconStyleData(
iconStyleData: IconStyleData( icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,),
icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,), iconSize: 12,
iconSize: 12, iconEnabledColor: Color(0xFF2D2D2D),
iconEnabledColor: Color(0xFF2D2D2D), iconDisabledColor: Colors.grey,
iconDisabledColor: Colors.grey,
),
dropdownStyleData: DropdownStyleData(
maxHeight: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
), ),
scrollbarTheme: ScrollbarThemeData( dropdownStyleData: DropdownStyleData(
radius: const Radius.circular(15), maxHeight: 200,
thickness: MaterialStateProperty.all<double>( decoration: BoxDecoration(
6, borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
),
scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(15),
thickness: MaterialStateProperty.all<double>(
6,
),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
), menuItemStyleData: const MenuItemStyleData(
menuItemStyleData: const MenuItemStyleData( height: 40,
height: 40, padding: EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(left: 14, right: 14), ),
), ),
), ),
), ],
], ),
), ),
), errorWidget(context,provider.districtError),
errorWidget(context,provider.districtError), Text("Sub Locality"),
Text("Sub Locality"), DropdownButtonHideUnderline(
DropdownButtonHideUnderline( child: Row(
child: Row( children: [
children: [ Expanded(
Expanded( child: DropdownButton2<SubLocations>(
child: DropdownButton2<SubLocations>( isExpanded: true,
isExpanded: true, hint: Text(
hint: Text( 'Select Sub Locality',
'Select Sub Locality', style: TextStyle(fontSize: 14),
style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, ),
), items:
items: provider.subLocations
provider.subLocations .map(
.map( (subloc) =>
(subloc) => DropdownMenuItem<SubLocations>(
DropdownMenuItem<SubLocations>( value: subloc,
value: subloc, child: Text(
child: Text( subloc.subLocality ?? '',
subloc.subLocality ?? '', style: const TextStyle(
style: const TextStyle( fontSize: 14,
fontSize: 14, ),
overflow: TextOverflow.ellipsis,
), ),
overflow: TextOverflow.ellipsis,
), ),
), )
) .toList(),
.toList(), value: provider.selectedSubLocations,
value: provider.selectedSubLocations, onChanged: (SubLocations? value) {
onChanged: (SubLocations? value) { if (value != null) {
if (value != null) { if (provider.subLocations.isNotEmpty) {
if (provider.subLocations.isNotEmpty) { provider.selectedSubLocations = value;
provider.selectedSubLocations = value; print("Selected ID: ${value.id}");
print("Selected ID: ${value.id}"); provider.selectedSubLocID = value.id!;
provider.selectedSubLocID = value.id!; provider.selectedSubLocValue =
provider.selectedSubLocValue = value.subLocality!;
value.subLocality!; print(
print( "hfjkshfg" +
"hfjkshfg" + provider.selectedSubLocID.toString(),
provider.selectedSubLocID.toString(), );
); }
} }
} },
}, buttonStyleData: ButtonStyleData(
buttonStyleData: ButtonStyleData( height: 50,
height: 50, width: 160,
width: 160, padding: const EdgeInsets.only(
padding: const EdgeInsets.only( left: 14,
left: 14, right: 14,
right: 14, ),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColors.text_field_color,
),
), ),
decoration: BoxDecoration( iconStyleData: IconStyleData(
borderRadius: BorderRadius.circular(14), icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,),
color: AppColors.text_field_color, iconSize: 12,
iconEnabledColor: Color(0xFF2D2D2D),
iconDisabledColor: Colors.grey,
), ),
), dropdownStyleData: DropdownStyleData(
iconStyleData: IconStyleData( maxHeight: 200,
icon: SvgPicture.asset("assets/svg/arrow_dropdown.svg",height: 25,width: 20,), decoration: BoxDecoration(
iconSize: 12, borderRadius: BorderRadius.circular(14),
iconEnabledColor: Color(0xFF2D2D2D), color: AppColors.text_field_color,
iconDisabledColor: Colors.grey, ),
), scrollbarTheme: ScrollbarThemeData(
dropdownStyleData: DropdownStyleData( radius: const Radius.circular(15),
maxHeight: 200, thickness: MaterialStateProperty.all<double>(
decoration: BoxDecoration( 6,
borderRadius: BorderRadius.circular(14), ),
color: AppColors.text_field_color, thumbVisibility:
), MaterialStateProperty.all<bool>(true),
scrollbarTheme: ScrollbarThemeData(
radius: const Radius.circular(15),
thickness: MaterialStateProperty.all<double>(
6,
), ),
thumbVisibility:
MaterialStateProperty.all<bool>(true),
), ),
), menuItemStyleData: const MenuItemStyleData(
menuItemStyleData: const MenuItemStyleData( height: 40,
height: 40, padding: EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(left: 14, right: 14), ),
), ),
), ),
), ],
], ),
), ),
), errorWidget(context,provider.localityError),
errorWidget(context,provider.localityError), textControllerWidget(
textControllerWidget( context,
context, provider.addressController,
provider.addressController, "Enter Address",
"Enter Address", provider.updateAddress,TextInputType.text,false,null
provider.updateAddress,TextInputType.text,false,null ),
), errorWidget(context,provider.addressError),
errorWidget(context,provider.addressError), ],
], ),
), ),
), SizedBox(height: 15,),
SizedBox(height: 15,), Column(
Column( children: [
children: [ InkResponse(
InkResponse( onTap: () => provider.isVisible = !provider.isVisible,
onTap: () => provider.isVisible = !provider.isVisible, child: Center(
child: Center( child: Text(
child: Text( provider.isVisible?"- Hide More Details":"+ Add More Details",style: TextStyle(
provider.isVisible?"- Hide More Details":"+ Add More Details",style: TextStyle( color: AppColors.app_blue,
color: AppColors.app_blue, fontSize: 16,
fontSize: 16, fontFamily: "JakartaMedium"
fontFamily: "JakartaMedium" ),
), ),
), ),
), ),
), Visibility(
Visibility( visible: provider.isVisible,
visible: provider.isVisible, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Container(
Container( margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10), padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, borderRadius: BorderRadius.circular(16)
borderRadius: BorderRadius.circular(16) ),
), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Text("Bank Details",style: TextStyle(
Text("Bank Details",style: TextStyle( color: AppColors.app_blue,
color: AppColors.app_blue, fontSize: 16,
fontSize: 16, fontFamily: "JakartaMedium"
fontFamily: "JakartaMedium" ),),
),), textControllerWidget(
textControllerWidget( context,
context, provider.bankNameController,
provider.bankNameController, "Bank Name",
"Bank Name", provider.updateBankName,TextInputType.text,false,null
provider.updateBankName,TextInputType.text,false,null ),
), errorWidget(context,provider.banknameError),
errorWidget(context,provider.banknameError), textControllerWidget(
textControllerWidget( context,
context, provider.branchNameController,
provider.branchNameController, "Bank Branch",
"Bank Branch", provider.updateBankBranch,TextInputType.text,false,null
provider.updateBankBranch,TextInputType.text,false,null ),
), errorWidget(context,provider.bankBranchError),
errorWidget(context,provider.bankBranchError), textControllerWidget(
textControllerWidget( context,
context, provider.bankIfscCotroller,
provider.bankIfscCotroller, "Bank IFSC",
"Bank IFSC", provider.updateIFSC,TextInputType.text,false,null
provider.updateIFSC,TextInputType.text,false,null ),
), errorWidget(context,provider.bankIFSCError),
errorWidget(context,provider.bankIFSCError), textControllerWidget(
textControllerWidget( context,
context, provider.bankHolderNameController,
provider.bankHolderNameController, "Bank Holder Name",
"Bank Holder Name", provider.updateHolder,TextInputType.text,false,null
provider.updateHolder,TextInputType.text,false,null ),
), errorWidget(context,provider.bankHolderNameError),
errorWidget(context,provider.bankHolderNameError), textControllerWidget(
textControllerWidget( context,
context, provider.bankAcNumberController,
provider.bankAcNumberController, "Bank Account Number",
"Bank Account Number", provider.updateNumber,TextInputType.number,false,FilteringTextInputFormatter.digitsOnly
provider.updateNumber,TextInputType.number,false,FilteringTextInputFormatter.digitsOnly ),
), errorWidget(context,provider.bankAcNumberError),
errorWidget(context,provider.bankAcNumberError), textControllerWidget(
textControllerWidget( context,
context, provider.bankUpiController,
provider.bankUpiController, "Bank UPI ID",
"Bank UPI ID", provider.updateUPI,TextInputType.text,false,null
provider.updateUPI,TextInputType.text,false,null ),
), errorWidget(context,provider.upiError),
errorWidget(context,provider.upiError), ],
], ),
), ),
), Container(
Container( margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10), padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, borderRadius: BorderRadius.circular(16)
borderRadius: BorderRadius.circular(16) ),
), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Text("Contact Details",style: TextStyle(
Text("Contact Details",style: TextStyle( color: AppColors.app_blue,
color: AppColors.app_blue, fontSize: 16,
fontSize: 16, fontFamily: "JakartaMedium"
fontFamily: "JakartaMedium" ),),
),), textControllerWidget(
textControllerWidget( context,
context, provider.contactPersonController,
provider.contactPersonController, "Contact Person Name",
"Contact Person Name", provider.updateContactPerson,TextInputType.text,false,null
provider.updateContactPerson,TextInputType.text,false,null ),
), errorWidget(context,provider.contactPersonError),
errorWidget(context,provider.contactPersonError), textControllerWidget(
textControllerWidget( context,
context, provider.contectPersonDesignationController,
provider.contectPersonDesignationController, "Contact Person Designation",
"Contact Person Designation", provider.updateDesignation,TextInputType.text,false,null
provider.updateDesignation,TextInputType.text,false,null ),
), errorWidget(context,provider.desigantionError),
errorWidget(context,provider.desigantionError), textControllerWidget(
textControllerWidget( context,
context, provider.contectPersonAltMobController,
provider.contectPersonAltMobController, "Alternative Mobile Number",
"Alternative Mobile Number", (p0) {
(p0) { provider.updateAltMobile(p0);
provider.updateAltMobile(p0); provider.checkInputsAPI(context, "mob2", provider.contectPersonAltMobController.text);
provider.checkInputsAPI(context, "mob2", provider.contectPersonAltMobController.text); },TextInputType.number,false,FilteringTextInputFormatter.digitsOnly
},TextInputType.number,false,FilteringTextInputFormatter.digitsOnly ),
), errorWidget(context,provider.altMobError),
errorWidget(context,provider.altMobError), textControllerWidget(
textControllerWidget( context,
context, provider.contectPersonTeleController,
provider.contectPersonTeleController, "Telephone Number",
"Telephone Number", provider.updateTeleMobile,TextInputType.number,false,FilteringTextInputFormatter.digitsOnly
provider.updateTeleMobile,TextInputType.number,false,FilteringTextInputFormatter.digitsOnly ),
), errorWidget(context,provider.teleError),
errorWidget(context,provider.teleError), textControllerWidget(
textControllerWidget( context,
context, provider.contectPersonMailController,
provider.contectPersonMailController, "Customer Mail ID",
"Customer Mail ID", provider.updateMail,TextInputType.text,false,null
provider.updateMail,TextInputType.text,false,null ),
), errorWidget(context,provider.mailError),
errorWidget(context,provider.mailError), ],
], ),
), )
) ],
], ),
), ),
), ],
)
], ],
) ),
],
), ),
), ),
), ),
......
...@@ -39,54 +39,56 @@ class _CommondashboardState extends State<Commondashboard> { ...@@ -39,54 +39,56 @@ class _CommondashboardState extends State<Commondashboard> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Common"), appBar: appbar(context, "Common"),
body: GridView.builder( body: SafeArea(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), child: GridView.builder(
itemCount: gridPages.length, padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( itemCount: gridPages.length,
crossAxisCount: 2, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 10, crossAxisCount: 2,
mainAxisSpacing: 10, crossAxisSpacing: 10,
), mainAxisSpacing: 10,
itemBuilder: (context, index) { ),
final icons = ["comm_ic_1", "comm_ic_2"]; itemBuilder: (context, index) {
return InkResponse( final icons = ["comm_ic_1", "comm_ic_2"];
onTap: () { return InkResponse(
switch (gridPages[index].pageName!) { onTap: () {
case "Account List": switch (gridPages[index].pageName!) {
Navigator.push( case "Account List":
context, Navigator.push(
MaterialPageRoute(builder: (context) => Accountslist()), context,
); MaterialPageRoute(builder: (context) => Accountslist()),
break; );
case "Account Ledger": break;
Navigator.push( case "Account Ledger":
context, Navigator.push(
MaterialPageRoute(builder: (context) => Accountledger()), context,
); MaterialPageRoute(builder: (context) => Accountledger()),
break; );
break;
default: default:
print("111"); print("111");
break; break;
} }
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/svg/${icons[index]}.svg"),
SizedBox(height: 10),
Text(gridPages[index].pageName!),
],
),
), ),
child: Column( );
crossAxisAlignment: CrossAxisAlignment.center, },
mainAxisAlignment: MainAxisAlignment.center, ),
children: [
SvgPicture.asset("assets/svg/${icons[index]}.svg"),
SizedBox(height: 10),
Text(gridPages[index].pageName!),
],
),
),
);
},
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton:provider.accessPages floatingActionButton:provider.accessPages
......
...@@ -38,138 +38,140 @@ class _TransactiondetailsState extends State<Transactiondetails> { ...@@ -38,138 +38,140 @@ class _TransactiondetailsState extends State<Transactiondetails> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: appbar(context, "Details"), appBar: appbar(context, "Details"),
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
body: Container( body: SafeArea(
margin: EdgeInsets.symmetric(vertical: 10,horizontal: 10), child: Container(
child: SingleChildScrollView( margin: EdgeInsets.symmetric(vertical: 10,horizontal: 10),
child: Container( child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), child: Container(
margin: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
decoration: BoxDecoration( margin: EdgeInsets.symmetric(vertical: 5),
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), color: Colors.white,
), borderRadius: BorderRadius.circular(16),
child: Column( ),
children: [ child: Column(
Row( children: [
mainAxisAlignment: MainAxisAlignment.start, Row(
children: [ mainAxisAlignment: MainAxisAlignment.start,
Expanded( children: [
flex: 1, Expanded(
child: SizedBox( flex: 1,
child: child: SizedBox(
widget.type == "Credit" child:
? Image.asset(
"assets/images/trans_debit.png",
height: 45,
width: 45,
fit: BoxFit.contain,
)
: Image.asset(
"assets/images/trans_credit.png",
height: 45,
width: 45,
fit: BoxFit.contain,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 5,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.type == "Credit" widget.type == "Credit"
? "Debited Amount" ? Image.asset(
: "Credited Amount", "assets/images/trans_debit.png",
maxLines: 2, height: 45,
overflow: TextOverflow.ellipsis, width: 45,
style: TextStyle( fit: BoxFit.contain,
fontFamily: "JakartaMedium", )
fontSize: 12, : Image.asset(
"assets/images/trans_credit.png",
height: 45,
width: 45,
fit: BoxFit.contain,
),
),
),
SizedBox(width: 10),
Expanded(
flex: 5,
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.type == "Credit"
? "Debited Amount"
: "Credited Amount",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 12,
),
), ),
), RichText(
RichText( textAlign: TextAlign.right,
textAlign: TextAlign.right, maxLines: 1,
maxLines: 1, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, text: TextSpan(
text: TextSpan( children: [
children: [ TextSpan(
TextSpan( text:
text: widget.type == "Credit" ? "-" : "+",
widget.type == "Credit" ? "-" : "+", style: TextStyle(
style: TextStyle( color: Color(0xFF2D2D2D),
color: Color(0xFF2D2D2D), fontSize: 13,
fontSize: 13, fontFamily: "JakartaRegular",
fontFamily: "JakartaRegular", ),
), ),
), TextSpan(
TextSpan( text: "₹${details.amount}",
text: "₹${details.amount}", style: TextStyle(
style: TextStyle( color: Color(0xFF2D2D2D),
color: Color(0xFF2D2D2D), fontSize: 13,
fontSize: 13, fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", ),
), ),
), ],
], ),
), ),
), ],
], ),
), ),
), ),
), ],
], ),
), Divider(thickness: 0.5, color: Color(0xFFd7d7d7)),
Divider(thickness: 0.5, color: Color(0xFFd7d7d7)), ...List.generate(5, (j) {
...List.generate(5, (j) { final headings = [
final headings = [ "ID",
"ID", "Date",
"Date", "Account",
"Account", "Ref Type",
"Ref Type", "Description",
"Description", ];
];
final subHeadings = [
final subHeadings = [ details.id ?? "-",
details.id ?? "-", details.createdDatetime ?? "-",
details.createdDatetime ?? "-", details.accountName ?? "-",
details.accountName ?? "-", details.refType ?? "-",
details.refType ?? "-", details.description ?? "-",
details.description ?? "-", ];
]; return Container(
return Container( padding: EdgeInsets.symmetric(vertical: 5),
padding: EdgeInsets.symmetric(vertical: 5), child: Row(
child: Row( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Expanded(
Expanded( child: Text(
child: Text( headings[j],
headings[j], style: TextStyle(
style: TextStyle( fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", fontSize: 14,
fontSize: 14, color: AppColors.semi_black,
color: AppColors.semi_black, ),
), ),
), ),
), SizedBox(width: 15),
SizedBox(width: 15), Expanded(
Expanded( child: Text(
child: Text( subHeadings[j] ?? "-",
subHeadings[j] ?? "-", style: TextStyle(
style: TextStyle( fontFamily: "JakartaMedium",
fontFamily: "JakartaMedium", fontSize: 14,
fontSize: 14, color: AppColors.grey_thick,
color: AppColors.grey_thick, ),
), ),
), ),
), ],
], ),
), );
); }),
}), ],
], ),
), ),
), ),
), ),
......
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