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
Showing
with 173 additions and 0 deletions
Ajout d'une barre de navigation, séparation des graphiques en plusieurs pages.
Navigation entre pages par mouvement de "swipe".
Séparation des statistiques globales et récentes.
Ajout du graphique "top artistes".
Améliorations visuelles des graphiques.
Amélioration du graphique des découvertes.
Nettoyage/améliorations/refactorisations de code.
Sauvegarde des données d'écoutes de l'API.
Mise à jour des dépendances.
Amélioration de la navigation par swipe.
Amélioration / uniformisation des nombres de jours sur les graphiques.
Amélioration du chargement des données des graphiques.
Amélioration de la mise à jour des données et des graphiques.
Ajout d'une page de paramètres (nom d'utilisateur, jeton de sécurité).
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;
}
import 'package:hydrated_bloc/hydrated_bloc.dart';
class BottomNavCubit extends HydratedCubit<int> {
BottomNavCubit() : super(0);
int pagesCount = 4;
void updateIndex(int index) {
if (isIndexAllowed(index)) {
emit(index);
} else {
goToHomePage();
}
}
bool isIndexAllowed(int index) {
return (index >= 0) && (index < pagesCount);
}
void goToHomePage() => emit(0);
@override
int? fromJson(Map<String, dynamic> json) {
return 0;
}
@override
Map<String, dynamic>? toJson(int state) {
return <String, int>{'pageIndex': state};
}
}
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:scrobbles/models/counts_by_day.dart';
part 'data_counts_by_day_state.dart';
class DataCountsByDayCubit extends HydratedCubit<DataCountsByDayState> {
DataCountsByDayCubit() : super(const DataCountsByDayState());
void getData(DataCountsByDayState state) {
emit(state);
}
CountsByDayData? getValue() {
return state.countsByDay;
}
void update(CountsByDayData? countsByDay) {
if (state.countsByDay.toString() != countsByDay.toString()) {
setValue(countsByDay);
}
}
void setValue(CountsByDayData? countsByDay) {
emit(DataCountsByDayState(
countsByDay: countsByDay,
));
}
@override
DataCountsByDayState? fromJson(Map<String, dynamic> json) {
return DataCountsByDayState(
countsByDay: CountsByDayData.fromJson(json['countsByDay']),
);
}
@override
Map<String, Object?>? toJson(DataCountsByDayState state) {
return <String, Object?>{
'countsByDay': state.countsByDay?.toJson(),
};
}
}
part of 'data_counts_by_day_cubit.dart';
@immutable
class DataCountsByDayState extends Equatable {
const DataCountsByDayState({
this.countsByDay,
});
final CountsByDayData? countsByDay;
@override
List<Object?> get props => <Object?>[
countsByDay,
];
}
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:scrobbles/models/counts_by_hour.dart';
part 'data_counts_by_hour_state.dart';
class DataCountsByHourCubit extends HydratedCubit<DataCountsByHourState> {
DataCountsByHourCubit() : super(const DataCountsByHourState());
void getData(DataCountsByHourState state) {
emit(state);
}
CountsByHourData? getValue() {
return state.countsByHour;
}
void update(CountsByHourData? countsByHour) {
if (state.countsByHour.toString() != countsByHour.toString()) {
setValue(countsByHour);
}
}
void setValue(CountsByHourData? countsByHour) {
emit(DataCountsByHourState(
countsByHour: countsByHour,
));
}
@override
DataCountsByHourState? fromJson(Map<String, dynamic> json) {
return DataCountsByHourState(
countsByHour: CountsByHourData.fromJson(json['countsByHour']),
);
}
@override
Map<String, Object?>? toJson(DataCountsByHourState state) {
return <String, Object?>{
'countsByHour': state.countsByHour?.toJson(),
};
}
}
part of 'data_counts_by_hour_cubit.dart';
@immutable
class DataCountsByHourState extends Equatable {
const DataCountsByHourState({
this.countsByHour,
});
final CountsByHourData? countsByHour;
@override
List<Object?> get props => <Object?>[
countsByHour,
];
}