💄 Better ui
This commit is contained in:
@ -102,81 +102,79 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
}
|
||||
|
||||
Widget buildEntry(Attachment element, int idx) {
|
||||
return RepaintBoundary(
|
||||
child: GestureDetector(
|
||||
child: Container(
|
||||
width: widget.width ?? MediaQuery.of(context).size.width,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
AttachmentItem(
|
||||
parentId: widget.parentId,
|
||||
key: Key('a${element.uuid}'),
|
||||
item: element,
|
||||
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: 100, sigmaY: 100),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (element.isMature && !_showMature)
|
||||
Center(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 280),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.visibility_off,
|
||||
color: Colors.white, size: 32),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'matureContent'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'matureContentCaption'.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
width: widget.width ?? MediaQuery.of(context).size.width,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
onTap: () {
|
||||
if (!_showMature && _attachmentsMeta.any((e) => e!.isMature)) {
|
||||
setState(() => _showMature = true);
|
||||
} else if (['image'].contains(element.mimetype.split('/').first)) {
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AttachmentListFullScreen(
|
||||
parentId: widget.parentId,
|
||||
attachment: element,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
AttachmentItem(
|
||||
parentId: widget.parentId,
|
||||
key: Key('a${element.uuid}'),
|
||||
item: element,
|
||||
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: 100, sigmaY: 100),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
if (element.isMature && !_showMature)
|
||||
Center(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 280),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.visibility_off,
|
||||
color: Colors.white, size: 32),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'matureContent'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
'matureContentCaption'.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (!_showMature && _attachmentsMeta.any((e) => e!.isMature)) {
|
||||
setState(() => _showMature = true);
|
||||
} else if (['image'].contains(element.mimetype.split('/').first)) {
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AttachmentListFullScreen(
|
||||
parentId: widget.parentId,
|
||||
attachment: element,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user