Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
gen_rentals
Commits
df116895
Commit
df116895
authored
Oct 18, 2025
by
Sai Srinivas
Browse files
New Screen and api
parent
9462b0ba
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
android/app/src/main/AndroidManifest.xml
View file @
df116895
...
...
@@ -2,7 +2,8 @@
<application
android:label=
"Gen Rentals"
android:name=
"${applicationName}"
android:icon=
"@mipmap/ic_launcher"
>
android:icon=
"@mipmap/ic_launcher"
android:enableOnBackInvokedCallback=
"true"
>
<!-- Fixed: Removed extra quote and corrected placement -->
<activity
android:name=
".MainActivity"
android:exported=
"true"
...
...
@@ -17,9 +18,9 @@
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name=
"io.flutter.embedding.android.NormalTheme"
android:resource=
"@style/NormalTheme"
/>
android:name=
"io.flutter.embedding.android.NormalTheme"
android:resource=
"@style/NormalTheme"
/>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
...
...
@@ -42,4 +43,4 @@
<data
android:mimeType=
"text/plain"
/>
</intent>
</queries>
</manifest>
</manifest>
\ No newline at end of file
android/gradle.properties
View file @
df116895
org.gradle.jvmargs
=
-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX
=
true
android.enableJetifier
=
true
flutter.minSdkVersion
=
23
assets/svg/help_ic.svg
0 → 100644
View file @
df116895
<svg
width=
"38"
height=
"38"
viewBox=
"0 0 38 38"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M18.9809 37.9618C29.4637 37.9618 37.9618 29.4637 37.9618 18.9809C37.9618 8.49803 29.4637 0 18.9809 0C8.49803 0 0 8.49803 0 18.9809C0 29.4637 8.49803 37.9618 18.9809 37.9618Z"
fill=
"url(#paint0_linear_383_1201)"
/>
<path
d=
"M18.8177 32.4369C17.2122 32.4369 15.8743 31.1325 15.8743 29.5271C15.8743 27.9216 17.2122 26.6172 18.8177 26.6172C20.4231 26.6172 21.761 27.9216 21.761 29.5271C21.761 31.1325 20.4231 32.4369 18.8177 32.4369Z"
fill=
"white"
/>
<path
d=
"M20.7245 22.1017V24.6105H16.0086L15.2058 18.6567C19.186 18.6567 21.9954 17.7872 21.9954 15.2451C21.9954 13.6061 20.7915 12.3018 18.7178 12.3018C17.38 12.3018 15.6404 12.9037 14.102 13.9072L13.4663 9.15762C14.8712 8.18757 17.0789 7.48535 19.1525 7.48535C23.8349 7.48535 27.347 10.6628 27.347 14.8438C27.347 18.8908 24.0024 21.6671 20.7245 22.1017Z"
fill=
"white"
/>
<defs>
<linearGradient
id=
"paint0_linear_383_1201"
x1=
"25.4745"
y1=
"36.8219"
x2=
"12.4873"
y2=
"1.13985"
gradientUnits=
"userSpaceOnUse"
>
<stop
offset=
"0.2486"
stop-color=
"#948BF7"
/>
<stop
offset=
"0.9279"
stop-color=
"#C7CBFF"
/>
</linearGradient>
</defs>
</svg>
lib/Models/DashboardResponse.dart
View file @
df116895
class
DashboardResponse
{
String
?
error
;
String
?
mobNum
;
String
?
raname
;
Str
in
g
?
balanceAmount
;
in
t
?
balanceAmount
;
String
?
message
;
List
<
Products
>?
product
s
;
List
<
Orders
>?
order
s
;
DashboardResponse
(
{
this
.
error
,
this
.
mobNum
,
this
.
raname
,
this
.
balanceAmount
,
this
.
message
,
this
.
product
s
});
this
.
order
s
});
DashboardResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
mobNum
=
json
[
'mob_num'
];
raname
=
json
[
'raname'
];
balanceAmount
=
json
[
'balance_amount'
];
message
=
json
[
'message'
];
if
(
json
[
'
product
s'
]
!=
null
)
{
products
=
<
Product
s
>[];
json
[
'
product
s'
].
forEach
((
v
)
{
product
s
!.
add
(
new
Product
s
.
fromJson
(
v
));
if
(
json
[
'
order
s'
]
!=
null
)
{
orders
=
<
Order
s
>[];
json
[
'
order
s'
].
forEach
((
v
)
{
order
s
!.
add
(
new
Order
s
.
fromJson
(
v
));
});
}
}
...
...
@@ -28,65 +31,62 @@ class DashboardResponse {
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'mob_num'
]
=
this
.
mobNum
;
data
[
'raname'
]
=
this
.
raname
;
data
[
'balance_amount'
]
=
this
.
balanceAmount
;
data
[
'message'
]
=
this
.
message
;
if
(
this
.
product
s
!=
null
)
{
data
[
'
product
s'
]
=
this
.
product
s
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
if
(
this
.
order
s
!=
null
)
{
data
[
'
order
s'
]
=
this
.
order
s
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
Product
s
{
class
Order
s
{
String
?
orderid
;
String
?
productName
;
String
?
orderNum
;
String
?
productImage
;
String
?
plan
;
String
?
rentedDate
;
String
?
expiringInColor
;
String
?
expiringText
;
String
?
address
;
bool
?
hasPendingPayment
;
String
?
pendingPaymentText
;
List
<
String
>?
products
;
Product
s
(
Order
s
(
{
this
.
orderid
,
this
.
productName
,
this
.
orderNum
,
this
.
productImage
,
this
.
plan
,
this
.
rentedDate
,
this
.
expiringInColor
,
this
.
expiringText
,
this
.
address
,
this
.
hasPendingPayment
,
this
.
pendingPaymentText
});
this
.
pendingPaymentText
,
this
.
products
});
Product
s
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
Order
s
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
orderid
=
json
[
'orderid'
];
productName
=
json
[
'productName
'
];
orderNum
=
json
[
'order_num
'
];
productImage
=
json
[
'productImage'
];
plan
=
json
[
'plan'
];
rentedDate
=
json
[
'rentedDate'
];
expiringInColor
=
json
[
'ExpiringInColor'
];
expiringText
=
json
[
'expiringText'
];
address
=
json
[
'address'
];
hasPendingPayment
=
json
[
'hasPendingPayment'
];
pendingPaymentText
=
json
[
'pendingPaymentText'
];
products
=
json
[
'products'
].
cast
<
String
>();
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'orderid'
]
=
this
.
orderid
;
data
[
'
productName'
]
=
this
.
productName
;
data
[
'
order_num'
]
=
this
.
orderNum
;
data
[
'productImage'
]
=
this
.
productImage
;
data
[
'plan'
]
=
this
.
plan
;
data
[
'rentedDate'
]
=
this
.
rentedDate
;
data
[
'ExpiringInColor'
]
=
this
.
expiringInColor
;
data
[
'expiringText'
]
=
this
.
expiringText
;
data
[
'address'
]
=
this
.
address
;
data
[
'hasPendingPayment'
]
=
this
.
hasPendingPayment
;
data
[
'pendingPaymentText'
]
=
this
.
pendingPaymentText
;
data
[
'products'
]
=
this
.
products
;
return
data
;
}
}
lib/Models/SubscribeOrderDetailsResponse.dart
0 → 100644
View file @
df116895
class
SubscribeOrderDetailsResponse
{
String
?
orderid
;
String
?
orderNum
;
String
?
rentedDate
;
String
?
expiringInColor
;
String
?
expiringText
;
List
<
Products
>?
products
;
String
?
error
;
String
?
message
;
SubscribeOrderDetailsResponse
(
{
this
.
orderid
,
this
.
orderNum
,
this
.
rentedDate
,
this
.
expiringInColor
,
this
.
expiringText
,
this
.
products
,
this
.
error
,
this
.
message
});
SubscribeOrderDetailsResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
orderid
=
json
[
'orderid'
];
orderNum
=
json
[
'order_num'
];
rentedDate
=
json
[
'rentedDate'
];
expiringInColor
=
json
[
'ExpiringInColor'
];
expiringText
=
json
[
'expiringText'
];
if
(
json
[
'products'
]
!=
null
)
{
products
=
<
Products
>[];
json
[
'products'
].
forEach
((
v
)
{
products
!.
add
(
new
Products
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'orderid'
]
=
this
.
orderid
;
data
[
'order_num'
]
=
this
.
orderNum
;
data
[
'rentedDate'
]
=
this
.
rentedDate
;
data
[
'ExpiringInColor'
]
=
this
.
expiringInColor
;
data
[
'expiringText'
]
=
this
.
expiringText
;
if
(
this
.
products
!=
null
)
{
data
[
'products'
]
=
this
.
products
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
return
data
;
}
}
class
Products
{
String
?
id
;
String
?
idName
;
String
?
prodName
;
String
?
totalPrice
;
String
?
per
;
String
?
dispatchDate
;
String
?
receivedDate
;
Products
(
{
this
.
id
,
this
.
idName
,
this
.
prodName
,
this
.
totalPrice
,
this
.
per
,
this
.
dispatchDate
,
this
.
receivedDate
});
Products
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
idName
=
json
[
'id_name'
];
prodName
=
json
[
'prod_name'
];
totalPrice
=
json
[
'total_price'
];
per
=
json
[
'per'
];
dispatchDate
=
json
[
'dispatch_date'
];
receivedDate
=
json
[
'received_date'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'id_name'
]
=
this
.
idName
;
data
[
'prod_name'
]
=
this
.
prodName
;
data
[
'total_price'
]
=
this
.
totalPrice
;
data
[
'per'
]
=
this
.
per
;
data
[
'dispatch_date'
]
=
this
.
dispatchDate
;
data
[
'received_date'
]
=
this
.
receivedDate
;
return
data
;
}
}
lib/Models/TransactionsResponse.dart
0 → 100644
View file @
df116895
class
TransactionsResponse
{
int
?
balanceAmount
;
String
?
creditAmount
;
String
?
debitAmount
;
Map
<
String
,
List
<
TransactionItem
>>?
transactions
;
String
?
error
;
String
?
message
;
TransactionsResponse
({
this
.
balanceAmount
,
this
.
creditAmount
,
this
.
debitAmount
,
this
.
transactions
,
this
.
error
,
this
.
message
,
});
TransactionsResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
balanceAmount
=
json
[
'balance_amount'
];
creditAmount
=
json
[
'credit_amount'
];
debitAmount
=
json
[
'debit_amount'
];
error
=
json
[
'error'
];
message
=
json
[
'message'
];
if
(
json
[
'transactions'
]
!=
null
)
{
transactions
=
{};
json
[
'transactions'
].
forEach
((
key
,
value
)
{
transactions
![
key
]
=
(
value
as
List
)
.
map
((
v
)
=>
TransactionItem
.
fromJson
(
v
))
.
toList
();
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
{};
data
[
'balance_amount'
]
=
balanceAmount
;
data
[
'credit_amount'
]
=
creditAmount
;
data
[
'debit_amount'
]
=
debitAmount
;
data
[
'error'
]
=
error
;
data
[
'message'
]
=
message
;
if
(
transactions
!=
null
)
{
data
[
'transactions'
]
=
transactions
!.
map
((
key
,
value
)
=>
MapEntry
(
key
,
value
.
map
((
v
)
=>
v
.
toJson
()).
toList
()));
}
return
data
;
}
}
class
TransactionItem
{
String
?
paymentId
;
String
?
amount
;
String
?
type
;
String
?
purpose
;
String
?
date
;
TransactionItem
({
this
.
paymentId
,
this
.
amount
,
this
.
type
,
this
.
purpose
,
this
.
date
,
});
TransactionItem
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
paymentId
=
json
[
'payment_id'
];
amount
=
json
[
'amount'
];
type
=
json
[
'type'
];
purpose
=
json
[
'purpose'
];
date
=
json
[
'date'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
{};
data
[
'payment_id'
]
=
paymentId
;
data
[
'amount'
]
=
amount
;
data
[
'type'
]
=
type
;
data
[
'purpose'
]
=
purpose
;
data
[
'date'
]
=
date
;
return
data
;
}
}
lib/Models/orderListResponse.dart
deleted
100644 → 0
View file @
9462b0ba
class
OrderListResponse
{
List
<
Order
>?
order
;
int
?
error
;
String
?
message
;
OrderListResponse
({
this
.
order
,
this
.
error
,
this
.
message
});
OrderListResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'order'
]
!=
null
)
{
order
=
<
Order
>[];
json
[
'order'
].
forEach
((
v
)
{
order
!.
add
(
new
Order
.
fromJson
(
v
));
});
}
error
=
json
[
'error'
];
message
=
json
[
'message'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
order
!=
null
)
{
data
[
'order'
]
=
this
.
order
!.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
return
data
;
}
}
class
Order
{
String
?
orderid
;
String
?
datetime
;
String
?
address
;
Order
({
this
.
orderid
,
this
.
datetime
,
this
.
address
});
Order
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
orderid
=
json
[
'orderid'
];
datetime
=
json
[
'datetime'
];
address
=
json
[
'address'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'orderid'
]
=
this
.
orderid
;
data
[
'datetime'
]
=
this
.
datetime
;
data
[
'address'
]
=
this
.
address
;
return
data
;
}
}
lib/Notifier/DashboardProvider.dart
View file @
df116895
...
...
@@ -15,6 +15,7 @@ class DashboardProvider with ChangeNotifier {
/// Fetch Dashboard API
Future
<
void
>
fetchDashboard
({
required
String
accId
,
required
String
sessionId
,
})
async
{
_isLoading
=
true
;
_errorMessage
=
null
;
...
...
@@ -22,7 +23,7 @@ class DashboardProvider with ChangeNotifier {
try
{
final
response
=
await
ApiCalling
.
fetchDashboardApi
(
accId
,);
await
ApiCalling
.
fetchDashboardApi
(
accId
,
sessionId
);
if
(
response
!=
null
)
{
_dashboardData
=
response
;
...
...
lib/Notifier/RentalContactProvider .dart
View file @
df116895
import
'package:flutter/material.dart'
;
import
'package:gen_rentals/Services/api_calling.dart'
;
import
'package:device_info_plus/device_info_plus.dart'
;
import
'dart:io'
;
class
RentalProvider
extends
ChangeNotifier
{
FetchMobileResponse
?
_response
;
FetchMobileResponse
?
otpResponse
;
bool
_isLoading
=
false
;
FetchMobileResponse
?
get
response
=>
_response
;
bool
get
isLoading
=>
_isLoading
;
bool
isOtpLoading
=
false
;
...
...
@@ -33,7 +36,8 @@ class RentalProvider extends ChangeNotifier {
notifyListeners
();
try
{
final
result
=
await
ApiCalling
.
fetchMobileOtpApi
(
mob
,
otp
);
final
deviceDetails
=
await
getDeviceDetails
();
final
result
=
await
ApiCalling
.
fetchMobileOtpApi
(
mob
,
otp
,
deviceDetails
);
otpResponse
=
result
;
}
catch
(
e
)
{
debugPrint
(
"❌ OTP API Error:
$e
"
);
...
...
@@ -44,6 +48,41 @@ class RentalProvider extends ChangeNotifier {
}
}
Future
<
Map
<
String
,
String
>>
getDeviceDetails
()
async
{
final
deviceInfo
=
DeviceInfoPlugin
();
if
(
Platform
.
isAndroid
)
{
final
androidInfo
=
await
deviceInfo
.
androidInfo
;
return
{
"versionName"
:
androidInfo
.
version
.
release
??
""
,
"versionCode"
:
androidInfo
.
version
.
codename
??
""
,
"osVersion"
:
androidInfo
.
version
.
release
??
""
,
"sdkVersion"
:
androidInfo
.
version
.
sdkInt
.
toString
(),
"device"
:
androidInfo
.
device
??
""
,
"model"
:
androidInfo
.
model
??
""
,
"product"
:
androidInfo
.
product
??
""
,
"manufacturer"
:
androidInfo
.
manufacturer
??
""
,
"brand"
:
androidInfo
.
brand
??
""
,
"user"
:
""
,
"display"
:
androidInfo
.
display
??
""
,
"hardware"
:
androidInfo
.
hardware
??
""
,
"board"
:
androidInfo
.
board
??
""
,
"host"
:
androidInfo
.
host
??
""
,
"serial"
:
androidInfo
.
serialNumber
??
"unknown"
,
"id"
:
androidInfo
.
id
??
""
,
"bootloader"
:
androidInfo
.
bootloader
??
""
,
"cpuAbi1"
:
androidInfo
.
supportedAbis
.
isNotEmpty
?
androidInfo
.
supportedAbis
[
0
]
:
""
,
"cpuAbi2"
:
androidInfo
.
supportedAbis
.
length
>
1
?
androidInfo
.
supportedAbis
[
1
]
:
""
,
"fingerprint"
:
androidInfo
.
fingerprint
??
""
,
};
}
return
{};
}
}
...
...
@@ -52,6 +91,7 @@ class FetchMobileResponse {
String
?
errorMsg
;
String
?
accId
;
String
?
message
;
String
?
sessionId
;
FetchMobileResponse
({
this
.
error
,
this
.
errorMsg
});
...
...
@@ -60,6 +100,7 @@ class FetchMobileResponse {
errorMsg
=
json
[
'error_msg'
];
accId
=
json
[
'acc_id'
];
message
=
json
[
'message'
];
sessionId
=
json
[
'session_id'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -68,7 +109,9 @@ class FetchMobileResponse {
data
[
'error_msg'
]
=
this
.
errorMsg
;
data
[
'acc_id'
]
=
this
.
accId
;
data
[
'message'
]
=
this
.
message
;
data
[
'session_id'
]
=
this
.
sessionId
;
return
data
;
}
}
lib/Notifier/SubscribeOrderDetailsProvider.dart
0 → 100644
View file @
df116895
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gen_rentals/Services/api_calling.dart'
;
import
'dart:convert'
;
import
'../Models/SubscribeOrderDetailsResponse.dart'
;
class
SubscribeOrderDetailsProvider
with
ChangeNotifier
{
SubscribeOrderDetailsResponse
?
_orderDetails
;
bool
_isLoading
=
false
;
String
_errorMessage
=
''
;
// Getters
SubscribeOrderDetailsResponse
?
get
orderDetails
=>
_orderDetails
;
bool
get
isLoading
=>
_isLoading
;
String
get
errorMessage
=>
_errorMessage
;
/// Fetch Subscribe Order Details
Future
<
void
>
fetchSubscribeOrderDetails
(
String
sessionId
,
String
orderId
,
String
accId
,
)
async
{
_isLoading
=
true
;
_errorMessage
=
''
;
notifyListeners
();
try
{
final
response
=
await
ApiCalling
.
fetchSubsOrderDetailApi
(
sessionId
,
orderId
,
accId
,
);
if
(
response
!=
null
)
{
// Check if error is "0" which means success in your API
if
(
response
.
error
==
"0"
)
{
_orderDetails
=
response
;
_errorMessage
=
''
;
}
// Handle other error cases
else
if
(
response
.
error
!=
null
&&
response
.
error
!.
isNotEmpty
&&
response
.
error
!=
"0"
)
{
_errorMessage
=
response
.
message
??
'An error occurred'
;
_orderDetails
=
null
;
}
// Handle message-based errors
else
if
(
response
.
message
!=
null
&&
response
.
message
!.
isNotEmpty
&&
!
response
.
message
!.
toLowerCase
().
contains
(
'success'
))
{
_errorMessage
=
response
.
message
!;
_orderDetails
=
null
;
}
// Default success case
else
{
_orderDetails
=
response
;
_errorMessage
=
''
;
}
}
else
{
_errorMessage
=
'Failed to load order details'
;
_orderDetails
=
null
;
}
}
catch
(
e
)
{
_errorMessage
=
'An error occurred:
$e
'
;
_orderDetails
=
null
;
debugPrint
(
"❌ Provider Error (fetchSubscribeOrderDetails):
$e
"
);
}
finally
{
_isLoading
=
false
;
notifyListeners
();
}
}
// ... rest of your provider code
}
\ No newline at end of file
lib/Notifier/TransactionsProvider.dart
0 → 100644
View file @
df116895
import
'dart:developer'
;
import
'package:flutter/material.dart'
;
import
'package:gen_rentals/Services/api_calling.dart'
;
import
'../Models/TransactionsResponse.dart'
;
class
TransactionsProvider
with
ChangeNotifier
{
bool
_isLoading
=
false
;
TransactionsResponse
?
_transactionsResponse
;
bool
get
isLoading
=>
_isLoading
;
TransactionsResponse
?
get
transactionsResponse
=>
_transactionsResponse
;
/// For UI convenience
Map
<
String
,
List
<
TransactionItem
>>
get
transactionsByMonth
=>
_transactionsResponse
?.
transactions
??
{};
/// Fetch Rental Transactions API
Future
<
void
>
fetchRentalTransactions
(
String
sessionId
,
String
accId
)
async
{
_isLoading
=
true
;
notifyListeners
();
try
{
final
response
=
await
ApiCalling
.
fetchRentalsTransactionsApi
(
sessionId
,
accId
);
if
(
response
!=
null
&&
response
.
error
==
"0"
)
{
_transactionsResponse
=
response
;
log
(
"✅ Transactions fetched successfully:
${response.transactions?.length ?? 0}
months"
);
}
else
{
log
(
"⚠️ Error in API response:
${response?.message}
"
);
_transactionsResponse
=
null
;
}
}
catch
(
e
)
{
log
(
"❌ Exception in fetchRentalTransactions:
$e
"
);
_transactionsResponse
=
null
;
}
finally
{
_isLoading
=
false
;
notifyListeners
();
}
}
/// Optional: Clear data
void
clearTransactions
()
{
_transactionsResponse
=
null
;
notifyListeners
();
}
}
lib/Screens/DashboardScreen.dart
View file @
df116895
This diff is collapsed.
Click to expand it.
lib/Screens/ProductsDetailScreen.dart
View file @
df116895
This diff is collapsed.
Click to expand it.
lib/Screens/SplashScreen.dart
View file @
df116895
...
...
@@ -104,13 +104,14 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
Future
<
void
>
_navigateToDashboard
()
async
{
final
String
?
savedAccId
=
await
prefs
.
getString
(
"accId"
);
final
String
?
savedSessionId
=
await
prefs
.
getString
(
"session_id"
);
// Check if accId is not null and not empty
if
(
savedAccId
!=
null
&&
savedAccId
.
isNotEmpty
)
{
Navigator
.
pushReplacement
(
context
,
PageRouteBuilder
(
pageBuilder:
(
_
,
__
,
___
)
=>
DashboardScreen
(
accId:
savedAccId
),
pageBuilder:
(
_
,
__
,
___
)
=>
DashboardScreen
(
accId:
savedAccId
,
sessionId:
savedSessionId
.
toString
(),
),
transitionsBuilder:
(
_
,
animation
,
__
,
child
)
{
return
FadeTransition
(
opacity:
animation
,
...
...
lib/Screens/TransactionsScreen.dart
View file @
df116895
This diff is collapsed.
Click to expand it.
lib/Screens/authScreen/OTP_Screen.dart
View file @
df116895
...
...
@@ -91,12 +91,16 @@ class _OtpScreenState extends State<OtpScreen> {
// Added null check for accId
if
(
rentalProvider
.
otpResponse
?.
accId
!=
null
)
{
await
prefs
.
saveString
(
"accId"
,
rentalProvider
.
otpResponse
!.
accId
!);
await
prefs
.
saveString
(
"session_id"
,
rentalProvider
.
otpResponse
!.
sessionId
!);
}
// Navigate to dashboard
Navigator
.
pushReplacement
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
DashboardScreen
(
accId:
rentalProvider
.
otpResponse
!.
accId
!,)),
MaterialPageRoute
(
builder:
(
_
)
=>
DashboardScreen
(
accId:
rentalProvider
.
otpResponse
!.
accId
!,
sessionId:
rentalProvider
.
otpResponse
!.
sessionId
!,)
),
);
}
else
{
// ❌ Invalid OTP
...
...
lib/Services/api_URLs.dart
View file @
df116895
/// base Url of api
const
baseUrl
=
"https://erp.gengroup.in/ci/app/Inventory/"
;
const
baseUrl
=
"https://erp.gengroup.in/ci/app/Rental/Rental_Home/"
;
const
baseUrl2
=
"https://erp.gengroup.in/ci/app/Rental/"
;
/// tokens url
const
addFcmTokenUrl
=
"
${baseUrl}
add_fcm_token"
;
/// payments and bills
const
addPaymentUrl
=
"
${baseUrl}
add_payment"
;
const
rentalPaymentDetailsUrl
=
"
${baseUrl}
rental_payment_detail
s"
;
const
transactionsUrl
=
"
${baseUrl}
transaction
s"
;
const
balanceUrl
=
"
${baseUrl}
balance"
;
const
billDetailsUrl
=
"
${baseUrl}
bill_details"
;
const
billListUrl
=
"
${baseUrl}
bill_list"
;
...
...
@@ -21,7 +22,7 @@ const getRentalAccInfoUrl = "${baseUrl}get_rental_acc_info";
const
orderDetailsBillUrl
=
"
${baseUrl}
order_details_bill"
;
const
orderDetailsMainUrl
=
"
${baseUrl}
order_details_main"
;
const
orderDetailsProductUrl
=
"
${baseUrl}
order_details_product"
;
const
orderListUrl
=
"
${baseUrl}
order_
list
"
;
const
subsOrderDetails
=
"
${baseUrl}
subs_
order_
details
"
;
const
tagOrderUrl
=
"
${baseUrl}
tag_order"
;
/// tickets
...
...
@@ -33,6 +34,6 @@ const ticketListUrl = "${baseUrl}ticket_list";
/// dashboard and login
const
fetchMobileUrl
=
"
${baseUrl}
fetch_mobile_number"
;
const
fetchOtpUrl
=
"
${baseUrl}
login"
;
const
dashboardUrl
=
"
${baseUrl}
dashboard"
;
\ No newline at end of file
const
fetchMobileUrl
=
"
${baseUrl2}
Rental_Auth/fetch_mobile_number"
;
const
fetchOtpUrl
=
"
${baseUrl2}
Rental_Auth/login"
;
const
dashboardUrl
=
"
${baseUrl2}
Rental_Home/dashboard"
;
\ No newline at end of file
lib/Services/api_calling.dart
View file @
df116895
...
...
@@ -7,11 +7,12 @@ import 'package:gen_rentals/Models/billProductResponse.dart';
import
'package:gen_rentals/Models/orderDetailsBillResponse.dart'
;
import
'package:gen_rentals/Models/orderDetailsMainResponse.dart'
;
import
'package:gen_rentals/Models/orderDetailsProductResponse.dart'
;
import
'package:gen_rentals/Models/
orderList
Response.dart'
;
import
'package:gen_rentals/Models/
SubscribeOrderDetails
Response.dart'
;
import
'package:gen_rentals/Models/ticketListResponse.dart'
;
import
'package:gen_rentals/Notifier/billDetailsResponse.dart'
;
import
'../Models/DashboardResponse.dart'
;
import
'../Models/RentalPaymentDetailsResponse.dart'
;
import
'../Models/TransactionsResponse.dart'
;
import
'../Models/rentalAccountResponse.dart'
;
import
'../Models/rentalContactResponse.dart'
;
import
'../Notifier/RentalContactProvider .dart'
;
...
...
@@ -47,13 +48,15 @@ class ApiCalling {
static
Future
<
FetchMobileResponse
?>
fetchMobileOtpApi
(
String
mob
,
String
otp
String
otp
,
Map
<
String
,
String
>
deviceDetails
)
async
{
debugPrint
(
"############################### Api calling "
);
try
{
Map
<
String
,
String
>
data
=
{
"mob"
:
mob
,
"otp"
:
otp
,
"device_details"
:
deviceDetails
.
toString
(),
};
final
res
=
await
post
(
data
,
fetchOtpUrl
,
{});
...
...
@@ -204,23 +207,24 @@ class ApiCalling {
}
}
/// Fetch
Order List
static
Future
<
OrderList
Response
?>
fetchOrder
List
Api
(
/// Fetch
Subscribe Order Details
static
Future
<
SubscribeOrderDetails
Response
?>
fetch
Subs
Order
Detail
Api
(
String
sessionId
,
String
emp
Id
,
String
order
Id
,
String
accId
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
"session_id"
:
sessionId
,
"
emp
_id"
:
emp
Id
,
"
order
_id"
:
order
Id
,
"acc_id"
:
accId
,
};
final
res
=
await
post
(
data
,
orderListUrl
,
{});
final
res
=
await
post
(
data
,
subsOrderDetails
,
{});
debugPrint
(
"Subscribe order details Response:
${res?.body}
"
);
if
(
res
!=
null
)
{
return
OrderList
Response
.
fromJson
(
jsonDecode
(
res
.
body
));
return
SubscribeOrderDetails
Response
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
...
...
@@ -286,23 +290,21 @@ class ApiCalling {
}
}
/// Fetch Rental
Payment Details
static
Future
<
RentalPaymentDetail
sResponse
?>
fetchRental
PaymentDetail
sApi
(
/// Fetch Rental
Transaction
static
Future
<
Transaction
sResponse
?>
fetchRental
sTransaction
sApi
(
String
sessionId
,
String
empId
,
String
billId
,
String
accId
,
)
async
{
try
{
Map
<
String
,
String
>
data
=
{
"session_id"
:
sessionId
,
"emp_id"
:
empId
,
"bill_id"
:
billId
,
"acc_id"
:
accId
,
};
final
res
=
await
post
(
data
,
rentalPaymentDetail
sUrl
,
{});
final
res
=
await
post
(
data
,
transaction
sUrl
,
{});
if
(
res
!=
null
)
{
return
RentalPaymentDetail
sResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
return
Transaction
sResponse
.
fromJson
(
jsonDecode
(
res
.
body
));
}
else
{
debugPrint
(
"Null Response"
);
return
null
;
...
...
@@ -535,11 +537,13 @@ class ApiCalling {
/// Fetch Dashboard
static
Future
<
DashboardResponse
?>
fetchDashboardApi
(
String
accId
,
String
sessionId
,
)
async
{
debugPrint
(
"Dashboard Api called ##############"
);
try
{
Map
<
String
,
String
>
data
=
{
"acc_id"
:
accId
,
"session_id"
:
sessionId
,
};
debugPrint
(
"Account Id :
$accId
"
);
...
...
lib/main.dart
View file @
df116895
import
'package:flutter/material.dart'
;
import
'package:gen_rentals/Notifier/DashboardProvider.dart'
;
import
'package:gen_rentals/Notifier/TransactionsProvider.dart'
;
import
'package:gen_rentals/Screens/SplashScreen.dart'
;
import
'package:provider/provider.dart'
;
import
'Notifier/RentalContactProvider .dart'
;
import
'Notifier/SubscribeOrderDetailsProvider.dart'
;
import
'Notifier/theme_provider.dart'
;
import
'Screens/authScreen/LoginScreen.dart'
;
...
...
@@ -28,6 +30,8 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider
<
DashboardProvider
>(
create:
(
_
)
=>
DashboardProvider
()),
ChangeNotifierProvider
<
RentalProvider
>(
create:
(
_
)
=>
RentalProvider
(),),
ChangeNotifierProvider
<
ThemeProvider
>(
create:
(
_
)
=>
ThemeProvider
(),),
ChangeNotifierProvider
(
create:
(
_
)
=>
SubscribeOrderDetailsProvider
()),
ChangeNotifierProvider
(
create:
(
_
)
=>
TransactionsProvider
()),
],
child:
Consumer
<
ThemeProvider
>(
builder:
(
context
,
themeProvider
,
child
)
{
...
...
pubspec.lock
View file @
df116895
...
...
@@ -129,6 +129,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.11"
device_info_plus:
dependency: "direct dev"
description:
name: device_info_plus
sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074
url: "https://pub.dev"
source: hosted
version: "10.1.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: e1ea89119e34903dca74b883d0dd78eb762814f97fb6c76f35e9ff74d261a18f
url: "https://pub.dev"
source: hosted
version: "7.0.3"
fake_async:
dependency: transitive
description:
...
...
@@ -781,6 +797,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.13.0"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852"
url: "https://pub.dev"
source: hosted
version: "1.1.5"
xdg_directories:
dependency: transitive
description:
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment