Compare commits
	
		
			2 Commits
		
	
	
		
			4209a13c84
			...
			21a1d4a2ad
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 21a1d4a2ad | |||
| 603875b1af | 
@@ -113,21 +113,20 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
 | 
			
		||||
                                    ? Theme.of(context)
 | 
			
		||||
                                        .colorScheme
 | 
			
		||||
                                        .primaryContainer
 | 
			
		||||
                                    : Theme.of(context)
 | 
			
		||||
                                        .colorScheme
 | 
			
		||||
                                        .surfaceContainerLow,
 | 
			
		||||
                                    : Colors.transparent,
 | 
			
		||||
                              ),
 | 
			
		||||
                            ),
 | 
			
		||||
                            onPressed: () {
 | 
			
		||||
                              GoRouter.of(context).goNamed(ele.screen);
 | 
			
		||||
                              Scaffold.of(context).closeDrawer();
 | 
			
		||||
                              nav.setIndex(idx);
 | 
			
		||||
                            },
 | 
			
		||||
                          ),
 | 
			
		||||
                        ),
 | 
			
		||||
                      );
 | 
			
		||||
                    },
 | 
			
		||||
                  ).toList(),
 | 
			
		||||
                ).padding(horizontal: 16),
 | 
			
		||||
                ).padding(horizontal: 16, bottom: 8),
 | 
			
		||||
              Align(
 | 
			
		||||
                alignment: Alignment.bottomCenter,
 | 
			
		||||
                child: ListTile(
 | 
			
		||||
@@ -173,7 +172,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
 | 
			
		||||
                  },
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
              Gap(MediaQuery.of(context).padding.bottom),
 | 
			
		||||
              Gap(MediaQuery.of(context).padding.bottom + 8),
 | 
			
		||||
            ],
 | 
			
		||||
          ),
 | 
			
		||||
        );
 | 
			
		||||
