55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class AccountCounter extends StatelessWidget {
|
|
final Map<String, double> accountsTotals;
|
|
|
|
const AccountCounter({super.key, required this.accountsTotals});
|
|
|
|
List<Row> _renderAccountTotals(BuildContext context) {
|
|
return accountsTotals.entries.toList().map((entry) => Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Flexible(
|
|
child: Text(
|
|
entry.key,
|
|
overflow: TextOverflow.ellipsis,
|
|
)
|
|
),
|
|
Text(
|
|
NumberFormat('#######.00 €', 'fr_FR').format(entry.value),
|
|
style: TextStyle(
|
|
fontFamily: 'NovaMono',
|
|
fontSize: 15,
|
|
color: entry.value > 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error
|
|
)),
|
|
],
|
|
)).toList();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(10),
|
|
margin: const EdgeInsets.only(bottom: 10),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(15),
|
|
color: Theme.of(context).colorScheme.primaryContainer,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Theme.of(context).colorScheme.shadow,
|
|
blurRadius: 10,
|
|
offset: const Offset(2, 2),
|
|
spreadRadius: 0.1,
|
|
blurStyle: BlurStyle.normal,
|
|
)
|
|
]
|
|
),
|
|
alignment: Alignment.centerRight,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: _renderAccountTotals(context),
|
|
),
|
|
);
|
|
}
|
|
} |