chore: Format code
This commit is contained in:
@@ -2085,7 +2085,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.''',
|
||||
homepage: 'https://github.com/fluttercommunity/get_it',
|
||||
authors: [
|
||||
'Flutter Community <community@flutter.zone>',
|
||||
'Thomas Burkhart <burkhartsengineering@gmail.com>'
|
||||
'Thomas Burkhart <burkhartsengineering@gmail.com>',
|
||||
],
|
||||
version: '7.2.0',
|
||||
license: '''MIT License
|
||||
|
||||
@@ -123,7 +123,10 @@ class DatabaseService {
|
||||
);
|
||||
}
|
||||
|
||||
Future<AnimeTrackingData> incrementAnimeWatchCounter(AnimeTrackingData data, int value) async {
|
||||
Future<AnimeTrackingData> incrementAnimeWatchCounter(
|
||||
AnimeTrackingData data,
|
||||
int value,
|
||||
) async {
|
||||
final result = await _db.rawQuery(
|
||||
'UPDATE $animeTable SET episodesWatched = episodesWatched + $value WHERE id = ? RETURNING *',
|
||||
[
|
||||
@@ -171,7 +174,10 @@ class DatabaseService {
|
||||
);
|
||||
}
|
||||
|
||||
Future<MangaTrackingData> incrementMangaReadChapters(MangaTrackingData data, int value) async {
|
||||
Future<MangaTrackingData> incrementMangaReadChapters(
|
||||
MangaTrackingData data,
|
||||
int value,
|
||||
) async {
|
||||
final result = await _db.rawQuery(
|
||||
'UPDATE $mangaTable SET episodesWatched = chaptersRead + $value WHERE id = ? RETURNING *',
|
||||
[
|
||||
|
||||
@@ -31,10 +31,12 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
|
||||
}
|
||||
|
||||
/// Internal anime state
|
||||
final List<AnimeTrackingData> _animes =
|
||||
List<AnimeTrackingData>.empty(growable: true);
|
||||
final List<MangaTrackingData> _mangas =
|
||||
List<MangaTrackingData>.empty(growable: true);
|
||||
final List<AnimeTrackingData> _animes = List<AnimeTrackingData>.empty(
|
||||
growable: true,
|
||||
);
|
||||
final List<MangaTrackingData> _mangas = List<MangaTrackingData>.empty(
|
||||
growable: true,
|
||||
);
|
||||
|
||||
List<AnimeTrackingData> get unfilteredAnime => _animes;
|
||||
|
||||
@@ -120,9 +122,12 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
|
||||
|
||||
final anime = state.animes[index];
|
||||
if (anime.episodesTotal != null &&
|
||||
anime.episodesWatched + 1 > anime.episodesTotal!) return;
|
||||
anime.episodesWatched + 1 > anime.episodesTotal!)
|
||||
return;
|
||||
|
||||
final newAnime = await GetIt.I.get<DatabaseService>().incrementAnimeWatchCounter(anime, 1);
|
||||
final newAnime = await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.incrementAnimeWatchCounter(anime, 1);
|
||||
final newList = List<AnimeTrackingData>.from(state.animes);
|
||||
newList[index] = newAnime;
|
||||
emit(
|
||||
@@ -142,8 +147,9 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
|
||||
final anime = state.animes[index];
|
||||
if (anime.episodesWatched - 1 < 0) return;
|
||||
|
||||
|
||||
final newAnime = await GetIt.I.get<DatabaseService>().incrementAnimeWatchCounter(anime, -1);
|
||||
final newAnime = await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.incrementAnimeWatchCounter(anime, -1);
|
||||
final newList = List<AnimeTrackingData>.from(state.animes);
|
||||
newList[index] = newAnime;
|
||||
emit(
|
||||
@@ -217,9 +223,12 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
|
||||
|
||||
final manga = state.mangas[index];
|
||||
if (manga.chaptersTotal != null &&
|
||||
manga.chaptersRead + 1 > manga.chaptersTotal!) return;
|
||||
manga.chaptersRead + 1 > manga.chaptersTotal!)
|
||||
return;
|
||||
|
||||
final newManga = await GetIt.I.get<DatabaseService>().incrementMangaReadChapters(manga, 1);
|
||||
final newManga = await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.incrementMangaReadChapters(manga, 1);
|
||||
final newList = List<MangaTrackingData>.from(state.mangas);
|
||||
newList[index] = newManga;
|
||||
emit(
|
||||
@@ -244,7 +253,9 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
|
||||
final manga = state.mangas[index];
|
||||
if (manga.chaptersRead - 1 < 0) return;
|
||||
|
||||
final newManga = await GetIt.I.get<DatabaseService>().incrementMangaReadChapters(manga, -1);
|
||||
final newManga = await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.incrementMangaReadChapters(manga, -1);
|
||||
final newList = List<MangaTrackingData>.from(state.mangas);
|
||||
newList[index] = newManga;
|
||||
emit(
|
||||
|
||||
@@ -69,9 +69,9 @@ class DetailsBloc extends Bloc<DetailsEvent, DetailsState> {
|
||||
),
|
||||
);
|
||||
|
||||
await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.updateAnime(event.data as AnimeTrackingData);
|
||||
await GetIt.I.get<DatabaseService>().updateAnime(
|
||||
event.data as AnimeTrackingData,
|
||||
);
|
||||
|
||||
GetIt.I.get<AnimeListBloc>().add(
|
||||
AnimeUpdatedEvent(event.data as AnimeTrackingData),
|
||||
@@ -83,9 +83,9 @@ class DetailsBloc extends Bloc<DetailsEvent, DetailsState> {
|
||||
),
|
||||
);
|
||||
|
||||
await GetIt.I
|
||||
.get<DatabaseService>()
|
||||
.updateManga(event.data as MangaTrackingData);
|
||||
await GetIt.I.get<DatabaseService>().updateManga(
|
||||
event.data as MangaTrackingData,
|
||||
);
|
||||
|
||||
GetIt.I.get<AnimeListBloc>().add(
|
||||
MangaUpdatedEvent(event.data as MangaTrackingData),
|
||||
|
||||
@@ -105,8 +105,9 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
|
||||
);
|
||||
|
||||
final title = anime.getElement('series_title')!.text;
|
||||
final totalEpisodes =
|
||||
int.parse(anime.getElement('series_episodes')!.text);
|
||||
final totalEpisodes = int.parse(
|
||||
anime.getElement('series_episodes')!.text,
|
||||
);
|
||||
final id = anime.getElement('series_animedb_id')!.text;
|
||||
|
||||
print('Waiting 500ms to not hammer Jikan ($title)');
|
||||
|
||||
@@ -273,8 +273,9 @@ class AnimeListPageState extends State<AnimeListPage> {
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: BottomBar(
|
||||
selectedIndex:
|
||||
state.trackingType == TrackingMediumType.anime ? 0 : 1,
|
||||
selectedIndex: state.trackingType == TrackingMediumType.anime
|
||||
? 0
|
||||
: 1,
|
||||
onTap: (int index) {
|
||||
context.read<AnimeListBloc>().add(
|
||||
AnimeTrackingTypeChanged(
|
||||
|
||||
@@ -183,9 +183,9 @@ class CalendarPageState extends State<CalendarPage> {
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
context
|
||||
.read<CalendarBloc>()
|
||||
.add(RefreshPerformedEvent());
|
||||
context.read<CalendarBloc>().add(
|
||||
RefreshPerformedEvent(),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
),
|
||||
|
||||
@@ -157,7 +157,10 @@ class DetailsPage extends StatelessWidget {
|
||||
end: 8,
|
||||
),
|
||||
child: Text(
|
||||
t.details.details.titleJa,
|
||||
t
|
||||
.details
|
||||
.details
|
||||
.titleJa,
|
||||
style:
|
||||
Theme.of(
|
||||
context,
|
||||
@@ -173,21 +176,32 @@ class DetailsPage extends StatelessWidget {
|
||||
end: 8,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize:
|
||||
MainAxisSize
|
||||
.min,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(
|
||||
ClipboardData(
|
||||
text: state.data!.title,
|
||||
text: state
|
||||
.data!
|
||||
.title,
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.copy),
|
||||
icon:
|
||||
const Icon(
|
||||
Icons
|
||||
.copy,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsGeometry.only(left: 8),
|
||||
padding:
|
||||
const EdgeInsetsGeometry.only(
|
||||
left: 8,
|
||||
),
|
||||
child: Text(
|
||||
state
|
||||
.data!
|
||||
@@ -223,13 +237,17 @@ class DetailsPage extends StatelessWidget {
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
final url = switch (state.trackingType) {
|
||||
TrackingMediumType.anime => 'https://myanimelist.net/anime/${state.data!.id}',
|
||||
TrackingMediumType.manga => 'https://myanimelist.net/manga/${state.data!.id}',
|
||||
final url = switch (state
|
||||
.trackingType) {
|
||||
TrackingMediumType.anime =>
|
||||
'https://myanimelist.net/anime/${state.data!.id}',
|
||||
TrackingMediumType.manga =>
|
||||
'https://myanimelist.net/manga/${state.data!.id}',
|
||||
};
|
||||
await launchUrl(
|
||||
Uri.parse(url),
|
||||
mode: LaunchMode.externalApplication,
|
||||
mode: LaunchMode
|
||||
.externalApplication,
|
||||
);
|
||||
},
|
||||
child: Text(t.details.mal),
|
||||
|
||||
@@ -96,13 +96,14 @@ class SettingsPage extends StatelessWidget {
|
||||
title: Text(t.settings.exportData),
|
||||
onTap: () async {
|
||||
// Pick the file
|
||||
final result =
|
||||
await FilePicker.platform.getDirectoryPath();
|
||||
final result = await FilePicker.platform
|
||||
.getDirectoryPath();
|
||||
if (result == null) return;
|
||||
|
||||
if (!(await Permission.manageExternalStorage
|
||||
.request())
|
||||
.isGranted) return;
|
||||
.isGranted)
|
||||
return;
|
||||
|
||||
GetIt.I.get<SettingsBloc>().add(
|
||||
DataExportedEvent(
|
||||
@@ -123,8 +124,9 @@ class SettingsPage extends StatelessWidget {
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: Text(t.settings.importInvalidData.title),
|
||||
content:
|
||||
Text(t.settings.importInvalidData.content),
|
||||
content: Text(
|
||||
t.settings.importInvalidData.content,
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -39,8 +39,9 @@ class DropdownSelectorState<T> extends State<DropdownSelector<T>> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
index =
|
||||
widget.values.indexWhere((item) => item.value == widget.initialValue);
|
||||
index = widget.values.indexWhere(
|
||||
(item) => item.value == widget.initialValue,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -93,8 +94,9 @@ class DropdownSelectorState<T> extends State<DropdownSelector<T>> {
|
||||
if (result == widget.values[index].value) return;
|
||||
|
||||
setState(() {
|
||||
index =
|
||||
widget.values.indexWhere((item) => item.value == result);
|
||||
index = widget.values.indexWhere(
|
||||
(item) => item.value == result,
|
||||
);
|
||||
});
|
||||
|
||||
widget.onChanged(result);
|
||||
|
||||
Reference in New Issue
Block a user