@@ -282,7 +281,7 @@ class _DrawerContentList extends StatelessWidget {
 | 
			
		||||
                  ),
 | 
			
		||||
                  title: Text(nav.focusedRealm!.name),
 | 
			
		||||
                  onTap: () {
 | 
			
		||||
                    GoRouter.of(context).pushNamed(
 | 
			
		||||
                    GoRouter.of(context).goNamed(
 | 
			
		||||
                      'realmDetail',
 | 
			
		||||
                      pathParameters: {
 | 
			
		||||
                        'alias': nav.focusedRealm!.alias,
 | 
			
		||||
@@ -300,7 +299,7 @@ class _DrawerContentList extends StatelessWidget {
 | 
			
		||||
                  leading: const Icon(Symbols.globe),
 | 
			
		||||
                  title: Text('community').tr(),
 | 
			
		||||
                  onTap: () {
 | 
			
		||||
                    GoRouter.of(context).pushNamed(
 | 
			
		||||
                    GoRouter.of(context).goNamed(
 | 
			
		||||
                      'realmCommunity',
 | 
			
		||||
                      pathParameters: {
 | 
			
		||||
                        'alias': nav.focusedRealm!.alias,
 | 
			
		||||
@@ -325,7 +324,7 @@ class _DrawerContentList extends StatelessWidget {
 | 
			
		||||
                    leading: const Icon(Symbols.tag),
 | 
			
		||||
                    title: Text(ele.name),
 | 
			
		||||
                    onTap: () {
 | 
			
		||||
                      GoRouter.of(context).pushNamed(
 | 
			
		||||
                      GoRouter.of(context).goNamed(
 | 
			
		||||
                        'chatRoom',
 | 
			
		||||
                        pathParameters: {
 | 
			
		||||
                          'scope': ele.realm?.alias ?? 'global',
 | 
			
		||||
 
 | 
			
		||||
@@ -103,7 +103,7 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
 | 
			
		||||
      final sn = context.read<SnNetworkProvider>();
 | 
			
		||||
      await sn.client
 | 
			
		||||
          .put('/cgi/co/questions/${widget.parentPost.id}/answer', data: {
 | 
			
		||||
        'publisher': answer.publisherId,
 | 
			
		||||
        'publisher': widget.parentPost.publisherId,
 | 
			
		||||
        'answer_id': answer.id,
 | 
			
		||||
      });
 | 
			
		||||
      if (!mounted) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -279,6 +279,8 @@ class _PostItemState extends State<PostItem> {
 | 
			
		||||
    final ua = context.read<UserProvider>();
 | 
			
		||||
    final isAuthor =
 | 
			
		||||
        ua.isAuthorized && widget.data.publisher.accountId == ua.user?.id;
 | 
			
		||||
    final isParentAuthor = ua.isAuthorized &&
 | 
			
		||||
        widget.data.replyTo?.publisher.accountId == ua.user?.id;
 | 
			
		||||
 | 
			
		||||
    final displayableAttachments = widget.data.preload?.attachments
 | 
			
		||||
        ?.where((ele) =>
 | 
			
		||||
@@ -333,6 +335,7 @@ class _PostItemState extends State<PostItem> {
 | 
			
		||||
                    _PostActionPopup(
 | 
			
		||||
                      data: widget.data,
 | 
			
		||||
                      isAuthor: isAuthor,
 | 
			
		||||
                      isParentAuthor: isParentAuthor,
 | 
			
		||||
                      onShare: () => _doShare(context),
 | 
			
		||||
                      onShareImage: () => _doShareViaPicture(context),
 | 
			
		||||
                      onSelectAnswer: widget.onSelectAnswer,
 | 
			
		||||
@@ -577,6 +580,7 @@ class _PostItemState extends State<PostItem> {
 | 
			
		||||
                            _PostActionPopup(
 | 
			
		||||
                              data: widget.data,
 | 
			
		||||
                              isAuthor: isAuthor,
 | 
			
		||||
                              isParentAuthor: isParentAuthor,
 | 
			
		||||
                              onShare: () => _doShare(context),
 | 
			
		||||
                              onShareImage: () => _doShareViaPicture(context),
 | 
			
		||||
                              onSelectAnswer: widget.onSelectAnswer,
 | 
			
		||||
@@ -1317,6 +1321,7 @@ class _PostAvatar extends StatelessWidget {
 | 
			
		||||
class _PostActionPopup extends StatelessWidget {
 | 
			
		||||
  final SnPost data;
 | 
			
		||||
  final bool isAuthor;
 | 
			
		||||
  final bool isParentAuthor;
 | 
			
		||||
  final Function onDeleted;
 | 
			
		||||
  final Function() onShare, onShareImage;
 | 
			
		||||
  final Function()? onSelectAnswer;
 | 
			
		||||
@@ -1324,6 +1329,7 @@ class _PostActionPopup extends StatelessWidget {
 | 
			
		||||
  const _PostActionPopup({
 | 
			
		||||
    required this.data,
 | 
			
		||||
    required this.isAuthor,
 | 
			
		||||
    required this.isParentAuthor,
 | 
			
		||||
    required this.onDeleted,
 | 
			
		||||
    required this.onShare,
 | 
			
		||||
    required this.onShareImage,
 | 
			
		||||
@@ -1397,7 +1403,7 @@ class _PostActionPopup extends StatelessWidget {
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
          if (onTranslate != null) PopupMenuDivider(),
 | 
			
		||||
          if (isAuthor && onSelectAnswer != null)
 | 
			
		||||
          if (isParentAuthor && onSelectAnswer != null)
 | 
			
		||||
            PopupMenuItem(
 | 
			
		||||
              child: Row(
 | 
			
		||||
                children: [
 | 
			
		||||
@@ -1410,7 +1416,7 @@ class _PostActionPopup extends StatelessWidget {
 | 
			
		||||
                onSelectAnswer?.call();
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
          if (isAuthor && onSelectAnswer != null) PopupMenuDivider(),
 | 
			
		||||
          if (isParentAuthor && onSelectAnswer != null) PopupMenuDivider(),
 | 
			
		||||
          if (isAuthor)
 | 
			
		||||
            PopupMenuItem(
 | 
			
		||||
              child: Row(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user