v1.0.24+24

- tags lul
This commit is contained in:
2025-06-04 12:35:09 +02:00
parent 189f9a6efd
commit 28c4a17c43
4 changed files with 190 additions and 66 deletions

View File

@ -12,6 +12,7 @@ class DetailView extends StatefulWidget {
final String type;
final int mode;
final bool random;
final String? tagname;
const DetailView({
super.key,
@ -20,6 +21,7 @@ class DetailView extends StatefulWidget {
required this.type,
required this.mode,
required this.random,
required this.tagname,
});
@override
@ -29,6 +31,7 @@ class DetailView extends StatefulWidget {
class _DetailViewState extends State<DetailView> {
late PageController _pageController;
late List<MediaItem> mediaItems;
String? _tagname;
int currentItemId = 0;
bool isLoading = false;
@ -36,6 +39,7 @@ class _DetailViewState extends State<DetailView> {
void initState() {
super.initState();
mediaItems = widget.mediaItems;
_tagname = widget.tagname;
final initialIndex = mediaItems.indexWhere(
(item) => item.id == widget.initialItemId,
);
@ -67,6 +71,7 @@ class _DetailViewState extends State<DetailView> {
type: widget.type,
mode: widget.mode,
random: widget.random,
tag: _tagname,
);
if (mounted && newMedia.isNotEmpty) {
setState(() => mediaItems.addAll(newMedia));
@ -110,18 +115,56 @@ class _DetailViewState extends State<DetailView> {
title: Text('f0ck #$currentItemId (${widget.type})'),
centerTitle: true,
),
body: PageTransformer(
controller: _pageController,
pages: mediaItems.map((item) {
return Scaffold(
body: SafeArea(
child: SmartRefreshIndicator(
onRefresh: _refreshMediaItem,
child: _buildMediaItem(item),
body: Stack(
children: [
PageTransformer(
controller: _pageController,
pages: mediaItems.map((item) {
return Scaffold(
body: SafeArea(
child: SmartRefreshIndicator(
onRefresh: _refreshMediaItem,
child: _buildMediaItem(item),
),
),
);
}).toList(),
),
if (_tagname != null)
Positioned(
bottom: 60,
left: MediaQuery.of(context).size.width * 0.2,
right: MediaQuery.of(context).size.width * 0.2,
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 10,
horizontal: 20,
),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Tag: $_tagname',
style: const TextStyle(color: Colors.white),
),
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () {
setState(() {
_tagname = '___empty___';
Navigator.pop(context, _tagname);
});
},
),
],
),
),
),
);
}).toList(),
],
),
);
}
@ -150,14 +193,23 @@ class _DetailViewState extends State<DetailView> {
alignment: WrapAlignment.center,
spacing: 5.0,
children: item.tags.map((tag) {
return Chip(
label: Text(tag.tag),
backgroundColor: switch (tag.id) {
1 => Colors.green,
2 => Colors.red,
_ => const Color(0xFF090909),
return GestureDetector(
onTap: () {
if (tag.tag == 'sfw' || tag.tag == 'nsfw') return;
setState(() {
_tagname = tag.tag;
Navigator.pop(context, _tagname);
});
},
labelStyle: const TextStyle(color: Colors.white),
child: Chip(
label: Text(tag.tag),
backgroundColor: switch (tag.id) {
1 => Colors.green,
2 => Colors.red,
_ => const Color(0xFF090909),
},
labelStyle: const TextStyle(color: Colors.white),
),
);
}).toList(),
),