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