💫 Optimize post editor transition
This commit is contained in:
parent
aefcbad02f
commit
6cbd78e836
@ -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(
|
||||
edit: arguments?.edit,
|
||||
reply: arguments?.reply,
|
||||
repost: arguments?.repost,
|
||||
realm: arguments?.realm,
|
||||
postListController: arguments?.postListController,
|
||||
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
||||
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,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -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,14 +57,12 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: CenteredContainer(
|
||||
child: PostItem(
|
||||
item: item!,
|
||||
isClickable: true,
|
||||
isFullDate: true,
|
||||
isShowReply: false,
|
||||
isContentSelectable: true,
|
||||
),
|
||||
child: PostItem(
|
||||
item: item!,
|
||||
isClickable: true,
|
||||
isFullDate: true,
|
||||
isShowReply: false,
|
||||
isContentSelectable: true,
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
@ -73,14 +70,12 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
||||
.paddingOnly(top: 4),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: CenteredContainer(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'postReplies'.tr,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
).paddingOnly(left: 24, right: 24, top: 16),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'postReplies'.tr,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
).paddingOnly(left: 24, right: 24, top: 16),
|
||||
),
|
||||
),
|
||||
PostReplyList(item: item!),
|
||||
|
@ -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,16 +28,14 @@ class PostListWidget extends StatelessWidget {
|
||||
pagingController: controller,
|
||||
builderDelegate: PagedChildBuilderDelegate<Post>(
|
||||
itemBuilder: (context, item, index) {
|
||||
return CenteredContainer(
|
||||
child: PostListEntryWidget(
|
||||
isShowEmbed: isShowEmbed,
|
||||
isNestedClickable: isNestedClickable,
|
||||
isClickable: isClickable,
|
||||
item: item,
|
||||
onUpdate: () {
|
||||
controller.refresh();
|
||||
},
|
||||
),
|
||||
return PostListEntryWidget(
|
||||
isShowEmbed: isShowEmbed,
|
||||
isNestedClickable: isNestedClickable,
|
||||
isClickable: isClickable,
|
||||
item: item,
|
||||
onUpdate: () {
|
||||
controller.refresh();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user