Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
586e3fc4db | ||
|
|
61c2d0561c | ||
|
|
dff2cd806d | ||
|
|
6f902740c1 | ||
|
|
bae64cd8c2 | ||
|
|
5586fea6b3 | ||
|
|
d0419fdf80 | ||
|
|
f60c767a0d | ||
|
|
40ac7cd055 |
@@ -10,7 +10,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.0.1-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.0.1" /></a>
|
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.0.8-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.0.8" /></a>
|
||||||
<img src="https://img.shields.io/badge/Flutter-3.47+-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter" />
|
<img src="https://img.shields.io/badge/Flutter-3.47+-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter" />
|
||||||
<img src="https://img.shields.io/badge/Platform-Android%20%7C%20Linux%20%7C%20Windows-00C853?style=for-the-badge" alt="Platforms" />
|
<img src="https://img.shields.io/badge/Platform-Android%20%7C%20Linux%20%7C%20Windows-00C853?style=for-the-badge" alt="Platforms" />
|
||||||
<a href="https://github.com/RarDog/Lunaris/wiki"><img src="https://img.shields.io/badge/Wiki-Documentation-FF6F00?style=for-the-badge&logo=gitbook&logoColor=white" alt="Wiki" /></a>
|
<a href="https://github.com/RarDog/Lunaris/wiki"><img src="https://img.shields.io/badge/Wiki-Documentation-FF6F00?style=for-the-badge&logo=gitbook&logoColor=white" alt="Wiki" /></a>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
const appDisplayVersion = '3.0.1';
|
const appDisplayVersion = '3.0.8';
|
||||||
const appBuildNumber = 52;
|
const appBuildNumber = 59;
|
||||||
const appReleaseChannel = 'Stable';
|
const appReleaseChannel = 'Stable';
|
||||||
|
|||||||
@@ -1,4 +1,43 @@
|
|||||||
const lunarisChangelog = [
|
const lunarisChangelog = [
|
||||||
|
LunarisChange(
|
||||||
|
version: '3.0.8',
|
||||||
|
title: 'iPhone Liquid Glass — раздел «Настройки» и парящая стеклянная кнопка',
|
||||||
|
bullets: [
|
||||||
|
'Парящая стеклянная кнопка настроек (Liquid Glass Floating Button): круглая сфера из матового стекла с эффектом BackdropFilter blur, зеркальным радиальным градиентом, подсветкой ободка, пружинящей анимацией масштабирования и вращения при нажатии.',
|
||||||
|
'Карточки настроек в стиле Liquid Glass (1:1 iOS): группы настроек переработаны в матовые стеклянные карточки с мягким градиентом, зеркальной рамкой и многослойными тенями глубины.',
|
||||||
|
'Иконки разделов и пунктов в стиле iOS: яркие сквиркл-бейджи с акцентными градиентами, мягким свечением и четкими белыми иконками, как в нативных настройках iPhone.',
|
||||||
|
'Стеклянная быстрая навигация по категориям: зафиксированная панель категорий с размытием фона и тактильным откликом при переключении разделов.',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
LunarisChange(
|
||||||
|
version: '3.0.7',
|
||||||
|
title: 'Liquid Glass Navigation Bar — парящая стеклянная панель и анимированная пилюля',
|
||||||
|
bullets: [
|
||||||
|
'Парящая панель Liquid Glass: нижняя панель навигации преобразована в парящий стеклянный док со скруглением, полупрозрачным градиентом и размытием фона (BackdropFilter blur).',
|
||||||
|
'Плавающая пилюля-индикатор (Liquid Pill): плавный анимированный бегунок перетекает под активную вкладку со сглаженной пружинящей физикой (easeOutBack).',
|
||||||
|
'Микроанимации нажатия и тактильный отклик: иконки мягко сжимаются при тапе и отпружинивают назад с легким тактильным виброоткликом (Haptic Feedback).',
|
||||||
|
'Глубина контента: контент ленты, поиска и галереи плавно просвечивает и размывается под стеклянной панелью при прокрутке.',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
LunarisChange(
|
||||||
|
version: '3.0.6',
|
||||||
|
title: 'Улучшение недавних запросов и отображения тегов',
|
||||||
|
bullets: [
|
||||||
|
'Полная видимость тегов и запросов: сняты тесные ограничения ширины (140px), теги и поисковые запросы теперь отображаются целиком без усечения.',
|
||||||
|
'Устранение дубликатов в истории: автоматическая дедупликация поисковых запросов в базе данных и интерфейсе. Устранены повторяющиеся пары запросов с пустыми счетчиками.',
|
||||||
|
'Исправление заголовка карточки поиска: заголовок «Недавние запросы» и счетчик больше не обрезаются на экранах смартфонов.',
|
||||||
|
'Удобное удаление: увеличенная область нажатия для кнопки удаления (крестика) предотвращает случайные нажатия на сам запрос.',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
LunarisChange(
|
||||||
|
version: '3.0.5',
|
||||||
|
title: 'Интерактивные ссылки на соцсети и авторов в объявлениях и описаниях',
|
||||||
|
bullets: [
|
||||||
|
'Кликабельные ссылки в объявлениях автора и описании постов: все URL в тексте подсвечиваются и открываются во внешнем браузере по клику.',
|
||||||
|
'Красивые бейджи соцсетей (CreatorLinkChips): автоматическое распознавание и стилизация ссылок на YouTube, X (Twitter), Instagram, TikTok, Discord, Patreon, Fanbox, Fantia, Boosty, Pixiv, Twitch, Telegram, Gumroad и другие платформы с фирменными иконками и цветами.',
|
||||||
|
'Корректная очистка пунктуации: знаки препинания в конце URL (!, ?, :, ., ,, ;, >) больше не ломают ссылки.',
|
||||||
|
],
|
||||||
|
),
|
||||||
LunarisChange(
|
LunarisChange(
|
||||||
version: '3.0.0',
|
version: '3.0.0',
|
||||||
title: 'Lunaris 3.0 — Глобальное обновление: Дизайн 2.0, Интеграция Pawchive и умная синхронизация',
|
title: 'Lunaris 3.0 — Глобальное обновление: Дизайн 2.0, Интеграция Pawchive и умная синхронизация',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export 'models/artist_tag.dart';
|
|||||||
export 'models/artist_link.dart';
|
export 'models/artist_link.dart';
|
||||||
export 'models/artist_announcement.dart';
|
export 'models/artist_announcement.dart';
|
||||||
export 'models/cloud_media_link.dart';
|
export 'models/cloud_media_link.dart';
|
||||||
|
export 'models/creator_link.dart';
|
||||||
export 'models/download_task.dart';
|
export 'models/download_task.dart';
|
||||||
export 'models/downloaded_media.dart';
|
export 'models/downloaded_media.dart';
|
||||||
export 'models/favorite.dart';
|
export 'models/favorite.dart';
|
||||||
|
|||||||
@@ -0,0 +1,332 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
enum CreatorLinkType {
|
||||||
|
youtube,
|
||||||
|
twitter,
|
||||||
|
instagram,
|
||||||
|
tiktok,
|
||||||
|
discord,
|
||||||
|
pixiv,
|
||||||
|
fanbox,
|
||||||
|
patreon,
|
||||||
|
fantia,
|
||||||
|
boosty,
|
||||||
|
twitch,
|
||||||
|
telegram,
|
||||||
|
gumroad,
|
||||||
|
subscribestar,
|
||||||
|
artstation,
|
||||||
|
deviantart,
|
||||||
|
linkhub,
|
||||||
|
other,
|
||||||
|
}
|
||||||
|
|
||||||
|
class CreatorLink {
|
||||||
|
const CreatorLink({
|
||||||
|
required this.url,
|
||||||
|
required this.type,
|
||||||
|
required this.title,
|
||||||
|
this.customLabel,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String url;
|
||||||
|
final CreatorLinkType type;
|
||||||
|
final String title;
|
||||||
|
final String? customLabel;
|
||||||
|
|
||||||
|
String get serviceName {
|
||||||
|
switch (type) {
|
||||||
|
case CreatorLinkType.youtube:
|
||||||
|
return 'YouTube';
|
||||||
|
case CreatorLinkType.twitter:
|
||||||
|
return 'X (Twitter)';
|
||||||
|
case CreatorLinkType.instagram:
|
||||||
|
return 'Instagram';
|
||||||
|
case CreatorLinkType.tiktok:
|
||||||
|
return 'TikTok';
|
||||||
|
case CreatorLinkType.discord:
|
||||||
|
return 'Discord';
|
||||||
|
case CreatorLinkType.pixiv:
|
||||||
|
return 'Pixiv';
|
||||||
|
case CreatorLinkType.fanbox:
|
||||||
|
return 'Fanbox';
|
||||||
|
case CreatorLinkType.patreon:
|
||||||
|
return 'Patreon';
|
||||||
|
case CreatorLinkType.fantia:
|
||||||
|
return 'Fantia';
|
||||||
|
case CreatorLinkType.boosty:
|
||||||
|
return 'Boosty';
|
||||||
|
case CreatorLinkType.twitch:
|
||||||
|
return 'Twitch';
|
||||||
|
case CreatorLinkType.telegram:
|
||||||
|
return 'Telegram';
|
||||||
|
case CreatorLinkType.gumroad:
|
||||||
|
return 'Gumroad';
|
||||||
|
case CreatorLinkType.subscribestar:
|
||||||
|
return 'SubscribeStar';
|
||||||
|
case CreatorLinkType.artstation:
|
||||||
|
return 'ArtStation';
|
||||||
|
case CreatorLinkType.deviantart:
|
||||||
|
return 'DeviantArt';
|
||||||
|
case CreatorLinkType.linkhub:
|
||||||
|
return 'Links Hub';
|
||||||
|
case CreatorLinkType.other:
|
||||||
|
return title.isNotEmpty ? title : 'Web Link';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color get brandColor {
|
||||||
|
switch (type) {
|
||||||
|
case CreatorLinkType.youtube:
|
||||||
|
return const Color(0xFFFF0000); // YouTube Red
|
||||||
|
case CreatorLinkType.twitter:
|
||||||
|
return const Color(0xFF1D9BF0); // Twitter Blue
|
||||||
|
case CreatorLinkType.instagram:
|
||||||
|
return const Color(0xFFE1306C); // Instagram Gradient Magenta
|
||||||
|
case CreatorLinkType.tiktok:
|
||||||
|
return const Color(0xFF00F2FE); // TikTok Cyan
|
||||||
|
case CreatorLinkType.discord:
|
||||||
|
return const Color(0xFF5865F2); // Discord Blurple
|
||||||
|
case CreatorLinkType.pixiv:
|
||||||
|
return const Color(0xFF0096FA); // Pixiv Blue
|
||||||
|
case CreatorLinkType.fanbox:
|
||||||
|
return const Color(0xFFF1A12F); // Fanbox Orange
|
||||||
|
case CreatorLinkType.patreon:
|
||||||
|
return const Color(0xFFFF424D); // Patreon Coral
|
||||||
|
case CreatorLinkType.fantia:
|
||||||
|
return const Color(0xFFE0245E); // Fantia Pink
|
||||||
|
case CreatorLinkType.boosty:
|
||||||
|
return const Color(0xFFF15A24); // Boosty Orange
|
||||||
|
case CreatorLinkType.twitch:
|
||||||
|
return const Color(0xFF9146FF); // Twitch Purple
|
||||||
|
case CreatorLinkType.telegram:
|
||||||
|
return const Color(0xFF2AABEE); // Telegram Blue
|
||||||
|
case CreatorLinkType.gumroad:
|
||||||
|
return const Color(0xFFFF90E8); // Gumroad Pink
|
||||||
|
case CreatorLinkType.subscribestar:
|
||||||
|
return const Color(0xFF00ADB5); // SubscribeStar Teal
|
||||||
|
case CreatorLinkType.artstation:
|
||||||
|
return const Color(0xFF13AFF0); // ArtStation Blue
|
||||||
|
case CreatorLinkType.deviantart:
|
||||||
|
return const Color(0xFF05CC47); // DeviantArt Green
|
||||||
|
case CreatorLinkType.linkhub:
|
||||||
|
return const Color(0xFF43E660); // Linktree Green
|
||||||
|
case CreatorLinkType.other:
|
||||||
|
return const Color(0xFF5C6BC0); // Indigo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IconData get iconData {
|
||||||
|
switch (type) {
|
||||||
|
case CreatorLinkType.youtube:
|
||||||
|
return Icons.smart_display_rounded;
|
||||||
|
case CreatorLinkType.twitter:
|
||||||
|
return Icons.alternate_email_rounded;
|
||||||
|
case CreatorLinkType.instagram:
|
||||||
|
return Icons.camera_alt_rounded;
|
||||||
|
case CreatorLinkType.tiktok:
|
||||||
|
return Icons.music_note_rounded;
|
||||||
|
case CreatorLinkType.discord:
|
||||||
|
return Icons.forum_rounded;
|
||||||
|
case CreatorLinkType.pixiv:
|
||||||
|
return Icons.palette_rounded;
|
||||||
|
case CreatorLinkType.fanbox:
|
||||||
|
return Icons.favorite_rounded;
|
||||||
|
case CreatorLinkType.patreon:
|
||||||
|
return Icons.volunteer_activism_rounded;
|
||||||
|
case CreatorLinkType.fantia:
|
||||||
|
return Icons.stars_rounded;
|
||||||
|
case CreatorLinkType.boosty:
|
||||||
|
return Icons.rocket_launch_rounded;
|
||||||
|
case CreatorLinkType.twitch:
|
||||||
|
return Icons.live_tv_rounded;
|
||||||
|
case CreatorLinkType.telegram:
|
||||||
|
return Icons.send_rounded;
|
||||||
|
case CreatorLinkType.gumroad:
|
||||||
|
return Icons.shopping_bag_rounded;
|
||||||
|
case CreatorLinkType.subscribestar:
|
||||||
|
return Icons.star_rounded;
|
||||||
|
case CreatorLinkType.artstation:
|
||||||
|
case CreatorLinkType.deviantart:
|
||||||
|
return Icons.brush_rounded;
|
||||||
|
case CreatorLinkType.linkhub:
|
||||||
|
return Icons.link_rounded;
|
||||||
|
case CreatorLinkType.other:
|
||||||
|
return Icons.language_rounded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static final _urlRegex = RegExp(
|
||||||
|
r'''https?://[^\s<>"{}|\\^`\[\]]+''',
|
||||||
|
caseSensitive: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
static final _htmlLinkRegex = RegExp(
|
||||||
|
r"""<a\s+[^>]*href=["']([^"']+)["'][^>]*>(.*?)</a>""",
|
||||||
|
caseSensitive: false,
|
||||||
|
dotAll: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
static const _cloudDriveHosts = {
|
||||||
|
'drive.google.com',
|
||||||
|
'mega.nz',
|
||||||
|
'mega.co.nz',
|
||||||
|
'dropbox.com',
|
||||||
|
'pixeldrain.com',
|
||||||
|
'mediafire.com',
|
||||||
|
'catbox.moe',
|
||||||
|
'bunkr.',
|
||||||
|
'gofile.io',
|
||||||
|
'terabox.com',
|
||||||
|
'1024tera.com',
|
||||||
|
'dubox.com',
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Extracts all social media, creator profiles and external web links from text.
|
||||||
|
static List<CreatorLink> extractLinks(
|
||||||
|
String? text, {
|
||||||
|
bool excludeCloudDrives = true,
|
||||||
|
}) {
|
||||||
|
if (text == null || text.trim().isEmpty) return const [];
|
||||||
|
final results = <CreatorLink>[];
|
||||||
|
final seenUrls = <String>{};
|
||||||
|
|
||||||
|
void processUrl(String rawUrl, {String? customTitle}) {
|
||||||
|
var url = rawUrl.trim();
|
||||||
|
while (url.isNotEmpty &&
|
||||||
|
(url.endsWith(')') ||
|
||||||
|
url.endsWith('.') ||
|
||||||
|
url.endsWith(',') ||
|
||||||
|
url.endsWith(';') ||
|
||||||
|
url.endsWith('!') ||
|
||||||
|
url.endsWith('?') ||
|
||||||
|
url.endsWith(':') ||
|
||||||
|
url.endsWith('>'))) {
|
||||||
|
url = url.substring(0, url.length - 1);
|
||||||
|
}
|
||||||
|
final uri = Uri.tryParse(url);
|
||||||
|
if (uri == null || !uri.hasScheme || !uri.scheme.startsWith('http')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (seenUrls.contains(url)) return;
|
||||||
|
seenUrls.add(url);
|
||||||
|
|
||||||
|
final host = uri.host.toLowerCase();
|
||||||
|
if (excludeCloudDrives) {
|
||||||
|
if (_cloudDriveHosts.any((ch) => host.contains(ch))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final (type, defaultTitle) = _classifyHost(uri);
|
||||||
|
results.add(CreatorLink(
|
||||||
|
url: url,
|
||||||
|
type: type,
|
||||||
|
title: (customTitle != null && customTitle.isNotEmpty && customTitle != url)
|
||||||
|
? customTitle
|
||||||
|
: defaultTitle,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Process HTML anchors
|
||||||
|
if (text.contains('<a ')) {
|
||||||
|
for (final match in _htmlLinkRegex.allMatches(text)) {
|
||||||
|
final href = match.group(1);
|
||||||
|
final rawTitle = match.group(2);
|
||||||
|
final cleanTitle =
|
||||||
|
rawTitle?.replaceAll(RegExp(r'<[^>]*>'), '').trim() ?? '';
|
||||||
|
if (href != null && href.isNotEmpty) {
|
||||||
|
processUrl(href, customTitle: cleanTitle.isNotEmpty ? cleanTitle : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Process all plain URLs
|
||||||
|
for (final match in _urlRegex.allMatches(text)) {
|
||||||
|
final url = match.group(0);
|
||||||
|
if (url != null) processUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
static (CreatorLinkType, String) _classifyHost(Uri uri) {
|
||||||
|
final host = uri.host.toLowerCase();
|
||||||
|
|
||||||
|
// YouTube
|
||||||
|
if (host.contains('youtube.com') || host.contains('youtu.be')) {
|
||||||
|
return (CreatorLinkType.youtube, 'YouTube');
|
||||||
|
}
|
||||||
|
// X / Twitter
|
||||||
|
if (host.contains('twitter.com') || host.contains('x.com') || host == 't.co') {
|
||||||
|
return (CreatorLinkType.twitter, 'X (Twitter)');
|
||||||
|
}
|
||||||
|
// Instagram
|
||||||
|
if (host.contains('instagram.com') || host.contains('instagr.am')) {
|
||||||
|
return (CreatorLinkType.instagram, 'Instagram');
|
||||||
|
}
|
||||||
|
// TikTok
|
||||||
|
if (host.contains('tiktok.com')) {
|
||||||
|
return (CreatorLinkType.tiktok, 'TikTok');
|
||||||
|
}
|
||||||
|
// Discord
|
||||||
|
if (host.contains('discord.gg') || host.contains('discord.com')) {
|
||||||
|
return (CreatorLinkType.discord, 'Discord');
|
||||||
|
}
|
||||||
|
// Pixiv
|
||||||
|
if (host.contains('pixiv.net')) {
|
||||||
|
return (CreatorLinkType.pixiv, 'Pixiv');
|
||||||
|
}
|
||||||
|
// Fanbox
|
||||||
|
if (host.contains('fanbox.cc')) {
|
||||||
|
return (CreatorLinkType.fanbox, 'Fanbox');
|
||||||
|
}
|
||||||
|
// Patreon
|
||||||
|
if (host.contains('patreon.com')) {
|
||||||
|
return (CreatorLinkType.patreon, 'Patreon');
|
||||||
|
}
|
||||||
|
// Fantia
|
||||||
|
if (host.contains('fantia.jp')) {
|
||||||
|
return (CreatorLinkType.fantia, 'Fantia');
|
||||||
|
}
|
||||||
|
// Boosty
|
||||||
|
if (host.contains('boosty.to')) {
|
||||||
|
return (CreatorLinkType.boosty, 'Boosty');
|
||||||
|
}
|
||||||
|
// Twitch
|
||||||
|
if (host.contains('twitch.tv')) {
|
||||||
|
return (CreatorLinkType.twitch, 'Twitch');
|
||||||
|
}
|
||||||
|
// Telegram
|
||||||
|
if (host.contains('t.me') || host.contains('telegram.me')) {
|
||||||
|
return (CreatorLinkType.telegram, 'Telegram');
|
||||||
|
}
|
||||||
|
// Gumroad
|
||||||
|
if (host.contains('gumroad.com')) {
|
||||||
|
return (CreatorLinkType.gumroad, 'Gumroad');
|
||||||
|
}
|
||||||
|
// SubscribeStar
|
||||||
|
if (host.contains('subscribestar.adult') || host.contains('subscribestar.com')) {
|
||||||
|
return (CreatorLinkType.subscribestar, 'SubscribeStar');
|
||||||
|
}
|
||||||
|
// ArtStation
|
||||||
|
if (host.contains('artstation.com')) {
|
||||||
|
return (CreatorLinkType.artstation, 'ArtStation');
|
||||||
|
}
|
||||||
|
// DeviantArt
|
||||||
|
if (host.contains('deviantart.com')) {
|
||||||
|
return (CreatorLinkType.deviantart, 'DeviantArt');
|
||||||
|
}
|
||||||
|
// Link hubs
|
||||||
|
if (host.contains('linktr.ee') || host.contains('carrd.co') || host.contains('lit.link')) {
|
||||||
|
return (CreatorLinkType.linkhub, 'Links Hub');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default clean host name
|
||||||
|
var cleanHost = host.replaceFirst(RegExp(r'^www\.'), '');
|
||||||
|
if (cleanHost.length > 25) {
|
||||||
|
cleanHost = cleanHost.substring(0, 25);
|
||||||
|
}
|
||||||
|
return (CreatorLinkType.other, cleanHost.isNotEmpty ? cleanHost : 'Web Link');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,15 @@ class SearchRepository {
|
|||||||
|
|
||||||
Future<Result<void>> save(SearchHistory history, {int maxItems = 500}) {
|
Future<Result<void>> save(SearchHistory history, {int maxItems = 500}) {
|
||||||
return _databaseService.safeWrite((isar) async {
|
return _databaseService.safeWrite((isar) async {
|
||||||
|
final norm = history.query.trim().toLowerCase();
|
||||||
|
// Remove any existing duplicate records with same query
|
||||||
|
final all = await isar.searchHistoryEntitys.where().findAll();
|
||||||
|
for (final item in all) {
|
||||||
|
if (item.query.trim().toLowerCase() == norm) {
|
||||||
|
await isar.searchHistoryEntitys.delete(item.isarId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await isar.searchHistoryEntitys.put(
|
await isar.searchHistoryEntitys.put(
|
||||||
SearchHistoryEntity()
|
SearchHistoryEntity()
|
||||||
..historyId = history.id
|
..historyId = history.id
|
||||||
@@ -42,13 +51,40 @@ class SearchRepository {
|
|||||||
return _databaseService.safeRead((isar) async {
|
return _databaseService.safeRead((isar) async {
|
||||||
final items = await isar.searchHistoryEntitys.where().findAll();
|
final items = await isar.searchHistoryEntitys.where().findAll();
|
||||||
items.sort((a, b) => b.searchedAt.compareTo(a.searchedAt));
|
items.sort((a, b) => b.searchedAt.compareTo(a.searchedAt));
|
||||||
final limited = limit == null ? items : items.take(limit);
|
|
||||||
|
final seen = <String>{};
|
||||||
|
final deduplicated = <SearchHistoryEntity>[];
|
||||||
|
for (final item in items) {
|
||||||
|
final key = item.query.trim().toLowerCase();
|
||||||
|
if (key.isEmpty) continue;
|
||||||
|
if (seen.add(key)) {
|
||||||
|
deduplicated.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final limited = limit == null ? deduplicated : deduplicated.take(limit);
|
||||||
return limited.map((entity) => entity.toModel()).toList();
|
return limited.map((entity) => entity.toModel()).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Result<bool>> delete(String historyId) {
|
Future<Result<bool>> delete(String historyId) {
|
||||||
return _databaseService.safeWrite((isar) async {
|
return _databaseService.safeWrite((isar) async {
|
||||||
|
final target = await isar.searchHistoryEntitys
|
||||||
|
.where()
|
||||||
|
.filter()
|
||||||
|
.historyIdEqualTo(historyId)
|
||||||
|
.findFirst();
|
||||||
|
if (target != null) {
|
||||||
|
final norm = target.query.trim().toLowerCase();
|
||||||
|
final all = await isar.searchHistoryEntitys.where().findAll();
|
||||||
|
for (final item in all) {
|
||||||
|
if (item.query.trim().toLowerCase() == norm ||
|
||||||
|
item.historyId == historyId) {
|
||||||
|
await isar.searchHistoryEntitys.delete(item.isarId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return await isar.searchHistoryEntitys.deleteByHistoryId(historyId);
|
return await isar.searchHistoryEntitys.deleteByHistoryId(historyId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,27 @@ import '../../core/utils/result.dart';
|
|||||||
import '../models/app_update_info.dart';
|
import '../models/app_update_info.dart';
|
||||||
import 'settings_service.dart';
|
import 'settings_service.dart';
|
||||||
|
|
||||||
|
enum UpdateSource {
|
||||||
|
gitea,
|
||||||
|
github,
|
||||||
|
}
|
||||||
|
|
||||||
class UpdateService {
|
class UpdateService {
|
||||||
UpdateService(this._dio, this._settingsService);
|
UpdateService(this._dio, this._settingsService);
|
||||||
|
|
||||||
static const latestReleaseUrl =
|
static const giteaLatestReleaseUrl =
|
||||||
|
'https://gitea.rardogsynapse.online/api/v1/repos/RarDog/Lunaris/releases/latest';
|
||||||
|
static const giteaReleasesUrl =
|
||||||
|
'https://gitea.rardogsynapse.online/api/v1/repos/RarDog/Lunaris/releases';
|
||||||
|
|
||||||
|
static const githubLatestReleaseUrl =
|
||||||
'https://api.github.com/repos/RarDog/Lunaris/releases/latest';
|
'https://api.github.com/repos/RarDog/Lunaris/releases/latest';
|
||||||
static const releasesUrl =
|
static const githubReleasesUrl =
|
||||||
'https://api.github.com/repos/RarDog/Lunaris/releases';
|
'https://api.github.com/repos/RarDog/Lunaris/releases';
|
||||||
|
|
||||||
|
static const latestReleaseUrl = githubLatestReleaseUrl;
|
||||||
|
static const releasesUrl = githubReleasesUrl;
|
||||||
|
|
||||||
static const _deviceChannel = MethodChannel('rulegel/device');
|
static const _deviceChannel = MethodChannel('rulegel/device');
|
||||||
|
|
||||||
final Dio _dio;
|
final Dio _dio;
|
||||||
@@ -50,14 +63,17 @@ class UpdateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Result<AppUpdateInfo?>> checkForUpdates({bool force = false}) async {
|
Future<Result<AppUpdateInfo?>> checkForUpdates({
|
||||||
|
bool force = false,
|
||||||
|
UpdateSource source = UpdateSource.gitea,
|
||||||
|
}) async {
|
||||||
final settingsResult = await _settingsService.getSettings();
|
final settingsResult = await _settingsService.getSettings();
|
||||||
final settings = settingsResult is Success<AppSettings>
|
final settings = settingsResult is Success<AppSettings>
|
||||||
? settingsResult.data
|
? settingsResult.data
|
||||||
: AppSettings.defaults;
|
: AppSettings.defaults;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final info = await _latestAllowedRelease(settings);
|
final info = await _latestAllowedRelease(settings, source: source);
|
||||||
final nextSettings = settings.copyWith(
|
final nextSettings = settings.copyWith(
|
||||||
lastUpdateCheckAt: DateTime.now().toIso8601String(),
|
lastUpdateCheckAt: DateTime.now().toIso8601String(),
|
||||||
);
|
);
|
||||||
@@ -81,16 +97,29 @@ class UpdateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AppUpdateInfo> _latestAllowedRelease(AppSettings settings) async {
|
Future<AppUpdateInfo> _latestAllowedRelease(
|
||||||
final response = await _dio.get<dynamic>(
|
AppSettings settings, {
|
||||||
releasesUrl,
|
UpdateSource source = UpdateSource.gitea,
|
||||||
queryParameters: {'per_page': 30},
|
}) async {
|
||||||
options: Options(
|
final isGitea = source == UpdateSource.gitea;
|
||||||
headers: {
|
final rUrl = isGitea ? giteaReleasesUrl : githubReleasesUrl;
|
||||||
|
final latestUrl = isGitea ? giteaLatestReleaseUrl : githubLatestReleaseUrl;
|
||||||
|
|
||||||
|
final options = Options(
|
||||||
|
headers: isGitea
|
||||||
|
? {
|
||||||
|
'Authorization': 'token 1c744d6044d756759d7b1f693c94c80cf70d75fa',
|
||||||
|
}
|
||||||
|
: {
|
||||||
'User-Agent': 'Lunaris-App',
|
'User-Agent': 'Lunaris-App',
|
||||||
'Accept': 'application/vnd.github+json',
|
'Accept': 'application/vnd.github+json',
|
||||||
},
|
},
|
||||||
),
|
);
|
||||||
|
|
||||||
|
final response = await _dio.get<dynamic>(
|
||||||
|
rUrl,
|
||||||
|
queryParameters: isGitea ? {'limit': 30} : {'per_page': 30},
|
||||||
|
options: options,
|
||||||
);
|
);
|
||||||
final items = (response.data as List?) ?? const [];
|
final items = (response.data as List?) ?? const [];
|
||||||
final releases = items
|
final releases = items
|
||||||
@@ -102,13 +131,8 @@ class UpdateService {
|
|||||||
.toList(growable: false);
|
.toList(growable: false);
|
||||||
if (releases.isEmpty) {
|
if (releases.isEmpty) {
|
||||||
final latest = await _dio.get<dynamic>(
|
final latest = await _dio.get<dynamic>(
|
||||||
latestReleaseUrl,
|
latestUrl,
|
||||||
options: Options(
|
options: options,
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Lunaris-App',
|
|
||||||
'Accept': 'application/vnd.github+json',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return _releaseFromJson(Map<String, dynamic>.from(latest.data as Map));
|
return _releaseFromJson(Map<String, dynamic>.from(latest.data as Map));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import '../../../core/utils/result.dart';
|
|||||||
import '../../../shared/widgets/adaptive_scaffold.dart';
|
import '../../../shared/widgets/adaptive_scaffold.dart';
|
||||||
import '../../../shared/widgets/empty_view.dart';
|
import '../../../shared/widgets/empty_view.dart';
|
||||||
import '../../../shared/widgets/error_view.dart';
|
import '../../../shared/widgets/error_view.dart';
|
||||||
|
import '../../../shared/widgets/formatted_content_text.dart';
|
||||||
import '../../../shared/widgets/post_masonry_grid.dart';
|
import '../../../shared/widgets/post_masonry_grid.dart';
|
||||||
import '../../favorites/presentation/favorites_controller.dart';
|
import '../../favorites/presentation/favorites_controller.dart';
|
||||||
import '../../settings/presentation/settings_controller.dart';
|
import '../../settings/presentation/settings_controller.dart';
|
||||||
@@ -235,7 +236,8 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final a = _announcements[index];
|
final a = _announcements[index];
|
||||||
final cleanContent = CloudLinkExtractor.cleanCommentary(a.content);
|
final cleanContent = CloudLinkExtractor.cleanCommentary(a.content);
|
||||||
final detectedLinks = CloudLinkExtractor.extractLinks(content: a.content);
|
final detectedCloudLinks = CloudLinkExtractor.extractLinks(content: a.content);
|
||||||
|
final creatorLinks = CreatorLink.extractLinks(a.content);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -250,18 +252,25 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
SelectableText(
|
FormattedContentText(
|
||||||
cleanContent.isNotEmpty ? cleanContent : a.content,
|
text: cleanContent.isNotEmpty ? cleanContent : a.content,
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
height: 1.45,
|
height: 1.45,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (detectedLinks.isNotEmpty) ...[
|
if (creatorLinks.isNotEmpty) ...[
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
CreatorLinkChips(
|
||||||
|
links: creatorLinks,
|
||||||
|
title: 'Ссылки автора',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (detectedCloudLinks.isNotEmpty) ...[
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Wrap(
|
Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 6,
|
runSpacing: 6,
|
||||||
children: detectedLinks.map((link) {
|
children: detectedCloudLinks.map((link) {
|
||||||
return ActionChip(
|
return ActionChip(
|
||||||
avatar: Icon(
|
avatar: Icon(
|
||||||
link.iconData,
|
link.iconData,
|
||||||
|
|||||||
@@ -123,14 +123,18 @@ class FeedController extends AsyncNotifier<FeedState> {
|
|||||||
final settingsRes = await ref.read(settingsServiceProvider).getSettings();
|
final settingsRes = await ref.read(settingsServiceProvider).getSettings();
|
||||||
final settings =
|
final settings =
|
||||||
settingsRes is Success<AppSettings> ? settingsRes.data : AppSettings.defaults;
|
settingsRes is Success<AppSettings> ? settingsRes.data : AppSettings.defaults;
|
||||||
await ref
|
try {
|
||||||
.read(searchServiceProvider)
|
|
||||||
.saveSearch(query, 0, maxHistory: settings.searchHistoryLimit);
|
|
||||||
await refresh();
|
await refresh();
|
||||||
final count = state.value?.posts.length ?? 0;
|
final count = state.value?.posts.length ?? 0;
|
||||||
await ref
|
await ref
|
||||||
.read(searchServiceProvider)
|
.read(searchServiceProvider)
|
||||||
.saveSearch(query, count, maxHistory: settings.searchHistoryLimit);
|
.saveSearch(query, count, maxHistory: settings.searchHistoryLimit);
|
||||||
|
} catch (_) {
|
||||||
|
await ref
|
||||||
|
.read(searchServiceProvider)
|
||||||
|
.saveSearch(query, 0, maxHistory: settings.searchHistoryLimit);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateTagSuggestions(String query) async {
|
Future<void> updateTagSuggestions(String query) async {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
|
|
||||||
import '../../../../app/app_strings.dart';
|
import '../../../../app/app_strings.dart';
|
||||||
import '../../../../backend/models/cloud_media_link.dart';
|
import '../../../../backend/models/cloud_media_link.dart';
|
||||||
|
import '../../../../backend/models/creator_link.dart';
|
||||||
|
import '../../../../shared/widgets/formatted_content_text.dart';
|
||||||
|
|
||||||
class CloudMirrorsCard extends StatelessWidget {
|
class CloudMirrorsCard extends StatelessWidget {
|
||||||
const CloudMirrorsCard({
|
const CloudMirrorsCard({
|
||||||
@@ -186,13 +188,26 @@ class CloudMirrorsCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SelectableText(
|
FormattedContentText(
|
||||||
commentary!.trim(),
|
text: commentary!.trim(),
|
||||||
style: theme.textTheme.bodySmall?.copyWith(
|
style: theme.textTheme.bodySmall?.copyWith(
|
||||||
height: 1.45,
|
height: 1.45,
|
||||||
color: theme.colorScheme.onSurfaceVariant,
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Builder(
|
||||||
|
builder: (context) {
|
||||||
|
final creatorLinks = CreatorLink.extractLinks(commentary);
|
||||||
|
if (creatorLinks.isEmpty) return const SizedBox.shrink();
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10),
|
||||||
|
child: CreatorLinkChips(
|
||||||
|
links: creatorLinks,
|
||||||
|
title: strings.ru ? 'Ссылки автора' : 'Author Links',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -175,10 +175,21 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
|
|||||||
icon: Icons.history_rounded,
|
icon: Icons.history_rounded,
|
||||||
accentColor: const Color(0xFF6366F1),
|
accentColor: const Color(0xFF6366F1),
|
||||||
title: isRu ? 'Недавние запросы' : 'Recent searches',
|
title: isRu ? 'Недавние запросы' : 'Recent searches',
|
||||||
badgeCount: data.recent.length,
|
badgeCount: data.recent
|
||||||
|
.map((e) => e.query.trim().toLowerCase())
|
||||||
|
.where((q) => q.isNotEmpty)
|
||||||
|
.toSet()
|
||||||
|
.length,
|
||||||
trailing: data.recent.isEmpty
|
trailing: data.recent.isEmpty
|
||||||
? null
|
? null
|
||||||
: TextButton(
|
: TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10, vertical: 4),
|
||||||
|
minimumSize: Size.zero,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
),
|
||||||
onPressed: () => ref
|
onPressed: () => ref
|
||||||
.read(searchControllerProvider.notifier)
|
.read(searchControllerProvider.notifier)
|
||||||
.clearHistory(),
|
.clearHistory(),
|
||||||
@@ -390,9 +401,10 @@ class _SearchSectionCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Icon(icon, size: 18, color: accentColor),
|
child: Icon(icon, size: 18, color: accentColor),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -401,6 +413,7 @@ class _SearchSectionCard extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: theme.textTheme.titleMedium?.copyWith(
|
style: theme.textTheme.titleMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -408,7 +421,7 @@ class _SearchSectionCard extends StatelessWidget {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 8, vertical: 2),
|
horizontal: 7, vertical: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: accentColor.withValues(alpha: 0.15),
|
color: accentColor.withValues(alpha: 0.15),
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
|||||||
@@ -47,8 +47,44 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deduplicate items by normalized query
|
||||||
|
final seen = <String>{};
|
||||||
|
final uniqueItems = <SearchHistory>[];
|
||||||
|
for (final item in widget.items) {
|
||||||
|
final key = item.query.trim().toLowerCase();
|
||||||
|
if (key.isEmpty) continue;
|
||||||
|
if (seen.add(key)) {
|
||||||
|
uniqueItems.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uniqueItems.isEmpty) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 16),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.history_toggle_off_rounded,
|
||||||
|
size: 40,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
'История поиска пуста',
|
||||||
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
final visibleItems =
|
final visibleItems =
|
||||||
_expanded ? widget.items : widget.items.take(20).toList();
|
_expanded ? uniqueItems : uniqueItems.take(20).toList();
|
||||||
|
final screenW = MediaQuery.sizeOf(context).width;
|
||||||
|
final maxQueryWidth = (screenW - 200).clamp(180.0, 480.0);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -66,7 +102,7 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
onTap: () => widget.onTap(item.query),
|
onTap: () => widget.onTap(item.query),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
const EdgeInsets.only(left: 10, right: 6, top: 6, bottom: 6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@@ -79,18 +115,22 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
size: 14,
|
size: 15,
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 140),
|
constraints: BoxConstraints(maxWidth: maxQueryWidth),
|
||||||
|
child: Tooltip(
|
||||||
|
message: item.query,
|
||||||
|
waitDuration: const Duration(milliseconds: 600),
|
||||||
child: Text(
|
child: Text(
|
||||||
item.query,
|
item.query,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: theme.textTheme.bodyMedium?.copyWith(
|
style: theme.textTheme.bodyMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -100,14 +140,14 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 6, vertical: 2),
|
horizontal: 6, vertical: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.colorScheme.secondaryContainer,
|
color: theme.colorScheme.primary.withValues(alpha: 0.12),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${item.resultCount}',
|
'${item.resultCount}',
|
||||||
style: theme.textTheme.labelSmall?.copyWith(
|
style: theme.textTheme.labelSmall?.copyWith(
|
||||||
color: theme.colorScheme.onSecondaryContainer,
|
color: theme.colorScheme.primary,
|
||||||
fontSize: 10,
|
fontSize: 11,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -115,14 +155,21 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
],
|
],
|
||||||
if (widget.onDelete != null) ...[
|
if (widget.onDelete != null) ...[
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
GestureDetector(
|
Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
shape: const CircleBorder(),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
child: InkWell(
|
||||||
|
customBorder: const CircleBorder(),
|
||||||
onTap: () => widget.onDelete!(item.id),
|
onTap: () => widget.onDelete!(item.id),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(2),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close_rounded,
|
Icons.close_rounded,
|
||||||
size: 14,
|
size: 15,
|
||||||
color: theme.colorScheme.onSurfaceVariant,
|
color: theme.colorScheme.onSurfaceVariant
|
||||||
|
.withValues(alpha: 0.75),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -134,7 +181,7 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (widget.items.length > 20) ...[
|
if (uniqueItems.length > 20) ...[
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Center(
|
Center(
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
@@ -148,7 +195,7 @@ class _RecentSearchesState extends State<RecentSearches> {
|
|||||||
label: Text(
|
label: Text(
|
||||||
_expanded
|
_expanded
|
||||||
? 'Свернуть'
|
? 'Свернуть'
|
||||||
: 'Показать все (${widget.items.length})',
|
: 'Показать все (${uniqueItems.length})',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart' hide appBuildNumber;
|
import 'package:flutter/services.dart' hide appBuildNumber;
|
||||||
@@ -150,14 +151,21 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
|||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
// Pinned Top Category Quick Navigation
|
// Pinned Top Category Quick Navigation (Frosted Glass)
|
||||||
Container(
|
ClipRect(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
|
||||||
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.scaffoldBackgroundColor,
|
color: theme.scaffoldBackgroundColor.withValues(
|
||||||
|
alpha: theme.brightness == Brightness.dark ? 0.76 : 0.82,
|
||||||
|
),
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.25),
|
color: theme.brightness == Brightness.dark
|
||||||
|
? Colors.white.withValues(alpha: 0.08)
|
||||||
|
: Colors.black.withValues(alpha: 0.06),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -172,6 +180,8 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// Scrollable Settings Cards
|
// Scrollable Settings Cards
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -958,12 +968,216 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _checkUpdates(BuildContext context, WidgetRef ref) async {
|
Future<void> _checkUpdates(BuildContext context, WidgetRef ref) async {
|
||||||
|
final isRu = settings.languageCode == 'ru';
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
final selectedSource = await showModalBottomSheet<UpdateSource>(
|
||||||
|
context: context,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder: (sheetContext) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: theme.colorScheme.surface,
|
||||||
|
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
width: 36,
|
||||||
|
height: 4,
|
||||||
|
margin: const EdgeInsets.only(bottom: 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.3),
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
isRu ? 'Источник обновлений' : 'Update Source',
|
||||||
|
style: theme.textTheme.titleMedium?.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
isRu
|
||||||
|
? 'Выберите сервер для загрузки обновлений'
|
||||||
|
: 'Choose a server to download updates from',
|
||||||
|
style: theme.textTheme.bodySmall?.copyWith(
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
|
// Option 1: GitHub (Recommended for speed)
|
||||||
|
Material(
|
||||||
|
color: theme.colorScheme.primaryContainer.withValues(alpha: 0.35),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
onTap: () => Navigator.pop(sheetContext, UpdateSource.github),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 44,
|
||||||
|
height: 44,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: theme.colorScheme.primary.withValues(alpha: 0.15),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.bolt_rounded,
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'GitHub',
|
||||||
|
style: theme.textTheme.titleSmall?.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 6,
|
||||||
|
vertical: 2,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.green.withValues(alpha: 0.2),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
isRu ? 'Рекомендуется для скорости' : 'Recommended for speed',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
Text(
|
||||||
|
isRu
|
||||||
|
? 'Прямая быстрая загрузка без ограничений'
|
||||||
|
: 'Direct fast download without limits',
|
||||||
|
style: theme.textTheme.bodySmall?.copyWith(
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
size: 14,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
// Option 2: Gitea (Muted / neutral grey)
|
||||||
|
Material(
|
||||||
|
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.25),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
onTap: () => Navigator.pop(sheetContext, UpdateSource.gitea),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 44,
|
||||||
|
height: 44,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: theme.colorScheme.onSurface.withValues(alpha: 0.08),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.dns_rounded,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
size: 22,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Gitea',
|
||||||
|
style: theme.textTheme.titleSmall?.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
Text(
|
||||||
|
isRu
|
||||||
|
? 'Сервер релизов'
|
||||||
|
: 'Release server',
|
||||||
|
style: theme.textTheme.bodySmall?.copyWith(
|
||||||
|
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.7),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
size: 14,
|
||||||
|
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selectedSource == null) return;
|
||||||
|
if (!context.mounted) return;
|
||||||
|
|
||||||
final messenger = ScaffoldMessenger.of(context);
|
final messenger = ScaffoldMessenger.of(context);
|
||||||
messenger.showSnackBar(
|
messenger.showSnackBar(
|
||||||
const SnackBar(content: Text('Checking for updates...')),
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
selectedSource == UpdateSource.gitea
|
||||||
|
? (isRu ? 'Проверка обновлений на Gitea...' : 'Checking updates on Gitea...')
|
||||||
|
: (isRu ? 'Проверка обновлений на GitHub...' : 'Checking updates on GitHub...'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
final result = await ref.read(updateServiceProvider).checkForUpdates(
|
||||||
|
force: true,
|
||||||
|
source: selectedSource,
|
||||||
);
|
);
|
||||||
final result =
|
|
||||||
await ref.read(updateServiceProvider).checkForUpdates(force: true);
|
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
messenger.hideCurrentSnackBar();
|
messenger.hideCurrentSnackBar();
|
||||||
if (result is Error<AppUpdateInfo?>) {
|
if (result is Error<AppUpdateInfo?>) {
|
||||||
@@ -973,7 +1187,11 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
|||||||
final update = (result as Success<AppUpdateInfo?>).data;
|
final update = (result as Success<AppUpdateInfo?>).data;
|
||||||
if (update == null) {
|
if (update == null) {
|
||||||
messenger.showSnackBar(
|
messenger.showSnackBar(
|
||||||
const SnackBar(content: Text('Lunaris is up to date')),
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
isRu ? 'У вас установлена последняя версия Lunaris' : 'Lunaris is up to date',
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1089,6 +1307,49 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
|||||||
// Settings 2.0 Modern Components
|
// Settings 2.0 Modern Components
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class _SettingsIconBadge extends StatelessWidget {
|
||||||
|
const _SettingsIconBadge({
|
||||||
|
required this.icon,
|
||||||
|
required this.color,
|
||||||
|
this.size = 34,
|
||||||
|
this.iconSize = 18,
|
||||||
|
});
|
||||||
|
|
||||||
|
final IconData icon;
|
||||||
|
final Color color;
|
||||||
|
final double size;
|
||||||
|
final double iconSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
color,
|
||||||
|
color.withValues(alpha: 0.86),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(size * 0.28),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: color.withValues(alpha: 0.35),
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: const Offset(0, 2.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(icon, size: iconSize, color: Colors.white),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class _CategoryQuickNav extends StatelessWidget {
|
class _CategoryQuickNav extends StatelessWidget {
|
||||||
const _CategoryQuickNav({
|
const _CategoryQuickNav({
|
||||||
required this.categories,
|
required this.categories,
|
||||||
@@ -1102,8 +1363,10 @@ class _CategoryQuickNav extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
final isDark = theme.brightness == Brightness.dark;
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 40,
|
height: 44,
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
@@ -1111,35 +1374,87 @@ class _CategoryQuickNav extends StatelessWidget {
|
|||||||
separatorBuilder: (_, __) => const SizedBox(width: 8),
|
separatorBuilder: (_, __) => const SizedBox(width: 8),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final cat = categories[index];
|
final cat = categories[index];
|
||||||
return Material(
|
return Container(
|
||||||
color: theme.colorScheme.surfaceContainer,
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
child: InkWell(
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
onTap: () => onSelect(cat.key),
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(22),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: isDark
|
||||||
|
? Colors.black.withValues(alpha: 0.25)
|
||||||
|
: cat.color.withValues(alpha: 0.12),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 2.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(22),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
|
||||||
|
child: Material(
|
||||||
|
color: isDark
|
||||||
|
? theme.colorScheme.surfaceContainerHigh.withValues(alpha: 0.60)
|
||||||
|
: Colors.white.withValues(alpha: 0.82),
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(22),
|
||||||
|
onTap: () {
|
||||||
|
HapticFeedback.selectionClick();
|
||||||
|
onSelect(cat.key);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(22),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.18)
|
||||||
|
: Colors.white.withValues(alpha: 0.85),
|
||||||
|
width: 1.1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(cat.icon, size: 16, color: cat.color),
|
Container(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
cat.color,
|
||||||
|
cat.color.withValues(alpha: 0.82),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(7),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: cat.color.withValues(alpha: 0.35),
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: const Offset(0, 1.5),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(cat.icon, size: 14, color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
cat.label,
|
cat.label,
|
||||||
style: theme.textTheme.labelLarge?.copyWith(
|
style: theme.textTheme.labelLarge?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
letterSpacing: -0.2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -1165,51 +1480,96 @@ class _SettingsCardGroup extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
final isDark = theme.brightness == Brightness.dark;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
key: sectionKey,
|
key: sectionKey,
|
||||||
margin: const EdgeInsets.only(bottom: 16),
|
margin: const EdgeInsets.only(bottom: 18),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.colorScheme.surfaceContainerLow,
|
borderRadius: BorderRadius.circular(24),
|
||||||
borderRadius: BorderRadius.circular(20),
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: isDark
|
||||||
|
? Colors.black.withValues(alpha: 0.40)
|
||||||
|
: accentColor.withValues(alpha: 0.08),
|
||||||
|
blurRadius: 20,
|
||||||
|
offset: const Offset(0, 6),
|
||||||
|
spreadRadius: -2,
|
||||||
|
),
|
||||||
|
BoxShadow(
|
||||||
|
color: accentColor.withValues(alpha: isDark ? 0.08 : 0.04),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(24),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(24),
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: isDark
|
||||||
|
? [
|
||||||
|
theme.colorScheme.surfaceContainerHigh.withValues(alpha: 0.60),
|
||||||
|
theme.colorScheme.surfaceContainerLow.withValues(alpha: 0.40),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
Colors.white.withValues(alpha: 0.88),
|
||||||
|
Colors.white.withValues(alpha: 0.72),
|
||||||
|
],
|
||||||
|
),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.3),
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.15)
|
||||||
|
: Colors.white.withValues(alpha: 0.85),
|
||||||
|
width: 1.2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
// Header
|
// iOS Liquid Glass Card Header
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 10),
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 12),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
_SettingsIconBadge(
|
||||||
width: 32,
|
icon: icon,
|
||||||
height: 32,
|
color: accentColor,
|
||||||
decoration: BoxDecoration(
|
size: 34,
|
||||||
color: accentColor.withValues(alpha: 0.14),
|
iconSize: 19,
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
),
|
||||||
child: Icon(icon, size: 18, color: accentColor),
|
const SizedBox(width: 14),
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: theme.textTheme.titleMedium?.copyWith(
|
style: theme.textTheme.titleMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
letterSpacing: -0.2,
|
letterSpacing: -0.3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(height: 1, thickness: 1, indent: 0, endIndent: 0),
|
Container(
|
||||||
|
height: 1,
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.08)
|
||||||
|
: theme.colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||||
|
),
|
||||||
...children,
|
...children,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1219,12 +1579,15 @@ class _SettingsDivider extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||||
return Divider(
|
return Divider(
|
||||||
height: 1,
|
height: 1,
|
||||||
thickness: 0.7,
|
thickness: 0.7,
|
||||||
indent: 68,
|
indent: 64,
|
||||||
endIndent: 16,
|
endIndent: 16,
|
||||||
color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.25),
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.07)
|
||||||
|
: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1255,14 +1618,11 @@ class _SettingsTile extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
_SettingsIconBadge(
|
||||||
width: 38,
|
icon: icon,
|
||||||
height: 38,
|
color: iconColor,
|
||||||
decoration: BoxDecoration(
|
size: 34,
|
||||||
color: iconColor.withValues(alpha: 0.12),
|
iconSize: 18,
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Icon(icon, size: 20, color: iconColor),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 14),
|
const SizedBox(width: 14),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -1328,14 +1688,11 @@ class _SettingsSegmentedTile<T> extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
_SettingsIconBadge(
|
||||||
width: 38,
|
icon: icon,
|
||||||
height: 38,
|
color: iconColor,
|
||||||
decoration: BoxDecoration(
|
size: 34,
|
||||||
color: iconColor.withValues(alpha: 0.12),
|
iconSize: 18,
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Icon(icon, size: 20, color: iconColor),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 14),
|
const SizedBox(width: 14),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -1445,14 +1802,11 @@ class _SettingsStepperTile extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
_SettingsIconBadge(
|
||||||
width: 38,
|
icon: icon,
|
||||||
height: 38,
|
color: iconColor,
|
||||||
decoration: BoxDecoration(
|
size: 34,
|
||||||
color: iconColor.withValues(alpha: 0.12),
|
iconSize: 18,
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Icon(icon, size: 20, color: iconColor),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 14),
|
const SizedBox(width: 14),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -1545,18 +1899,11 @@ class _SettingsFolderStructureTile extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
const _SettingsIconBadge(
|
||||||
width: 38,
|
icon: Icons.folder_copy_rounded,
|
||||||
height: 38,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFF0EA5E9).withValues(alpha: 0.12),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.folder_copy_rounded,
|
|
||||||
size: 20,
|
|
||||||
color: Color(0xFF0EA5E9),
|
color: Color(0xFF0EA5E9),
|
||||||
),
|
size: 34,
|
||||||
|
iconSize: 18,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 14),
|
const SizedBox(width: 14),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@@ -192,23 +192,46 @@ class _TagInputSearchBarState extends State<TagInputSearchBar> {
|
|||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final screenSize = MediaQuery.sizeOf(context);
|
||||||
final renderBox =
|
final renderBox =
|
||||||
_fieldKey.currentContext?.findRenderObject() as RenderBox?;
|
_fieldKey.currentContext?.findRenderObject() as RenderBox?;
|
||||||
final width =
|
final fieldWidth =
|
||||||
renderBox?.hasSize == true ? renderBox!.size.width : 360.0;
|
renderBox?.hasSize == true ? renderBox!.size.width : 360.0;
|
||||||
final height =
|
final fieldHeight =
|
||||||
renderBox?.hasSize == true ? renderBox!.size.height : 48.0;
|
renderBox?.hasSize == true ? renderBox!.size.height : 48.0;
|
||||||
|
|
||||||
|
final screenW = screenSize.width;
|
||||||
|
// Substantially wider dropdown:
|
||||||
|
// Mobile (< 600px): use full screen width minus comfortable 24px margins.
|
||||||
|
// Desktop/Tablet (>= 600px): expand to 1.35x field width, up to 780px.
|
||||||
|
final dropdownWidth = screenW < 600
|
||||||
|
? (screenW - 24.0).clamp(fieldWidth, 580.0)
|
||||||
|
: (fieldWidth * 1.35).clamp(fieldWidth, (screenW - 32.0).clamp(fieldWidth, 780.0));
|
||||||
|
|
||||||
|
// Ensure dropdown stays fully on screen and doesn't get clipped
|
||||||
|
double dxOffset = 0.0;
|
||||||
|
if (renderBox?.hasSize == true && renderBox?.attached == true) {
|
||||||
|
final globalPos = renderBox!.localToGlobal(Offset.zero);
|
||||||
|
final globalRight = globalPos.dx + dropdownWidth;
|
||||||
|
final maxRight = screenW - 12.0;
|
||||||
|
if (globalRight > maxRight) {
|
||||||
|
dxOffset = maxRight - globalRight;
|
||||||
|
}
|
||||||
|
if (globalPos.dx + dxOffset < 12.0) {
|
||||||
|
dxOffset = 12.0 - globalPos.dx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return CompositedTransformFollower(
|
return CompositedTransformFollower(
|
||||||
link: _layerLink,
|
link: _layerLink,
|
||||||
showWhenUnlinked: false,
|
showWhenUnlinked: false,
|
||||||
offset: Offset(0, height + 6),
|
offset: Offset(dxOffset, fieldHeight + 6),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: TapRegion(
|
child: TapRegion(
|
||||||
groupId: _fieldKey,
|
groupId: _fieldKey,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: width.clamp(280.0, 620.0),
|
width: dropdownWidth,
|
||||||
child: _TagSuggestionDropdown(
|
child: _TagSuggestionDropdown(
|
||||||
suggestions: suggestions,
|
suggestions: suggestions,
|
||||||
query: token,
|
query: token,
|
||||||
@@ -565,7 +588,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final scheme = Theme.of(context).colorScheme;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 620),
|
constraints: const BoxConstraints(maxWidth: 820),
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
shadowColor: Colors.black.withValues(alpha: 0.18),
|
shadowColor: Colors.black.withValues(alpha: 0.18),
|
||||||
@@ -641,7 +664,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
|||||||
if (cleanToken.isEmpty) {
|
if (cleanToken.isEmpty) {
|
||||||
return Text(
|
return Text(
|
||||||
text,
|
text,
|
||||||
maxLines: 1,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: defaultStyle,
|
style: defaultStyle,
|
||||||
);
|
);
|
||||||
@@ -653,7 +676,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
|||||||
if (matchIndex < 0) {
|
if (matchIndex < 0) {
|
||||||
return Text(
|
return Text(
|
||||||
text,
|
text,
|
||||||
maxLines: 1,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: defaultStyle,
|
style: defaultStyle,
|
||||||
);
|
);
|
||||||
@@ -678,7 +701,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
|||||||
if (after.isNotEmpty) TextSpan(text: after),
|
if (after.isNotEmpty) TextSpan(text: after),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
maxLines: 1,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:ui';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
@@ -281,30 +282,394 @@ class _MobileShell extends StatelessWidget {
|
|||||||
? location == '/'
|
? location == '/'
|
||||||
: location.startsWith(item.location),
|
: location.startsWith(item.location),
|
||||||
);
|
);
|
||||||
|
final bottomInset = 76.0 + MediaQuery.paddingOf(context).bottom;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: child,
|
extendBody: true,
|
||||||
|
body: MediaQuery(
|
||||||
|
data: MediaQuery.of(context).copyWith(
|
||||||
|
padding: MediaQuery.of(context).padding.copyWith(
|
||||||
|
bottom: bottomInset,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
floatingActionButton: location == '/settings'
|
floatingActionButton: location == '/settings'
|
||||||
? null
|
? null
|
||||||
: FloatingActionButton.small(
|
: Padding(
|
||||||
heroTag: 'mobile-settings',
|
padding: const EdgeInsets.only(bottom: 68, right: 4),
|
||||||
tooltip: ru
|
child: _LiquidGlassSettingsButton(
|
||||||
? '\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438'
|
ru: ru,
|
||||||
: 'Settings',
|
onTap: () => context.go('/settings'),
|
||||||
onPressed: () => context.go('/settings'),
|
),
|
||||||
child: const Icon(Icons.settings_rounded),
|
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||||
bottomNavigationBar: NavigationBar(
|
bottomNavigationBar: _LiquidGlassBottomBar(
|
||||||
selectedIndex: selected < 0 ? 0 : selected,
|
selectedIndex: selected < 0 ? 0 : selected,
|
||||||
onDestinationSelected: (index) => context.go(items[index].location),
|
onDestinationSelected: (index) => context.go(items[index].location),
|
||||||
destinations: [
|
items: items,
|
||||||
for (final item in items)
|
ru: ru,
|
||||||
NavigationDestination(
|
),
|
||||||
icon: Icon(item.icon),
|
);
|
||||||
label: item.mobileLabelFor(ru),
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LiquidGlassBottomBar extends StatefulWidget {
|
||||||
|
const _LiquidGlassBottomBar({
|
||||||
|
required this.selectedIndex,
|
||||||
|
required this.onDestinationSelected,
|
||||||
|
required this.items,
|
||||||
|
required this.ru,
|
||||||
|
});
|
||||||
|
|
||||||
|
final int selectedIndex;
|
||||||
|
final ValueChanged<int> onDestinationSelected;
|
||||||
|
final List<_Destination> items;
|
||||||
|
final bool ru;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_LiquidGlassBottomBar> createState() => _LiquidGlassBottomBarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LiquidGlassBottomBarState extends State<_LiquidGlassBottomBar> {
|
||||||
|
int? _pressedIndex;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
final isDark = theme.brightness == Brightness.dark;
|
||||||
|
final scheme = theme.colorScheme;
|
||||||
|
final count = widget.items.length;
|
||||||
|
if (count == 0) return const SizedBox.shrink();
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
|
top: false,
|
||||||
|
left: false,
|
||||||
|
right: false,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(14, 0, 14, 10),
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
final barWidth = constraints.maxWidth;
|
||||||
|
final itemWidth = barWidth / count;
|
||||||
|
final pillWidth = (itemWidth - 6).clamp(36.0, 64.0);
|
||||||
|
final pillLeft =
|
||||||
|
widget.selectedIndex * itemWidth + (itemWidth - pillWidth) / 2;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
height: 64,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(28),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withValues(alpha: isDark ? 0.38 : 0.09),
|
||||||
|
blurRadius: 22,
|
||||||
|
offset: const Offset(0, 8),
|
||||||
|
spreadRadius: -2,
|
||||||
|
),
|
||||||
|
if (isDark)
|
||||||
|
BoxShadow(
|
||||||
|
color: scheme.primary.withValues(alpha: 0.07),
|
||||||
|
blurRadius: 18,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(28),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(28),
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: isDark
|
||||||
|
? [
|
||||||
|
scheme.surfaceContainerHigh
|
||||||
|
.withValues(alpha: 0.70),
|
||||||
|
scheme.surface.withValues(alpha: 0.82),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
Colors.white.withValues(alpha: 0.84),
|
||||||
|
Colors.white.withValues(alpha: 0.68),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.16)
|
||||||
|
: Colors.white.withValues(alpha: 0.75),
|
||||||
|
width: 1.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
children: [
|
||||||
|
// Animated sliding liquid pill indicator
|
||||||
|
AnimatedPositioned(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeOutBack,
|
||||||
|
left: pillLeft,
|
||||||
|
top: 7,
|
||||||
|
child: Container(
|
||||||
|
width: pillWidth,
|
||||||
|
height: 32,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: scheme.primaryContainer.withValues(
|
||||||
|
alpha: isDark ? 0.75 : 0.88,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(
|
||||||
|
color: scheme.primary.withValues(
|
||||||
|
alpha: isDark ? 0.35 : 0.22,
|
||||||
|
),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: scheme.primary.withValues(
|
||||||
|
alpha: isDark ? 0.22 : 0.12,
|
||||||
|
),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Navigation item buttons
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
for (var i = 0; i < count; i++)
|
||||||
|
Expanded(
|
||||||
|
child: _LiquidNavItem(
|
||||||
|
destination: widget.items[i],
|
||||||
|
label: widget.items[i]
|
||||||
|
.mobileLabelFor(widget.ru),
|
||||||
|
isSelected: widget.selectedIndex == i,
|
||||||
|
isPressed: _pressedIndex == i,
|
||||||
|
onTapDown: () =>
|
||||||
|
setState(() => _pressedIndex = i),
|
||||||
|
onTapUp: () =>
|
||||||
|
setState(() => _pressedIndex = null),
|
||||||
|
onTapCancel: () =>
|
||||||
|
setState(() => _pressedIndex = null),
|
||||||
|
onTap: () {
|
||||||
|
HapticFeedback.lightImpact();
|
||||||
|
widget.onDestinationSelected(i);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LiquidNavItem extends StatelessWidget {
|
||||||
|
const _LiquidNavItem({
|
||||||
|
required this.destination,
|
||||||
|
required this.label,
|
||||||
|
required this.isSelected,
|
||||||
|
required this.isPressed,
|
||||||
|
required this.onTapDown,
|
||||||
|
required this.onTapUp,
|
||||||
|
required this.onTapCancel,
|
||||||
|
required this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
final _Destination destination;
|
||||||
|
final String label;
|
||||||
|
final bool isSelected;
|
||||||
|
final bool isPressed;
|
||||||
|
final VoidCallback onTapDown;
|
||||||
|
final VoidCallback onTapUp;
|
||||||
|
final VoidCallback onTapCancel;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
final scheme = theme.colorScheme;
|
||||||
|
final isDark = theme.brightness == Brightness.dark;
|
||||||
|
|
||||||
|
final targetScale = isPressed ? 0.86 : (isSelected ? 1.05 : 1.0);
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTapDown: (_) => onTapDown(),
|
||||||
|
onTapUp: (_) => onTapUp(),
|
||||||
|
onTapCancel: onTapCancel,
|
||||||
|
onTap: onTap,
|
||||||
|
child: Center(
|
||||||
|
child: AnimatedScale(
|
||||||
|
scale: targetScale,
|
||||||
|
duration: const Duration(milliseconds: 180),
|
||||||
|
curve: Curves.easeOutCubic,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 32,
|
||||||
|
child: Center(
|
||||||
|
child: AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
transitionBuilder: (child, anim) => ScaleTransition(
|
||||||
|
scale: anim,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
destination.icon,
|
||||||
|
key: ValueKey('${destination.id}_$isSelected'),
|
||||||
|
size: isSelected ? 22 : 20,
|
||||||
|
color: isSelected
|
||||||
|
? scheme.onPrimaryContainer
|
||||||
|
: (isDark
|
||||||
|
? scheme.onSurfaceVariant
|
||||||
|
.withValues(alpha: 0.78)
|
||||||
|
: scheme.onSurfaceVariant
|
||||||
|
.withValues(alpha: 0.85)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 2),
|
||||||
|
AnimatedDefaultTextStyle(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10.5,
|
||||||
|
fontWeight:
|
||||||
|
isSelected ? FontWeight.w700 : FontWeight.w500,
|
||||||
|
color: isSelected
|
||||||
|
? (isDark ? scheme.primary : scheme.onSurface)
|
||||||
|
: scheme.onSurfaceVariant.withValues(alpha: 0.75),
|
||||||
|
letterSpacing: -0.2,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
child: Text(label),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LiquidGlassSettingsButton extends StatefulWidget {
|
||||||
|
const _LiquidGlassSettingsButton({
|
||||||
|
required this.ru,
|
||||||
|
required this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
final bool ru;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_LiquidGlassSettingsButton> createState() =>
|
||||||
|
_LiquidGlassSettingsButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LiquidGlassSettingsButtonState extends State<_LiquidGlassSettingsButton> {
|
||||||
|
bool _pressed = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
final isDark = theme.brightness == Brightness.dark;
|
||||||
|
final scheme = theme.colorScheme;
|
||||||
|
|
||||||
|
return Tooltip(
|
||||||
|
message: widget.ru ? 'Настройки' : 'Settings',
|
||||||
|
child: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTapDown: (_) => setState(() => _pressed = true),
|
||||||
|
onTapUp: (_) => setState(() => _pressed = false),
|
||||||
|
onTapCancel: () => setState(() => _pressed = false),
|
||||||
|
onTap: () {
|
||||||
|
HapticFeedback.mediumImpact();
|
||||||
|
widget.onTap();
|
||||||
|
},
|
||||||
|
child: AnimatedScale(
|
||||||
|
scale: _pressed ? 0.88 : 1.0,
|
||||||
|
duration: const Duration(milliseconds: 160),
|
||||||
|
curve: Curves.easeOutCubic,
|
||||||
|
child: Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withValues(alpha: isDark ? 0.38 : 0.12),
|
||||||
|
blurRadius: 18,
|
||||||
|
offset: const Offset(0, 6),
|
||||||
|
spreadRadius: -1,
|
||||||
|
),
|
||||||
|
BoxShadow(
|
||||||
|
color: scheme.primary.withValues(alpha: isDark ? 0.20 : 0.12),
|
||||||
|
blurRadius: 12,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: ClipOval(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
gradient: RadialGradient(
|
||||||
|
center: const Alignment(-0.3, -0.4),
|
||||||
|
radius: 1.1,
|
||||||
|
colors: isDark
|
||||||
|
? [
|
||||||
|
scheme.surfaceContainerHigh.withValues(alpha: 0.85),
|
||||||
|
scheme.surface.withValues(alpha: 0.75),
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
Colors.white.withValues(alpha: 0.92),
|
||||||
|
Colors.white.withValues(alpha: 0.70),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color: isDark
|
||||||
|
? Colors.white.withValues(alpha: 0.24)
|
||||||
|
: Colors.white.withValues(alpha: 0.85),
|
||||||
|
width: 1.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: AnimatedRotation(
|
||||||
|
turns: _pressed ? 0.125 : 0.0,
|
||||||
|
duration: const Duration(milliseconds: 250),
|
||||||
|
curve: Curves.easeOutBack,
|
||||||
|
child: Icon(
|
||||||
|
Icons.settings_rounded,
|
||||||
|
size: 23,
|
||||||
|
color: scheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,261 @@
|
|||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../../backend/models/creator_link.dart';
|
||||||
|
|
||||||
|
class FormattedContentText extends StatefulWidget {
|
||||||
|
const FormattedContentText({
|
||||||
|
super.key,
|
||||||
|
required this.text,
|
||||||
|
this.style,
|
||||||
|
this.linkColor,
|
||||||
|
this.selectable = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String text;
|
||||||
|
final TextStyle? style;
|
||||||
|
final Color? linkColor;
|
||||||
|
final bool selectable;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FormattedContentText> createState() => _FormattedContentTextState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FormattedContentTextState extends State<FormattedContentText> {
|
||||||
|
final List<TapGestureRecognizer> _recognizers = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
for (final r in _recognizers) {
|
||||||
|
r.dispose();
|
||||||
|
}
|
||||||
|
_recognizers.clear();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _clearRecognizers() {
|
||||||
|
for (final r in _recognizers) {
|
||||||
|
r.dispose();
|
||||||
|
}
|
||||||
|
_recognizers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _launch(String url) async {
|
||||||
|
final uri = Uri.tryParse(url);
|
||||||
|
if (uri != null) {
|
||||||
|
try {
|
||||||
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
|
} catch (_) {
|
||||||
|
if (mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Не удалось открыть ссылку: $url')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
_clearRecognizers();
|
||||||
|
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
final scheme = theme.colorScheme;
|
||||||
|
final defaultStyle = widget.style ?? theme.textTheme.bodyMedium ?? const TextStyle();
|
||||||
|
final linkStyle = defaultStyle.copyWith(
|
||||||
|
color: widget.linkColor ?? scheme.primary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
decorationColor: (widget.linkColor ?? scheme.primary).withValues(alpha: 0.45),
|
||||||
|
);
|
||||||
|
|
||||||
|
final text = widget.text;
|
||||||
|
if (text.isEmpty) return const SizedBox.shrink();
|
||||||
|
|
||||||
|
final urlRegex = RegExp(r'''https?://[^\s<>"{}|\\^`\[\]]+''', caseSensitive: false);
|
||||||
|
final spans = <InlineSpan>[];
|
||||||
|
var lastIndex = 0;
|
||||||
|
|
||||||
|
for (final match in urlRegex.allMatches(text)) {
|
||||||
|
if (match.start > lastIndex) {
|
||||||
|
spans.add(TextSpan(
|
||||||
|
text: text.substring(lastIndex, match.start),
|
||||||
|
style: defaultStyle,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
var rawUrl = match.group(0)!;
|
||||||
|
var cleanUrl = rawUrl;
|
||||||
|
var trailing = '';
|
||||||
|
while (cleanUrl.isNotEmpty &&
|
||||||
|
(cleanUrl.endsWith(')') ||
|
||||||
|
cleanUrl.endsWith('.') ||
|
||||||
|
cleanUrl.endsWith(',') ||
|
||||||
|
cleanUrl.endsWith(';') ||
|
||||||
|
cleanUrl.endsWith('!') ||
|
||||||
|
cleanUrl.endsWith('?') ||
|
||||||
|
cleanUrl.endsWith(':') ||
|
||||||
|
cleanUrl.endsWith('>'))) {
|
||||||
|
trailing = cleanUrl[cleanUrl.length - 1] + trailing;
|
||||||
|
cleanUrl = cleanUrl.substring(0, cleanUrl.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
final recognizer = TapGestureRecognizer()
|
||||||
|
..onTap = () => _launch(cleanUrl);
|
||||||
|
_recognizers.add(recognizer);
|
||||||
|
|
||||||
|
spans.add(TextSpan(
|
||||||
|
text: cleanUrl,
|
||||||
|
style: linkStyle,
|
||||||
|
recognizer: recognizer,
|
||||||
|
));
|
||||||
|
|
||||||
|
if (trailing.isNotEmpty) {
|
||||||
|
spans.add(TextSpan(
|
||||||
|
text: trailing,
|
||||||
|
style: defaultStyle,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
lastIndex = match.end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastIndex < text.length) {
|
||||||
|
spans.add(TextSpan(
|
||||||
|
text: text.substring(lastIndex),
|
||||||
|
style: defaultStyle,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widget.selectable) {
|
||||||
|
return SelectableText.rich(
|
||||||
|
TextSpan(children: spans),
|
||||||
|
style: defaultStyle,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Text.rich(
|
||||||
|
TextSpan(children: spans),
|
||||||
|
style: defaultStyle,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CreatorLinkChips extends StatelessWidget {
|
||||||
|
const CreatorLinkChips({
|
||||||
|
super.key,
|
||||||
|
required this.links,
|
||||||
|
this.title,
|
||||||
|
});
|
||||||
|
|
||||||
|
final List<CreatorLink> links;
|
||||||
|
final String? title;
|
||||||
|
|
||||||
|
Future<void> _openLink(BuildContext context, String url) async {
|
||||||
|
final uri = Uri.tryParse(url);
|
||||||
|
if (uri != null) {
|
||||||
|
try {
|
||||||
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
|
} catch (_) {
|
||||||
|
if (context.mounted) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Не удалось открыть ссылку: $url')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (links.isEmpty) return const SizedBox.shrink();
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (title != null && title!.isNotEmpty) ...[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 6),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.link_rounded,
|
||||||
|
size: 15,
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
title!,
|
||||||
|
style: theme.textTheme.labelMedium?.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Wrap(
|
||||||
|
spacing: 8,
|
||||||
|
runSpacing: 6,
|
||||||
|
children: links.map((link) {
|
||||||
|
final brand = link.brandColor;
|
||||||
|
final labelText = link.title.isNotEmpty ? link.title : link.serviceName;
|
||||||
|
|
||||||
|
return Material(
|
||||||
|
color: brand.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
onTap: () => _openLink(context, link.url),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
border: Border.all(
|
||||||
|
color: brand.withValues(alpha: 0.35),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
link.iconData,
|
||||||
|
size: 16,
|
||||||
|
color: brand,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 240),
|
||||||
|
child: Text(
|
||||||
|
labelText,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: theme.colorScheme.onSurface,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_outward_rounded,
|
||||||
|
size: 12,
|
||||||
|
color: brand.withValues(alpha: 0.75),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
name: gel_rule_app
|
name: gel_rule_app
|
||||||
description: Local backend/core layer for a Flutter booru browser app.
|
description: Local backend/core layer for a Flutter booru browser app.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 3.0.1+52
|
version: 3.0.8+59
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.3.0 <4.0.0"
|
sdk: ">=3.3.0 <4.0.0"
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:gel_rule_app/backend/models/creator_link.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
group('CreatorLink extractor and classification tests', () {
|
||||||
|
test('extracts and classifies social and creator links accurately', () {
|
||||||
|
const text = '''
|
||||||
|
Check out my latest speedpaint on YouTube: https://youtu.be/dQw4w9WgXcQ
|
||||||
|
Also follow my X account https://x.com/artist_handle and Instagram: https://instagram.com/p/C1234567/!
|
||||||
|
Support me on Patreon: https://www.patreon.com/my_art or Fanbox: https://artist.fanbox.cc
|
||||||
|
Join my Discord: https://discord.gg/invitelink
|
||||||
|
Other links: https://carrd.co/myportfolio and https://example.com/blog.
|
||||||
|
Cloud links like https://drive.google.com/file/d/123/view and https://mega.nz/file/abc should be excluded by default.
|
||||||
|
''';
|
||||||
|
|
||||||
|
final links = CreatorLink.extractLinks(text);
|
||||||
|
|
||||||
|
expect(links.length, 8);
|
||||||
|
|
||||||
|
final yt = links.firstWhere((l) => l.type == CreatorLinkType.youtube);
|
||||||
|
expect(yt.serviceName, 'YouTube');
|
||||||
|
expect(yt.url, 'https://youtu.be/dQw4w9WgXcQ');
|
||||||
|
|
||||||
|
final twitter = links.firstWhere((l) => l.type == CreatorLinkType.twitter);
|
||||||
|
expect(twitter.serviceName, 'X (Twitter)');
|
||||||
|
expect(twitter.url, 'https://x.com/artist_handle');
|
||||||
|
|
||||||
|
final insta = links.firstWhere((l) => l.type == CreatorLinkType.instagram);
|
||||||
|
expect(insta.serviceName, 'Instagram');
|
||||||
|
expect(insta.url, 'https://instagram.com/p/C1234567/');
|
||||||
|
|
||||||
|
final patreon = links.firstWhere((l) => l.type == CreatorLinkType.patreon);
|
||||||
|
expect(patreon.serviceName, 'Patreon');
|
||||||
|
|
||||||
|
final fanbox = links.firstWhere((l) => l.type == CreatorLinkType.fanbox);
|
||||||
|
expect(fanbox.serviceName, 'Fanbox');
|
||||||
|
|
||||||
|
final discord = links.firstWhere((l) => l.type == CreatorLinkType.discord);
|
||||||
|
expect(discord.serviceName, 'Discord');
|
||||||
|
|
||||||
|
final hub = links.firstWhere((l) => l.type == CreatorLinkType.linkhub);
|
||||||
|
expect(hub.serviceName, 'Links Hub');
|
||||||
|
|
||||||
|
final web = links.firstWhere((l) => l.type == CreatorLinkType.other);
|
||||||
|
expect(web.url, 'https://example.com/blog');
|
||||||
|
|
||||||
|
// Verify cloud storage was excluded
|
||||||
|
expect(links.any((l) => l.url.contains('drive.google.com')), isFalse);
|
||||||
|
expect(links.any((l) => l.url.contains('mega.nz')), isFalse);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('handles HTML anchor links with custom titles', () {
|
||||||
|
const html = '''
|
||||||
|
<p>Visit my <a href="https://twitter.com/draws">Twitter Profile</a> and watch on <a href="https://www.youtube.com/channel/123">YouTube Stream</a>!</p>
|
||||||
|
''';
|
||||||
|
|
||||||
|
final links = CreatorLink.extractLinks(html);
|
||||||
|
expect(links.length, 2);
|
||||||
|
|
||||||
|
final tw = links.firstWhere((l) => l.type == CreatorLinkType.twitter);
|
||||||
|
expect(tw.title, 'Twitter Profile');
|
||||||
|
|
||||||
|
final yt = links.firstWhere((l) => l.type == CreatorLinkType.youtube);
|
||||||
|
expect(yt.title, 'YouTube Stream');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user