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,117 +170,120 @@ 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(
|
||||||
physics: const BouncingScrollPhysics(),
|
onRefresh: _onRefresh,
|
||||||
slivers: [
|
child: CustomScrollView(
|
||||||
SliverAppBar(
|
physics: const BouncingScrollPhysics(),
|
||||||
pinned: false,
|
slivers: [
|
||||||
floating: true,
|
SliverAppBar(
|
||||||
stretch: true,
|
pinned: false,
|
||||||
surfaceTintColor: Colors.transparent,
|
floating: true,
|
||||||
backgroundColor: isDark
|
stretch: true,
|
||||||
? const Color(0xFF0D0D0D)
|
surfaceTintColor: Colors.transparent,
|
||||||
: const Color(0xFFF8F9FA),
|
backgroundColor: isDark
|
||||||
title: constraints.maxWidth < ResponsivePolicy.md
|
? const Color(0xFF0D0D0D)
|
||||||
? Image(
|
: const Color(0xFFF8F9FA),
|
||||||
image: const AssetImage('assets/velocity.png'),
|
title: constraints.maxWidth < ResponsivePolicy.md
|
||||||
width: 130,
|
? Image(
|
||||||
)
|
image: const AssetImage('assets/velocity.png'),
|
||||||
: null,
|
width: 130,
|
||||||
actions: [
|
)
|
||||||
if (_isLoggedIn) ...[
|
: null,
|
||||||
Container(
|
actions: [
|
||||||
width: 30,
|
if (_isLoggedIn) ...[
|
||||||
height: 30,
|
Container(
|
||||||
margin: const EdgeInsets.only(right: 4),
|
width: 30,
|
||||||
decoration: BoxDecoration(
|
height: 30,
|
||||||
border: Border.all(
|
margin: const EdgeInsets.only(right: 4),
|
||||||
color: isDark
|
decoration: BoxDecoration(
|
||||||
? Colors.white.withValues(alpha: 0.12)
|
border: Border.all(
|
||||||
: Colors.black87.withAlpha(20),
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.12)
|
||||||
|
: Colors.black87.withAlpha(20),
|
||||||
|
),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
theme.colorScheme.primary.withValues(
|
||||||
|
alpha: 0.15,
|
||||||
|
),
|
||||||
|
theme.colorScheme.tertiary.withValues(
|
||||||
|
alpha: 0.05,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
stops: const [0.3, 0.7],
|
||||||
|
begin: Alignment.topRight,
|
||||||
|
end: Alignment.bottomLeft,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
shape: BoxShape.circle,
|
child: Center(
|
||||||
gradient: LinearGradient(
|
child: Text(
|
||||||
colors: [
|
initials,
|
||||||
theme.colorScheme.primary.withValues(
|
style: TextStyle(
|
||||||
alpha: 0.15,
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: isDark ? Colors.white : Colors.black87,
|
||||||
),
|
),
|
||||||
theme.colorScheme.tertiary.withValues(
|
|
||||||
alpha: 0.05,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
stops: const [0.3, 0.7],
|
|
||||||
begin: Alignment.topRight,
|
|
||||||
end: Alignment.bottomLeft,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
initials,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: isDark ? Colors.white : Colors.black87,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
IconButton(
|
||||||
IconButton(
|
icon: Icon(
|
||||||
icon: Icon(
|
Icons.logout_rounded,
|
||||||
Icons.logout_rounded,
|
color: isDark ? Colors.white54 : Colors.black54,
|
||||||
color: isDark ? Colors.white54 : Colors.black54,
|
size: 20,
|
||||||
size: 20,
|
),
|
||||||
|
onPressed: _showLogoutDialog,
|
||||||
),
|
),
|
||||||
onPressed: _showLogoutDialog,
|
],
|
||||||
),
|
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
SliverToBoxAdapter(
|
||||||
SliverToBoxAdapter(
|
child: Center(
|
||||||
child: Center(
|
child: SizedBox(
|
||||||
child: SizedBox(
|
width: constraints.maxWidth > 600
|
||||||
width: constraints.maxWidth > 600
|
? 600
|
||||||
? 600
|
: constraints.maxWidth,
|
||||||
: constraints.maxWidth,
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.fromLTRB(16, 8, 16, 32),
|
||||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 32),
|
child: LayoutBuilder(
|
||||||
child: LayoutBuilder(
|
builder: (context, innerConstraints) {
|
||||||
builder: (context, innerConstraints) {
|
return Column(
|
||||||
return Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
FadeTransition(
|
||||||
FadeTransition(
|
opacity: _providersFadeAnimation,
|
||||||
opacity: _providersFadeAnimation,
|
child: SlideTransition(
|
||||||
child: SlideTransition(
|
position: _providersSlideAnimation,
|
||||||
position: _providersSlideAnimation,
|
child: _buildProvidersSection(
|
||||||
child: _buildProvidersSection(
|
theme,
|
||||||
theme,
|
isDark,
|
||||||
isDark,
|
innerConstraints,
|
||||||
innerConstraints,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 24),
|
||||||
const SizedBox(height: 24),
|
FadeTransition(
|
||||||
FadeTransition(
|
opacity: _transactionsFadeAnimation,
|
||||||
opacity: _transactionsFadeAnimation,
|
child: SlideTransition(
|
||||||
child: SlideTransition(
|
position: _transactionsSlideAnimation,
|
||||||
position: _transactionsSlideAnimation,
|
child: _buildTransactionsSection(
|
||||||
child: _buildTransactionsSection(
|
theme,
|
||||||
theme,
|
isDark,
|
||||||
isDark,
|
innerConstraints,
|
||||||
innerConstraints,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -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,
|
||||||
@@ -150,4 +148,4 @@ class TransactionModel {
|
|||||||
_$TransactionModelFromJson(json);
|
_$TransactionModelFromJson(json);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$TransactionModelToJson(this);
|
Map<String, dynamic> toJson() => _$TransactionModelToJson(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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