View All Created
This commit is contained in:
@@ -127,6 +127,9 @@ class _KMobileState extends State<KMobile> with WidgetsBindingObserver {
|
|||||||
theme: themeState.getLightThemeData(),
|
theme: themeState.getLightThemeData(),
|
||||||
darkTheme: themeState.getDarkThemeData(),
|
darkTheme: themeState.getDarkThemeData(),
|
||||||
themeMode: context.watch<ThemeModeCubit>().state.mode,
|
themeMode: context.watch<ThemeModeCubit>().state.mode,
|
||||||
|
navigatorObservers: [
|
||||||
|
getIt<RouteObserver<ModalRoute<void>>>(),
|
||||||
|
],
|
||||||
onGenerateRoute: AppRoutes.generateRoute,
|
onGenerateRoute: AppRoutes.generateRoute,
|
||||||
initialRoute: AppRoutes.splash,
|
initialRoute: AppRoutes.splash,
|
||||||
home: const AuthGate(),
|
home: const AuthGate(),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/api/services/branch_service.dart';
|
import 'package:kmobile/api/services/branch_service.dart';
|
||||||
import 'package:kmobile/api/services/limit_service.dart';
|
import 'package:kmobile/api/services/limit_service.dart';
|
||||||
import 'package:kmobile/api/services/rtgs_service.dart';
|
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||||
@@ -21,6 +22,8 @@ import '../security/secure_storage.dart';
|
|||||||
final getIt = GetIt.instance;
|
final getIt = GetIt.instance;
|
||||||
|
|
||||||
Future<void> setupDependencies() async {
|
Future<void> setupDependencies() async {
|
||||||
|
getIt.registerSingleton<RouteObserver<ModalRoute<void>>>(
|
||||||
|
RouteObserver<ModalRoute<void>>());
|
||||||
//getIt.registerLazySingleton<ThemeController>(() => ThemeController());
|
//getIt.registerLazySingleton<ThemeController>(() => ThemeController());
|
||||||
//getIt.registerLazySingleton<ThemeModeController>(() => ThemeModeController());
|
//getIt.registerLazySingleton<ThemeModeController>(() => ThemeModeController());
|
||||||
getIt.registerSingleton<ThemeCubit>(ThemeCubit());
|
getIt.registerSingleton<ThemeCubit>(ThemeCubit());
|
||||||
@@ -71,9 +74,9 @@ Dio _createDioClient() {
|
|||||||
final dio = Dio(
|
final dio = Dio(
|
||||||
BaseOptions(
|
BaseOptions(
|
||||||
baseUrl:
|
baseUrl:
|
||||||
//'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test
|
'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test
|
||||||
//'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod
|
//'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod
|
||||||
'https://kccbmbnk.net', //prod small
|
//'https://kccbmbnk.net', //prod small
|
||||||
connectTimeout: const Duration(seconds: 60),
|
connectTimeout: const Duration(seconds: 60),
|
||||||
receiveTimeout: const Duration(seconds: 60),
|
receiveTimeout: const Duration(seconds: 60),
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
141
lib/features/accounts/screens/all_accounts_screen.dart
Normal file
141
lib/features/accounts/screens/all_accounts_screen.dart
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:kmobile/data/models/user.dart';
|
||||||
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
|
class AllAccountsScreen extends StatefulWidget {
|
||||||
|
final List<User> users;
|
||||||
|
const AllAccountsScreen({super.key, required this.users});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AllAccountsScreen> createState() => _AllAccountsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AllAccountsScreenState extends State<AllAccountsScreen> {
|
||||||
|
final Map<String, bool> _visibilityMap = {};
|
||||||
|
|
||||||
|
String getFullAccountType(BuildContext context, String? accountType) {
|
||||||
|
// This is duplicated from dashboard_screen.dart.
|
||||||
|
// In a real app, this should be moved to a utility/helper class.
|
||||||
|
if (accountType == null || accountType.isEmpty) return 'N/A';
|
||||||
|
switch (accountType.toLowerCase()) {
|
||||||
|
case 'sa':
|
||||||
|
return "Savings Account"; // Using hardcoded strings for simplicity
|
||||||
|
case 'sb':
|
||||||
|
return "Savings Account";
|
||||||
|
case 'ln':
|
||||||
|
return "Loan Account";
|
||||||
|
case 'td':
|
||||||
|
return "Term Deposit";
|
||||||
|
case 'rd':
|
||||||
|
return "Recurring Deposit";
|
||||||
|
case 'ca':
|
||||||
|
return "Current Account";
|
||||||
|
default:
|
||||||
|
return "Unknown Account";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('All Accounts'),
|
||||||
|
),
|
||||||
|
body: ListView.builder(
|
||||||
|
itemCount: widget.users.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final user = widget.users[index];
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
|
child: _buildAccountCard(user),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildAccountCard(User user) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
final accountNo = user.accountNo ?? '';
|
||||||
|
final isVisible = _visibilityMap[accountNo] ?? false;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFF01A04C),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Top section: Account Type and Number
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
getFullAccountType(context, user.accountType),
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.onPrimary,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
user.accountNo ?? 'N/A',
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.onPrimary,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
// Bottom section: Balance and Toggle
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"₹ ",
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.onPrimary,
|
||||||
|
fontSize: 32,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
isVisible ? user.currentBalance ?? '0.00' : '*****',
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.onPrimary,
|
||||||
|
fontSize: 32,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_visibilityMap[accountNo] = !isVisible;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Icon(
|
||||||
|
isVisible ? Symbols.visibility_lock : Symbols.visibility,
|
||||||
|
color: theme.scaffoldBackgroundColor,
|
||||||
|
weight: 800,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import 'package:kmobile/data/repositories/transaction_repository.dart';
|
|||||||
import 'package:kmobile/di/injection.dart';
|
import 'package:kmobile/di/injection.dart';
|
||||||
import 'package:kmobile/features/accounts/screens/account_info_screen.dart';
|
import 'package:kmobile/features/accounts/screens/account_info_screen.dart';
|
||||||
import 'package:kmobile/features/accounts/screens/account_statement_screen.dart';
|
import 'package:kmobile/features/accounts/screens/account_statement_screen.dart';
|
||||||
|
import 'package:kmobile/features/accounts/screens/all_accounts_screen.dart';
|
||||||
import 'package:kmobile/features/accounts/screens/transaction_details_screen.dart';
|
import 'package:kmobile/features/accounts/screens/transaction_details_screen.dart';
|
||||||
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||||
import 'package:kmobile/features/auth/controllers/auth_state.dart';
|
import 'package:kmobile/features/auth/controllers/auth_state.dart';
|
||||||
@@ -34,33 +35,97 @@ class DashboardScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DashboardScreenState extends State<DashboardScreen>
|
class _DashboardScreenState extends State<DashboardScreen>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin, RouteAware {
|
||||||
int selectedAccountIndex = 0;
|
int selectedAccountIndex = 0;
|
||||||
Map<String, bool> _visibilityMap = {};
|
Map<String, bool> _visibilityMap = {};
|
||||||
bool isRefreshing = false;
|
bool isRefreshing = false;
|
||||||
bool isBalanceLoading = false;
|
|
||||||
bool _biometricPromptShown = false;
|
bool _biometricPromptShown = false;
|
||||||
bool _txLoading = false;
|
bool _txLoading = false;
|
||||||
List<Transaction> _transactions = [];
|
List<Transaction> _transactions = [];
|
||||||
bool _txInitialized = false;
|
bool _txInitialized = false;
|
||||||
PageController? _pageController;
|
PageController? _pageController;
|
||||||
|
final routeObserver = getIt<RouteObserver<ModalRoute<void>>>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
routeObserver.unsubscribe(this);
|
||||||
_pageController?.dispose();
|
_pageController?.dispose();
|
||||||
|
_visibilityMap.clear();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didPushNext() {
|
||||||
|
// This method is called when another route is pushed on top of this one.
|
||||||
|
// We clear the map and call setState to ensure the UI is updated
|
||||||
|
// if the user navigates back.
|
||||||
|
setState(() {
|
||||||
|
_visibilityMap.clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildViewAllTab(List<User> users) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AllAccountsScreen(users: users),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 40, // Small width for the tab
|
||||||
|
height: 160,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||||
|
),
|
||||||
|
child: const Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"View",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"All",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildAccountCard(User user, bool isSelected) {
|
Widget _buildAccountCard(User user, bool isSelected) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final bool isCardVisible = _visibilityMap[user.accountNo] ?? false;
|
final bool isCardVisible = _visibilityMap[user.accountNo] ?? false;
|
||||||
// Animated scale for the selected card
|
// Animated scale for the selected card
|
||||||
final scale = isSelected ? 1.0 : 0.9;
|
final scale = isSelected ? 1.0 : 0.85;
|
||||||
return AnimatedScale(
|
return AnimatedScale(
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
scale: scale,
|
scale: scale,
|
||||||
child: Container(
|
child: Transform.translate(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
offset: isSelected ? const Offset(10.0, 0.0) : Offset.zero,
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 2),
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 18,
|
horizontal: 18,
|
||||||
vertical: 10,
|
vertical: 10,
|
||||||
@@ -72,6 +137,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
// Top section with account type and number (no refresh button here)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -91,69 +157,72 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: theme.colorScheme.onPrimary,
|
color: theme.colorScheme.onPrimary,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w700, // Changed to bold
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (isSelected) // Only show refresh for selected card
|
if (isSelected) // Show logo only if card is selected
|
||||||
IconButton(
|
CircleAvatar(
|
||||||
icon: isRefreshing
|
radius: 20,
|
||||||
? SizedBox(
|
backgroundColor: Colors.white,
|
||||||
width: 20,
|
child: Padding(
|
||||||
height: 20,
|
padding: const EdgeInsets.all(2.0),
|
||||||
child: CircularProgressIndicator(
|
child: ClipOval(
|
||||||
color: theme.colorScheme.onPrimary,
|
child: Image.asset(
|
||||||
strokeWidth: 2,
|
'assets/images/logo.png',
|
||||||
),
|
width: 30,
|
||||||
)
|
height: 30,
|
||||||
: Icon(
|
fit: BoxFit.cover,
|
||||||
Symbols.refresh,
|
),
|
||||||
color: theme.colorScheme.onPrimary,
|
),
|
||||||
),
|
),
|
||||||
onPressed: isRefreshing
|
|
||||||
? null
|
|
||||||
: () => _refreshAccountData(context),
|
|
||||||
tooltip: 'Refresh',
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
// Bottom section with balance and combined toggle/refresh
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
if (isRefreshing && isSelected)
|
||||||
"₹ ",
|
|
||||||
style: TextStyle(
|
|
||||||
color: theme.colorScheme.onPrimary,
|
|
||||||
fontSize: 32, // Adjusted for space
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (isRefreshing || (isBalanceLoading && isSelected))
|
|
||||||
Expanded(child: _buildBalanceShimmer())
|
Expanded(child: _buildBalanceShimmer())
|
||||||
else
|
else
|
||||||
Expanded(
|
Expanded(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Row(
|
||||||
isCardVisible ? user.currentBalance ?? '0.00' : '*****',
|
children: [
|
||||||
style: TextStyle(
|
Text(
|
||||||
color: theme.colorScheme.onPrimary,
|
"₹ ",
|
||||||
fontSize: 32,
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w700,
|
color: theme.colorScheme.onPrimary,
|
||||||
),
|
fontSize: 40,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
isCardVisible
|
||||||
|
? user.currentBalance ?? '0.00'
|
||||||
|
: '*****',
|
||||||
|
style: TextStyle(
|
||||||
|
color: theme.colorScheme.onPrimary,
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const SizedBox(width: 10), // A steady space
|
||||||
if (isSelected) // Only show toggle for selected card
|
if (isSelected) // Only show toggle for selected card
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (isBalanceLoading) return;
|
if (isRefreshing) return; // Prevent taps while refreshing
|
||||||
final accountNo = user.accountNo;
|
final accountNo = user.accountNo;
|
||||||
if (accountNo == null) return;
|
if (accountNo == null) return;
|
||||||
|
|
||||||
@@ -161,18 +230,15 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
_visibilityMap[accountNo] ?? false;
|
_visibilityMap[accountNo] ?? false;
|
||||||
|
|
||||||
if (!currentVisibility) {
|
if (!currentVisibility) {
|
||||||
// If it's currently hidden, we show it after a delay
|
// If hidden, refresh data and then show the balance
|
||||||
setState(() {
|
await _refreshAccountData(context);
|
||||||
isBalanceLoading = true;
|
if (mounted) {
|
||||||
});
|
setState(() {
|
||||||
await Future.delayed(
|
_visibilityMap[accountNo] = true;
|
||||||
const Duration(milliseconds: 500)); // Shorter delay
|
});
|
||||||
setState(() {
|
}
|
||||||
_visibilityMap[accountNo] = true;
|
|
||||||
isBalanceLoading = false;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// If it's currently visible, we hide it immediately
|
// If visible, just hide it
|
||||||
setState(() {
|
setState(() {
|
||||||
_visibilityMap[accountNo] = false;
|
_visibilityMap[accountNo] = false;
|
||||||
});
|
});
|
||||||
@@ -195,6 +261,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +510,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
}
|
}
|
||||||
_pageController ??= PageController(
|
_pageController ??= PageController(
|
||||||
initialPage: selectedAccountIndex,
|
initialPage: selectedAccountIndex,
|
||||||
viewportFraction: 0.85,
|
viewportFraction: 0.80,
|
||||||
);
|
);
|
||||||
final firstName = getProcessedFirstName(currAccount.name);
|
final firstName = getProcessedFirstName(currAccount.name);
|
||||||
|
|
||||||
@@ -467,33 +534,53 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// Account Info Cards
|
// Account Info Cards
|
||||||
SizedBox(
|
ClipRect(
|
||||||
height: 160, // Adjusted height
|
child: SizedBox( // This SizedBox defines the height for the Stack
|
||||||
child: PageView.builder(
|
height: 160,
|
||||||
controller: _pageController,
|
child: Stack(
|
||||||
itemCount: users.length,
|
children: [
|
||||||
onPageChanged: (int newIndex) async {
|
// PageView part, painted underneath
|
||||||
if (newIndex == selectedAccountIndex) return;
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 48.0), // Space for tab (40) + gap (8)
|
||||||
|
child: SizedBox( // Keep SizedBox for PageView height
|
||||||
|
height: 160,
|
||||||
|
child: PageView.builder(
|
||||||
|
controller: _pageController,
|
||||||
|
itemCount: users.length,
|
||||||
|
clipBehavior: Clip.none, // Keep this to show adjacent cards
|
||||||
|
padEnds: false,
|
||||||
|
onPageChanged: (int newIndex) async {
|
||||||
|
if (newIndex == selectedAccountIndex) return;
|
||||||
|
|
||||||
// Hide the balance of the old card when scrolling away
|
// Hide the balance of the old card when scrolling away
|
||||||
final oldAccountNo = users[selectedAccountIndex].accountNo;
|
final oldAccountNo = users[selectedAccountIndex].accountNo;
|
||||||
if (oldAccountNo != null) {
|
if (oldAccountNo != null) {
|
||||||
_visibilityMap[oldAccountNo] = false;
|
_visibilityMap[oldAccountNo] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedAccountIndex = newIndex;
|
selectedAccountIndex = newIndex;
|
||||||
});
|
});
|
||||||
|
|
||||||
await _loadTransactions(
|
await _loadTransactions(
|
||||||
users[newIndex].accountNo!,
|
users[newIndex].accountNo!,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final user = users[index];
|
final user = users[index];
|
||||||
final isSelected = index == selectedAccountIndex;
|
final isSelected = index == selectedAccountIndex;
|
||||||
return _buildAccountCard(user, isSelected);
|
return _buildAccountCard(user, isSelected);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// View All tab part, painted on top
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: _buildViewAllTab(users),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
|
|||||||
Reference in New Issue
Block a user