Skip to content

Commit

Permalink
Merge branch 'lint/animate-timeline' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Jan 7, 2024
2 parents 2d83ecc + 64bc013 commit 8c09772
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 44 deletions.
4 changes: 3 additions & 1 deletion lib/view/common/misskey_notes/misskey_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ class MisskeyNoteState extends ConsumerState<MisskeyNote> {
(status) => status.copyWith(isMuteOpened: true),
),
child: Padding(
padding: const EdgeInsets.only(top: 5.0, bottom: 5.0, left: 10.0),
padding:
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
child: Text(
S.of(context).mutedNotePlaceholder(
displayNote.user.name ?? displayNote.user.username,
Expand Down Expand Up @@ -258,6 +259,7 @@ class MisskeyNoteState extends ConsumerState<MisskeyNote> {
padding: EdgeInsets.only(
top: MediaQuery.textScalerOf(context).scale(5),
bottom: MediaQuery.textScalerOf(context).scale(5),
right: 10,
),
decoration: widget.isDisplayBorder
? BoxDecoration(
Expand Down
79 changes: 36 additions & 43 deletions lib/view/timeline_page/misskey_timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,42 @@ class MisskeyTimeline extends ConsumerWidget {
final controller = ref.watch(timelineControllerProvider(tabSetting));
final centerKey = ref.watch(_centerKeyProvider);

return Column(
children: [
if (timeline.isLoading && timeline.isEmpty)
const Padding(
padding: EdgeInsets.only(top: 10),
child: Center(child: CircularProgressIndicator()),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 10),
child: CustomScrollView(
center: centerKey,
controller: controller.scrollController,
slivers: [
SliverAnimatedList(
key: controller.listKey,
initialItemCount: timeline.newerNotes.length,
itemBuilder: (context, index, animation) {
return SizeTransition(
sizeFactor: animation,
child: NoteWrapper(
targetNote: timeline.newerNotes[index],
tabSetting: tabSetting,
),
);
},
),
SliverList.builder(
key: centerKey,
itemCount: timeline.olderNotes.length + 1,
itemBuilder: (context, index) {
if (index < timeline.olderNotes.length) {
return NoteWrapper(
targetNote: timeline.olderNotes[index],
tabSetting: tabSetting,
);
}
return TimelineBottomItem(tabSetting: tabSetting);
},
),
],
),
),
if (timeline.isLoading && timeline.isEmpty) {
return const Padding(
padding: EdgeInsets.all(10),
child: Center(child: CircularProgressIndicator()),
);
}

return CustomScrollView(
center: centerKey,
controller: controller.scrollController,
slivers: [
SliverAnimatedList(
key: controller.listKey,
initialItemCount: timeline.newerNotes.length,
itemBuilder: (context, index, animation) {
return SizeTransition(
sizeFactor: animation,
child: NoteWrapper(
targetNote: timeline.newerNotes[index],
tabSetting: tabSetting,
),
);
},
),
SliverList.builder(
key: centerKey,
itemCount: timeline.olderNotes.length + 1,
itemBuilder: (context, index) {
if (index < timeline.olderNotes.length) {
return NoteWrapper(
targetNote: timeline.olderNotes[index],
tabSetting: tabSetting,
);
}
return TimelineBottomItem(tabSetting: tabSetting);
},
),
],
);
Expand Down

0 comments on commit 8c09772

Please sign in to comment.