Ref: Passt Linter-Rules an
This commit is contained in:
@@ -24,7 +24,6 @@ linter:
|
|||||||
- always_declare_return_types
|
- always_declare_return_types
|
||||||
- always_put_control_body_on_new_line
|
- always_put_control_body_on_new_line
|
||||||
- always_put_required_named_parameters_first
|
- always_put_required_named_parameters_first
|
||||||
- always_specify_types
|
|
||||||
- annotate_overrides
|
- annotate_overrides
|
||||||
- annotate_redeclares
|
- annotate_redeclares
|
||||||
- avoid_annotating_with_dynamic
|
- avoid_annotating_with_dynamic
|
||||||
@@ -123,6 +122,7 @@ linter:
|
|||||||
- noop_primitive_operations
|
- noop_primitive_operations
|
||||||
- null_check_on_nullable_type_parameter
|
- null_check_on_nullable_type_parameter
|
||||||
- null_closures
|
- null_closures
|
||||||
|
- omit_obvious_local_variable_types
|
||||||
- one_member_abstracts
|
- one_member_abstracts
|
||||||
- only_throw_errors
|
- only_throw_errors
|
||||||
- overridden_fields
|
- overridden_fields
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ class Dashboard extends StatelessWidget {
|
|||||||
/// [context] ist der Build-Kontext
|
/// [context] ist der Build-Kontext
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) {
|
Widget build(final BuildContext context) {
|
||||||
const double currentBalance = 4820.75;
|
const currentBalance = 4820.75;
|
||||||
const double previousMonthBalance = 4300;
|
const double previousMonthBalance = 4300;
|
||||||
|
|
||||||
final Map<String, double> monthlyBalance = <String, double>{
|
final monthlyBalance = <String, double>{
|
||||||
'Jan': 1200.0,
|
'Jan': 1200.0,
|
||||||
'Feb': 900.0,
|
'Feb': 900.0,
|
||||||
'Mär': 1100.0,
|
'Mär': 1100.0,
|
||||||
@@ -26,7 +26,7 @@ class Dashboard extends StatelessWidget {
|
|||||||
'Jun': 1050.0,
|
'Jun': 1050.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
final List<Map<String, Object>> recentTransactions = <Map<String, Object>>[
|
final recentTransactions = <Map<String, Object>>[
|
||||||
<String, Object>{'name': 'Supermarkt', 'amount': -45.50},
|
<String, Object>{'name': 'Supermarkt', 'amount': -45.50},
|
||||||
<String, Object>{'name': 'Gehalt', 'amount': 2500.00},
|
<String, Object>{'name': 'Gehalt', 'amount': 2500.00},
|
||||||
<String, Object>{'name': 'Miete', 'amount': -900.00},
|
<String, Object>{'name': 'Miete', 'amount': -900.00},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class _SettingsState extends State<Settings> {
|
|||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _addAccount() async {
|
Future<void> _addAccount() async {
|
||||||
final TextEditingController controller = TextEditingController();
|
final controller = TextEditingController();
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -49,7 +49,7 @@ class _SettingsState extends State<Settings> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _renameAccount(final int index) async {
|
Future<void> _renameAccount(final int index) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final controller = TextEditingController(
|
||||||
text: _accounts[index],
|
text: _accounts[index],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class _TrendState extends State<Trend> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _pickDateRange() async {
|
Future<void> _pickDateRange() async {
|
||||||
final DateTime now = DateTime.now();
|
final now = DateTime.now();
|
||||||
final DateTimeRange<DateTime>? picked = await showDateRangePicker(
|
final DateTimeRange<DateTime>? picked = await showDateRangePicker(
|
||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime(now.year - 5),
|
firstDate: DateTime(now.year - 5),
|
||||||
@@ -91,7 +91,7 @@ class _TrendState extends State<Trend> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateUrl() {
|
void _updateUrl() {
|
||||||
final Map<String, String> params = <String, String>{
|
final params = <String, String>{
|
||||||
if (nameController.text.isNotEmpty) 'name': nameController.text,
|
if (nameController.text.isNotEmpty) 'name': nameController.text,
|
||||||
if (minController.text.isNotEmpty) 'min': minController.text,
|
if (minController.text.isNotEmpty) 'min': minController.text,
|
||||||
if (maxController.text.isNotEmpty) 'max': maxController.text,
|
if (maxController.text.isNotEmpty) 'max': maxController.text,
|
||||||
@@ -104,7 +104,7 @@ class _TrendState extends State<Trend> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _monthName(final int month) {
|
String _monthName(final int month) {
|
||||||
const List<String> names = <String>[
|
const names = <String>[
|
||||||
'',
|
'',
|
||||||
'Januar',
|
'Januar',
|
||||||
'Februar',
|
'Februar',
|
||||||
@@ -135,9 +135,9 @@ class _TrendState extends State<Trend> {
|
|||||||
|
|
||||||
final List<Map<String, Object>> filteredTransactions =
|
final List<Map<String, Object>> filteredTransactions =
|
||||||
transactions.where((final Map<String, Object> tx) {
|
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) {
|
if (selectedRange != null) {
|
||||||
rangeMatch =
|
rangeMatch =
|
||||||
!date.isBefore(selectedRange!.start) &&
|
!date.isBefore(selectedRange!.start) &&
|
||||||
@@ -147,7 +147,7 @@ class _TrendState extends State<Trend> {
|
|||||||
final bool nameMatch =
|
final bool nameMatch =
|
||||||
searchName.isEmpty ||
|
searchName.isEmpty ||
|
||||||
((tx['name'] ?? '') as String).contains(searchName);
|
((tx['name'] ?? '') as String).contains(searchName);
|
||||||
final double amount = (tx['amount'] ?? 0) as double;
|
final amount = (tx['amount'] ?? 0) as double;
|
||||||
final bool amountMatch =
|
final bool amountMatch =
|
||||||
(minAmount == null || amount >= minAmount) &&
|
(minAmount == null || amount >= minAmount) &&
|
||||||
(maxAmount == null || amount <= maxAmount);
|
(maxAmount == null || amount <= maxAmount);
|
||||||
@@ -158,11 +158,10 @@ class _TrendState extends State<Trend> {
|
|||||||
(b['date']! as DateTime).compareTo(a['date']! as DateTime),
|
(b['date']! as DateTime).compareTo(a['date']! as DateTime),
|
||||||
);
|
);
|
||||||
|
|
||||||
final Map<String, List<Map<String, Object>>> transactionsByMonth =
|
final transactionsByMonth = <String, List<Map<String, Object>>>{};
|
||||||
<String, List<Map<String, Object>>>{};
|
for (final tx in filteredTransactions) {
|
||||||
for (final Map<String, Object> tx in filteredTransactions) {
|
final date = tx['date']! as DateTime;
|
||||||
final DateTime date = tx['date']! as DateTime;
|
final monthName = '${_monthName(date.month)} ${date.year}';
|
||||||
final String monthName = '${_monthName(date.month)} ${date.year}';
|
|
||||||
transactionsByMonth
|
transactionsByMonth
|
||||||
.putIfAbsent(monthName, () => <Map<String, Object>>[])
|
.putIfAbsent(monthName, () => <Map<String, Object>>[])
|
||||||
.add(tx);
|
.add(tx);
|
||||||
@@ -339,8 +338,8 @@ class _TrendState extends State<Trend> {
|
|||||||
final int index,
|
final int index,
|
||||||
) {
|
) {
|
||||||
final Map<String, Object> tx = entry.value[index];
|
final Map<String, Object> tx = entry.value[index];
|
||||||
final double amount = (tx['amount'] ?? 0) as double;
|
final amount = (tx['amount'] ?? 0) as double;
|
||||||
final DateTime date = tx['date']! as DateTime;
|
final date = tx['date']! as DateTime;
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text((tx['name'] ?? '') as String),
|
title: Text((tx['name'] ?? '') as String),
|
||||||
|
|||||||
Reference in New Issue
Block a user