mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 03:32:06 +00:00
l10n for trackers
This commit is contained in:
parent
fb71379cb9
commit
d04457c60b
9 changed files with 217 additions and 152 deletions
|
|
@ -39,7 +39,7 @@
|
|||
"no_recent_updates":"No recent updates",
|
||||
"remove_everything":"Remove everything",
|
||||
"remove_everything_msg":"Are you sure? All history will be lost",
|
||||
"ok":"Ok",
|
||||
"ok":"OK",
|
||||
"cancel":"Cancel",
|
||||
"remove":"Remove",
|
||||
"remove_history_msg":"This will remove the read date of this chapter. Are you sure?",
|
||||
|
|
@ -165,5 +165,20 @@
|
|||
"import_archive_bd":"Import Comic Archive",
|
||||
"import_archive_from_file":".cbz or .zip files",
|
||||
"import_archive_from_folder":"From folder (which contains .cbz or .zip files)",
|
||||
"nothing_read_recently":"Nothing read recently"
|
||||
"nothing_read_recently":"Nothing read recently",
|
||||
"status": "Status",
|
||||
"not_started": "Not started",
|
||||
"score": "Score",
|
||||
"start_date": "Start date",
|
||||
"finish_date": "Finish date",
|
||||
"reading": "Reading",
|
||||
"on_hold": "On hold",
|
||||
"dropped":"Dropped",
|
||||
"plan_to_read": "Plan to read",
|
||||
"re_reading": "Rereading",
|
||||
"chapters": "Chapters",
|
||||
"add_tracker": "Add tracking",
|
||||
"one_tracker":"1 tracker",
|
||||
"n_tracker":"{n} trackers",
|
||||
"tracking": "Tracking"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"no_recent_updates":"Aucune mise à jour disponible",
|
||||
"remove_everything":"Tout retirer",
|
||||
"remove_everything_msg":"Êtes-vous sûr(e) ? Tout l'historique sera effacé.",
|
||||
"ok":"Ok",
|
||||
"ok":"OK",
|
||||
"cancel":"Annuler",
|
||||
"remove":"Supprimer",
|
||||
"remove_history_msg":"Ceci enlèvera la date de lecture de ce chapitre. Êtes-vous sûr(e) ?",
|
||||
|
|
@ -165,5 +165,20 @@
|
|||
"import_archive_bd":"Importer des archives BD",
|
||||
"import_archive_from_file":"fichier .cbz ou .zip",
|
||||
"import_archive_from_folder":"à partir d'un dossier (comprenant fichier .cbz ou .zip)",
|
||||
"nothing_read_recently":"Rien de lu recemment"
|
||||
"nothing_read_recently":"Rien de lu recemment",
|
||||
"status": "Statut",
|
||||
"not_started": "Pas commencé",
|
||||
"score": "Note",
|
||||
"start_date": "Date de début",
|
||||
"finish_date": "Date de fin",
|
||||
"reading": "En cours",
|
||||
"on_hold": "En pause",
|
||||
"dropped":"Abandonné",
|
||||
"plan_to_read": "À lire",
|
||||
"re_reading": "Relecture",
|
||||
"chapters": "Chapitres",
|
||||
"add_tracker": "Ajouter le suivi",
|
||||
"one_tracker":"Suivi par 1 service",
|
||||
"n_tracker":"Suivi par {n} services",
|
||||
"tracking": "Suivi"
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import 'package:mangayomi/main.dart';
|
|||
import 'package:mangayomi/models/chapter.dart';
|
||||
import 'package:mangayomi/models/download.dart';
|
||||
import 'package:mangayomi/models/manga.dart';
|
||||
import 'package:mangayomi/models/settings.dart';
|
||||
import 'package:mangayomi/models/track.dart';
|
||||
import 'package:mangayomi/models/track_preference.dart';
|
||||
import 'package:mangayomi/models/track_search.dart';
|
||||
|
|
@ -1290,102 +1291,108 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
return Container(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
widget.action!,
|
||||
StreamBuilder(
|
||||
stream: isar.trackPreferences
|
||||
.filter()
|
||||
.syncIdIsNotNull()
|
||||
.watch(fireImmediately: true),
|
||||
builder: (context, snapshot) {
|
||||
List<TrackPreference>? entries =
|
||||
snapshot.hasData ? snapshot.data! : [];
|
||||
if (entries.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
return SizedBox(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0),
|
||||
onPressed: () {
|
||||
_trackingDraggableMenu(entries);
|
||||
},
|
||||
child: StreamBuilder(
|
||||
stream: isar.tracks
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.mangaIdEqualTo(widget.manga!.id!)
|
||||
.watch(fireImmediately: true),
|
||||
builder: (context, snapshot) {
|
||||
List<Track>? trackRes =
|
||||
snapshot.hasData ? snapshot.data : [];
|
||||
bool isNotEmpty = trackRes!.isNotEmpty;
|
||||
Color color = isNotEmpty
|
||||
? primaryColor(context)
|
||||
: secondaryColor(context);
|
||||
return Column(
|
||||
children: [
|
||||
Icon(
|
||||
isNotEmpty
|
||||
? Icons.done
|
||||
: Icons.screen_rotation_alt_rounded,
|
||||
size: 22,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
isNotEmpty
|
||||
? '${trackRes.length} traker'
|
||||
: 'Tracking',
|
||||
style: TextStyle(fontSize: 13, color: color),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
SizedBox(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0),
|
||||
onPressed: () {
|
||||
final manga = widget.manga!;
|
||||
final source =
|
||||
getSource(widget.manga!.lang!, widget.manga!.source!);
|
||||
String url = source.apiUrl!.isEmpty
|
||||
? widget.manga!.link!
|
||||
: "${source.baseUrl}${widget.manga!.link!}";
|
||||
Expanded(child: widget.action!),
|
||||
Expanded(
|
||||
child: StreamBuilder(
|
||||
stream: isar.trackPreferences
|
||||
.filter()
|
||||
.syncIdIsNotNull()
|
||||
.watch(fireImmediately: true),
|
||||
builder: (context, snapshot) {
|
||||
List<TrackPreference>? entries =
|
||||
snapshot.hasData ? snapshot.data! : [];
|
||||
if (entries.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
return SizedBox(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0),
|
||||
onPressed: () {
|
||||
_trackingDraggableMenu(entries);
|
||||
},
|
||||
child: StreamBuilder(
|
||||
stream: isar.tracks
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.mangaIdEqualTo(widget.manga!.id!)
|
||||
.watch(fireImmediately: true),
|
||||
builder: (context, snapshot) {
|
||||
final l10n = l10nLocalizations(context)!;
|
||||
List<Track>? trackRes =
|
||||
snapshot.hasData ? snapshot.data : [];
|
||||
bool isNotEmpty = trackRes!.isNotEmpty;
|
||||
Color color = isNotEmpty
|
||||
? primaryColor(context)
|
||||
: secondaryColor(context);
|
||||
return Column(
|
||||
children: [
|
||||
Icon(
|
||||
isNotEmpty
|
||||
? Icons.done
|
||||
: Icons.screen_rotation_alt_rounded,
|
||||
size: 22,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
isNotEmpty
|
||||
? trackRes.length == 1
|
||||
? l10n.one_tracker
|
||||
: l10n.n_tracker(trackRes.length)
|
||||
: l10n.tracking,
|
||||
style: TextStyle(fontSize: 13, color: color),textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0),
|
||||
onPressed: () {
|
||||
final manga = widget.manga!;
|
||||
final source =
|
||||
getSource(widget.manga!.lang!, widget.manga!.source!);
|
||||
String url = source.apiUrl!.isEmpty
|
||||
? widget.manga!.link!
|
||||
: "${source.baseUrl}${widget.manga!.link!}";
|
||||
|
||||
Map<String, String> data = {
|
||||
'url': url,
|
||||
'sourceId': source.id.toString(),
|
||||
'title': manga.name!
|
||||
};
|
||||
context.push("/mangawebview", extra: data);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.public,
|
||||
size: 22,
|
||||
color: secondaryColor(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
'WebView',
|
||||
style:
|
||||
TextStyle(fontSize: 13, color: secondaryColor(context)),
|
||||
)
|
||||
],
|
||||
Map<String, String> data = {
|
||||
'url': url,
|
||||
'sourceId': source.id.toString(),
|
||||
'title': manga.name!
|
||||
};
|
||||
context.push("/mangawebview", extra: data);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.public,
|
||||
size: 22,
|
||||
color: secondaryColor(context),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
'WebView',
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: secondaryColor(context)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -1616,7 +1623,11 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
maxHeight: mediaHeight(context, 0.9),
|
||||
minHeight: 80,
|
||||
child: Material(
|
||||
color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9),
|
||||
color: isLight(context)
|
||||
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
||||
: !isar.settings.getSync(227)!.pureBlackDarkMode!
|
||||
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
||||
: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
child: Padding(
|
||||
|
|
@ -1644,6 +1655,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
trackRes: trackRes.first,
|
||||
)
|
||||
: TrackListile(
|
||||
text: l10nLocalizations(context)!.add_tracker,
|
||||
onTap: () async {
|
||||
final trackSearch =
|
||||
await trackersSearchraggableMenu(
|
||||
|
|
|
|||
|
|
@ -139,14 +139,14 @@ class _MangaDetailsViewState extends ConsumerState<MangaDetailsView> {
|
|||
children: [
|
||||
const Icon(
|
||||
Icons.favorite,
|
||||
size: 22,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
l10n.in_library,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
style: const TextStyle(fontSize: 11),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@ import 'package:mangayomi/models/track_search.dart';
|
|||
import 'package:mangayomi/modules/manga/detail/providers/track_state_providers.dart';
|
||||
import 'package:mangayomi/modules/manga/detail/widgets/tracker_search_widget.dart';
|
||||
import 'package:mangayomi/modules/more/settings/track/providers/track_providers.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/utils/colors.dart';
|
||||
import 'package:mangayomi/utils/constant.dart';
|
||||
import 'package:mangayomi/utils/date.dart';
|
||||
import 'package:mangayomi/utils/media_query.dart';
|
||||
import 'package:mangayomi/utils/utils.dart';
|
||||
import 'package:numberpicker/numberpicker.dart';
|
||||
|
||||
class TrackerWidget extends ConsumerStatefulWidget {
|
||||
|
|
@ -38,17 +40,22 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
final findManga = await ref
|
||||
.read(trackStateProvider(track: widget.trackRes).notifier)
|
||||
.findManga();
|
||||
|
||||
ref
|
||||
.read(tracksProvider(syncId: widget.trackPreference.syncId!).notifier)
|
||||
.updateTrackManga(findManga!);
|
||||
if (mounted) {
|
||||
ref
|
||||
.read(tracksProvider(syncId: widget.trackPreference.syncId!).notifier)
|
||||
.updateTrackManga(findManga!);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = l10nLocalizations(context);
|
||||
final l10nLocale = ref.watch(l10nLocaleStateProvider);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
color: isLight(context)
|
||||
? Theme.of(context).scaffoldBackgroundColor
|
||||
: Colors.black,
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
@ -92,7 +99,10 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
child: Text(
|
||||
widget.trackRes.title!,
|
||||
style: TextStyle(
|
||||
color: secondaryColor(context),
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.color,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
|
|
@ -121,8 +131,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text(
|
||||
"Status",
|
||||
title: Text(
|
||||
l10n!.status,
|
||||
),
|
||||
content: SizedBox(
|
||||
width: mediaWidth(context, 0.8),
|
||||
|
|
@ -154,7 +164,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
.updateManga();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
title: Text(getTrackStatus(status)),
|
||||
title:
|
||||
Text(getTrackStatus(status, context)),
|
||||
);
|
||||
},
|
||||
)),
|
||||
|
|
@ -167,7 +178,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
)),
|
||||
|
|
@ -176,7 +187,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
],
|
||||
);
|
||||
});
|
||||
}, text: getTrackStatus(widget.trackRes.status)),
|
||||
}, text: getTrackStatus(widget.trackRes.status, context)),
|
||||
),
|
||||
Expanded(
|
||||
child: _elevatedButton(context, onPressed: () {
|
||||
|
|
@ -185,8 +196,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text(
|
||||
"Chapters",
|
||||
title: Text(
|
||||
l10n!.chapters,
|
||||
),
|
||||
content: StatefulBuilder(
|
||||
builder: (context, setState) => SizedBox(
|
||||
|
|
@ -218,7 +229,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
)),
|
||||
|
|
@ -234,7 +245,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"OK",
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
)),
|
||||
|
|
@ -246,7 +257,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
},
|
||||
text: widget.trackRes.totalChapter != 0
|
||||
? "${widget.trackRes.lastChapterRead}/${widget.trackRes.totalChapter}"
|
||||
: "${widget.trackRes.lastChapterRead == 0 ? "Not Started" : widget.trackRes.lastChapterRead}"),
|
||||
: "${widget.trackRes.lastChapterRead == 0 ? l10n!.not_started : widget.trackRes.lastChapterRead}"),
|
||||
),
|
||||
Expanded(
|
||||
child: _elevatedButton(context, onPressed: () {
|
||||
|
|
@ -255,8 +266,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text(
|
||||
"Score",
|
||||
title: Text(
|
||||
l10n!.score,
|
||||
),
|
||||
content: StatefulBuilder(
|
||||
builder: (context, setState) => SizedBox(
|
||||
|
|
@ -301,7 +312,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
l10n.cancel,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
)),
|
||||
|
|
@ -316,7 +327,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"OK",
|
||||
l10n.ok,
|
||||
style: TextStyle(
|
||||
color: primaryColor(context)),
|
||||
)),
|
||||
|
|
@ -331,7 +342,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
.read(trackStateProvider(track: widget.trackRes)
|
||||
.notifier)
|
||||
.displayScore(widget.trackRes.score!)
|
||||
: "Score"),
|
||||
: l10n!.score),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -342,8 +353,8 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(20)), onPressed: () async {
|
||||
DateTime? newDate = await showDatePicker(
|
||||
helpText: 'Start date',
|
||||
locale: const Locale("fr", "FR"),
|
||||
helpText: l10n!.start_date,
|
||||
locale: l10nLocale,
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(1900),
|
||||
|
|
@ -365,15 +376,15 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
ref: ref,
|
||||
useRelativeTimesTamps: false,
|
||||
context: context)
|
||||
: "Start date"),
|
||||
: l10n!.start_date),
|
||||
),
|
||||
Expanded(
|
||||
child: _elevatedButton(context,
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomRight: Radius.circular(20)), onPressed: () async {
|
||||
DateTime? newDate = await showDatePicker(
|
||||
helpText: 'Finish date',
|
||||
locale: const Locale("fr", "FR"),
|
||||
helpText: l10n!.finish_date,
|
||||
locale: l10nLocale,
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(1900),
|
||||
|
|
@ -395,7 +406,7 @@ class _TrackerWidgetState extends ConsumerState<TrackerWidget> {
|
|||
ref: ref,
|
||||
useRelativeTimesTamps: false,
|
||||
context: context)
|
||||
: "Finish date"),
|
||||
: l10n!.finish_date),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
@ -413,17 +424,24 @@ Widget _elevatedButton(BuildContext context,
|
|||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(0),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
backgroundColor: isLight(context)
|
||||
? Theme.of(context).scaffoldBackgroundColor
|
||||
: Colors.black,
|
||||
elevation: 0,
|
||||
shadowColor: Colors.transparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 0.05, color: secondaryColor(context)),
|
||||
side: BorderSide(
|
||||
width: 0, color: secondaryColor(context).withOpacity(0.1)),
|
||||
borderRadius: borderRadius ?? BorderRadius.circular(0))),
|
||||
onPressed: onPressed,
|
||||
child: child ??
|
||||
Text(
|
||||
text,
|
||||
style:
|
||||
TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.color!
|
||||
.withOpacity(0.9)),
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
icon: Icons.download_outlined,
|
||||
onTap: () => context.push('/downloads')),
|
||||
ListTileWidget(
|
||||
title: "Tracking",
|
||||
title: l10n.tracking,
|
||||
subtitle: "",
|
||||
icon: Icons.screen_rotation_alt_rounded,
|
||||
onTap: () => context.push('/track')),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:isar/isar.dart';
|
|||
import 'package:mangayomi/main.dart';
|
||||
import 'package:mangayomi/models/track_preference.dart';
|
||||
import 'package:mangayomi/modules/more/settings/track/widgets/track_listile.dart';
|
||||
import 'package:mangayomi/providers/l10n_providers.dart';
|
||||
import 'package:mangayomi/services/trackers/anilist.dart';
|
||||
import 'package:mangayomi/services/trackers/myanimelist.dart';
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ class TrackScreen extends ConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Tracking"),
|
||||
title: Text(l10nLocalizations(context)!.tracking),
|
||||
),
|
||||
body: StreamBuilder(
|
||||
stream: isar.trackPreferences
|
||||
|
|
|
|||
|
|
@ -8,19 +8,20 @@ class TrackListile extends ConsumerWidget {
|
|||
final VoidCallback onTap;
|
||||
final int id;
|
||||
final List<TrackPreference> entries;
|
||||
final Widget? trailing;
|
||||
final String? text;
|
||||
const TrackListile(
|
||||
{super.key,
|
||||
required this.onTap,
|
||||
required this.id,
|
||||
required this.entries,
|
||||
this.trailing});
|
||||
this.text});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final bool isLogged =
|
||||
entries.where((element) => element.syncId == id).isNotEmpty;
|
||||
return ListTile(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
leading: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Container(
|
||||
|
|
@ -32,14 +33,13 @@ class TrackListile extends ConsumerWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
trailing: trailing ??
|
||||
(isLogged
|
||||
? const Icon(
|
||||
Icons.check,
|
||||
size: 30,
|
||||
color: Colors.green,
|
||||
)
|
||||
: null),
|
||||
trailing: (isLogged
|
||||
? const Icon(
|
||||
Icons.check,
|
||||
size: 30,
|
||||
color: Colors.green,
|
||||
)
|
||||
: null),
|
||||
onTap: isLogged
|
||||
? () {
|
||||
showDialog(
|
||||
|
|
@ -76,7 +76,10 @@ class TrackListile extends ConsumerWidget {
|
|||
});
|
||||
}
|
||||
: onTap,
|
||||
title: Text(trackInfos(id).$2),
|
||||
title: Text(
|
||||
text ?? trackInfos(id).$2,
|
||||
style: TextStyle(fontSize: text != null ? 13 : null),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,14 +29,15 @@ IconData getMangaStatusIcon(Status status) {
|
|||
};
|
||||
}
|
||||
|
||||
String getTrackStatus(TrackStatus status) {
|
||||
String getTrackStatus(TrackStatus status, BuildContext context) {
|
||||
final l10n = l10nLocalizations(context)!;
|
||||
return switch (status) {
|
||||
TrackStatus.reading => "Reading",
|
||||
TrackStatus.completed => "Completed",
|
||||
TrackStatus.onHold => "On Hold",
|
||||
TrackStatus.dropped => "Dropped",
|
||||
TrackStatus.planToRead => "Plan To Read",
|
||||
TrackStatus.rereading => "Rereading",
|
||||
TrackStatus.reading => l10n.reading,
|
||||
TrackStatus.completed => l10n.completed,
|
||||
TrackStatus.onHold => l10n.on_hold,
|
||||
TrackStatus.dropped => l10n.dropped,
|
||||
TrackStatus.planToRead => l10n.plan_to_read,
|
||||
TrackStatus.rereading => l10n.re_reading,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue