💫 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:go_router/go_router.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
import 'package:solian/screens/about.dart';
|
import 'package:solian/screens/about.dart';
|
||||||
@ -93,15 +95,26 @@ abstract class AppRouter {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/posts/editor',
|
path: '/posts/editor',
|
||||||
name: 'postEditor',
|
name: 'postEditor',
|
||||||
builder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
final arguments = state.extra as PostPublishArguments?;
|
final arguments = state.extra as PostPublishArguments?;
|
||||||
return PostPublishScreen(
|
return CustomTransitionPage(
|
||||||
edit: arguments?.edit,
|
child: PostPublishScreen(
|
||||||
reply: arguments?.reply,
|
edit: arguments?.edit,
|
||||||
repost: arguments?.repost,
|
reply: arguments?.reply,
|
||||||
realm: arguments?.realm,
|
repost: arguments?.repost,
|
||||||
postListController: arguments?.postListController,
|
realm: arguments?.realm,
|
||||||
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
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/exts.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/providers/content/posts.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_item.dart';
|
||||||
import 'package:solian/widgets/posts/post_replies.dart';
|
import 'package:solian/widgets/posts/post_replies.dart';
|
||||||
|
|
||||||
@ -58,14 +57,12 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
return CustomScrollView(
|
return CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: CenteredContainer(
|
child: PostItem(
|
||||||
child: PostItem(
|
item: item!,
|
||||||
item: item!,
|
isClickable: true,
|
||||||
isClickable: true,
|
isFullDate: true,
|
||||||
isFullDate: true,
|
isShowReply: false,
|
||||||
isShowReply: false,
|
isContentSelectable: true,
|
||||||
isContentSelectable: true,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
@ -73,14 +70,12 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
.paddingOnly(top: 4),
|
.paddingOnly(top: 4),
|
||||||
),
|
),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: CenteredContainer(
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment.centerLeft,
|
||||||
alignment: Alignment.centerLeft,
|
child: Text(
|
||||||
child: Text(
|
'postReplies'.tr,
|
||||||
'postReplies'.tr,
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
).paddingOnly(left: 24, right: 24, top: 16),
|
||||||
).paddingOnly(left: 24, right: 24, top: 16),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PostReplyList(item: item!),
|
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/models/post.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/router.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_action.dart';
|
||||||
import 'package:solian/widgets/posts/post_item.dart';
|
import 'package:solian/widgets/posts/post_item.dart';
|
||||||
|
|
||||||
@ -29,16 +28,14 @@ class PostListWidget extends StatelessWidget {
|
|||||||
pagingController: controller,
|
pagingController: controller,
|
||||||
builderDelegate: PagedChildBuilderDelegate<Post>(
|
builderDelegate: PagedChildBuilderDelegate<Post>(
|
||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return CenteredContainer(
|
return PostListEntryWidget(
|
||||||
child: PostListEntryWidget(
|
isShowEmbed: isShowEmbed,
|
||||||
isShowEmbed: isShowEmbed,
|
isNestedClickable: isNestedClickable,
|
||||||
isNestedClickable: isNestedClickable,
|
isClickable: isClickable,
|
||||||
isClickable: isClickable,
|
item: item,
|
||||||
item: item,
|
onUpdate: () {
|
||||||
onUpdate: () {
|
controller.refresh();
|
||||||
controller.refresh();
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user