Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • android/org.benoitharrault.scrobbles
1 result
Show changes
Commits on Source (4)
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.42 app.versionName=0.0.44
app.versionCode=42 app.versionCode=44
Auto save settings.
Fix parse heatmap data.
Sauvegarde automatique du paramétrage.
Correction sur le traitement des données de la heatmap.
...@@ -13,10 +13,6 @@ class DataHeatmapCubit extends HydratedCubit<DataHeatmapState> { ...@@ -13,10 +13,6 @@ class DataHeatmapCubit extends HydratedCubit<DataHeatmapState> {
emit(state); emit(state);
} }
HeatmapData? getValue() {
return state.heatmap;
}
void update(HeatmapData? heatmapData) { void update(HeatmapData? heatmapData) {
if ((heatmapData != null) && (state.heatmap.toString() != heatmapData.toString())) { if ((heatmapData != null) && (state.heatmap.toString() != heatmapData.toString())) {
setValue(heatmapData); setValue(heatmapData);
......
...@@ -31,9 +31,8 @@ class HeatmapData { ...@@ -31,9 +31,8 @@ class HeatmapData {
this.data.keys.forEach((day) { this.data.keys.forEach((day) {
Map<String, int> dayMap = {}; Map<String, int> dayMap = {};
this.data.keys.forEach((hour) { this.data[day]?.forEach((hour, count) {
int? value = this.data[day]?[hour]; dayMap[hour.toString()] = count;
dayMap[hour.toString()] = value != null ? value.toInt() : 0;
}); });
map[day.toString()] = dayMap; map[day.toString()] = dayMap;
}); });
......
...@@ -30,7 +30,7 @@ class CardHeatmap extends StatelessWidget { ...@@ -30,7 +30,7 @@ class CardHeatmap extends StatelessWidget {
'daysCount': daysCount.toString(), 'daysCount': daysCount.toString(),
}, },
), ),
loader: updateCountsByHour(daysCount), loader: updateHeatmapData(daysCount),
content: ChartHeatmap( content: ChartHeatmap(
chartData: heatmap, chartData: heatmap,
), ),
...@@ -39,7 +39,7 @@ class CardHeatmap extends StatelessWidget { ...@@ -39,7 +39,7 @@ class CardHeatmap extends StatelessWidget {
); );
} }
Widget updateCountsByHour(int daysCount) { Widget updateHeatmapData(int daysCount) {
final Widget loading = const Text('⏳'); final Widget loading = const Text('⏳');
final Widget done = const Text(''); final Widget done = const Text('');
......
import 'dart:math';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
......
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unicons/unicons.dart';
import 'package:scrobbles/config/default_settings.dart'; import 'package:scrobbles/config/default_settings.dart';
import 'package:scrobbles/cubit/settings_cubit.dart'; import 'package:scrobbles/cubit/settings_cubit.dart';
...@@ -116,6 +115,7 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -116,6 +115,7 @@ class _SettingsFormState extends State<SettingsForm> {
_selectedDiscoveriesDaysCount[i] = i == index; _selectedDiscoveriesDaysCount[i] = i == index;
} }
}); });
saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
...@@ -139,6 +139,7 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -139,6 +139,7 @@ class _SettingsFormState extends State<SettingsForm> {
_selectedDistributionDaysCount[i] = i == index; _selectedDistributionDaysCount[i] = i == index;
} }
}); });
saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
...@@ -162,6 +163,7 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -162,6 +163,7 @@ class _SettingsFormState extends State<SettingsForm> {
_selectedStatisticsRecentDaysCount[i] = i == index; _selectedStatisticsRecentDaysCount[i] = i == index;
} }
}); });
saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
...@@ -185,6 +187,7 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -185,6 +187,7 @@ class _SettingsFormState extends State<SettingsForm> {
_selectedTimelineDaysCount[i] = i == index; _selectedTimelineDaysCount[i] = i == index;
} }
}); });
saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
...@@ -208,6 +211,7 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -208,6 +211,7 @@ class _SettingsFormState extends State<SettingsForm> {
_selectedTopArtistsDaysCount[i] = i == index; _selectedTopArtistsDaysCount[i] = i == index;
} }
}); });
saveSettings();
}, },
borderRadius: const BorderRadius.all(Radius.circular(8)), borderRadius: const BorderRadius.all(Radius.circular(8)),
constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0), constraints: const BoxConstraints(minHeight: 30.0, minWidth: 30.0),
...@@ -218,18 +222,18 @@ class _SettingsFormState extends State<SettingsForm> { ...@@ -218,18 +222,18 @@ class _SettingsFormState extends State<SettingsForm> {
), ),
// Save // Save
ElevatedButton( // ElevatedButton(
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
Icon(UniconsLine.save), // Icon(UniconsLine.save),
SizedBox(width: 8), // SizedBox(width: 8),
Text('settings_button_save').tr(), // Text('settings_button_save').tr(),
], // ],
), // ),
onPressed: () => saveSettings(), // onPressed: () => saveSettings(),
), // ),
], ],
); );
} }
......
...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts ...@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none' publish_to: 'none'
version: 0.0.42+42 version: 0.0.44+44
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......