mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-24 23:31:29 +01:00
make FullPostPage constructor private
This commit is contained in:
parent
cff87e0682
commit
b58f91bc84
@ -12,7 +12,6 @@ import '../hooks/stores.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/extensions/spaced.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/pictrs.dart';
|
||||
import '../widgets/editor.dart';
|
||||
import '../widgets/markdown_mode_icon.dart';
|
||||
@ -39,10 +38,8 @@ class CreatePostFab extends HookWidget {
|
||||
);
|
||||
|
||||
if (postView != null) {
|
||||
await goTo(
|
||||
context,
|
||||
(_) => FullPostPage.fromPostView(postView),
|
||||
);
|
||||
await Navigator.of(context)
|
||||
.push(FullPostPage.fromPostViewRoute(postView));
|
||||
}
|
||||
}),
|
||||
child: const Icon(Icons.add),
|
||||
|
@ -29,16 +29,16 @@ class FullPostPage extends StatelessWidget {
|
||||
final PostView? postView;
|
||||
final PostStore? postStore;
|
||||
|
||||
const FullPostPage({
|
||||
const FullPostPage._({
|
||||
required int this.id,
|
||||
required String this.instanceHost,
|
||||
}) : postView = null,
|
||||
postStore = null;
|
||||
const FullPostPage.fromPostView(PostView this.postView)
|
||||
const FullPostPage._fromPostView(PostView this.postView)
|
||||
: id = null,
|
||||
instanceHost = null,
|
||||
postStore = null;
|
||||
const FullPostPage.fromPostStore(PostStore this.postStore)
|
||||
const FullPostPage._fromPostStore(PostStore this.postStore)
|
||||
: id = null,
|
||||
instanceHost = null,
|
||||
postView = null;
|
||||
@ -67,7 +67,7 @@ class FullPostPage extends StatelessWidget {
|
||||
create: (context) =>
|
||||
FullPostStore(instanceHost: instanceHost, postId: id)
|
||||
..refresh(_tryGetJwt(context, instanceHost)),
|
||||
child: FullPostPage(
|
||||
child: FullPostPage._(
|
||||
id: id,
|
||||
instanceHost: instanceHost,
|
||||
),
|
||||
@ -78,14 +78,14 @@ class FullPostPage extends StatelessWidget {
|
||||
builder: (context) => Provider(
|
||||
create: (context) => FullPostStore.fromPostView(postView)
|
||||
..refresh(_tryGetJwt(context, postView.instanceHost)),
|
||||
child: FullPostPage.fromPostView(postView),
|
||||
child: FullPostPage._fromPostView(postView),
|
||||
),
|
||||
);
|
||||
static Route fromPostStoreRoute(PostStore postStore) => MaterialPageRoute(
|
||||
builder: (context) => Provider(
|
||||
create: (context) => FullPostStore.fromPostStore(postStore)
|
||||
..refresh(_tryGetJwt(context, postStore.postView.instanceHost)),
|
||||
child: FullPostPage.fromPostStore(postStore)),
|
||||
child: FullPostPage._fromPostStore(postStore)),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user