💫 Optimize post editor transition

This commit is contained in:
LittleSheep 2024-08-02 04:59:35 +08:00
parent aefcbad02f
commit 6cbd78e836
3 changed files with 41 additions and 36 deletions

View File

@ -1,3 +1,5 @@
import 'package:animations/animations.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:solian/models/realm.dart';
import 'package:solian/screens/about.dart';
@ -93,15 +95,26 @@ abstract class AppRouter {
GoRoute(
path: '/posts/editor',
name: 'postEditor',
builder: (context, state) {
pageBuilder: (context, state) {
final arguments = state.extra as PostPublishArguments?;
return PostPublishScreen(
return CustomTransitionPage(
child: PostPublishScreen(
edit: arguments?.edit,
reply: arguments?.reply,
repost: arguments?.repost,
realm: arguments?.realm,
postListController: arguments?.postListController,
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
),
transitionsBuilder:
(context, animation, secondaryAnimation, child) {
return FadeThroughTransition(
fillColor: Theme.of(context).scaffoldBackgroundColor,
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child,
);
},
);
},
),

View File

@ -3,7 +3,6 @@ import 'package:get/get.dart';
import 'package:solian/exts.dart';
import 'package:solian/models/post.dart';
import 'package:solian/providers/content/posts.dart';
import 'package:solian/widgets/sized_container.dart';
import 'package:solian/widgets/posts/post_item.dart';
import 'package:solian/widgets/posts/post_replies.dart';
@ -58,7 +57,6 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: CenteredContainer(
child: PostItem(
item: item!,
isClickable: true,
@ -67,13 +65,11 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
isContentSelectable: true,
),
),
),
SliverToBoxAdapter(
child: const Divider(thickness: 0.3, height: 1)
.paddingOnly(top: 4),
),
SliverToBoxAdapter(
child: CenteredContainer(
child: Align(
alignment: Alignment.centerLeft,
child: Text(
@ -82,7 +78,6 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
).paddingOnly(left: 24, right: 24, top: 16),
),
),
),
PostReplyList(item: item!),
SliverToBoxAdapter(
child: SizedBox(height: MediaQuery.of(context).padding.bottom),

View File

@ -4,7 +4,6 @@ import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:solian/models/post.dart';
import 'package:solian/providers/auth.dart';
import 'package:solian/router.dart';
import 'package:solian/widgets/sized_container.dart';
import 'package:solian/widgets/posts/post_action.dart';
import 'package:solian/widgets/posts/post_item.dart';
@ -29,8 +28,7 @@ class PostListWidget extends StatelessWidget {
pagingController: controller,
builderDelegate: PagedChildBuilderDelegate<Post>(
itemBuilder: (context, item, index) {
return CenteredContainer(
child: PostListEntryWidget(
return PostListEntryWidget(
isShowEmbed: isShowEmbed,
isNestedClickable: isNestedClickable,
isClickable: isClickable,
@ -38,7 +36,6 @@ class PostListWidget extends StatelessWidget {
onUpdate: () {
controller.refresh();
},
),
);
},
),