fixed member dashboard issue
This commit is contained in:
parent
60e998fea4
commit
a200064284
|
|
@ -297,14 +297,14 @@ class _MemberDashboardState extends State<MemberDashboard> {
|
||||||
Widget _buildGroupCard(dynamic group) {
|
Widget _buildGroupCard(dynamic group) {
|
||||||
final color = Colors.green.shade600;
|
final color = Colors.green.shade600;
|
||||||
final groupName = group.name ?? 'Unnamed Group';
|
final groupName = group.name ?? 'Unnamed Group';
|
||||||
final totalAmount = group.totalAmount ?? 0;
|
final totalValue = group.totalValue ?? 0.0;
|
||||||
final monthlyInstallment = group.monthlyInstallment ?? 0;
|
final monthlyInstallment = group.monthlyInstallment ?? 0.0;
|
||||||
final durationMonths = group.durationMonths ?? 0;
|
final durationMonths = group.durationMonths ?? 0;
|
||||||
final status = group.status ?? 'pending';
|
final status = group.status ?? 'pending';
|
||||||
|
|
||||||
// Format currency
|
// Format currency
|
||||||
final totalValue = '₹${totalAmount.toString().replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]},')}';
|
final totalValueFormatted = '₹${_formatCurrency(totalValue)}';
|
||||||
final installmentValue = '₹${monthlyInstallment.toString().replaceAllMapped(RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'), (Match m) => '${m[1]},')}';
|
final installmentValueFormatted = '₹${_formatCurrency(monthlyInstallment)}';
|
||||||
|
|
||||||
return InteractiveCard(
|
return InteractiveCard(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -353,7 +353,7 @@ class _MemberDashboardState extends State<MemberDashboard> {
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildGroupInfo('Total Value', totalValue),
|
child: _buildGroupInfo('Total Value', totalValueFormatted),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 8.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
@ -365,7 +365,7 @@ class _MemberDashboardState extends State<MemberDashboard> {
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildGroupInfo('Installment', installmentValue),
|
child: _buildGroupInfo('Installment', installmentValueFormatted),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.w),
|
SizedBox(width: 8.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
@ -397,6 +397,15 @@ class _MemberDashboardState extends State<MemberDashboard> {
|
||||||
return status[0].toUpperCase() + status.substring(1).toLowerCase();
|
return status[0].toUpperCase() + status.substring(1).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _formatCurrency(double amount) {
|
||||||
|
// Format number with Indian comma notation
|
||||||
|
final amountStr = amount.toStringAsFixed(0);
|
||||||
|
return amountStr.replaceAllMapped(
|
||||||
|
RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
|
||||||
|
(Match m) => '${m[1]},'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildGroupInfo(String label, String value) {
|
Widget _buildGroupInfo(String label, String value) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.all(12.w),
|
padding: EdgeInsets.all(12.w),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue