Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show cross-posts #851

Merged
merged 7 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finish create cross-post functionality
  • Loading branch information
micahmo committed Oct 26, 2023
commit 8616c5493f67a836567d8f63a8be145078c8100a
3 changes: 3 additions & 0 deletions lib/community/pages/create_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CreatePostPage extends StatefulWidget {
final DraftPost? previousDraftPost;

// used create post from action sheet
final String? title;
final String? text;
final File? image;
final String? url;
Expand All @@ -44,6 +45,7 @@ class CreatePostPage extends StatefulWidget {
this.previousDraftPost,
this.onUpdateDraft,
this.image,
this.title,
this.text,
this.url,
this.prePopulated = false,
Expand Down Expand Up @@ -99,6 +101,7 @@ class _CreatePostPageState extends State<CreatePostPage> {
});

if (widget.prePopulated == true) {
_titleTextController.text = widget.title ?? '';
_bodyTextController.text = widget.text ?? '';
_urlTextController.text = widget.url ?? '';
_getDataFromLink();
Expand Down
9 changes: 7 additions & 2 deletions lib/post/widgets/post_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import 'package:thunder/shared/media_view.dart';
import 'package:thunder/thunder/thunder_icons.dart';
import 'package:thunder/user/utils/special_user_checks.dart';
import 'package:thunder/utils/instance.dart';
import 'package:thunder/utils/navigate_create_post.dart';
import 'package:thunder/utils/navigate_post.dart';
import 'package:thunder/utils/navigate_user.dart';
import 'package:thunder/utils/numbers.dart';
Expand Down Expand Up @@ -246,8 +247,12 @@ class _PostSubviewState extends State<PostSubview> with SingleTickerProviderStat
),
InkWell(
onTap: () async {
// TODO: Use navigateToCreatePostPage
// https://github.com/thunder-app/thunder/blob/4bc8763d597c2fdb6a1e8ae1422cd7f222d2fb58/lib/utils/navigate_create_post.dart
await navigateToCreatePostPage(
context,
title: widget.postViewMedia.postView.post.name,
url: widget.postViewMedia.postView.post.url,
prePopulated: true,
);
},
borderRadius: BorderRadius.circular(10),
child: Padding(
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/navigate_create_post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';

Future<void> navigateToCreatePostPage(
BuildContext context, {
String? title,
String? text,
File? image,
String? url,
Expand All @@ -34,6 +35,7 @@ Future<void> navigateToCreatePostPage(
BlocProvider<AccountBloc>.value(value: accountBloc),
],
child: CreatePostPage(
title: title,
text: text,
image: image,
url: url,
Expand Down