Ref: Passt Linter-Rules an

This commit is contained in:
2025-12-22 03:34:15 +01:00
parent 92fec89333
commit 7a76f0d40e
4 changed files with 18 additions and 19 deletions

View File

@@ -76,7 +76,7 @@ class _TrendState extends State<Trend> {
}
Future<void> _pickDateRange() async {
final DateTime now = DateTime.now();
final now = DateTime.now();
final DateTimeRange<DateTime>? picked = await showDateRangePicker(
context: context,
firstDate: DateTime(now.year - 5),
@@ -91,7 +91,7 @@ class _TrendState extends State<Trend> {
}
void _updateUrl() {
final Map<String, String> params = <String, String>{
final params = <String, String>{
if (nameController.text.isNotEmpty) 'name': nameController.text,
if (minController.text.isNotEmpty) 'min': minController.text,
if (maxController.text.isNotEmpty) 'max': maxController.text,
@@ -104,7 +104,7 @@ class _TrendState extends State<Trend> {
}
String _monthName(final int month) {
const List<String> names = <String>[
const names = <String>[
'',
'Januar',
'Februar',
@@ -135,9 +135,9 @@ class _TrendState extends State<Trend> {
final List<Map<String, Object>> filteredTransactions =
transactions.where((final Map<String, Object> tx) {
final DateTime date = tx['date']! as DateTime;
final date = tx['date']! as DateTime;
bool rangeMatch = true;
var rangeMatch = true;
if (selectedRange != null) {
rangeMatch =
!date.isBefore(selectedRange!.start) &&
@@ -147,7 +147,7 @@ class _TrendState extends State<Trend> {
final bool nameMatch =
searchName.isEmpty ||
((tx['name'] ?? '') as String).contains(searchName);
final double amount = (tx['amount'] ?? 0) as double;
final amount = (tx['amount'] ?? 0) as double;
final bool amountMatch =
(minAmount == null || amount >= minAmount) &&
(maxAmount == null || amount <= maxAmount);
@@ -158,11 +158,10 @@ class _TrendState extends State<Trend> {
(b['date']! as DateTime).compareTo(a['date']! as DateTime),
);
final Map<String, List<Map<String, Object>>> transactionsByMonth =
<String, List<Map<String, Object>>>{};
for (final Map<String, Object> tx in filteredTransactions) {
final DateTime date = tx['date']! as DateTime;
final String monthName = '${_monthName(date.month)} ${date.year}';
final transactionsByMonth = <String, List<Map<String, Object>>>{};
for (final tx in filteredTransactions) {
final date = tx['date']! as DateTime;
final monthName = '${_monthName(date.month)} ${date.year}';
transactionsByMonth
.putIfAbsent(monthName, () => <Map<String, Object>>[])
.add(tx);
@@ -339,8 +338,8 @@ class _TrendState extends State<Trend> {
final int index,
) {
final Map<String, Object> tx = entry.value[index];
final double amount = (tx['amount'] ?? 0) as double;
final DateTime date = tx['date']! as DateTime;
final amount = (tx['amount'] ?? 0) as double;
final date = tx['date']! as DateTime;
return ListTile(
contentPadding: EdgeInsets.zero,
title: Text((tx['name'] ?? '') as String),