Compare commits
	
		
			2 Commits
		
	
	
		
			00863b94e8
			...
			a75083d916
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a75083d916 | |||
| 919ff5e464 | 
@@ -171,7 +171,18 @@ class _ChatScreenState extends State<ChatScreen> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _onTapChannel(SnChannel channel) {
 | 
					  void _onTapChannel(SnChannel channel) {
 | 
				
			||||||
    setState(() => _unreadCounts?[channel.id] = 0);
 | 
					    setState(() {
 | 
				
			||||||
 | 
					      _unreadCounts?[channel.id] = 0;
 | 
				
			||||||
 | 
					      if (channel.realmId != null) {
 | 
				
			||||||
 | 
					        _unreadCountsGrouped?[channel.realmId!] =
 | 
				
			||||||
 | 
					            (_unreadCountsGrouped?[channel.realmId!] ?? 0) -
 | 
				
			||||||
 | 
					                (_unreadCounts?[channel.id] ?? 0);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      if (channel.type == 1) {
 | 
				
			||||||
 | 
					        _unreadCountsGrouped?[0] =
 | 
				
			||||||
 | 
					            (_unreadCountsGrouped?[0] ?? 0) - (_unreadCounts?[channel.id] ?? 0);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
    if (ResponsiveScaffold.getIsExpand(context)) {
 | 
					    if (ResponsiveScaffold.getIsExpand(context)) {
 | 
				
			||||||
      GoRouter.of(context).pushReplacementNamed(
 | 
					      GoRouter.of(context).pushReplacementNamed(
 | 
				
			||||||
        'chatRoom',
 | 
					        'chatRoom',
 | 
				
			||||||
@@ -180,9 +191,8 @@ class _ChatScreenState extends State<ChatScreen> {
 | 
				
			|||||||
          'alias': channel.alias,
 | 
					          'alias': channel.alias,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      ).then((value) {
 | 
					      ).then((value) {
 | 
				
			||||||
        if (mounted) {
 | 
					        if (mounted && value == true) {
 | 
				
			||||||
          setState(() => _unreadCounts?[channel.id] = 0);
 | 
					          _refreshChannels();
 | 
				
			||||||
          _refreshChannels(noRemote: true);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
@@ -193,9 +203,8 @@ class _ChatScreenState extends State<ChatScreen> {
 | 
				
			|||||||
          'alias': channel.alias,
 | 
					          'alias': channel.alias,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      ).then((value) {
 | 
					      ).then((value) {
 | 
				
			||||||
        if (mounted) {
 | 
					        if (mounted && value == true) {
 | 
				
			||||||
          setState(() => _unreadCounts?[channel.id] = 0);
 | 
					          _refreshChannels();
 | 
				
			||||||
          _refreshChannels(noRemote: true);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ class AccountPopoverCard extends StatelessWidget {
 | 
				
			|||||||
            IconButton(
 | 
					            IconButton(
 | 
				
			||||||
              onPressed: () {
 | 
					              onPressed: () {
 | 
				
			||||||
                Navigator.pop(context);
 | 
					                Navigator.pop(context);
 | 
				
			||||||
                GoRouter.of(context).pushNamed(
 | 
					                GoRouter.of(context).pushReplacementNamed(
 | 
				
			||||||
                  'accountProfilePage',
 | 
					                  'accountProfilePage',
 | 
				
			||||||
                  pathParameters: {'name': data.name},
 | 
					                  pathParameters: {'name': data.name},
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,7 @@ class AttachmentItem extends StatelessWidget {
 | 
				
			|||||||
  final String? heroTag;
 | 
					  final String? heroTag;
 | 
				
			||||||
  final BoxFit fit;
 | 
					  final BoxFit fit;
 | 
				
			||||||
  final FilterQuality? filterQuality;
 | 
					  final FilterQuality? filterQuality;
 | 
				
			||||||
 | 
					  final Function? onZoom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const AttachmentItem({
 | 
					  const AttachmentItem({
 | 
				
			||||||
    super.key,
 | 
					    super.key,
 | 
				
			||||||
@@ -32,6 +33,7 @@ class AttachmentItem extends StatelessWidget {
 | 
				
			|||||||
    required this.data,
 | 
					    required this.data,
 | 
				
			||||||
    required this.heroTag,
 | 
					    required this.heroTag,
 | 
				
			||||||
    this.filterQuality,
 | 
					    this.filterQuality,
 | 
				
			||||||
 | 
					    this.onZoom,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Widget _buildContent(BuildContext context) {
 | 
					  Widget _buildContent(BuildContext context) {
 | 
				
			||||||
@@ -94,7 +96,14 @@ class AttachmentItem extends StatelessWidget {
 | 
				
			|||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return _buildContent(context);
 | 
					    return GestureDetector(
 | 
				
			||||||
 | 
					      child: _buildContent(context),
 | 
				
			||||||
 | 
					      onTap: () {
 | 
				
			||||||
 | 
					        if (data?.mimetype.startsWith('image') ?? false) {
 | 
				
			||||||
 | 
					          onZoom?.call();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,7 +74,6 @@ class _AttachmentListState extends State<AttachmentList> {
 | 
				
			|||||||
          return Container(
 | 
					          return Container(
 | 
				
			||||||
            padding: widget.padding ?? EdgeInsets.zero,
 | 
					            padding: widget.padding ?? EdgeInsets.zero,
 | 
				
			||||||
            constraints: constraints,
 | 
					            constraints: constraints,
 | 
				
			||||||
            child: GestureDetector(
 | 
					 | 
				
			||||||
            child: AspectRatio(
 | 
					            child: AspectRatio(
 | 
				
			||||||
              aspectRatio: singleAspectRatio,
 | 
					              aspectRatio: singleAspectRatio,
 | 
				
			||||||
              child: Container(
 | 
					              child: Container(
 | 
				
			||||||
@@ -90,14 +89,7 @@ class _AttachmentListState extends State<AttachmentList> {
 | 
				
			|||||||
                    heroTag: heroTags[0],
 | 
					                    heroTag: heroTags[0],
 | 
				
			||||||
                    fit: widget.fit,
 | 
					                    fit: widget.fit,
 | 
				
			||||||
                    filterQuality: widget.filterQuality,
 | 
					                    filterQuality: widget.filterQuality,
 | 
				
			||||||
                    ),
 | 
					                    onZoom: () {
 | 
				
			||||||
                  ),
 | 
					 | 
				
			||||||
                ),
 | 
					 | 
				
			||||||
              ),
 | 
					 | 
				
			||||||
              onTap: () {
 | 
					 | 
				
			||||||
                if (widget.data.firstOrNull?.mediaType != SnMediaType.image) {
 | 
					 | 
				
			||||||
                  return;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                      context.pushTransparentRoute(
 | 
					                      context.pushTransparentRoute(
 | 
				
			||||||
                        AttachmentZoomView(
 | 
					                        AttachmentZoomView(
 | 
				
			||||||
                          data: widget.data.where((ele) => ele != null).cast(),
 | 
					                          data: widget.data.where((ele) => ele != null).cast(),
 | 
				
			||||||
@@ -109,6 +101,9 @@ class _AttachmentListState extends State<AttachmentList> {
 | 
				
			|||||||
                      );
 | 
					                      );
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -133,21 +128,14 @@ class _AttachmentListState extends State<AttachmentList> {
 | 
				
			|||||||
                mainAxisSpacing: 4,
 | 
					                mainAxisSpacing: 4,
 | 
				
			||||||
                children: widget.data
 | 
					                children: widget.data
 | 
				
			||||||
                    .mapIndexed(
 | 
					                    .mapIndexed(
 | 
				
			||||||
                      (idx, ele) => GestureDetector(
 | 
					                      (idx, ele) => Container(
 | 
				
			||||||
                        child: Container(
 | 
					 | 
				
			||||||
                        constraints: constraints,
 | 
					                        constraints: constraints,
 | 
				
			||||||
                        child: AttachmentItem(
 | 
					                        child: AttachmentItem(
 | 
				
			||||||
                          data: ele,
 | 
					                          data: ele,
 | 
				
			||||||
                          heroTag: heroTags[idx],
 | 
					                          heroTag: heroTags[idx],
 | 
				
			||||||
                          fit: BoxFit.cover,
 | 
					                          fit: BoxFit.cover,
 | 
				
			||||||
                          filterQuality: widget.filterQuality,
 | 
					                          filterQuality: widget.filterQuality,
 | 
				
			||||||
                          ),
 | 
					                          onZoom: () {
 | 
				
			||||||
                        ),
 | 
					 | 
				
			||||||
                        onTap: () {
 | 
					 | 
				
			||||||
                          if (widget.data[idx]!.mediaType !=
 | 
					 | 
				
			||||||
                              SnMediaType.image) {
 | 
					 | 
				
			||||||
                            return;
 | 
					 | 
				
			||||||
                          }
 | 
					 | 
				
			||||||
                            context.pushTransparentRoute(
 | 
					                            context.pushTransparentRoute(
 | 
				
			||||||
                              AttachmentZoomView(
 | 
					                              AttachmentZoomView(
 | 
				
			||||||
                                data: widget.data
 | 
					                                data: widget.data
 | 
				
			||||||
@@ -161,6 +149,7 @@ class _AttachmentListState extends State<AttachmentList> {
 | 
				
			|||||||
                            );
 | 
					                            );
 | 
				
			||||||
                          },
 | 
					                          },
 | 
				
			||||||
                        ),
 | 
					                        ),
 | 
				
			||||||
 | 
					                      ),
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                    .toList(),
 | 
					                    .toList(),
 | 
				
			||||||
              ),
 | 
					              ),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user