Skip to content

Commit

Permalink
Merge pull request #1629 from matthiasn/smoother_scrolling
Browse files Browse the repository at this point in the history
Smoother scrolling infinite journal page
  • Loading branch information
matthiasn committed Jun 23, 2023
2 parents 801ec16 + 5c83a9e commit d178543
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Changed:
- Smoother scrolling infinite journal page

## [0.8.388] - 2023-06-23
### Changed:
- Upgraded dependencies

### Fixed:
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/journal/entry_detail_linked_from.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class LinkedFromEntriesWidget extends StatelessWidget {
return JournalCard(
item: item,
key: Key('${item.meta.id}-${item.meta.id}'),
showLinkedDuration: true,
);
},
);
Expand Down
5 changes: 4 additions & 1 deletion lib/widgets/journal/entry_details_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class EntryDetailWidget extends StatelessWidget {
final isAudio = item is JournalAudio;

if (isTask && !showTaskDetails) {
return JournalCard(item: item);
return JournalCard(
item: item,
showLinkedDuration: true,
);
}

return BlocProvider<EntryCubit>(
Expand Down
17 changes: 11 additions & 6 deletions lib/widgets/journal/journal_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,32 @@ class JournalCardTitle extends StatelessWidget {
}
}

class JournalCard extends StatelessWidget {
class JournalCard extends StatefulWidget {
const JournalCard({
required this.item,
super.key,
this.maxHeight = 120,
this.showLinkedDuration = true,
this.showLinkedDuration = false,
});

final JournalEntity item;
final double maxHeight;
final bool showLinkedDuration;

@override
State<JournalCard> createState() => _JournalCardState();
}

class _JournalCardState extends State<JournalCard> {
@override
Widget build(BuildContext context) {
return StreamBuilder<JournalEntity?>(
stream: getIt<JournalDb>().watchEntityById(item.meta.id),
stream: getIt<JournalDb>().watchEntityById(widget.item.meta.id),
builder: (
BuildContext context,
AsyncSnapshot<JournalEntity?> snapshot,
) {
final updatedItem = snapshot.data ?? item;
final updatedItem = snapshot.data ?? widget.item;
if (updatedItem.meta.deletedAt != null) {
return const SizedBox.shrink();
}
Expand Down Expand Up @@ -211,8 +216,8 @@ class JournalCard extends StatelessWidget {
),
title: JournalCardTitle(
item: updatedItem,
maxHeight: maxHeight,
showLinkedDuration: showLinkedDuration,
maxHeight: widget.maxHeight,
showLinkedDuration: widget.showLinkedDuration,
),
onTap: onTap,
),
Expand Down
14 changes: 10 additions & 4 deletions lib/widgets/journal/tags/tags_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ import 'package:lotti/services/tags_service.dart';
import 'package:lotti/themes/theme.dart';
import 'package:lotti/themes/utils.dart';

class TagsViewWidget extends StatelessWidget {
TagsViewWidget({
class TagsViewWidget extends StatefulWidget {
const TagsViewWidget({
required this.item,
super.key,
});

final TagsService tagsService = getIt<TagsService>();
final JournalEntity item;

@override
State<TagsViewWidget> createState() => _TagsViewWidgetState();
}

class _TagsViewWidgetState extends State<TagsViewWidget> {
final TagsService tagsService = getIt<TagsService>();

@override
Widget build(BuildContext context) {
return StreamBuilder<List<TagEntity>>(
Expand All @@ -26,7 +32,7 @@ class TagsViewWidget extends StatelessWidget {
// data in the tags service will already have been updated.
AsyncSnapshot<List<TagEntity>> _,
) {
final tagIds = item.meta.tagIds ?? [];
final tagIds = widget.item.meta.tagIds ?? [];
final tagsFromTagIds = <TagEntity>[];

for (final tagId in tagIds) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.388+2276
version: 0.9.389+2277

msix_config:
display_name: LottiApp
Expand Down

0 comments on commit d178543

Please sign in to comment.