Tracking Views +

This commit is contained in:
kodjomoustapha 2023-11-21 15:08:04 +01:00
parent b54390adc8
commit 09e7712e03
6 changed files with 116 additions and 73 deletions

View file

@ -258,5 +258,8 @@
"daily":"Daily",
"every_2_days":"Every 2 days",
"weekly":"Weekly",
"restore_backup_warning_title":"Restoring a backup will overwrite all existing data.\n\nContinue restoring?"
"restore_backup_warning_title":"Restoring a backup will overwrite all existing data.\n\nContinue restoring?",
"services":"Services",
"tracking_warning_info":"One-way sync yo update the chapter progress in tracking services. Set up tracking for individual entries from their tracking button."
}

View file

@ -258,5 +258,7 @@
"daily":"Tous les jours",
"every_2_days":"Tous les 2 jours",
"weekly":"Chaque semaine",
"restore_backup_warning_title":"La restauration d'une sauvegarde écrasera toutes les données existantes.\n\nContinuer la restauration ?"
"restore_backup_warning_title":"La restauration d'une sauvegarde écrasera toutes les données existantes.\n\nContinuer la restauration ?",
"services":"Services",
"tracking_warning_info":"Synchronisation à sens unique pour mettre à jour la progression du chapitre dans les services de suivi. Configurez le suivi des entrées individuelles à partir de leur boutton de suivi."
}

View file

@ -1366,9 +1366,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
return Column(
children: [
Icon(
isNotEmpty
? Icons.done
: Icons.screen_rotation_alt_rounded,
isNotEmpty ? Icons.done_rounded : Icons.sync_outlined,
size: 20,
color: color,
),

View file

@ -44,7 +44,7 @@ class SettingsScreen extends StatelessWidget {
ListTileWidget(
title: l10n.tracking,
subtitle: "",
icon: Icons.screen_rotation_alt_rounded,
icon: Icons.sync_outlined,
onTap: () => context.push('/track')),
ListTileWidget(
title: l10n.browse,

View file

@ -8,6 +8,7 @@ import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/services/trackers/anilist.dart';
import 'package:mangayomi/services/trackers/kitsu.dart';
import 'package:mangayomi/services/trackers/myanimelist.dart';
import 'package:mangayomi/utils/colors.dart';
import 'package:mangayomi/utils/media_query.dart';
class TrackScreen extends ConsumerWidget {
@ -15,6 +16,7 @@ class TrackScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final l10n = l10nLocalizations(context)!;
return Scaffold(
appBar: AppBar(
title: Text(l10nLocalizations(context)!.tracking),
@ -30,7 +32,19 @@ class TrackScreen extends ConsumerWidget {
snapshot.hasData ? snapshot.data : [];
return Column(
children: [
Padding(
padding: const EdgeInsets.only(
left: 15, right: 15, bottom: 10, top: 5),
child: Row(
children: [
Text(l10n.services,
style: TextStyle(
fontSize: 13, color: primaryColor(context))),
],
),
),
TrackListile(
color: const Color.fromRGBO(18, 25, 35, 1),
onTap: () async {
await ref
.read(anilistProvider(syncId: 2).notifier)
@ -39,12 +53,14 @@ class TrackScreen extends ConsumerWidget {
id: 2,
entries: entries!),
TrackListile(
color: const Color.fromRGBO(51, 37, 50, 1),
onTap: () async {
_showDialogLogin(context, ref);
},
id: 3,
entries: entries),
TrackListile(
color: const Color.fromRGBO(46, 81, 162, 1),
onTap: () async {
await ref
.read(myAnimeListProvider(syncId: 1, isManga: null)
@ -52,7 +68,23 @@ class TrackScreen extends ConsumerWidget {
.login();
},
id: 1,
entries: entries)
entries: entries),
ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
children: [
Icon(
Icons.info_outline_rounded,
color: secondaryColor(context),
),
],
),
),
subtitle: Text(l10n.tracking_warning_info,
style: TextStyle(
fontSize: 11, color: secondaryColor(context))),
)
],
);
}),

View file

@ -11,11 +11,13 @@ class TrackListile extends ConsumerWidget {
final int id;
final List<TrackPreference> entries;
final String? text;
final Color? color;
const TrackListile(
{super.key,
required this.onTap,
required this.id,
required this.entries,
this.color,
this.text});
@override
@ -23,77 +25,83 @@ class TrackListile extends ConsumerWidget {
final bool isLogged =
entries.where((element) => element.syncId == id).isNotEmpty;
final l10n = l10nLocalizations(context)!;
return ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
leading: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Container(
color: const Color.fromRGBO(18, 25, 35, 1),
width: 70,
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
leading: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: color,
),
width: 60,
height: 70,
child: Image.asset(
trackInfos(id).$1,
height: 30,
),
),
),
trailing: (isLogged
? const Icon(
Icons.check,
size: 30,
color: Colors.green,
)
: null),
onTap: isLogged
? () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(l10n.log_out_from(trackInfos(id).$2)),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
surfaceTintColor: Colors.transparent,
shape: RoundedRectangleBorder(
side: BorderSide(
color: secondaryColor(context)),
borderRadius:
BorderRadius.circular(20))),
onPressed: () {
Navigator.pop(context);
},
child: Text(l10n.cancel)),
const SizedBox(width: 15),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
Colors.red.withOpacity(0.7)),
onPressed: () {
ref
.read(tracksProvider(syncId: id).notifier)
.logout();
Navigator.pop(context);
},
child: Text(
l10n.log_out,
style:
TextStyle(color: secondaryColor(context)),
)),
],
)
],
);
});
}
: onTap,
title: Text(
text ?? trackInfos(id).$2,
style: TextStyle(fontSize: text != null ? 13 : null),
trailing: (isLogged
? const Icon(
Icons.check,
size: 30,
color: Colors.green,
)
: null),
onTap: isLogged
? () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(l10n.log_out_from(trackInfos(id).$2)),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
surfaceTintColor: Colors.transparent,
shape: RoundedRectangleBorder(
side: BorderSide(
color: secondaryColor(context)),
borderRadius:
BorderRadius.circular(20))),
onPressed: () {
Navigator.pop(context);
},
child: Text(l10n.cancel,
style:
TextStyle(color: secondaryColor(context)),)),
const SizedBox(width: 15),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor:
Colors.red.withOpacity(0.7)),
onPressed: () {
ref
.read(tracksProvider(syncId: id).notifier)
.logout();
Navigator.pop(context);
},
child: Text(
l10n.log_out,
style:
TextStyle(color: secondaryColor(context)),
)),
],
)
],
);
});
}
: onTap,
title: Text(
text ?? trackInfos(id).$2,
style: TextStyle(fontSize: text != null ? 13 : null),
),
),
);
}