-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
47 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:xbb/components/post_viewer.dart'; | ||
import 'package:xbb/controller/setting.dart'; | ||
import 'package:xbb/model/post.dart'; | ||
|
||
class ViewPostPage extends StatelessWidget { | ||
const ViewPostPage({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final args = Get.arguments; | ||
final String postId = args[0]; | ||
final bool editable = args[1]; | ||
final Post post = args[0]; | ||
final settingController = Get.find<SettingController>(); | ||
// todo | ||
bool editable = (post.author == settingController.currentUserId.value); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('viewPost'), | ||
title: Text('view_post'.trParams({"postName": post.title})), | ||
actions: [ | ||
Visibility( | ||
visible: editable, | ||
child: IconButton( | ||
onPressed: () { | ||
Get.toNamed('/edit-post', arguments: [postId]); | ||
Get.toNamed('/edit-post', arguments: [post.id]); | ||
}, | ||
icon: const Icon(Icons.edit), | ||
), | ||
), | ||
], | ||
), | ||
body: PostViewer(postId: postId), | ||
body: PostViewer(postId: post.id), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters