Update Galleries page title

This commit is contained in:
2023-09-15 17:09:55 +08:00
parent dae5e13bd8
commit b5a73b4714
9 changed files with 162 additions and 41 deletions

23
lib/components/tag.dart Normal file
View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../api/gallery.dart';
import '../globals.dart';
class TagWidget extends StatelessWidget {
const TagWidget(this.tag, {Key? key, this.name}) : super(key: key);
final Tag tag;
final String? name;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
context.pushNamed("/galleries",
queryParameters: {
"tag": [tag.tag]
},
extra: GalleriesPageExtra(translatedTag: tag.translated));
},
child: Text(name ?? tag.tag));
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../api/gallery.dart';
import 'tag.dart';
String _getTag(Tag tag) {
final tags = tag.tag.split(":");
@@ -17,13 +16,7 @@ class TagTooltip extends StatelessWidget {
@override
Widget build(BuildContext context) {
final name = _getTag(tag);
final t = InkWell(
onTap: () {
context.pushNamed("/galleries", queryParameters: {
"tag": [tag.tag]
});
},
child: Text(name));
final t = TagWidget(tag, name: name);
return tag.intro != null && tag.intro!.isNotEmpty
? Tooltip(
message: tag.intro!,

View File

@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:go_router/go_router.dart';
import '../api/gallery.dart';
import '../globals.dart';
import '../main.dart';
import 'tag.dart';
import 'tag_tooltip.dart';
import 'scroll_parent.dart';
@@ -74,13 +74,7 @@ class _TagsPanel extends State<TagsPanel> {
),
child: stt
? TagTooltip(ta[index - 1]!)
: InkWell(
onTap: () {
context.pushNamed("/galleries", queryParameters: {
"tag": [ta[index - 1]!.tag]
});
},
child: Text(ta[index - 1]!.tag)));
: TagWidget(ta[index - 1]!));
}
}));
});