✨ Attachment gallery
This commit is contained in:
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
import 'package:solian/models/attachment.dart';
|
||||
import 'package:solian/providers/content/attachment_item.dart';
|
||||
import 'package:solian/providers/content/attachment_list.dart';
|
||||
import 'package:solian/widgets/attachments/attachment_list_fullscreen.dart';
|
||||
|
||||
class AttachmentList extends StatefulWidget {
|
||||
final List<int> attachmentsId;
|
||||
@ -124,15 +125,15 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
AttachmentItem(
|
||||
key: Key('a${element!.uuid}'),
|
||||
item: element,
|
||||
badge: _attachmentsMeta.length > 1 ? '${idx+1}/${_attachmentsMeta.length}' : null,
|
||||
show: !element.isMature || _showMature,
|
||||
badge: _attachmentsMeta.length > 1 ? '${idx + 1}/${_attachmentsMeta.length}' : null,
|
||||
showHideButton: !element.isMature || _showMature,
|
||||
onHide: () {
|
||||
setState(() => _showMature = false);
|
||||
},
|
||||
),
|
||||
if (element.isMature && !_showMature)
|
||||
BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||
filter: ImageFilter.blur(sigmaX: 100, sigmaY: 100),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
@ -168,7 +169,13 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
if (!_showMature && _attachmentsMeta.any((e) => e!.isMature)) {
|
||||
setState(() => _showMature = true);
|
||||
} else {
|
||||
// Open detail box
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AttachmentListFullscreen(
|
||||
attachment: element,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
48
lib/widgets/attachments/attachment_list_fullscreen.dart
Normal file
48
lib/widgets/attachments/attachment_list_fullscreen.dart
Normal file
@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:solian/models/attachment.dart';
|
||||
import 'package:solian/providers/content/attachment_item.dart';
|
||||
import 'package:solian/services.dart';
|
||||
|
||||
class AttachmentListFullscreen extends StatefulWidget {
|
||||
final Attachment attachment;
|
||||
|
||||
const AttachmentListFullscreen({super.key, required this.attachment});
|
||||
|
||||
@override
|
||||
State<AttachmentListFullscreen> createState() => _AttachmentListFullscreenState();
|
||||
}
|
||||
|
||||
class _AttachmentListFullscreenState extends State<AttachmentListFullscreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: GestureDetector(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: InteractiveViewer(
|
||||
boundaryMargin: const EdgeInsets.all(128),
|
||||
minScale: 0.1,
|
||||
maxScale: 16,
|
||||
panEnabled: true,
|
||||
scaleEnabled: true,
|
||||
child: AttachmentItem(
|
||||
showHideButton: false,
|
||||
item: widget.attachment,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:solian/exts.dart';
|
||||
|
Reference in New Issue
Block a user