v1.0.24+24
- tags lul
This commit is contained in:
parent
189f9a6efd
commit
28c4a17c43
@ -12,6 +12,7 @@ class DetailView extends StatefulWidget {
|
|||||||
final String type;
|
final String type;
|
||||||
final int mode;
|
final int mode;
|
||||||
final bool random;
|
final bool random;
|
||||||
|
final String? tagname;
|
||||||
|
|
||||||
const DetailView({
|
const DetailView({
|
||||||
super.key,
|
super.key,
|
||||||
@ -20,6 +21,7 @@ class DetailView extends StatefulWidget {
|
|||||||
required this.type,
|
required this.type,
|
||||||
required this.mode,
|
required this.mode,
|
||||||
required this.random,
|
required this.random,
|
||||||
|
required this.tagname,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -29,6 +31,7 @@ class DetailView extends StatefulWidget {
|
|||||||
class _DetailViewState extends State<DetailView> {
|
class _DetailViewState extends State<DetailView> {
|
||||||
late PageController _pageController;
|
late PageController _pageController;
|
||||||
late List<MediaItem> mediaItems;
|
late List<MediaItem> mediaItems;
|
||||||
|
String? _tagname;
|
||||||
int currentItemId = 0;
|
int currentItemId = 0;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
|
||||||
@ -36,6 +39,7 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
mediaItems = widget.mediaItems;
|
mediaItems = widget.mediaItems;
|
||||||
|
_tagname = widget.tagname;
|
||||||
final initialIndex = mediaItems.indexWhere(
|
final initialIndex = mediaItems.indexWhere(
|
||||||
(item) => item.id == widget.initialItemId,
|
(item) => item.id == widget.initialItemId,
|
||||||
);
|
);
|
||||||
@ -67,6 +71,7 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
type: widget.type,
|
type: widget.type,
|
||||||
mode: widget.mode,
|
mode: widget.mode,
|
||||||
random: widget.random,
|
random: widget.random,
|
||||||
|
tag: _tagname,
|
||||||
);
|
);
|
||||||
if (mounted && newMedia.isNotEmpty) {
|
if (mounted && newMedia.isNotEmpty) {
|
||||||
setState(() => mediaItems.addAll(newMedia));
|
setState(() => mediaItems.addAll(newMedia));
|
||||||
@ -110,7 +115,9 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
title: Text('f0ck #$currentItemId (${widget.type})'),
|
title: Text('f0ck #$currentItemId (${widget.type})'),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: PageTransformer(
|
body: Stack(
|
||||||
|
children: [
|
||||||
|
PageTransformer(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
pages: mediaItems.map((item) {
|
pages: mediaItems.map((item) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -123,6 +130,42 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
);
|
);
|
||||||
}).toList(),
|
}).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);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +193,15 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
alignment: WrapAlignment.center,
|
alignment: WrapAlignment.center,
|
||||||
spacing: 5.0,
|
spacing: 5.0,
|
||||||
children: item.tags.map((tag) {
|
children: item.tags.map((tag) {
|
||||||
return Chip(
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (tag.tag == 'sfw' || tag.tag == 'nsfw') return;
|
||||||
|
setState(() {
|
||||||
|
_tagname = tag.tag;
|
||||||
|
Navigator.pop(context, _tagname);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Chip(
|
||||||
label: Text(tag.tag),
|
label: Text(tag.tag),
|
||||||
backgroundColor: switch (tag.id) {
|
backgroundColor: switch (tag.id) {
|
||||||
1 => Colors.green,
|
1 => Colors.green,
|
||||||
@ -158,6 +209,7 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
_ => const Color(0xFF090909),
|
_ => const Color(0xFF090909),
|
||||||
},
|
},
|
||||||
labelStyle: const TextStyle(color: Colors.white),
|
labelStyle: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
|
@ -14,7 +14,7 @@ class MediaGrid extends StatefulWidget {
|
|||||||
|
|
||||||
class _MediaGridState extends State<MediaGrid> {
|
class _MediaGridState extends State<MediaGrid> {
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
final String _version = '1.0.23+23';
|
final String _version = '1.0.24+24';
|
||||||
List<MediaItem> mediaItems = [];
|
List<MediaItem> mediaItems = [];
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
Timer? _debounceTimer;
|
Timer? _debounceTimer;
|
||||||
@ -24,6 +24,7 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
int _selectedMode = 0;
|
int _selectedMode = 0;
|
||||||
bool _random = false;
|
bool _random = false;
|
||||||
final List<String> _modes = ["sfw", "nsfw", "untagged", "all"];
|
final List<String> _modes = ["sfw", "nsfw", "untagged", "all"];
|
||||||
|
String? _selectedTag;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -63,6 +64,7 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
type: _selectedType,
|
type: _selectedType,
|
||||||
mode: _selectedMode,
|
mode: _selectedMode,
|
||||||
random: _random,
|
random: _random,
|
||||||
|
tag: _selectedTag,
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => mediaItems.addAll(newMedia));
|
setState(() => mediaItems.addAll(newMedia));
|
||||||
@ -86,6 +88,7 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
type: _selectedType,
|
type: _selectedType,
|
||||||
mode: _selectedMode,
|
mode: _selectedMode,
|
||||||
random: _random,
|
random: _random,
|
||||||
|
tag: _selectedTag,
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -110,7 +113,7 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
_navigationCompleter = Completer();
|
_navigationCompleter = Completer();
|
||||||
try {
|
try {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
await Navigator.push(
|
final String? newTag = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => DetailView(
|
builder: (context) => DetailView(
|
||||||
@ -119,9 +122,22 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
type: _selectedType,
|
type: _selectedType,
|
||||||
mode: _selectedMode,
|
mode: _selectedMode,
|
||||||
random: _random,
|
random: _random,
|
||||||
|
tagname: _selectedTag,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (newTag != null) {
|
||||||
|
setState(() {
|
||||||
|
if (newTag == '___empty___') {
|
||||||
|
_selectedTag = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_selectedTag = newTag;
|
||||||
|
}
|
||||||
|
_refreshMedia();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@ -153,9 +169,9 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
_refreshMedia();
|
_refreshMedia();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
]
|
],
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomAppBar(
|
bottomNavigationBar: BottomAppBar(
|
||||||
color: const Color.fromARGB(255, 43, 43, 43),
|
color: const Color.fromARGB(255, 43, 43, 43),
|
||||||
@ -228,7 +244,9 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: RefreshIndicator(
|
body: Stack(
|
||||||
|
children: [
|
||||||
|
RefreshIndicator(
|
||||||
onRefresh: _refreshMedia,
|
onRefresh: _refreshMedia,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
@ -262,9 +280,9 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
color: switch (item.mode) {
|
color: switch (item.mode) {
|
||||||
1 => Colors.green,
|
1 => Colors.green,
|
||||||
2 => Colors.red,
|
2 => Colors.red,
|
||||||
_ => Colors.yellow
|
_ => Colors.yellow,
|
||||||
},
|
},
|
||||||
size: 15.0
|
size: 15.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -273,6 +291,58 @@ class _MediaGridState extends State<MediaGrid> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_selectedTag != null)
|
||||||
|
Positioned(
|
||||||
|
bottom: 20,
|
||||||
|
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: $_selectedTag',
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close, color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_selectedTag = null;
|
||||||
|
_refreshMedia();
|
||||||
|
});
|
||||||
|
_scrollController.animateTo(
|
||||||
|
0.0,
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
curve: Curves.easeOut,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
/*floatingActionButton: FloatingActionButton(
|
||||||
|
backgroundColor: Colors.black.withValues(alpha: 0.8),
|
||||||
|
child: const Icon(Icons.arrow_upward, color: Colors.white),
|
||||||
|
onPressed: () {
|
||||||
|
_scrollController.animateTo(
|
||||||
|
0.0,
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
curve: Curves.easeOut,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),*/
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,14 @@ Future<List<MediaItem>> fetchMedia({
|
|||||||
String? type,
|
String? type,
|
||||||
int? mode,
|
int? mode,
|
||||||
bool? random,
|
bool? random,
|
||||||
|
String? tag,
|
||||||
}) async {
|
}) async {
|
||||||
final Uri url = Uri.parse('https://api.f0ck.me/items/get').replace(
|
final Uri url = Uri.parse('https://api.f0ck.me/items/get').replace(
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'type': type ?? 'image',
|
'type': type ?? 'image',
|
||||||
'mode': (mode ?? 0).toString(),
|
'mode': (mode ?? 0).toString(),
|
||||||
'random': (random! ? 1 : 0).toString(),
|
'random': (random! ? 1 : 0).toString(),
|
||||||
|
if (tag != null) 'tag': tag,
|
||||||
if (older != null) 'older': older,
|
if (older != null) 'older': older,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.23+23
|
version: 1.0.24+24
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.0-100.2.beta
|
sdk: ^3.9.0-100.2.beta
|
||||||
|
Loading…
x
Reference in New Issue
Block a user