Skip to content
Snippets Groups Projects
Commit 02eca99b authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Fix days counts

parent 031090bb
No related branches found
No related tags found
1 merge request!33Resolve "Fix days counts"
Pipeline #4641 passed
This commit is part of merge request !33. Comments created here will be created in the context of that merge request.
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.31 app.versionName=0.0.32
app.versionCode=31 app.versionCode=32
Improve / uniformize days counts on charts.
Amélioration / uniformisation des nombres de jours sur les graphiques.
class Settings {
static const int countsByDayDaysCount = 21;
static const int countsByHourDaysCount = 21;
static const int discoveriesDaysCount = 14;
static const int statisticsRecentDaysCount = 21;
static const int timelineDaysCount = 14;
static const int topArtistsDaysCount = 14;
}
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_counts_by_day_cubit.dart'; import 'package:scrobbles/cubit/data_counts_by_day_cubit.dart';
import 'package:scrobbles/models/counts_by_day.dart'; import 'package:scrobbles/models/counts_by_day.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -14,7 +15,7 @@ class CardCountsByDay extends StatelessWidget { ...@@ -14,7 +15,7 @@ class CardCountsByDay extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 21; final int daysCount = Settings.countsByDayDaysCount;
return BlocProvider<DataCountsByDayCubit>( return BlocProvider<DataCountsByDayCubit>(
create: (BuildContext context) => DataCountsByDayCubit(), create: (BuildContext context) => DataCountsByDayCubit(),
......
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_counts_by_hour_cubit.dart'; import 'package:scrobbles/cubit/data_counts_by_hour_cubit.dart';
import 'package:scrobbles/models/counts_by_hour.dart'; import 'package:scrobbles/models/counts_by_hour.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -14,7 +15,7 @@ class CardCountsByHour extends StatelessWidget { ...@@ -14,7 +15,7 @@ class CardCountsByHour extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 21; final int daysCount = Settings.countsByHourDaysCount;
return BlocProvider<DataCountsByHourCubit>( return BlocProvider<DataCountsByHourCubit>(
create: (BuildContext context) => DataCountsByHourCubit(), create: (BuildContext context) => DataCountsByHourCubit(),
......
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_discoveries_cubit.dart'; import 'package:scrobbles/cubit/data_discoveries_cubit.dart';
import 'package:scrobbles/models/discoveries.dart'; import 'package:scrobbles/models/discoveries.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -15,7 +16,7 @@ class CardDiscoveries extends StatelessWidget { ...@@ -15,7 +16,7 @@ class CardDiscoveries extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 14; final int daysCount = Settings.discoveriesDaysCount;
return BlocProvider<DataDiscoveriesCubit>( return BlocProvider<DataDiscoveriesCubit>(
create: (BuildContext context) => DataDiscoveriesCubit(), create: (BuildContext context) => DataDiscoveriesCubit(),
......
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_statistics_recent_cubit.dart'; import 'package:scrobbles/cubit/data_statistics_recent_cubit.dart';
import 'package:scrobbles/models/statistics_recent.dart'; import 'package:scrobbles/models/statistics_recent.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -14,7 +15,7 @@ class CardStatisticsRecent extends StatelessWidget { ...@@ -14,7 +15,7 @@ class CardStatisticsRecent extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 21; final int daysCount = Settings.statisticsRecentDaysCount;
// data context // data context
return BlocProvider<DataStatisticsRecentCubit>( return BlocProvider<DataStatisticsRecentCubit>(
......
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_timeline_cubit.dart'; import 'package:scrobbles/cubit/data_timeline_cubit.dart';
import 'package:scrobbles/models/timeline.dart'; import 'package:scrobbles/models/timeline.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -15,7 +16,7 @@ class CardTimeline extends StatelessWidget { ...@@ -15,7 +16,7 @@ class CardTimeline extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 14; final int daysCount = Settings.timelineDaysCount;
return BlocProvider<DataTimelineCubit>( return BlocProvider<DataTimelineCubit>(
create: (BuildContext context) => DataTimelineCubit(), create: (BuildContext context) => DataTimelineCubit(),
......
...@@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; ...@@ -4,6 +4,7 @@ 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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_top_artists_cubit.dart'; import 'package:scrobbles/cubit/data_top_artists_cubit.dart';
import 'package:scrobbles/models/topartists.dart'; import 'package:scrobbles/models/topartists.dart';
import 'package:scrobbles/ui/widgets/card_content.dart'; import 'package:scrobbles/ui/widgets/card_content.dart';
...@@ -14,7 +15,7 @@ class CardTopArtists extends StatelessWidget { ...@@ -14,7 +15,7 @@ class CardTopArtists extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final int daysCount = 14; final int daysCount = Settings.topArtistsDaysCount;
return BlocProvider<DataTopArtistsCubit>( return BlocProvider<DataTopArtistsCubit>(
create: (BuildContext context) => DataTopArtistsCubit(), create: (BuildContext context) => DataTopArtistsCubit(),
......
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:scrobbles/config/settings.dart';
import 'package:scrobbles/cubit/data_counts_by_day_cubit.dart'; import 'package:scrobbles/cubit/data_counts_by_day_cubit.dart';
import 'package:scrobbles/cubit/data_counts_by_hour_cubit.dart'; import 'package:scrobbles/cubit/data_counts_by_hour_cubit.dart';
import 'package:scrobbles/cubit/data_discoveries_cubit.dart'; import 'package:scrobbles/cubit/data_discoveries_cubit.dart';
...@@ -21,7 +22,6 @@ import 'package:scrobbles/ui/widgets/error.dart'; ...@@ -21,7 +22,6 @@ import 'package:scrobbles/ui/widgets/error.dart';
class UpdateData extends StatelessWidget { class UpdateData extends StatelessWidget {
const UpdateData({super.key}); const UpdateData({super.key});
final int daysCount = 21;
final Widget loading = const Text('⏳'); final Widget loading = const Text('⏳');
final Widget done = const Text(''); final Widget done = const Text('');
...@@ -31,13 +31,13 @@ class UpdateData extends StatelessWidget { ...@@ -31,13 +31,13 @@ class UpdateData extends StatelessWidget {
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
child: Stack( child: Stack(
children: [ children: [
updateCountsByDay(daysCount), updateCountsByDay(Settings.countsByDayDaysCount),
updateCountsByHour(daysCount), updateCountsByHour(Settings.countsByHourDaysCount),
updateDiscoveries(daysCount), updateDiscoveries(Settings.discoveriesDaysCount),
updateStatisticsGlobal(), updateStatisticsGlobal(),
updateStatisticsRecent(daysCount), updateStatisticsRecent(Settings.statisticsRecentDaysCount),
updateTimeline(daysCount), updateTimeline(Settings.timelineDaysCount),
updateTopArtists(daysCount), updateTopArtists(Settings.topArtistsDaysCount),
], ],
), ),
); );
......
...@@ -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.31+31 version: 0.0.32+32
environment: environment:
sdk: '^3.0.0' sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment