minor home screen fix
This commit is contained in:
@@ -113,6 +113,17 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||||||
await homeController.getTransactions(prefs.getString("userId")!);
|
await homeController.getTransactions(prefs.getString("userId")!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _onRefresh() async {
|
||||||
|
await homeController.getAccounts();
|
||||||
|
await homeController.getCategories();
|
||||||
|
await homeController.getProviders();
|
||||||
|
|
||||||
|
prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.getString("userId") != null) {
|
||||||
|
await homeController.getTransactions(prefs.getString("userId")!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _onRouteChanged() async {
|
void _onRouteChanged() async {
|
||||||
final location = router.routerDelegate.currentConfiguration.uri.toString();
|
final location = router.routerDelegate.currentConfiguration.uri.toString();
|
||||||
if (location.startsWith('/home')) {
|
if (location.startsWith('/home')) {
|
||||||
@@ -159,7 +170,9 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||||||
body: ListenableBuilder(
|
body: ListenableBuilder(
|
||||||
listenable: homeController,
|
listenable: homeController,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
return CustomScrollView(
|
return RefreshIndicator(
|
||||||
|
onRefresh: _onRefresh,
|
||||||
|
child: CustomScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
@@ -270,6 +283,7 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -299,6 +313,15 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
_buildSectionLabel(theme, isDark, Icons.grid_view_rounded, "Pay"),
|
_buildSectionLabel(theme, isDark, Icons.grid_view_rounded, "Pay"),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.refresh_rounded,
|
||||||
|
color: isDark ? Colors.white54 : Colors.black54,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
onPressed: _onRefresh,
|
||||||
|
tooltip: 'Refresh',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|||||||
@@ -34,9 +34,7 @@ class AdditionalDataJsonConverter
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
List<Map<String, dynamic>>? fromJson(List<dynamic>? json) {
|
List<Map<String, dynamic>>? fromJson(List<dynamic>? json) {
|
||||||
return json
|
return json?.map((e) => Map<String, dynamic>.from(e as Map)).toList();
|
||||||
?.map((e) => Map<String, dynamic>.from(e as Map))
|
|
||||||
.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -61,7 +59,7 @@ class TransactionModel {
|
|||||||
final Decimal totalAmount;
|
final Decimal totalAmount;
|
||||||
final String reference;
|
final String reference;
|
||||||
final String paymentProcessorLabel;
|
final String paymentProcessorLabel;
|
||||||
final String integrationProcessorLabel;
|
final String? integrationProcessorLabel;
|
||||||
final String confirmationProcessorLabel;
|
final String confirmationProcessorLabel;
|
||||||
final String providerLabel;
|
final String providerLabel;
|
||||||
final String debitPhone;
|
final String debitPhone;
|
||||||
@@ -109,7 +107,7 @@ class TransactionModel {
|
|||||||
required this.totalAmount,
|
required this.totalAmount,
|
||||||
required this.reference,
|
required this.reference,
|
||||||
required this.paymentProcessorLabel,
|
required this.paymentProcessorLabel,
|
||||||
required this.integrationProcessorLabel,
|
this.integrationProcessorLabel,
|
||||||
required this.confirmationProcessorLabel,
|
required this.confirmationProcessorLabel,
|
||||||
required this.providerLabel,
|
required this.providerLabel,
|
||||||
required this.debitPhone,
|
required this.debitPhone,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ TransactionModel _$TransactionModelFromJson(Map<String, dynamic> json) =>
|
|||||||
),
|
),
|
||||||
reference: json['reference'] as String,
|
reference: json['reference'] as String,
|
||||||
paymentProcessorLabel: json['paymentProcessorLabel'] as String,
|
paymentProcessorLabel: json['paymentProcessorLabel'] as String,
|
||||||
integrationProcessorLabel: json['integrationProcessorLabel'] as String,
|
integrationProcessorLabel: json['integrationProcessorLabel'] as String?,
|
||||||
confirmationProcessorLabel: json['confirmationProcessorLabel'] as String,
|
confirmationProcessorLabel: json['confirmationProcessorLabel'] as String,
|
||||||
providerLabel: json['providerLabel'] as String,
|
providerLabel: json['providerLabel'] as String,
|
||||||
debitPhone: json['debitPhone'] as String,
|
debitPhone: json['debitPhone'] as String,
|
||||||
|
|||||||
Reference in New Issue
Block a user