Channel organize

This commit is contained in:
2024-05-26 00:11:00 +08:00
parent 9eae49128e
commit 657f36c1f8
24 changed files with 650 additions and 34 deletions

View File

@ -4,6 +4,7 @@ import 'package:solian/models/attachment.dart';
import 'package:solian/services.dart';
class AttachmentItem extends StatelessWidget {
final String parentId;
final Attachment item;
final bool showBadge;
final bool showHideButton;
@ -13,6 +14,7 @@ class AttachmentItem extends StatelessWidget {
const AttachmentItem({
super.key,
required this.parentId,
required this.item,
this.badge,
this.fit = BoxFit.cover,
@ -24,7 +26,7 @@ class AttachmentItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Hero(
tag: Key('a${item.uuid}'),
tag: Key('a${item.uuid}p$parentId'),
child: Stack(
fit: StackFit.expand,
children: [
@ -48,8 +50,10 @@ class AttachmentItem extends StatelessWidget {
child: Material(
color: Colors.transparent,
child: ActionChip(
visualDensity: const VisualDensity(vertical: -4, horizontal: -4),
avatar: Icon(Icons.visibility_off, color: Theme.of(context).colorScheme.onSurfaceVariant),
visualDensity:
const VisualDensity(vertical: -4, horizontal: -4),
avatar: Icon(Icons.visibility_off,
color: Theme.of(context).colorScheme.onSurfaceVariant),
label: Text('hide'.tr),
onPressed: () {
if (onHide != null) onHide!();

View File

@ -9,9 +9,11 @@ import 'package:solian/providers/content/attachment.dart';
import 'package:solian/widgets/attachments/attachment_list_fullscreen.dart';
class AttachmentList extends StatefulWidget {
final String parentId;
final List<int> attachmentsId;
const AttachmentList({super.key, required this.attachmentsId});
const AttachmentList(
{super.key, required this.parentId, required this.attachmentsId});
@override
State<AttachmentList> createState() => _AttachmentListState();
@ -126,6 +128,7 @@ class _AttachmentListState extends State<AttachmentList> {
fit: StackFit.expand,
children: [
AttachmentItem(
parentId: widget.parentId,
key: Key('a${element!.uuid}'),
item: element,
badge: _attachmentsMeta.length > 1
@ -180,7 +183,8 @@ class _AttachmentListState extends State<AttachmentList> {
} else {
Navigator.of(context, rootNavigator: true).push(
MaterialPageRoute(
builder: (context) => AttachmentListFullscreen(
builder: (context) => AttachmentListFullScreen(
parentId: widget.parentId,
attachment: element,
),
),

View File

@ -2,17 +2,19 @@ import 'package:flutter/material.dart';
import 'package:solian/models/attachment.dart';
import 'package:solian/widgets/attachments/attachment_item.dart';
class AttachmentListFullscreen extends StatefulWidget {
class AttachmentListFullScreen extends StatefulWidget {
final String parentId;
final Attachment attachment;
const AttachmentListFullscreen({super.key, required this.attachment});
const AttachmentListFullScreen(
{super.key, required this.parentId, required this.attachment});
@override
State<AttachmentListFullscreen> createState() =>
_AttachmentListFullscreenState();
State<AttachmentListFullScreen> createState() =>
_AttachmentListFullScreenState();
}
class _AttachmentListFullscreenState extends State<AttachmentListFullscreen> {
class _AttachmentListFullScreenState extends State<AttachmentListFullScreen> {
@override
void initState() {
super.initState();
@ -33,6 +35,7 @@ class _AttachmentListFullscreenState extends State<AttachmentListFullscreen> {
panEnabled: true,
scaleEnabled: true,
child: AttachmentItem(
parentId: widget.parentId,
showHideButton: false,
item: widget.attachment,
fit: BoxFit.contain,