Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/services/database_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ class DatabaseHelper {
});
}

Future<String?> getAbstract(String doi) async {
final db = await database;
final result = await db.query(
'articles',
columns: ['abstract'],
where: 'doi = ?',
whereArgs: [doi],
);

return result.isNotEmpty ? result.first['abstract'] as String? : null;
}

Future<void> removeDownloaded(String doi) async {
final db = await database;

Expand Down
12 changes: 10 additions & 2 deletions lib/widgets/publication_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ class _PublicationCardState extends State<PublicationCard> {
}

return GestureDetector(
onTap: () {
onTap: () async {
String finalAbstract = widget.abstract;

if (widget.abstract.isEmpty) {
final dbAbstract = await databaseHelper.getAbstract(widget.doi);
if (dbAbstract != null && dbAbstract.isNotEmpty) {
finalAbstract = dbAbstract;
}
}
// Navigate to the ArticleScreen when the card is tapped
Navigator.push(
context,
Expand All @@ -84,7 +92,7 @@ class _PublicationCardState extends State<PublicationCard> {
doi: widget.doi,
title: widget.title,
issn: widget.issn,
abstract: widget.abstract,
abstract: finalAbstract,
journalTitle: widget.journalTitle,
publishedDate: widget.publishedDate,
authors: widget.authors,
Expand Down