Account Info card changes and snackbar in statement #2
This commit is contained in:
@@ -71,148 +71,151 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
final theme = Theme.of(context);
|
||||
final bool isCardVisible = _visibilityMap[user.accountNo] ?? false;
|
||||
// Animated scale for the selected card
|
||||
final scale = isSelected ? 1.0 : 0.85;
|
||||
return AnimatedScale(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
scale: scale,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 18,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF01A04C),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Top section with account type and number (no refresh button here)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
getFullAccountType(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,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isSelected) // Show logo only if card is selected
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
// Bottom section with balance and combined toggle/refresh
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (isRefreshing && isSelected)
|
||||
Expanded(child: _buildBalanceShimmer())
|
||||
else
|
||||
final scale = isSelected ? 1.0 : 0.9;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: AnimatedScale(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
scale: scale,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 18,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF01A04C),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Top section with account type and number (no refresh button here)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"₹ ",
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
getFullAccountType(user.accountType),
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Text(
|
||||
isCardVisible
|
||||
? user.currentBalance ?? '0.00'
|
||||
: '*****',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
user.accountNo ?? 'N/A',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onPrimary,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
],
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10), // A steady space
|
||||
if (isSelected) // Only show toggle for selected card
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
if (isRefreshing)
|
||||
return; // Prevent taps while refreshing
|
||||
final accountNo = user.accountNo;
|
||||
if (accountNo == null) return;
|
||||
if (isSelected) // Show logo only if card is selected
|
||||
CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/images/logo.png',
|
||||
width: 30,
|
||||
height: 30,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
// Bottom section with balance and combined toggle/refresh
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (isRefreshing && isSelected)
|
||||
Expanded(child: _buildBalanceShimmer())
|
||||
else
|
||||
Expanded(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"₹ ",
|
||||
style: TextStyle(
|
||||
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 SizedBox(width: 10), // A steady space
|
||||
if (isSelected) // Only show toggle for selected card
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
if (isRefreshing)
|
||||
return; // Prevent taps while refreshing
|
||||
final accountNo = user.accountNo;
|
||||
if (accountNo == null) return;
|
||||
|
||||
final bool currentVisibility =
|
||||
_visibilityMap[accountNo] ?? false;
|
||||
final bool currentVisibility =
|
||||
_visibilityMap[accountNo] ?? false;
|
||||
|
||||
if (!currentVisibility) {
|
||||
// If hidden, refresh data and then show the balance
|
||||
await _refreshAccountData(context);
|
||||
if (mounted) {
|
||||
if (!currentVisibility) {
|
||||
// If hidden, refresh data and then show the balance
|
||||
await _refreshAccountData(context);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_visibilityMap[accountNo] = true;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// If visible, just hide it
|
||||
setState(() {
|
||||
_visibilityMap[accountNo] = true;
|
||||
_visibilityMap[accountNo] = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// If visible, just hide it
|
||||
setState(() {
|
||||
_visibilityMap[accountNo] = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
isCardVisible
|
||||
? Symbols.visibility_lock
|
||||
: Symbols.visibility,
|
||||
color: theme.scaffoldBackgroundColor,
|
||||
weight: 800,
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
isCardVisible
|
||||
? Symbols.visibility_lock
|
||||
: Symbols.visibility,
|
||||
color: theme.scaffoldBackgroundColor,
|
||||
weight: 800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _refreshAccountData(BuildContext context) async {
|
||||
@@ -456,7 +459,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
}
|
||||
_pageController ??= PageController(
|
||||
initialPage: selectedAccountIndex,
|
||||
viewportFraction: 1.0,
|
||||
viewportFraction: 0.75,
|
||||
);
|
||||
final firstName = getProcessedFirstName(currAccount.name);
|
||||
|
||||
@@ -481,48 +484,35 @@ class _DashboardScreenState extends State<DashboardScreen>
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Account Info Cards
|
||||
ClipRect(
|
||||
child: SizedBox(
|
||||
// This SizedBox defines the height for the Stack
|
||||
height: 160,
|
||||
child: Stack(
|
||||
children: [
|
||||
// PageView part, painted underneath
|
||||
SizedBox(
|
||||
// Keep SizedBox for PageView height
|
||||
height: 160,
|
||||
child: PageView.builder(
|
||||
controller: _pageController,
|
||||
itemCount: users.length, // Keep this to show adjacent cards
|
||||
SizedBox(
|
||||
height: 160,
|
||||
child: PageView.builder(
|
||||
clipBehavior: Clip.none,
|
||||
controller: _pageController,
|
||||
itemCount: users.length, // Keep this to show adjacent cards
|
||||
|
||||
onPageChanged: (int newIndex) async {
|
||||
if (newIndex == selectedAccountIndex)
|
||||
return;
|
||||
onPageChanged: (int newIndex) async {
|
||||
if (newIndex == selectedAccountIndex)
|
||||
return;
|
||||
|
||||
// Hide the balance of the old card when scrolling away
|
||||
final oldAccountNo =
|
||||
users[selectedAccountIndex].accountNo;
|
||||
if (oldAccountNo != null) {
|
||||
_visibilityMap[oldAccountNo] = false;
|
||||
}
|
||||
// Hide the balance of the old card when scrolling away
|
||||
final oldAccountNo =
|
||||
users[selectedAccountIndex].accountNo;
|
||||
if (oldAccountNo != null) {
|
||||
_visibilityMap[oldAccountNo] = false;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
selectedAccountIndex = newIndex;
|
||||
});
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
final user = users[index];
|
||||
final isSelected =
|
||||
index == selectedAccountIndex;
|
||||
return _buildAccountCard(
|
||||
user, isSelected);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
setState(() {
|
||||
selectedAccountIndex = newIndex;
|
||||
});
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
final user = users[index];
|
||||
final isSelected =
|
||||
index == selectedAccountIndex;
|
||||
return _buildAccountCard(
|
||||
user, isSelected);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
@@ -15,13 +15,13 @@ void main() async {
|
||||
]);
|
||||
|
||||
// Check for device compromise
|
||||
final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
if (compromisedMessage != null) {
|
||||
runApp(MaterialApp(
|
||||
home: SecurityErrorScreen(message: compromisedMessage),
|
||||
));
|
||||
return;
|
||||
}
|
||||
// final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
// if (compromisedMessage != null) {
|
||||
// runApp(MaterialApp(
|
||||
// home: SecurityErrorScreen(message: compromisedMessage),
|
||||
// ));
|
||||
// return;
|
||||
// }
|
||||
await setupDependencies();
|
||||
runApp(const KMobile());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user