Compare commits

...
13 Commits
Author SHA1 Message Date
RarDog f983e3c8c0 feat: исключение дублирования в текстовых публикациях и вкладки зеркал (v3.3.1)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-05 10:40:14 +03:00
RarDog 67c6994311 feat: redesign artist messages/announcements & native text-only posts (v3.3.0)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-05 10:24:20 +03:00
RarDog a88a8b5050 feat: fix fullscreen video playback retention, orientation layout and clean up UI (v3.2.0)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-05 09:53:10 +03:00
RarDog a039f09ec3 feat: Fullscreen 2.0 with instant handoff, screen brightness gestures, and real-time scrub preview (v3.1.9)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 23:43:46 +03:00
RarDog c7f507836b fix: fullscreen playback state retention and responsive control buttons (v3.1.8)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 23:33:42 +03:00
RarDog 1395cfd414 fix: remove unsafe libmpv setProperty FFI calls causing SIGSEGV crash (v3.1.7)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 23:17:15 +03:00
RarDog 15bebd6e47 fix: fullscreen play-pause button, search clear providers, video volume persistence & codec fallback (v3.1.6)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 23:09:23 +03:00
RarDog 295499ca4b feat: persist video volume, fix fullscreen controls, search providers & comments headroom (v3.1.5)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 22:50:15 +03:00
RarDog 9a0fd282b7 feat(video): optimize video player aspect ratio sizing and seekbar positioning v3.1.4
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 21:50:17 +03:00
RarDog 254f0e3d59 feat: Liquid Glass redesign for providers and network check, and tab back navigation (v3.1.3)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 21:29:25 +03:00
RarDog 5a568a3df9 perf: optimize post tags scrolling performance and eliminate frame drops (v3.1.2)
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 21:11:03 +03:00
RarDog d58b512020 feat: colored tag categories division like e621/gelbooru/rule34 and fix search for tags with parentheses
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 20:56:35 +03:00
RarDog 384c07955c feat(ui): iPhone Liquid Glass redesign for Search, Favorites, and History, fix cheat sheet clearance and update sheet
Build and Release / Build Windows x64 (push) Has been cancelled
2026-09-04 19:06:37 +03:00
39 changed files with 6253 additions and 1744 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
</p>
<p align="center">
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.0.9-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.0.9" /></a>
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.3.1-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.3.1" /></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/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>
+2 -2
View File
@@ -1,3 +1,3 @@
const appDisplayVersion = '3.0.9';
const appBuildNumber = 60;
const appDisplayVersion = '3.3.1';
const appBuildNumber = 73;
const appReleaseChannel = 'Stable';
+131
View File
@@ -1,4 +1,135 @@
const lunarisChangelog = [
LunarisChange(
version: '3.3.1',
title: 'Улучшенное разделение текстовых постов и облачных зеркал',
bullets: [
'Исключение дублирования в текстовых публикациях: для текстовых постов (без медиа) убрана лишняя плашка «Облачные диски и зеркала», исключая повторный вывод того же текста внизу экрана.',
'Вкладки «Зеркала» и «Описание»: для постов с фото, видео и GIF в блоке облачных дисков теперь доступны удобные переключаемые вкладки, позволяющие отдельно просматривать список ссылок на хранилища и авторское описание.',
'Чистый и нативный вид карточек: если у медиапоста есть только ссылки или только описание, отображается аккуратная монолитная секция с соответствующим заголовком и иконкой без лишних переключателей.',
],
),
LunarisChange(
version: '3.3.0',
title: 'Редизайн личных сообщений и рассылок артиста, нативная поддержка текстовых публикаций',
bullets: [
'Центр сообщений и рассылок автора: полностью переработан диалог по кнопке-рупору на экране артиста — аккуратные карточки сообщений в стиле мессенджера, бейджи сервисов, точное время публикации и кнопка быстрого копирования текста в буфер обмена.',
'Нативная поддержка текстовых постов: публикации без медиафайлов больше не вызывают ошибок и пустых плейсхолдеров — в сетке они отображаются как стильные заметки с заголовком и выдержкой текста.',
'Удобное чтение статей и заметок: при открытии текстового поста отображается комфортный ридер с форматированным текстом, ссылками автора и тегами.',
'Фильтрация по типу контента: на экране автора добавлен фильтр «Текст» с подсчетом количества публикаций наряду с фото, видео и GIF.',
'Поддержка анонсов в Kemono и Coomer: API анонсов и персональных сообщений теперь полноценно работает для всех поддерживаемых провайдеров.',
],
),
LunarisChange(
version: '3.2.0',
title: 'Стабильный полноэкранный режим: сохранение воспроизведения, устранение вылетов плеера и чистый интерфейс',
bullets: [
'Сохранение воспроизведения видео при повороте экрана: исправлена логика адаптивности на смартфонах — альбомная ориентация больше не сбрасывает мобильный интерфейс и не уничтожает запущенный плеер.',
'Защита жизненного цикла Player в фоне: плеер не уничтожается при переходе в полный экран, а кнопки «Пуск/Пауза» и перемотки работают мгновенно и безотказно.',
'Чистый кинематографичный интерфейс: удалены старые дублирующиеся кнопки в правом верхнем углу; кнопка смены ориентации (альбомный/портретный режим) аккуратно интегрирована в верхнюю панель управления.',
'Быстрое скрытие и показ контролов: касание свободной области видео плавно переключает видимость панели управления, а при нажатии на кнопки таймер автоскрытия автоматически обновляется.',
],
),
LunarisChange(
version: '3.1.9',
title: 'Полноэкранный плеер 2.0: мгновенный переход без задержек, жесты яркости и скраббинг с превью',
bullets: [
'Мгновенный переход в полноэкранный режим: убраны промежуточные задержки и наложения текстур, вход и выход происходят без малейших задержек.',
'Двухзонное жестовое управление: левая сторона экрана регулирует яркость подсветки с индикатором солнца, правая сторона — громкость звука.',
'Плавный скраббинг с плавающим таймингом: перемещение по таймлайну видео теперь отображает интерактивную плашку точного времени, а контролы не исчезают во время удержания ползунка.',
'Сброс яркости: при выходе из полноэкранного режима системный уровень яркости экрана аккуратно восстанавливается.',
],
),
LunarisChange(
version: '3.1.8',
title: 'Безупречный полноэкранный плеер: устранение остановки при развертывании и отзывчивые кнопки управления',
bullets: [
'Непрерывное воспроизведение при открытии на весь экран: видео больше не останавливается самопроизвольно при входе в полноэкранный режим или смене ориентации устройства.',
'Корректный статус воспроизведения: устранен сброс кнопки на «Пуск» при переходе в полный экран — видео продолжает воспроизведение без ложных остановок.',
'Мгновенный отклик кнопок «Пуск/Пауза» и перемотки: жесты управления поверхностью (двойной тап, смахивание громкости) перемещены в фоновый слой, исключая перехват и отмену нажатий по кнопкам управления.',
'Синхронизация состояния при сворачивании: плеер точно запоминает состояние паузы/воспроизведения при выходе из полноэкранного режима обратно в пост.',
],
),
LunarisChange(
version: '3.1.7',
title: 'Устранение критического сбоя при открытии видеопоста (SIGSEGV в libmpv)',
bullets: [
'Устранение нативного вылета: полностью удалены небезопасные прямые FFI-вызовы setProperty к mpv, приводившие к немедленному падению приложения на Android при инициализации видео.',
'Безопасная конфигурация декодирования: перевод настроек аппаратного ускорения и фоллбэка кодеков на официальный типобезопасный VideoControllerConfiguration (media_kit_video).',
'Надежный фоллбэк при редких ошибках кодека: при несовместимости аппаратного декодера плеер бесшовно переключается на программный FFmpeg-декодер без риска краша.',
],
),
LunarisChange(
version: '3.1.6',
title: 'Надежный полноэкранный плеер, сохранение провайдеров в поиске, громкость и устранение ошибки кодека',
bullets: [
'Полноэкранный плеер — отзывчивая кнопка Пуск/Пауза: центральная кнопка управления воспроизведением полностью переработана на непроницаемый GestureDetector со сквиркл-откликом, гарантируя мгновенное срабатывание без перехвата внешними жестами.',
'Сохранение источников при нажатии на крестик в поиске: клик по кнопке сброса в строке поиска теперь очищает только поисковый запрос и теги, никогда не сбрасывая выбранные источники до «Все».',
'Безупречное сохранение громкости: громкость видеоплеера корректно инициализируется из настроек, сохраняется при регулировках жестом и переходе между постами, не сбрасываясь на 100% при открытии нового видео и перезапуске приложения.',
'Автоматический fallback для ошибки Could not open codec: видеоплеер получил безопасные профили декодирования и автопереключение на программный лавк-декодер (FFmpeg software fallback) при редких сбоях аппаратного ускорения.',
],
),
LunarisChange(
version: '3.1.5',
title: 'Сохранение громкости видео, исправление полноэкранного плеера, фильтрации и удобства комментариев',
bullets: [
'Сохранение уровня громкости (Persistent Volume): выбранная громкость видеоплеера теперь сохраняется при свайп-регулировке и переключениях между видео и сохраняется даже после перезапуска приложения.',
'Исправление кнопок в полноэкранном режиме: кнопки паузы/воспроизведения и быстрой перемотки на ±10 секунд в центре экрана теперь работают мгновенно и надежно с анимацией визуального отклика (Seek Ripple).',
'Сохранение выбранных источников при очистке тегов: удаление всех тегов в строке поиска больше не сбрасывает выбранные провайдеры до значения «Все», сохраняя ваши активные источники.',
'Плавная строка поиска: при выборе тега из подсказок поле ввода больше не сдвигается слишком далеко в сторону, оставляя тег и курсор в поле зрения.',
'Удобный доступ к комментариям в посте: увеличен отступ снизу в деталях поста и расширена зона клика блока комментариев, позволяя комфортно прокрутить их выше системных жестов навигации.',
],
),
LunarisChange(
version: '3.1.4',
title: 'Оптимизация видеоплеера — адаптивная высота и идеальное прилегание полосы воспроизведения',
bullets: [
'Устранение зазора под видео: контейнер плеера на мобильных устройствах и ПК теперь динамически подстраивается под пропорции видео (aspect ratio) вместо жестко фиксированной высоты 62% экрана, устраняя огромные пустые черные полосы сверху и снизу.',
'Точное позиционирование полосы воспроизведения: исправлен отступ снизу и ложное наложение системных insets на неполноэкранный плеер в карточке поста — ползунок воспроизведения, таймкоды и кнопка фуллскрина теперь аккуратно прилегают к нижнему краю видео без зависания в воздухе.',
'Компактные элементы управления: выровнены буферный трек и слайдер прокрутки, оптимизирован градиент затенения для максимальной видимости и удобства управления.',
],
),
LunarisChange(
version: '3.1.3',
title: 'iPhone Liquid Glass — Источники, Проверка сети и Навигация назад по вкладкам',
bullets: [
'Возврат назад по вкладкам (Tab Back Navigation): реализован стек истории переходов между разделами в AppShell — теперь при нажатии кнопки «Назад» или системного жеста происходит возврат к ранее открытым вкладкам и подразделам вместо случайного закрытия приложения.',
'Liquid Glass редизайн списка источников (Providers): стеклянные карточки провайдеров с красивыми сквиркл-иконками движков (Gelbooru, Rule34, Danbooru, e621, Yande.re, Paheal, Kemono), переключателями активности, инфо-бейджами приоритета и зеркальными кнопками управления.',
'Liquid Glass редизайн редактирования и создания источников (Edit / New Provider): секционные стеклянные карточки с градиентными бейджами, полоса быстрых пресетов для мгновенного заполнения URL и типа API, безопасный ввод API-ключей и наглядные подсказки.',
'Liquid Glass редизайн проверки состояния источников (Provider Check): карточка общих метрик сети (онлайн/офлайн, средний пинг), раскрывающиеся аккордеоны детальной диагностики, живые светодиодные LED-индикаторы статуса и кнопка одновременной проверки всех провайдеров.',
],
),
LunarisChange(
version: '3.1.2',
title: 'Оптимизация производительности: устранение лагов при скролле к тегам',
bullets: [
'Устранение лагов при прокрутке тегов: полностью ликвидирован тяжелый GPU-оверхед BackdropFilter на повторяющихся чипах тегов, вызывавший просадки FPS и микрофризы при скролле постов с десятками и сотнями тегов.',
'Высокопроизводительный стеклянный стиль чипов (TagChip): чипы переведены на эффективные аппаратные альфа-слои и зеркальные контуры без потери премиального неонового Liquid Glass вида и цветных индикаторов категорий.',
'Облегчение контейнеров блока тегов: на мобильных и десктоп экранах контейнеры тегов оптимизированы для мгновенного плавного 120 FPS скроллинга.',
'Интеллектуальный лимит начального отображения: оптимизировано первоначальное количество отображаемых тегов в огромных категориях с удобной кнопкой быстрого раскрытия.',
],
),
LunarisChange(
version: '3.1.1',
title: 'Деление тегов по стилю e621/Gelbooru/Rule34 и исправление поиска тегов со скобками',
bullets: [
'Цветное деление тегов по категориям (e621, Rule34, Gelbooru): теги авторов (Artist) подсвечиваются кораллово-красным, персонажи (Character) — мятно-зелёным, серии/копирайты (Copyright) — пурпурным, виды (Species) — янтарно-оранжевым, мета (Meta) — ледяным голубым, а общие теги (General) — нейтральным стилем.',
'Liquid Glass чипы тегов: компоненты TagChip получили полупрозрачный фон с BackdropFilter размытием, цветной светодиодный индикатор-точку со свечением и зеркальный контур.',
'Индикаторы в заголовках категорий: заголовки блоков тегов дополнены цветными точками категорий со свечением и стильными капсулами счётчиков.',
'Исправление поиска тегов со скобками: исправлена проблема, из-за которой теги с круглыми скобками (например, tyson_(password), touhou_(series)) очищались от скобок при поиске и не находили постов в ленте.',
'Поддержка скобок в подсказках и локальном кэше: автодополнение теперь корректно выдает теги со скобками, фильтруя только внешние скобки группировки and-веток.',
'Liquid Glass оформление блока тегов в детальном просмотре поста на мобильных и десктоп устройствах.',
],
),
LunarisChange(
version: '3.1.0',
title: 'iPhone Liquid Glass — Поиск, Избранное, История и исправление доступности',
bullets: [
'Liquid Glass редизайн разделов «Поиск», «Избранное» и «История»: матовые стеклянные карточки (BackdropFilter blur), полупрозрачные градиенты, зеркальные контуры и сквиркл-бейджи иконок в стиле iOS.',
'Исправление шпаргалки по поиску: увеличен нижний отступ прокрутки во всех списках и сетках до 140px + safe area, благодаря чему блок операторов и шпаргалка по поиску больше не перекрываются парящей навигационной панелью и легко нажимаются.',
'Исправление модального окна проверки обновлений: панель с выбором источников (GitHub и Gitea) открывается через корневой навигатор поверх всей навигации с безопасным отступом снизу, обеспечивая беспрепятственный доступ к обеим кнопкам.',
'Тактильный отклик и стеклянные пилюли: быстрые операторы, категории, недавние запросы, фильтры медиа и переключатели разделов получили матовое оформление и вибрационный отклик Haptic Feedback.',
],
),
LunarisChange(
version: '3.0.9',
title: 'Коррекция позиции кнопки настроек и отображения кнопок JSON и бэкапа',
+14 -4
View File
@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class AppBreakpoints {
@@ -6,11 +8,19 @@ class AppBreakpoints {
}
class Responsive {
static bool isMobile(BuildContext context) =>
MediaQuery.sizeOf(context).width < AppBreakpoints.mobile;
static bool isMobile(BuildContext context) {
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
return MediaQuery.sizeOf(context).shortestSide < 600;
}
return MediaQuery.sizeOf(context).width < AppBreakpoints.mobile;
}
static bool isDesktop(BuildContext context) =>
MediaQuery.sizeOf(context).width >= AppBreakpoints.desktop;
static bool isDesktop(BuildContext context) {
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
return MediaQuery.sizeOf(context).shortestSide >= 600;
}
return MediaQuery.sizeOf(context).width >= AppBreakpoints.desktop;
}
static int columnsFor(
BuildContext context, {
+11 -1
View File
@@ -60,11 +60,21 @@ class Post {
return null;
}
String? get description => commentary;
String? get title {
final list = tagGroups['copyright'];
if (list != null && list.isNotEmpty) {
return list.first;
}
return null;
}
List<String> get cleanTags {
return tags.where((tag) {
final t = tag.trim();
if (t.isEmpty) return false;
if (t == 'cloud_mirror') return false;
if (t == 'cloud_mirror' || t == 'text_post') return false;
if (t.startsWith('{') && t.endsWith('}')) return false;
if (t.contains('"url"') || t.contains('"service"')) return false;
if (t.startsWith('http://') || t.startsWith('https://')) return false;
+32 -6
View File
@@ -230,8 +230,23 @@ class KemonoProvider
@override
Future<List<ArtistAnnouncement>> getArtistAnnouncements(
String service, String artistId) async =>
const [];
String service, String artistId) async {
final path = '/api/v1/$service/user/$artistId/announcements';
for (final apiBase in _apiBaseCandidates()) {
try {
final response = await _getFromApiBase<dynamic>(apiBase, path);
final items = response.data;
if (items is List) {
return items
.whereType<Map>()
.map((item) =>
ArtistAnnouncement.fromJson(Map<String, dynamic>.from(item)))
.toList(growable: false);
}
} catch (_) {}
}
return const [];
}
String _creatorPath() => _isCoomer ? '/coomer' : '/kemono';
@@ -385,17 +400,23 @@ class KemonoProvider
}
// Support link-only posts where author uploaded files to cloud drives (MEGA, GDrive, etc.)
if (files.isEmpty && (cloudLinks.isNotEmpty || cleanDesc.isNotEmpty)) {
// or text-only posts where author wrote an announcement, status or note
if (files.isEmpty &&
(cloudLinks.isNotEmpty ||
cleanDesc.isNotEmpty ||
rawContent.trim().isNotEmpty ||
title.trim().isNotEmpty)) {
final stableId = '${query.service}:${query.artistId}:$postId:0';
final firstStreamable =
cloudLinks.where((l) => l.isStreamable).firstOrNull;
final firstLink = cloudLinks.isNotEmpty ? cloudLinks.first : null;
final fileUrl = firstStreamable?.directStreamUrl ?? firstLink?.url ?? '';
final isTextOnly = cloudLinks.isEmpty;
final tags = [
query.service,
query.artistName,
if (title.trim().isNotEmpty) title.trim(),
'cloud_mirror',
if (!isTextOnly) 'cloud_mirror' else 'text_post',
];
return [
Post(
@@ -411,14 +432,19 @@ class KemonoProvider
height: 0,
source: postSource,
createdAt: published,
fileType: firstStreamable != null ? 'video' : 'link',
fileType: firstStreamable != null
? 'video'
: (isTextOnly ? 'text' : 'link'),
score: 0,
tagGroups: {
'artist': [query.artistName],
'meta': [query.service],
if (title.trim().isNotEmpty) 'copyright': [title.trim()],
if (cloudLinksJson.isNotEmpty) 'cloud_links': cloudLinksJson,
if (cleanDesc.isNotEmpty) 'description': [cleanDesc],
if (cleanDesc.isNotEmpty)
'description': [cleanDesc]
else if (rawContent.trim().isNotEmpty)
'description': [rawContent.trim()],
},
),
];
+15 -4
View File
@@ -418,17 +418,23 @@ class PawchiveProvider
}
// Support link-only posts where author uploaded files to cloud drives (MEGA, GDrive, etc.)
if (files.isEmpty && (cloudLinks.isNotEmpty || cleanDesc.isNotEmpty)) {
// or text-only posts where author wrote an announcement, status or note
if (files.isEmpty &&
(cloudLinks.isNotEmpty ||
cleanDesc.isNotEmpty ||
rawContent.trim().isNotEmpty ||
title.trim().isNotEmpty)) {
final stableId = '${query.service}:${query.artistId}:$postId:0';
final firstStreamable =
cloudLinks.where((l) => l.isStreamable).firstOrNull;
final firstLink = cloudLinks.isNotEmpty ? cloudLinks.first : null;
final fileUrl = firstStreamable?.directStreamUrl ?? firstLink?.url ?? '';
final isTextOnly = cloudLinks.isEmpty;
final tags = [
query.service,
query.artistName,
if (title.trim().isNotEmpty) title.trim(),
'cloud_mirror',
if (!isTextOnly) 'cloud_mirror' else 'text_post',
];
return [
Post(
@@ -444,14 +450,19 @@ class PawchiveProvider
height: 0,
source: postSource,
createdAt: published,
fileType: firstStreamable != null ? 'video' : 'link',
fileType: firstStreamable != null
? 'video'
: (isTextOnly ? 'text' : 'link'),
score: 0,
tagGroups: {
'artist': [query.artistName],
'meta': [query.service],
if (title.trim().isNotEmpty) 'copyright': [title.trim()],
if (cloudLinksJson.isNotEmpty) 'cloud_links': cloudLinksJson,
if (cleanDesc.isNotEmpty) 'description': [cleanDesc],
if (cleanDesc.isNotEmpty)
'description': [cleanDesc]
else if (rawContent.trim().isNotEmpty)
'description': [rawContent.trim()],
},
),
];
+10 -1
View File
@@ -169,7 +169,16 @@ class ProviderManager {
for (final raw in rawTags) {
var token = raw.trim();
token = token.replaceAll(RegExp(r'^[\(\)]+|[\(\)]+$'), '').trim();
if (token.isEmpty) continue;
// Only strip parentheses if they are grouping delimiters (unbalanced in the token, e.g. '(cat' or 'dog)')
// but preserve tags that have internal paired parentheses like 'tyson_(password)'.
if (token.startsWith('(') && !token.contains(')')) {
token = token.substring(1).trim();
}
if (token.endsWith(')') && !token.contains('(')) {
token = token.substring(0, token.length - 1).trim();
}
if (token.isEmpty) continue;
if (token.toLowerCase() == 'and') {
+1 -4
View File
@@ -21,10 +21,7 @@ class SearchService {
TagCacheService? get tagCacheService => _tagCacheService;
static String sanitizeToken(String raw) {
return raw
.replaceAll(RegExp(r'^[\(\)]+|[\(\)]+$'), '')
.trim()
.toLowerCase();
return raw.trim().toLowerCase();
}
List<String> parseTags(String query) {
@@ -39,6 +39,7 @@ class AppSettings {
required this.motionRefreshMode,
required this.autoBatterySaver60Hz,
required this.videoPlayerMuted,
this.videoPlayerVolume = 100.0,
required this.videoPlayerHalfVolume,
required this.videoPlayerLoop,
required this.videoPlayerCover,
@@ -94,6 +95,7 @@ class AppSettings {
final String motionRefreshMode;
final bool autoBatterySaver60Hz;
final bool videoPlayerMuted;
final double videoPlayerVolume;
final bool videoPlayerHalfVolume;
final bool videoPlayerLoop;
final bool videoPlayerCover;
@@ -146,6 +148,7 @@ class AppSettings {
motionRefreshMode: 'auto',
autoBatterySaver60Hz: true,
videoPlayerMuted: false,
videoPlayerVolume: 100.0,
videoPlayerHalfVolume: false,
videoPlayerLoop: false,
videoPlayerCover: false,
@@ -191,6 +194,7 @@ class AppSettings {
String? motionRefreshMode,
bool? autoBatterySaver60Hz,
bool? videoPlayerMuted,
double? videoPlayerVolume,
bool? videoPlayerHalfVolume,
bool? videoPlayerLoop,
bool? videoPlayerCover,
@@ -252,6 +256,7 @@ class AppSettings {
motionRefreshMode: motionRefreshMode ?? this.motionRefreshMode,
autoBatterySaver60Hz: autoBatterySaver60Hz ?? this.autoBatterySaver60Hz,
videoPlayerMuted: videoPlayerMuted ?? this.videoPlayerMuted,
videoPlayerVolume: videoPlayerVolume ?? this.videoPlayerVolume,
videoPlayerHalfVolume:
videoPlayerHalfVolume ?? this.videoPlayerHalfVolume,
videoPlayerLoop: videoPlayerLoop ?? this.videoPlayerLoop,
@@ -309,6 +314,7 @@ class AppSettings {
'motionRefreshMode': motionRefreshMode,
'autoBatterySaver60Hz': autoBatterySaver60Hz,
'videoPlayerMuted': videoPlayerMuted,
'videoPlayerVolume': videoPlayerVolume,
'videoPlayerHalfVolume': videoPlayerHalfVolume,
'videoPlayerLoop': videoPlayerLoop,
'videoPlayerCover': videoPlayerCover,
@@ -392,6 +398,8 @@ class AppSettings {
defaults.autoBatterySaver60Hz,
videoPlayerMuted:
(json['videoPlayerMuted'] as bool?) ?? defaults.videoPlayerMuted,
videoPlayerVolume: (json['videoPlayerVolume'] as num?)?.toDouble() ??
defaults.videoPlayerVolume,
videoPlayerHalfVolume: (json['videoPlayerHalfVolume'] as bool?) ??
defaults.videoPlayerHalfVolume,
videoPlayerLoop:
@@ -601,6 +609,17 @@ class SettingsService {
return updateSettings(settings.copyWith(videoPlaybackPositions: positions));
}
Future<Result<void>> setVideoPlayerVolume(double volume) async {
final result = await getSettings();
if (result is Error<AppSettings>) return Error(result.failure);
final settings = (result as Success<AppSettings>).data;
final clamped = volume.clamp(0.0, 100.0);
if ((settings.videoPlayerVolume - clamped).abs() < 0.01) {
return const Success(null);
}
return updateSettings(settings.copyWith(videoPlayerVolume: clamped));
}
Future<Result<void>> appendDiagnosticLog(String message) async {
final result = await getSettings();
if (result is Error<AppSettings>) return Error(result.failure);
+5 -4
View File
@@ -66,10 +66,11 @@ class TagCacheService {
int limit = 16,
Iterable<String>? priorityTags,
}) {
final cleanPrefix = prefix
.replaceAll(RegExp(r'^[\(\)]+|[\(\)]+$'), '')
.trim()
.toLowerCase();
var cleanPrefix = prefix.trim().toLowerCase();
// If the prefix has an unbalanced opening parenthesis at the start (e.g. '(cat'), strip it
if (cleanPrefix.startsWith('(') && !cleanPrefix.contains(')')) {
cleanPrefix = cleanPrefix.substring(1).trim();
}
if (cleanPrefix.isEmpty) return const [];
final prioritySet = priorityTags
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -191,11 +192,13 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
if (_selectedTypes.isEmpty) return true;
final isVid = MediaUrlSelector.isVideo(post);
final isGif = MediaUrlSelector.isGif(post);
final isPhoto = !isVid && !isGif;
final isText = post.fileType == 'text';
final isPhoto = !isVid && !isGif && !isText;
if (_selectedTypes.contains('video') && isVid) return true;
if (_selectedTypes.contains('gif') && isGif) return true;
if (_selectedTypes.contains('photo') && isPhoto) return true;
if (_selectedTypes.contains('text') && isText) return true;
return false;
}
@@ -205,68 +208,217 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
context: context,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: theme.colorScheme.surface,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
builder: (ctx) => DraggableScrollableSheet(
expand: false,
initialChildSize: 0.6,
maxChildSize: 0.9,
initialChildSize: 0.65,
maxChildSize: 0.92,
builder: (_, scroll) => Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
padding: const EdgeInsets.fromLTRB(20, 4, 16, 12),
child: Row(
children: [
Icon(Icons.campaign_rounded, color: theme.colorScheme.primary),
const SizedBox(width: 10),
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
color: theme.colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(14),
),
child: Icon(
Icons.campaign_rounded,
color: theme.colorScheme.onPrimaryContainer,
size: 24,
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Анонсы автора (${_announcements.length})',
'Личные сообщения и анонсы',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
letterSpacing: -0.2,
),
),
const SizedBox(height: 2),
Text(
'${widget.artistName} • ${widget.service.toUpperCase()}',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: theme.colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(20),
),
child: Text(
'${_announcements.length}',
style: TextStyle(
color: theme.colorScheme.onSecondaryContainer,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
),
],
),
),
const Divider(),
Divider(
height: 1,
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.4),
),
Expanded(
child: ListView.separated(
controller: scroll,
padding: const EdgeInsets.all(16),
itemCount: _announcements.length,
separatorBuilder: (_, __) => const Divider(height: 24),
itemBuilder: (context, index) {
final a = _announcements[index];
final cleanContent = CloudLinkExtractor.cleanCommentary(a.content);
final detectedCloudLinks = CloudLinkExtractor.extractLinks(content: a.content);
final creatorLinks = CreatorLink.extractLinks(a.content);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
child: _announcements.isEmpty
? Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (a.added != null)
Icon(
Icons.mark_email_read_outlined,
size: 48,
color: theme.colorScheme.outline,
),
const SizedBox(height: 12),
Text(
'${a.added!.year}-${a.added!.month.toString().padLeft(2, '0')}-${a.added!.day.toString().padLeft(2, '0')}',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.primary,
'Нет сообщений или рассылок',
style: theme.textTheme.titleSmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 6),
],
),
)
: ListView.separated(
controller: scroll,
padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
itemCount: _announcements.length,
separatorBuilder: (_, __) => const SizedBox(height: 12),
itemBuilder: (context, index) {
final a = _announcements[index];
final cleanContent =
CloudLinkExtractor.cleanCommentary(a.content);
final detectedCloudLinks =
CloudLinkExtractor.extractLinks(content: a.content);
final creatorLinks =
CreatorLink.extractLinks(a.content);
final displayContent = cleanContent.isNotEmpty
? cleanContent
: a.content;
return Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: theme.colorScheme.outlineVariant
.withValues(alpha: 0.45),
),
),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 3,
),
decoration: BoxDecoration(
color: theme.colorScheme.primary
.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(8),
),
child: Text(
(a.service.isNotEmpty
? a.service
: widget.service)
.toUpperCase(),
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
letterSpacing: 0.5,
),
),
),
if (a.added != null) ...[
const SizedBox(width: 8),
Icon(
Icons.access_time_rounded,
size: 13,
color: theme.colorScheme.onSurfaceVariant,
),
const SizedBox(width: 4),
Text(
'${a.added!.day.toString().padLeft(2, '0')}.${a.added!.month.toString().padLeft(2, '0')}.${a.added!.year} ${a.added!.hour.toString().padLeft(2, '0')}:${a.added!.minute.toString().padLeft(2, '0')}',
style: TextStyle(
fontSize: 11.5,
color:
theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
),
],
const Spacer(),
IconButton(
icon: const Icon(Icons.copy_rounded,
size: 17),
tooltip: 'Скопировать текст',
visualDensity: VisualDensity.compact,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
onPressed: () {
Clipboard.setData(
ClipboardData(text: displayContent),
);
ScaffoldMessenger.of(context)
.showSnackBar(
const SnackBar(
content:
Text('Текст сообщения скопирован'),
duration: Duration(seconds: 2),
),
);
},
),
],
),
const SizedBox(height: 10),
FormattedContentText(
text: cleanContent.isNotEmpty ? cleanContent : a.content,
text: displayContent,
style: theme.textTheme.bodyMedium?.copyWith(
height: 1.45,
height: 1.5,
letterSpacing: 0.15,
),
),
if (creatorLinks.isNotEmpty) ...[
const SizedBox(height: 10),
const SizedBox(height: 12),
CreatorLinkChips(
links: creatorLinks,
title: 'Ссылки автора',
title: 'Ссылки из сообщения',
),
],
if (detectedCloudLinks.isNotEmpty) ...[
const SizedBox(height: 10),
const SizedBox(height: 12),
Wrap(
spacing: 8,
runSpacing: 6,
@@ -278,7 +430,9 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
color: link.brandColor,
),
label: Text(
link.title.isNotEmpty ? link.title : link.serviceName,
link.title.isNotEmpty
? link.title
: link.serviceName,
style: const TextStyle(fontSize: 12),
),
onPressed: () => launchUrl(
@@ -290,6 +444,7 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
),
],
],
),
);
},
),
@@ -303,10 +458,14 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
Widget _buildMediaTypeFilters() {
final scheme = Theme.of(context).colorScheme;
final photoCount = _posts
.where((p) => !MediaUrlSelector.isVideo(p) && !MediaUrlSelector.isGif(p))
.where((p) =>
p.fileType != 'text' &&
!MediaUrlSelector.isVideo(p) &&
!MediaUrlSelector.isGif(p))
.length;
final videoCount = _posts.where(MediaUrlSelector.isVideo).length;
final gifCount = _posts.where(MediaUrlSelector.isGif).length;
final textCount = _posts.where((p) => p.fileType == 'text').length;
return Padding(
padding: const EdgeInsets.fromLTRB(16, 6, 16, 4),
@@ -376,6 +535,27 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
});
},
),
if (textCount > 0) ...[
const SizedBox(width: 8),
FilterChip(
selected: _selectedTypes.contains('text'),
avatar: Icon(Icons.article_outlined,
size: 16,
color: _selectedTypes.contains('text')
? scheme.onPrimaryContainer
: scheme.onSurfaceVariant),
label: Text('Текст ($textCount)'),
onSelected: (selected) {
setState(() {
if (selected) {
_selectedTypes.add('text');
} else {
_selectedTypes.remove('text');
}
});
},
),
],
],
),
),
@@ -1,5 +1,8 @@
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
@@ -176,7 +179,25 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
// Search input bar if active
if (_isSearching)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
padding: const EdgeInsets.fromLTRB(16, 6, 16, 6),
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.surfaceContainerHigh
.withValues(alpha: 0.55)
: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.14)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
),
child: TextField(
controller: _searchController,
autofocus: true,
@@ -189,49 +210,97 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
? IconButton(
icon: const Icon(Icons.clear_rounded),
onPressed: () {
HapticFeedback.lightImpact();
_searchController.clear();
setState(() => _searchQuery = '');
},
)
: null,
isDense: true,
filled: true,
filled: false,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide.none,
border: InputBorder.none,
),
onChanged: (val) =>
setState(() => _searchQuery = val.trim()),
),
),
),
onChanged: (val) => setState(() => _searchQuery = val.trim()),
),
),
// Navigation Tabs
// Navigation Tabs with Liquid Glass container
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 6),
padding: const EdgeInsets.fromLTRB(16, 6, 16, 6),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(
alpha: Theme.of(context).brightness == Brightness.dark
? 0.20
: 0.04,
),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(22),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context)
.colorScheme
.surfaceContainerHigh
.withValues(alpha: 0.50)
: Colors.white.withValues(alpha: 0.72),
border: Border.all(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.12)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
),
child: SizedBox(
width: double.infinity,
child: SegmentedButton<int>(
showSelectedIcon: false,
style: ButtonStyle(
visualDensity: VisualDensity.compact,
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
),
segments: [
ButtonSegment(
value: 0,
icon: const Icon(Icons.favorite_rounded, size: 18),
label: Text(
'${isRu ? 'Все' : 'All'} (${allPosts.length})',
style: const TextStyle(fontSize: 12),
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
),
ButtonSegment(
value: 1,
icon: const Icon(Icons.offline_pin_rounded, size: 18),
icon: const Icon(Icons.offline_pin_rounded,
size: 18),
label: Text(
'${isRu ? 'Офлайн' : 'Offline'} (${offlinePosts.length})',
style: const TextStyle(fontSize: 12),
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
),
@@ -240,13 +309,15 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
icon: const Icon(Icons.groups_rounded, size: 18),
label: Text(
'${isRu ? 'Авторы' : 'Artists'} (${artistGroups.length})',
style: const TextStyle(fontSize: 12),
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
),
),
],
selected: {_tabIndex},
onSelectionChanged: (value) {
HapticFeedback.selectionClick();
setState(() {
_tabIndex = value.first;
_selectedArtist = null;
@@ -255,6 +326,10 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
),
),
),
),
),
),
),
// Media Type Filter Chips (for Tab 0 and Tab 1)
if (_tabIndex != 2)
@@ -265,9 +340,12 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
FilterChip(
label: Text(isRu ? 'Все' : 'All'),
selected: _mediaFilter == FavoriteMediaType.all,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _mediaFilter = FavoriteMediaType.all,
),
);
},
visualDensity: VisualDensity.compact,
),
const SizedBox(width: 8),
@@ -275,9 +353,12 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
avatar: const Icon(Icons.videocam_rounded, size: 16),
label: Text(isRu ? 'Видео' : 'Videos'),
selected: _mediaFilter == FavoriteMediaType.video,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _mediaFilter = FavoriteMediaType.video,
),
);
},
visualDensity: VisualDensity.compact,
),
const SizedBox(width: 8),
@@ -285,9 +366,12 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
avatar: const Icon(Icons.image_rounded, size: 16),
label: Text(isRu ? 'Фото' : 'Images'),
selected: _mediaFilter == FavoriteMediaType.image,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _mediaFilter = FavoriteMediaType.image,
),
);
},
visualDensity: VisualDensity.compact,
),
],
@@ -490,33 +574,42 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
}) {
final scheme = Theme.of(context).colorScheme;
return Container(
return _FavoritesLiquidCard(
margin: const EdgeInsets.fromLTRB(16, 4, 16, 8),
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: scheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: scheme.outlineVariant.withValues(alpha: 0.35),
),
),
glowColor: scheme.primary,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(10),
width: 40,
height: 40,
decoration: BoxDecoration(
color: scheme.primaryContainer.withValues(alpha: 0.7),
borderRadius: BorderRadius.circular(12),
gradient: LinearGradient(
colors: [
scheme.primary,
scheme.primary.withValues(alpha: 0.85),
],
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: scheme.primary.withValues(alpha: 0.35),
blurRadius: 7,
offset: const Offset(0, 2.5),
),
],
),
child: const Center(
child: Icon(
Icons.offline_pin_rounded,
color: scheme.onPrimaryContainer,
color: Colors.white,
size: 22,
),
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
@@ -526,6 +619,7 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
'$downloadedCount ${isRu ? 'из' : 'of'} $totalCount ${isRu ? 'офлайн' : 'saved'}',
style: Theme.of(context).textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold,
letterSpacing: -0.2,
),
),
const SizedBox(height: 2),
@@ -553,6 +647,7 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
if (pendingCount > 0)
FilledButton.tonalIcon(
onPressed: () async {
HapticFeedback.mediumImpact();
final dm = ref.read(downloadManagerServiceProvider);
for (final p in pendingPosts) {
await dm.start(p);
@@ -594,7 +689,7 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
vertical: 6,
),
decoration: BoxDecoration(
color: scheme.secondaryContainer.withValues(alpha: 0.5),
color: scheme.primary.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(12),
),
child: Row(
@@ -610,8 +705,8 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
isRu ? 'Всё готово' : 'Synced',
style:
Theme.of(context).textTheme.labelSmall?.copyWith(
color: scheme.onSecondaryContainer,
fontWeight: FontWeight.w600,
color: scheme.primary,
fontWeight: FontWeight.w700,
),
),
],
@@ -666,27 +761,36 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
ChoiceChip(
label: Text(isRu ? 'По дате' : 'Date'),
selected: _offlineSort == OfflineSortOption.dateAddedDesc,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _offlineSort = OfflineSortOption.dateAddedDesc,
),
);
},
visualDensity: VisualDensity.compact,
),
const SizedBox(width: 6),
ChoiceChip(
label: Text(isRu ? 'По размеру' : 'Size'),
selected: _offlineSort == OfflineSortOption.sizeDesc,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _offlineSort = OfflineSortOption.sizeDesc,
),
);
},
visualDensity: VisualDensity.compact,
),
const SizedBox(width: 6),
ChoiceChip(
label: Text(isRu ? 'По автору' : 'Artist'),
selected: _offlineSort == OfflineSortOption.artist,
onSelected: (_) => setState(
onSelected: (_) {
HapticFeedback.selectionClick();
setState(
() => _offlineSort = OfflineSortOption.artist,
),
);
},
visualDensity: VisualDensity.compact,
),
],
@@ -712,38 +816,50 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
return Column(
children: [
// Artist Header Banner
Container(
// Artist Header Banner (Liquid Glass)
_FavoritesLiquidCard(
margin: const EdgeInsets.fromLTRB(16, 4, 16, 8),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.surfaceContainerLow,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Theme.of(context)
.colorScheme
.outlineVariant
.withValues(alpha: 0.3),
),
),
child: Row(
children: [
IconButton(
onPressed: () => setState(() => _selectedArtist = null),
onPressed: () {
HapticFeedback.selectionClick();
setState(() => _selectedArtist = null);
},
icon: const Icon(Icons.arrow_back_rounded),
tooltip: isRu ? 'Все авторы' : 'All artists',
),
const SizedBox(width: 8),
CircleAvatar(
radius: 18,
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
Container(
width: 38,
height: 38,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.tertiary,
],
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.35),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
child: Center(
child: Text(
selected.isNotEmpty ? selected[0].toUpperCase() : '?',
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.onPrimaryContainer,
color: Colors.white,
),
),
),
),
@@ -756,6 +872,7 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
selected,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
letterSpacing: -0.2,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -776,6 +893,7 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
visualDensity: VisualDensity.compact,
),
onPressed: () {
HapticFeedback.selectionClick();
context.push('/search?q=${Uri.encodeComponent('artist:$selected')}');
},
icon: const Icon(Icons.search_rounded, size: 16),
@@ -808,7 +926,9 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
}
return ListView.separated(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 24),
// Extended bottom padding so the last artist cards scroll comfortably above the floating dock
padding: EdgeInsets.fromLTRB(
16, 8, 16, 140 + MediaQuery.paddingOf(context).bottom),
itemCount: entries.length,
separatorBuilder: (_, __) => const SizedBox(height: 10),
itemBuilder: (context, index) {
@@ -863,6 +983,83 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
}
}
class _FavoritesLiquidCard extends StatelessWidget {
const _FavoritesLiquidCard({
required this.child,
this.padding,
this.glowColor,
this.margin,
});
final Widget child;
final EdgeInsetsGeometry? padding;
final EdgeInsetsGeometry? margin;
final Color? glowColor;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final accent = glowColor ?? theme.colorScheme.primary;
return Container(
margin: margin,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.30)
: accent.withValues(alpha: 0.07),
blurRadius: 16,
offset: const Offset(0, 5),
spreadRadius: -2,
),
BoxShadow(
color: accent.withValues(alpha: isDark ? 0.05 : 0.02),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(22),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
child: Container(
padding: padding ?? const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.60),
theme.colorScheme.surfaceContainerLow
.withValues(alpha: 0.38),
]
: [
Colors.white.withValues(alpha: 0.88),
Colors.white.withValues(alpha: 0.72),
],
),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.14)
: Colors.white.withValues(alpha: 0.85),
width: 1.2,
),
),
child: child,
),
),
),
);
}
}
class _ArtistCard extends StatelessWidget {
const _ArtistCard({
required this.artistName,
@@ -881,45 +1078,91 @@ class _ArtistCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final isDark = Theme.of(context).brightness == Brightness.dark;
return Card(
elevation: 0,
color: scheme.surfaceContainerLow,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(
color: scheme.outlineVariant.withValues(alpha: 0.3),
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.28)
: scheme.primary.withValues(alpha: 0.06),
blurRadius: 14,
offset: const Offset(0, 4),
spreadRadius: -2,
),
],
),
clipBehavior: Clip.antiAlias,
child: ClipRRect(
borderRadius: BorderRadius.circular(22),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
child: Padding(
borderRadius: BorderRadius.circular(22),
onTap: () {
HapticFeedback.selectionClick();
onTap();
},
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
scheme.surfaceContainerHigh
.withValues(alpha: 0.58),
scheme.surfaceContainerLow
.withValues(alpha: 0.36),
]
: [
Colors.white.withValues(alpha: 0.88),
Colors.white.withValues(alpha: 0.72),
],
),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.13)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
),
child: Row(
children: [
// Artist Avatar
// Artist Squircle Avatar
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
scheme.primaryContainer,
scheme.tertiaryContainer,
scheme.primary,
scheme.tertiary,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(14),
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: scheme.primary.withValues(alpha: 0.35),
blurRadius: 8,
offset: const Offset(0, 2.5),
),
],
),
child: Center(
child: Text(
artistName.isNotEmpty ? artistName[0].toUpperCase() : '?',
style: TextStyle(
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: scheme.onPrimaryContainer,
color: Colors.white,
),
),
),
@@ -934,25 +1177,26 @@ class _ArtistCard extends StatelessWidget {
artistName,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
letterSpacing: -0.2,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 2),
const SizedBox(height: 3),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 2,
),
decoration: BoxDecoration(
color: scheme.secondaryContainer.withValues(alpha: 0.5),
color: scheme.primary.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(8),
),
child: Text(
'$postsCount ${isRu ? 'работ' : 'posts'}',
style: Theme.of(context).textTheme.labelSmall?.copyWith(
color: scheme.onSecondaryContainer,
fontWeight: FontWeight.w600,
color: scheme.primary,
fontWeight: FontWeight.w700,
),
),
),
@@ -966,12 +1210,20 @@ class _ArtistCard extends StatelessWidget {
children: [
for (final url in previewUrls)
Padding(
padding: const EdgeInsets.only(left: 4),
padding: const EdgeInsets.only(left: 5),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: SizedBox(
borderRadius: BorderRadius.circular(10),
child: Container(
width: 44,
height: 44,
decoration: BoxDecoration(
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.10)
: scheme.outlineVariant.withValues(alpha: 0.25),
),
borderRadius: BorderRadius.circular(10),
),
child: CachedNetworkImage(
imageUrl: url,
fit: BoxFit.cover,
@@ -992,15 +1244,19 @@ class _ArtistCard extends StatelessWidget {
],
),
],
const SizedBox(width: 6),
const SizedBox(width: 4),
Icon(
Icons.chevron_right_rounded,
color: scheme.onSurfaceVariant.withValues(alpha: 0.6),
size: 20,
color: scheme.onSurfaceVariant.withValues(alpha: 0.5),
),
],
),
),
),
),
),
),
);
}
}
@@ -374,7 +374,11 @@ class _FeedScreenState extends ConsumerState<FeedScreen>
void _submitSearch(String query) {
final trimmed = query.trim();
if (trimmed.isEmpty) {
_clearFilters();
if (widget.initialQuery != null) {
context.go('/');
} else {
_applySearchQuery('');
}
return;
}
final location = '/?q=${Uri.encodeQueryComponent(trimmed)}';
@@ -104,7 +104,7 @@ class _FeedToolbarState extends State<FeedToolbar> {
},
onCleared: () {
_query = '';
widget.onClearFilters();
widget.onSearch('');
},
),
),
@@ -235,7 +235,7 @@ class _FeedToolbarState extends State<FeedToolbar> {
},
onCleared: () {
_query = '';
widget.onClearFilters();
widget.onSearch('');
},
),
),
@@ -21,6 +21,7 @@ import '../../../shared/widgets/rating_badge.dart';
import '../../collections/presentation/collection_form_dialog.dart';
import '../../favorites/presentation/favorites_controller.dart';
import '../../feed/presentation/feed_controller.dart';
import '../../settings/presentation/settings_controller.dart';
import '../../viewed/presentation/viewed_controller.dart';
import 'post_details_controller.dart';
import 'widgets/cloud_mirrors_card.dart';
@@ -109,6 +110,16 @@ class PostDetailsScreen extends ConsumerWidget {
t.status == DownloadTaskStatus.queued),
) ??
false;
final isTextOnly = post.fileType == 'text' ||
(post.previewUrl.isEmpty &&
post.sampleUrl.isEmpty &&
post.fileUrl.isEmpty &&
!MediaUrlSelector.isVideo(post));
final shouldShowCloudCard = isTextOnly
? post.cloudLinks.isNotEmpty
: (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty));
if (Responsive.isMobile(context)) {
if (currentIndex >= 0 && feedPosts.length > 1) {
@@ -219,7 +230,48 @@ class PostDetailsScreen extends ConsumerWidget {
),
Expanded(
child: Center(
child: SizedBox(
child: MediaUrlSelector.isVideo(post)
? ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 760,
),
child: AspectRatio(
aspectRatio:
(post.width > 0 && post.height > 0)
? (post.width / post.height)
.clamp(0.45, 2.4)
: (16 / 9),
child: PostMediaViewer(
key: ValueKey(post.cacheKey),
post: post,
localFilePath: localMedia?.savedPath,
qualityMode: qualityMode,
mediaHeaders: ref
.watch(postMediaHeadersProvider(post))
.value ??
const {},
initialPosition: Duration(
milliseconds: settings.videoPlaybackPositions[
post.cacheKey] ??
0,
),
initialLoop: settings.videoPlayerLoop,
initialMuted: settings.videoPlayerMuted,
initialCoverVideo: settings.videoPlayerCover,
initialHalfVolume:
settings.videoPlayerHalfVolume,
initialVolume: settings.videoPlayerVolume,
onVolumeChanged: (vol) => ref
.read(settingsControllerProvider.notifier)
.setVideoPlayerVolume(vol),
onPlaybackSnapshot: (snapshot) =>
_saveVideoSnapshot(ref, post, snapshot),
onPlaybackPreferencesChanged: (snapshot) =>
_saveVideoPreferences(ref, snapshot),
),
),
)
: SizedBox(
width: double.infinity,
height: 760,
child: PostMediaViewer(
@@ -241,6 +293,10 @@ class PostDetailsScreen extends ConsumerWidget {
initialCoverVideo: settings.videoPlayerCover,
initialHalfVolume:
settings.videoPlayerHalfVolume,
initialVolume: settings.videoPlayerVolume,
onVolumeChanged: (vol) => ref
.read(settingsControllerProvider.notifier)
.setVideoPlayerVolume(vol),
onPlaybackSnapshot: (snapshot) =>
_saveVideoSnapshot(ref, post, snapshot),
onPlaybackPreferencesChanged: (snapshot) =>
@@ -295,14 +351,12 @@ class PostDetailsScreen extends ConsumerWidget {
localMedia: localMedia,
fileSizeBytes: fileSizeBytes,
),
if (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty)) ...[
if (shouldShowCloudCard) ...[
const SizedBox(height: 16),
CloudMirrorsCard(
links: post.cloudLinks,
strings: strings,
commentary: post.commentary,
commentary: isTextOnly ? null : post.commentary,
onPlayStream: (streamUrl) => launchUrl(
Uri.parse(streamUrl),
mode: LaunchMode.externalApplication,
@@ -316,14 +370,15 @@ class PostDetailsScreen extends ConsumerWidget {
const SizedBox(height: 16),
Container(
decoration: BoxDecoration(
color:
Theme.of(context).colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.surfaceContainerHigh.withValues(alpha: 0.70)
: Theme.of(context).colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Theme.of(context)
.colorScheme
.outlineVariant
.withValues(alpha: 0.35),
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.12)
: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.40),
width: 1.1,
),
),
padding: const EdgeInsets.all(16),
@@ -354,6 +409,7 @@ class PostDetailsScreen extends ConsumerWidget {
),
const SizedBox(height: 16),
_CommentsSection(post: post),
const SizedBox(height: 80),
],
),
),
@@ -390,6 +446,16 @@ class PostDetailsScreen extends ConsumerWidget {
t.status == DownloadTaskStatus.queued),
) ??
false;
final isTextOnly = post.fileType == 'text' ||
(post.previewUrl.isEmpty &&
post.sampleUrl.isEmpty &&
post.fileUrl.isEmpty &&
!MediaUrlSelector.isVideo(post));
final shouldShowCloudCard = isTextOnly
? post.cloudLinks.isNotEmpty
: (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty));
return GestureDetector(
behavior: HitTestBehavior.translucent,
@@ -398,7 +464,12 @@ class PostDetailsScreen extends ConsumerWidget {
if ((details.primaryVelocity ?? 0) > 900) _close(context);
},
child: ListView(
padding: const EdgeInsets.fromLTRB(8, 8, 8, 16),
padding: EdgeInsets.fromLTRB(
8,
8,
8,
120 + MediaQuery.paddingOf(context).bottom,
),
children: [
GestureDetector(
behavior: HitTestBehavior.deferToChild,
@@ -408,7 +479,49 @@ class PostDetailsScreen extends ConsumerWidget {
? null
: () =>
_showMobileQuickActions(context, ref, post, favoriteKeys),
child: SizedBox(
child: isVideo
? Center(
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.70,
),
child: AspectRatio(
aspectRatio: (post.width > 0 && post.height > 0)
? (post.width / post.height).clamp(0.45, 2.4)
: (16 / 9),
child: PostMediaViewer(
key: ValueKey(post.cacheKey),
post: post,
localFilePath: localMedia?.savedPath,
qualityMode: qualityMode,
mediaHeaders:
ref.watch(postMediaHeadersProvider(post)).value ??
const {},
initialPosition: Duration(
milliseconds:
settings.videoPlaybackPositions[post.cacheKey] ??
0,
),
initialLoop: settings.videoPlayerLoop,
initialMuted: settings.videoPlayerMuted,
initialCoverVideo: settings.videoPlayerCover,
initialHalfVolume: settings.videoPlayerHalfVolume,
initialVolume: settings.videoPlayerVolume,
onVolumeChanged: (vol) => ref
.read(settingsControllerProvider.notifier)
.setVideoPlayerVolume(vol),
onPlaybackSnapshot: (snapshot) =>
_saveVideoSnapshot(ref, post, snapshot),
onPlaybackPreferencesChanged: (snapshot) =>
_saveVideoPreferences(ref, snapshot),
onMediaGestureLockChanged: (locked) {
onMediaGestureLockChanged?.call(locked);
},
),
),
),
)
: SizedBox(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.62,
child: PostMediaViewer(
@@ -417,7 +530,8 @@ class PostDetailsScreen extends ConsumerWidget {
localFilePath: localMedia?.savedPath,
qualityMode: qualityMode,
mediaHeaders:
ref.watch(postMediaHeadersProvider(post)).value ?? const {},
ref.watch(postMediaHeadersProvider(post)).value ??
const {},
initialPosition: Duration(
milliseconds:
settings.videoPlaybackPositions[post.cacheKey] ?? 0,
@@ -426,6 +540,10 @@ class PostDetailsScreen extends ConsumerWidget {
initialMuted: settings.videoPlayerMuted,
initialCoverVideo: settings.videoPlayerCover,
initialHalfVolume: settings.videoPlayerHalfVolume,
initialVolume: settings.videoPlayerVolume,
onVolumeChanged: (vol) => ref
.read(settingsControllerProvider.notifier)
.setVideoPlayerVolume(vol),
onPlaybackSnapshot: (snapshot) =>
_saveVideoSnapshot(ref, post, snapshot),
onPlaybackPreferencesChanged: (snapshot) =>
@@ -462,14 +580,12 @@ class PostDetailsScreen extends ConsumerWidget {
localMedia: localMedia,
fileSizeBytes: fileSizeBytes,
),
if (post.cloudLinks.isNotEmpty ||
(post.commentary != null &&
post.commentary!.trim().isNotEmpty)) ...[
if (shouldShowCloudCard) ...[
const SizedBox(height: 12),
CloudMirrorsCard(
links: post.cloudLinks,
strings: strings,
commentary: post.commentary,
commentary: isTextOnly ? null : post.commentary,
onPlayStream: (streamUrl) => launchUrl(
Uri.parse(streamUrl),
mode: LaunchMode.externalApplication,
@@ -493,13 +609,15 @@ class PostDetailsScreen extends ConsumerWidget {
const SizedBox(height: 12),
Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(18),
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.surfaceContainerHigh.withValues(alpha: 0.70)
: Theme.of(context).colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Theme.of(context)
.colorScheme
.outlineVariant
.withValues(alpha: 0.35),
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.12)
: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.40),
width: 1.1,
),
),
clipBehavior: Clip.antiAlias,
@@ -530,6 +648,7 @@ class PostDetailsScreen extends ConsumerWidget {
),
const SizedBox(height: 12),
_CommentsSection(post: post),
const SizedBox(height: 24),
],
),
);
@@ -776,7 +895,8 @@ class PostDetailsScreen extends ConsumerWidget {
if (settings.videoPlayerMuted == snapshot.muted &&
settings.videoPlayerHalfVolume == snapshot.halfVolume &&
settings.videoPlayerLoop == snapshot.loopVideo &&
settings.videoPlayerCover == snapshot.coverVideo) {
settings.videoPlayerCover == snapshot.coverVideo &&
(settings.videoPlayerVolume - snapshot.volume).abs() < 0.01) {
return;
}
await ref.read(settingsServiceProvider).updateSettings(
@@ -785,6 +905,7 @@ class PostDetailsScreen extends ConsumerWidget {
videoPlayerHalfVolume: snapshot.halfVolume,
videoPlayerLoop: snapshot.loopVideo,
videoPlayerCover: snapshot.coverVideo,
videoPlayerVolume: snapshot.volume,
),
);
ref.invalidate(appSettingsProvider);
@@ -1081,7 +1202,7 @@ class _CommentsSectionState extends ConsumerState<_CommentsSection> {
),
clipBehavior: Clip.antiAlias,
child: ExpansionTile(
tilePadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2),
tilePadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
childrenPadding: const EdgeInsets.fromLTRB(14, 0, 14, 14),
initiallyExpanded: false,
shape: const Border(),
@@ -7,7 +7,7 @@ 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 StatefulWidget {
const CloudMirrorsCard({
super.key,
required this.links,
@@ -25,9 +25,21 @@ class CloudMirrorsCard extends StatelessWidget {
final ValueChanged<String>? onDownloadStream;
final bool initiallyExpanded;
@override
State<CloudMirrorsCard> createState() => _CloudMirrorsCardState();
}
class _CloudMirrorsCardState extends State<CloudMirrorsCard> {
int _selectedTab = 0; // 0: mirrors, 1: commentary
@override
Widget build(BuildContext context) {
if (links.isEmpty && (commentary == null || commentary!.trim().isEmpty)) {
final links = widget.links;
final commentary = widget.commentary;
final hasLinks = links.isNotEmpty;
final hasCommentary = commentary != null && commentary.trim().isNotEmpty;
if (!hasLinks && !hasCommentary) {
return const SizedBox.shrink();
}
@@ -37,6 +49,14 @@ class CloudMirrorsCard extends StatelessWidget {
.whereType<String>()
.firstWhere((p) => p.isNotEmpty, orElse: () => '');
final cardTitle = hasLinks
? (widget.strings.ru
? 'Облачные диски и зеркала (${links.length})'
: 'Cloud Mirrors & Drives (${links.length})')
: (widget.strings.ru ? 'Описание от автора' : 'Artist Commentary');
final cardIcon = hasLinks ? Icons.cloud_sync_rounded : Icons.notes_rounded;
return Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow,
@@ -49,20 +69,18 @@ class CloudMirrorsCard extends StatelessWidget {
child: ExpansionTile(
tilePadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2),
childrenPadding: const EdgeInsets.fromLTRB(14, 0, 14, 14),
initiallyExpanded: initiallyExpanded,
initiallyExpanded: widget.initiallyExpanded,
shape: const Border(),
collapsedShape: const Border(),
leading: Icon(
Icons.cloud_sync_rounded,
cardIcon,
color: theme.colorScheme.primary,
),
title: Row(
children: [
Expanded(
child: Text(
strings.ru
? 'Облачные диски и зеркала (${links.length})'
: 'Cloud Mirrors & Drives (${links.length})',
cardTitle,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold,
),
@@ -77,7 +95,8 @@ class CloudMirrorsCard extends StatelessWidget {
decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.green.withValues(alpha: 0.4)),
border:
Border.all(color: Colors.green.withValues(alpha: 0.4)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -86,7 +105,7 @@ class CloudMirrorsCard extends StatelessWidget {
size: 13, color: Colors.green),
const SizedBox(width: 4),
Text(
strings.ru ? 'Плеер' : 'Stream',
widget.strings.ru ? 'Плеер' : 'Stream',
style: theme.textTheme.labelSmall?.copyWith(
color: Colors.green,
fontWeight: FontWeight.bold,
@@ -116,7 +135,9 @@ class CloudMirrorsCard extends StatelessWidget {
Expanded(
child: Text.rich(
TextSpan(
text: strings.ru ? 'Пароль к архиву: ' : 'Archive Password: ',
text: widget.strings.ru
? 'Пароль к архиву: '
: 'Archive Password: ',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurface,
),
@@ -135,13 +156,15 @@ class CloudMirrorsCard extends StatelessWidget {
IconButton(
icon: const Icon(Icons.copy_rounded, size: 16),
visualDensity: VisualDensity.compact,
tooltip: strings.ru ? 'Копировать пароль' : 'Copy Password',
tooltip: widget.strings.ru
? 'Копировать пароль'
: 'Copy Password',
onPressed: () {
Clipboard.setData(ClipboardData(text: detectedPassword));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
strings.ru
widget.strings.ru
? 'Пароль скопирован: $detectedPassword'
: 'Password copied: $detectedPassword',
),
@@ -157,19 +180,75 @@ class CloudMirrorsCard extends StatelessWidget {
const SizedBox(height: 10),
],
// Links list
if (links.isNotEmpty) ...[
...links.map((link) => _buildLinkTile(context, link, strings)),
],
// Commentary / Description
if (commentary != null && commentary!.trim().isNotEmpty) ...[
const SizedBox(height: 10),
Divider(
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.4),
height: 1,
if (hasLinks && hasCommentary) ...[
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: SizedBox(
width: double.infinity,
child: SegmentedButton<int>(
segments: [
ButtonSegment(
value: 0,
icon: const Icon(Icons.cloud_queue_rounded, size: 16),
label: Text(
widget.strings.ru
? 'Зеркала (${links.length})'
: 'Mirrors (${links.length})',
),
const SizedBox(height: 10),
),
ButtonSegment(
value: 1,
icon: const Icon(Icons.notes_rounded, size: 16),
label: Text(
widget.strings.ru ? 'Описание' : 'Description',
),
),
],
selected: {_selectedTab},
onSelectionChanged: (set) =>
setState(() => _selectedTab = set.first),
),
),
),
IndexedStack(
index: _selectedTab,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: links
.map((link) => _buildLinkTile(
context,
link,
widget.strings,
))
.toList(),
),
_buildCommentarySection(context, commentary, theme),
],
),
] else if (hasLinks) ...[
...links.map((link) => _buildLinkTile(
context,
link,
widget.strings,
)),
] else if (hasCommentary) ...[
_buildCommentarySection(context, commentary, theme),
],
],
),
);
}
Widget _buildCommentarySection(
BuildContext context,
String text,
ThemeData theme,
) {
final creatorLinks = CreatorLink.extractLinks(text);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
@@ -179,7 +258,7 @@ class CloudMirrorsCard extends StatelessWidget {
),
const SizedBox(width: 6),
Text(
strings.ru ? 'Описание от автора' : 'Artist Commentary',
widget.strings.ru ? 'Описание от автора' : 'Artist Commentary',
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.bold,
color: theme.colorScheme.primary,
@@ -189,28 +268,20 @@ class CloudMirrorsCard extends StatelessWidget {
),
const SizedBox(height: 8),
FormattedContentText(
text: commentary!.trim(),
text: text.trim(),
style: theme.textTheme.bodySmall?.copyWith(
height: 1.45,
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(
if (creatorLinks.isNotEmpty) ...[
const SizedBox(height: 10),
CreatorLinkChips(
links: creatorLinks,
title: strings.ru ? 'Ссылки автора' : 'Author Links',
),
);
},
title: widget.strings.ru ? 'Ссылки автора' : 'Author Links',
),
],
],
),
);
}
@@ -303,7 +374,7 @@ class CloudMirrorsCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Play button (if streamable)
if (link.isStreamable && onPlayStream != null) ...[
if (link.isStreamable && widget.onPlayStream != null) ...[
FilledButton.tonalIcon(
style: FilledButton.styleFrom(
visualDensity: VisualDensity.compact,
@@ -313,7 +384,7 @@ class CloudMirrorsCard extends StatelessWidget {
label: Text(strings.ru ? 'Смотреть' : 'Play'),
onPressed: () {
final target = link.directStreamUrl ?? link.url;
onPlayStream!(target);
widget.onPlayStream!(target);
},
),
const SizedBox(width: 8),
@@ -321,12 +392,13 @@ class CloudMirrorsCard extends StatelessWidget {
// Download button (if direct streamable and callback exists)
if (link.isStreamable &&
link.directStreamUrl != null &&
onDownloadStream != null) ...[
widget.onDownloadStream != null) ...[
IconButton.filledTonal(
visualDensity: VisualDensity.compact,
tooltip: strings.download,
icon: const Icon(Icons.download_rounded, size: 16),
onPressed: () => onDownloadStream!(link.directStreamUrl!),
onPressed: () =>
widget.onDownloadStream!(link.directStreamUrl!),
),
const SizedBox(width: 8),
],
File diff suppressed because it is too large Load Diff
@@ -298,7 +298,7 @@ class _TagGroupBlock extends StatelessWidget {
required this.onLongPress,
});
static const _collapsedLimit = 36;
static const _collapsedLimit = 28;
final String label;
final String group;
@@ -320,14 +320,52 @@ class _TagGroupBlock extends StatelessWidget {
children: [
Row(
children: [
Text(label, style: Theme.of(context).textTheme.labelLarge),
const SizedBox(width: 8),
Container(
width: 8,
height: 8,
margin: const EdgeInsets.only(right: 8),
decoration: BoxDecoration(
color: _headerDotColor(group, Theme.of(context)),
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: _headerDotColor(group, Theme.of(context))
.withValues(alpha: 0.55),
blurRadius: 5,
spreadRadius: 1,
),
],
),
),
Text(
label,
style: Theme.of(context).textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.1,
),
),
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 1.5),
decoration: BoxDecoration(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.08)
: Colors.black.withValues(alpha: 0.05),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.12)
: Colors.black.withValues(alpha: 0.08),
),
),
child: Text(
'${tags.length}',
style: Theme.of(context).textTheme.labelMedium?.copyWith(
style: Theme.of(context).textTheme.labelSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
],
),
const SizedBox(height: 7),
@@ -338,6 +376,7 @@ class _TagGroupBlock extends StatelessWidget {
for (final tag in visibleTags)
TagChip(
tag: tag,
group: group,
onTap: () => onTap(tag),
onLongPress: () => onLongPress(tag),
),
@@ -360,4 +399,17 @@ class _TagGroupBlock extends StatelessWidget {
),
);
}
static Color _headerDotColor(String group, ThemeData theme) {
return switch (group.toLowerCase()) {
'artist' => const Color(0xFFFF4757),
'character' => const Color(0xFF2ED573),
'copyright' => const Color(0xFFA55EEA),
'species' => const Color(0xFFFFA502),
'meta' => const Color(0xFF1E90FF),
_ => theme.colorScheme.primary,
};
}
}
@@ -1,57 +1,335 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../backend/backend.dart';
import '../../../core/utils/result.dart';
import '../../../shared/widgets/adaptive_scaffold.dart';
import '../../../shared/widgets/error_view.dart';
import 'providers_controller.dart';
import 'widgets/provider_health_tile.dart';
class ProviderCheckScreen extends ConsumerWidget {
class ProviderCheckScreen extends ConsumerStatefulWidget {
const ProviderCheckScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
ConsumerState<ProviderCheckScreen> createState() =>
_ProviderCheckScreenState();
}
class _ProviderCheckScreenState extends ConsumerState<ProviderCheckScreen> {
bool _isCheckingAll = false;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final isRu = Localizations.maybeLocaleOf(context)?.languageCode == 'ru';
final providers = ref.watch(providersControllerProvider);
final health = ref.watch(providerHealthProvider);
final diagnostics = ref.watch(providerDiagnosticsProvider).value ?? {};
return AdaptiveScaffold(
title: 'Provider Check',
final bottomInset = MediaQuery.paddingOf(context).bottom;
return Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
child: AppBar(
backgroundColor: isDark
? theme.colorScheme.surface.withValues(alpha: 0.75)
: Colors.white.withValues(alpha: 0.85),
surfaceTintColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new_rounded, size: 20),
onPressed: () {
if (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
} else {
context.go('/providers');
}
},
tooltip: isRu ? 'Назад' : 'Back',
),
title: Text(
isRu ? 'Проверка источников' : 'Provider Check',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
),
actions: [
IconButton(
tooltip: 'Check all',
onPressed: () => _checkAll(ref),
icon: const Icon(Icons.playlist_add_check_rounded),
Padding(
padding: const EdgeInsets.only(right: 12),
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(14),
onTap: _isCheckingAll ? null : () => _checkAll(ref),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 6),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF6366F1), Color(0xFF8B5CF6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(14),
boxShadow: [
BoxShadow(
color: const Color(0xFF6366F1)
.withValues(alpha: 0.35),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (_isCheckingAll)
const SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
)
else
const Icon(
Icons.playlist_add_check_rounded,
size: 16,
color: Colors.white,
),
const SizedBox(width: 5),
Text(
isRu ? 'Проверить все' : 'Check All',
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
],
),
),
),
),
),
],
),
),
),
),
body: providers.when(
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, _) => ErrorView(message: error.toString()),
data: (items) => ListView.builder(
data: (items) {
int onlineCount = 0;
int offlineCount = 0;
int pingSum = 0;
int pingCount = 0;
for (final item in items) {
final h = health[item.id];
if (h != null) {
if (h.status == ProviderStatus.online) {
onlineCount++;
pingSum += h.pingMs;
pingCount++;
} else if (h.status == ProviderStatus.offline) {
offlineCount++;
}
}
}
final avgPing =
pingCount > 0 ? (pingSum / pingCount).round() : null;
return Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 860),
child: ListView(
padding: EdgeInsets.fromLTRB(
16,
MediaQuery.paddingOf(context).top + 68,
16,
140 + bottomInset,
),
children: [
// Status Overview Card
Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(16),
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.65),
theme.colorScheme.surfaceContainerLow
.withValues(alpha: 0.40),
]
: [
Colors.white.withValues(alpha: 0.90),
Colors.white.withValues(alpha: 0.75),
],
),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.14)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.25)
: const Color(0xFF6366F1).withValues(alpha: 0.08),
blurRadius: 16,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
alignment: WrapAlignment.spaceBetween,
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 8,
runSpacing: 6,
children: [
Text(
isRu ? 'Состояние сети' : 'Network Health',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
),
if (avgPing != null)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: const Color(0xFF10B981).withValues(
alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: const Color(0xFF10B981).withValues(
alpha: isDark ? 0.38 : 0.25),
),
),
child: Text(
'${isRu ? 'Средний пинг' : 'Avg ping'}: $avgPing ms',
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
color: Color(0xFF10B981),
fontFamily: 'monospace',
),
),
),
],
),
const SizedBox(height: 12),
Row(
children: [
Expanded(
child: _MetricPill(
label: isRu ? 'Всего' : 'Total',
value: '${items.length}',
color: theme.colorScheme.primary,
isDark: isDark,
),
),
const SizedBox(width: 8),
Expanded(
child: _MetricPill(
label: isRu ? 'Онлайн' : 'Online',
value: '$onlineCount',
color: const Color(0xFF10B981),
isDark: isDark,
),
),
const SizedBox(width: 8),
Expanded(
child: _MetricPill(
label: isRu ? 'Офлайн' : 'Offline',
value: '$offlineCount',
color: const Color(0xFFEF4444),
isDark: isDark,
),
),
],
),
],
),
),
// Health Tiles List
if (items.isEmpty)
Container(
padding: const EdgeInsets.all(32),
decoration: BoxDecoration(
color: isDark
? theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.40)
: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(24),
),
child: Center(
child: Text(
isRu ? 'Нет источников для проверки' : 'No providers to check',
style: theme.textTheme.bodyMedium,
),
),
)
else
...items.map((item) {
return ProviderHealthTile(
key: ValueKey(item.id),
config: item,
health: health[item.id],
diagnostics: diagnostics[item.id],
onCheck: () => _checkOne(ref, item.id),
);
},
}),
],
),
),
);
},
),
);
}
Future<void> _checkAll(WidgetRef ref) async {
final result = await ref.read(providerCheckServiceProvider).checkAll();
setState(() => _isCheckingAll = true);
HapticFeedback.mediumImpact();
try {
final result =
await ref.read(providerCheckServiceProvider).checkAll();
if (result is Success<List<ProviderHealth>>) {
ref.read(providerHealthProvider.notifier).state = {
for (final item in result.data) item.providerId: item,
};
}
} finally {
if (mounted) setState(() => _isCheckingAll = false);
}
}
Future<void> _checkOne(WidgetRef ref, String providerId) async {
@@ -65,3 +343,53 @@ class ProviderCheckScreen extends ConsumerWidget {
}
}
}
class _MetricPill extends StatelessWidget {
const _MetricPill({
required this.label,
required this.value,
required this.color,
required this.isDark,
});
final String label;
final String value;
final Color color;
final bool isDark;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
decoration: BoxDecoration(
color: color.withValues(alpha: isDark ? 0.12 : 0.08),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: color.withValues(alpha: isDark ? 0.30 : 0.20),
width: 1,
),
),
child: Column(
children: [
Text(
value,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w800,
color: color,
),
),
const SizedBox(height: 1),
Text(
label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: color.withValues(alpha: 0.85),
),
),
],
),
);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,9 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../shared/widgets/adaptive_scaffold.dart';
import '../../../shared/widgets/confirm_dialog.dart';
import '../../../shared/widgets/error_view.dart';
import 'providers_controller.dart';
@@ -13,40 +14,357 @@ class ProvidersScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final isRu = Localizations.maybeLocaleOf(context)?.languageCode == 'ru';
final providers = ref.watch(providersControllerProvider);
return AdaptiveScaffold(
title: 'Providers',
actions: [
IconButton(
tooltip: 'Check providers',
onPressed: () => context.go('/providers/check'),
icon: const Icon(Icons.network_check_rounded),
final bottomInset = MediaQuery.paddingOf(context).bottom;
return Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60),
child: ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
child: AppBar(
backgroundColor: isDark
? theme.colorScheme.surface.withValues(alpha: 0.72)
: Colors.white.withValues(alpha: 0.82),
surfaceTintColor: Colors.transparent,
elevation: 0,
centerTitle: false,
leading: Navigator.of(context).canPop()
? IconButton(
icon: const Icon(Icons.arrow_back_ios_new_rounded, size: 20),
onPressed: () => context.pop(),
tooltip: isRu ? 'Назад' : 'Back',
)
: null,
title: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 30,
height: 30,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF6366F1), Color(0xFF8B5CF6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
IconButton(
tooltip: 'Add provider',
onPressed: () => context.go('/providers/new'),
icon: const Icon(Icons.add_rounded),
borderRadius: BorderRadius.circular(9),
boxShadow: [
BoxShadow(
color:
const Color(0xFF6366F1).withValues(alpha: 0.35),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: const Center(
child:
Icon(Icons.hub_rounded, size: 16, color: Colors.white),
),
),
const SizedBox(width: 8),
Flexible(
child: Text(
isRu ? 'Провайдеры' : 'Providers',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
actions: [
// Provider Check Glass Button
Padding(
padding: const EdgeInsets.only(right: 6),
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(14),
onTap: () {
HapticFeedback.lightImpact();
context.push('/providers/check');
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: theme.colorScheme.primary
.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: theme.colorScheme.primary
.withValues(alpha: isDark ? 0.35 : 0.22),
width: 1,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.network_check_rounded,
size: 16,
color: theme.colorScheme.primary,
),
const SizedBox(width: 5),
Text(
isRu ? 'Проверка' : 'Check',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: theme.colorScheme.primary,
),
),
],
),
),
),
),
),
// Add Provider Accent Button
Padding(
padding: const EdgeInsets.only(right: 12),
child: Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(14),
onTap: () {
HapticFeedback.lightImpact();
context.push('/providers/new');
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 6),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF6366F1), Color(0xFF8B5CF6)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(14),
boxShadow: [
BoxShadow(
color: const Color(0xFF6366F1)
.withValues(alpha: 0.35),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.add_rounded,
size: 16,
color: Colors.white,
),
const SizedBox(width: 4),
Text(
isRu ? 'Создать' : 'Add',
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
],
),
),
),
),
),
],
),
),
),
),
body: providers.when(
loading: () => const Center(child: CircularProgressIndicator()),
error: (error, _) => ErrorView(message: error.toString()),
data: (items) => ListView.builder(
data: (items) {
final activeCount = items.where((p) => p.enabled).length;
return Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 860),
child: ListView(
padding: EdgeInsets.fromLTRB(
16,
MediaQuery.paddingOf(context).top + 68,
16,
140 + bottomInset,
),
children: [
// Overview Glass Card
Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(16),
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.65),
theme.colorScheme.surfaceContainerLow
.withValues(alpha: 0.40),
]
: [
Colors.white.withValues(alpha: 0.90),
Colors.white.withValues(alpha: 0.75),
],
),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.14)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.25)
: const Color(0xFF6366F1).withValues(alpha: 0.08),
blurRadius: 16,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
isRu
? 'Управление источниками'
: 'Provider Management',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
),
const SizedBox(height: 4),
Text(
isRu
? 'Настройте подключение, API ключи и приоритеты booru-сервисов'
: 'Configure connections, API keys and search priorities',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
),
],
),
),
const SizedBox(width: 12),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: const Color(0xFF10B981)
.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: const Color(0xFF10B981)
.withValues(alpha: isDark ? 0.40 : 0.28),
),
),
child: Text(
'$activeCount / ${items.length} ${isRu ? 'вкл' : 'on'}',
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w700,
color: Color(0xFF10B981),
),
),
),
],
),
),
// Empty State
if (items.isEmpty)
Container(
padding: const EdgeInsets.all(32),
decoration: BoxDecoration(
color: isDark
? theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.40)
: Colors.white.withValues(alpha: 0.80),
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.10)
: Colors.white,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.cloud_off_rounded,
size: 48,
color: theme.colorScheme.onSurfaceVariant
.withValues(alpha: 0.5),
),
const SizedBox(height: 12),
Text(
isRu
? 'Нет настроенных источников'
: 'No providers configured',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 6),
Text(
isRu
? 'Нажмите «Создать», чтобы добавить новый booru-провайдер'
: 'Tap "Add" to set up a new booru provider',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
textAlign: TextAlign.center,
),
],
),
)
else
// List of Provider Cards
...items.map((item) {
return ProviderCard(
key: ValueKey(item.id),
config: item,
onToggle: (enabled) => ref
.read(providersControllerProvider.notifier)
.toggle(item.id, enabled),
onEdit: () => context.go('/providers/new', extra: item),
onEdit: () => context.push(
'/providers/new',
extra: item,
),
onDelete: () async {
final ok = await showConfirmDialog(
context,
title: 'Delete provider',
message: 'Remove ${item.name}?',
title: isRu ? 'Удалить источник' : 'Delete provider',
message: isRu
? 'Вы действительно хотите удалить ${item.name}?'
: 'Remove ${item.name}?',
);
if (ok) {
await ref
@@ -55,9 +373,13 @@ class ProvidersScreen extends ConsumerWidget {
}
},
);
},
}),
],
),
),
);
},
),
);
}
}
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../../backend/backend.dart';
@@ -18,28 +19,397 @@ class ProviderCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
child: ListTile(
leading: Switch(value: config.enabled, onChanged: onToggle),
title: Text(config.name),
subtitle: Text(
'${config.apiType} · ${config.baseUrl}\nPriority ${config.priority}'),
isThreeLine: true,
trailing: Wrap(
spacing: 4,
children: [
IconButton(
tooltip: 'Edit',
onPressed: onEdit,
icon: const Icon(Icons.edit_rounded),
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final isRu = Localizations.maybeLocaleOf(context)?.languageCode == 'ru';
final (engineColor, engineIcon, engineTitle) = _engineInfo(config.apiType);
return Container(
margin: const EdgeInsets.only(bottom: 14),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.30)
: engineColor.withValues(alpha: 0.08),
blurRadius: 18,
offset: const Offset(0, 6),
spreadRadius: -2,
),
IconButton(
tooltip: 'Delete',
onPressed: onDelete,
icon: const Icon(Icons.delete_rounded),
BoxShadow(
color: engineColor.withValues(alpha: isDark ? 0.05 : 0.03),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
theme.colorScheme.surfaceContainerHigh
.withValues(alpha: config.enabled ? 0.65 : 0.35),
theme.colorScheme.surfaceContainerLow
.withValues(alpha: config.enabled ? 0.45 : 0.20),
]
: [
Colors.white
.withValues(alpha: config.enabled ? 0.90 : 0.60),
Colors.white
.withValues(alpha: config.enabled ? 0.75 : 0.45),
],
),
border: Border.all(
color: isDark
? (config.enabled
? engineColor.withValues(alpha: 0.28)
: Colors.white.withValues(alpha: 0.08))
: (config.enabled
? Colors.white.withValues(alpha: 0.90)
: Colors.white.withValues(alpha: 0.50)),
width: 1.2,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Row 1: Icon squircle + Name & details + Switch
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Engine Icon Squircle Badge
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: config.enabled
? [
engineColor,
engineColor.withValues(alpha: 0.80),
]
: [
Colors.grey.shade600,
Colors.grey.shade700,
],
),
borderRadius: BorderRadius.circular(14),
boxShadow: [
if (config.enabled)
BoxShadow(
color: engineColor.withValues(alpha: 0.38),
blurRadius: 10,
offset: const Offset(0, 3),
),
],
),
child: Center(
child: Icon(
engineIcon,
size: 22,
color: Colors.white,
),
),
),
const SizedBox(width: 14),
// Name & Sub-details
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Flexible(
child: Text(
config.name,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
color: config.enabled
? theme.colorScheme.onSurface
: theme.colorScheme.onSurface
.withValues(alpha: 0.6),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(height: 5),
Wrap(
spacing: 6,
runSpacing: 4,
children: [
// Engine badge
_GlassPill(
label: engineTitle,
color: engineColor,
isDark: isDark,
),
// Priority badge
_GlassPill(
label: '${isRu ? 'Приоритет' : 'Priority'} ${config.priority}',
color: theme.colorScheme.primary,
isDark: isDark,
),
],
),
],
),
),
// Switch
Transform.scale(
scale: 0.9,
child: Switch.adaptive(
value: config.enabled,
onChanged: (val) {
HapticFeedback.selectionClick();
onToggle(val);
},
activeThumbColor: engineColor,
activeTrackColor: engineColor.withValues(alpha: 0.45),
),
),
],
),
const SizedBox(height: 12),
// Row 2: Base URL glass chip
Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: isDark
? Colors.black.withValues(alpha: 0.20)
: theme.colorScheme.surfaceContainerHighest
.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.06)
: Colors.black.withValues(alpha: 0.05),
),
),
child: Row(
children: [
Icon(
Icons.link_rounded,
size: 14,
color: theme.colorScheme.onSurfaceVariant
.withValues(alpha: 0.8),
),
const SizedBox(width: 6),
Expanded(
child: Text(
config.baseUrl,
style: TextStyle(
fontSize: 12,
fontFamily: 'monospace',
color: theme.colorScheme.onSurfaceVariant,
letterSpacing: -0.1,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
const SizedBox(height: 12),
// Row 3: Action Buttons (Edit & Delete)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Edit Action Button
_GlassActionButton(
icon: Icons.edit_rounded,
label: isRu ? 'Изменить' : 'Edit',
color: theme.colorScheme.primary,
isDark: isDark,
onTap: () {
HapticFeedback.lightImpact();
onEdit();
},
),
const SizedBox(width: 8),
// Delete Action Button
_GlassActionButton(
icon: Icons.delete_outline_rounded,
label: isRu ? 'Удалить' : 'Delete',
color: const Color(0xFFEF4444),
isDark: isDark,
onTap: () {
HapticFeedback.lightImpact();
onDelete();
},
),
],
),
],
),
),
),
);
}
static (Color, IconData, String) _engineInfo(String apiType) {
return switch (apiType.toLowerCase()) {
'gelbooru' => (
const Color(0xFF10B981),
Icons.image_search_rounded,
'Gelbooru',
),
'rule34' => (
const Color(0xFF84CC16),
Icons.photo_library_rounded,
'Rule34',
),
'paheal' => (
const Color(0xFFF97316),
Icons.filter_hdr_rounded,
'Paheal HTML',
),
'realbooru_html' => (
const Color(0xFFEAB308),
Icons.camera_alt_rounded,
'Realbooru HTML',
),
'danbooru' => (
const Color(0xFF3B82F6),
Icons.auto_awesome_rounded,
'Danbooru',
),
'moebooru' => (
const Color(0xFF8B5CF6),
Icons.face_retouching_natural_rounded,
'Moebooru',
),
'e621' => (
const Color(0xFFF59E0B),
Icons.pets_rounded,
'e621 / e926',
),
'kemono' => (
const Color(0xFFEC4899),
Icons.palette_rounded,
'Kemono',
),
'coomer' => (
const Color(0xFF06B6D4),
Icons.collections_rounded,
'Coomer',
),
_ => (
const Color(0xFF6366F1),
Icons.hub_rounded,
apiType.isEmpty ? 'Custom' : apiType,
),
};
}
}
class _GlassPill extends StatelessWidget {
const _GlassPill({
required this.label,
required this.color,
required this.isDark,
});
final String label;
final Color color;
final bool isDark;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: color.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: color.withValues(alpha: isDark ? 0.35 : 0.25),
width: 1,
),
),
child: Text(
label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
color: color,
letterSpacing: -0.2,
),
),
);
}
}
class _GlassActionButton extends StatelessWidget {
const _GlassActionButton({
required this.icon,
required this.label,
required this.color,
required this.isDark,
required this.onTap,
});
final IconData icon;
final String label;
final Color color;
final bool isDark;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(12),
child: InkWell(
borderRadius: BorderRadius.circular(12),
onTap: onTap,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: color.withValues(alpha: isDark ? 0.14 : 0.08),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: color.withValues(alpha: isDark ? 0.32 : 0.22),
width: 1,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 14, color: color),
const SizedBox(width: 5),
Text(
label,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: color,
letterSpacing: -0.1,
),
),
],
),
),
),
);
}
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../../backend/backend.dart';
import '../../../../shared/widgets/provider_status_badge.dart';
class ProviderHealthTile extends StatelessWidget {
class ProviderHealthTile extends StatefulWidget {
const ProviderHealthTile({
required this.config,
required this.health,
@@ -17,59 +18,408 @@ class ProviderHealthTile extends StatelessWidget {
final ProviderDiagnostics? diagnostics;
final VoidCallback onCheck;
@override
State<ProviderHealthTile> createState() => _ProviderHealthTileState();
}
class _ProviderHealthTileState extends State<ProviderHealthTile> {
bool _expanded = false;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final isRu = Localizations.maybeLocaleOf(context)?.languageCode == 'ru';
final config = widget.config;
final health = widget.health;
final diagnostics = widget.diagnostics;
final hint = ProviderQualityHint.from(
config: config,
health: health,
diagnostics: diagnostics,
isRu: isRu,
);
return Card(
child: ExpansionTile(
leading: ProviderStatusBadge(health: health),
title: Text(config.name),
subtitle: Wrap(
spacing: 8,
runSpacing: 6,
final status = health?.status ?? ProviderStatus.unknown;
final statusColor = switch (status) {
ProviderStatus.online => (health != null && health.pingMs > 2500)
? const Color(0xFFF59E0B)
: const Color(0xFF10B981),
ProviderStatus.offline => const Color(0xFFEF4444),
ProviderStatus.unknown => const Color(0xFF94A3B8),
};
final hasError = diagnostics?.lastErrorMessage != null ||
health?.errorMessage != null;
final errorMessage = diagnostics?.lastErrorMessage ?? health?.errorMessage;
return Container(
margin: const EdgeInsets.only(bottom: 14),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.30)
: statusColor.withValues(alpha: 0.08),
blurRadius: 18,
offset: const Offset(0, 6),
spreadRadius: -2,
),
BoxShadow(
color: statusColor.withValues(alpha: isDark ? 0.06 : 0.03),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(22),
child: AnimatedContainer(
duration: const Duration(milliseconds: 250),
curve: Curves.easeOutCubic,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
theme.colorScheme.surfaceContainerHigh
.withValues(alpha: 0.65),
theme.colorScheme.surfaceContainerLow
.withValues(alpha: 0.40),
]
: [
Colors.white.withValues(alpha: 0.92),
Colors.white.withValues(alpha: 0.78),
],
),
border: Border.all(
color: isDark
? statusColor.withValues(alpha: 0.30)
: Colors.white.withValues(alpha: 0.90),
width: 1.2,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Header Tile
InkWell(
onTap: () {
HapticFeedback.selectionClick();
setState(() => _expanded = !_expanded);
},
borderRadius: BorderRadius.circular(22),
child: Padding(
padding: const EdgeInsets.all(16),
child: Row(
children: [
// Status Badge with glowing LED
ProviderStatusBadge(health: health),
const SizedBox(width: 12),
// Name & Badges
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
config.name,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 5),
Wrap(
spacing: 6,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Chip(
avatar: Icon(hint.icon, size: 16),
label: Text(hint.label),
visualDensity: VisualDensity.compact,
backgroundColor: hint.color(context).withValues(alpha: 0.16),
side:
BorderSide(color: hint.color(context).withValues(alpha: 0.4)),
// Ping chip if available
if (health != null)
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7, vertical: 2.5),
decoration: BoxDecoration(
color: statusColor.withValues(
alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: statusColor.withValues(
alpha: isDark ? 0.38 : 0.25),
width: 1,
),
Text('${config.apiType} | priority ${config.priority}'),
],
),
trailing: IconButton(
tooltip: 'Check',
onPressed: onCheck,
icon: const Icon(Icons.network_check_rounded),
),
childrenPadding: const EdgeInsets.fromLTRB(16, 0, 16, 14),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
[
'${config.enabled ? 'Enabled' : 'Disabled'} | ${config.baseUrl}',
if (health != null) 'Ping ${health!.pingMs} ms',
if (health?.apiVersion != null) 'API ${health!.apiVersion}',
if (health?.lastCheckedAt != null)
'Checked ${health!.lastCheckedAt}',
if (diagnostics != null)
'Last search: ${diagnostics!.lastResultCount} posts at ${diagnostics!.lastSearchAt}',
if (diagnostics?.lastErrorMessage != null)
diagnostics!.lastErrorMessage!,
if (health?.errorMessage != null) health!.errorMessage!,
].join('\n'),
Icon(
Icons.bolt_rounded,
size: 12,
color: statusColor,
),
const SizedBox(width: 3),
Text(
'${health.pingMs} ms',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
color: statusColor,
fontFamily: 'monospace',
),
),
],
),
),
// Quality Hint Chip
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7, vertical: 2.5),
decoration: BoxDecoration(
color: hint.color(context).withValues(
alpha: isDark ? 0.14 : 0.08),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: hint.color(context).withValues(
alpha: isDark ? 0.32 : 0.20),
width: 1,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
hint.icon,
size: 12,
color: hint.color(context),
),
const SizedBox(width: 4),
Text(
hint.label,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: hint.color(context),
letterSpacing: -0.1,
),
),
],
),
),
],
),
],
),
),
// Check Button
IconButton(
tooltip: isRu ? 'Проверить' : 'Check',
onPressed: () {
HapticFeedback.lightImpact();
widget.onCheck();
},
icon: Container(
width: 34,
height: 34,
decoration: BoxDecoration(
color: theme.colorScheme.primary
.withValues(alpha: isDark ? 0.18 : 0.10),
shape: BoxShape.circle,
border: Border.all(
color: theme.colorScheme.primary
.withValues(alpha: isDark ? 0.40 : 0.25),
),
),
child: Center(
child: Icon(
Icons.refresh_rounded,
size: 18,
color: theme.colorScheme.primary,
),
),
),
),
// Expand Chevron
Icon(
_expanded
? Icons.keyboard_arrow_up_rounded
: Icons.keyboard_arrow_down_rounded,
size: 20,
color: theme.colorScheme.onSurfaceVariant,
),
],
),
),
),
// Expanded Diagnostics Section
if (_expanded) ...[
Divider(
height: 1,
thickness: 1,
color: isDark
? Colors.white.withValues(alpha: 0.08)
: Colors.black.withValues(alpha: 0.05),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 14, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Diagnostic row 1: URL & Enabled
_DiagItem(
icon: Icons.link_rounded,
label: isRu ? 'Сервер' : 'Endpoint',
value: '${config.baseUrl} (${config.enabled ? (isRu ? 'Активен' : 'Enabled') : (isRu ? 'Выключен' : 'Disabled')})',
isMonospace: true,
),
const SizedBox(height: 8),
// Diagnostic row 2: API Type & Priority
_DiagItem(
icon: Icons.hub_outlined,
label: isRu ? 'Движок и приоритет' : 'Engine & Priority',
value: '${config.apiType} · ${isRu ? 'приоритет' : 'priority'} ${config.priority}',
),
const SizedBox(height: 8),
// Diagnostic row 3: API Version
if (health?.apiVersion != null) ...[
_DiagItem(
icon: Icons.info_outline_rounded,
label: isRu ? 'Версия API' : 'API Version',
value: health!.apiVersion!,
),
const SizedBox(height: 8),
],
// Diagnostic row 4: Last Checked Time
if (health?.lastCheckedAt != null) ...[
_DiagItem(
icon: Icons.schedule_rounded,
label: isRu ? 'Проверено' : 'Last Checked',
value: health!.lastCheckedAt.toString().split('.').first,
isMonospace: true,
),
const SizedBox(height: 8),
],
// Diagnostic row 5: Last Search
if (diagnostics != null) ...[
_DiagItem(
icon: Icons.search_rounded,
label: isRu ? 'Последний поиск' : 'Last Search',
value: isRu
? '${diagnostics.lastResultCount} постов получено в ${diagnostics.lastSearchAt.toString().split('.').first}'
: '${diagnostics.lastResultCount} posts retrieved at ${diagnostics.lastSearchAt.toString().split('.').first}',
),
const SizedBox(height: 8),
],
// Error Box (if any)
if (hasError && errorMessage != null) ...[
const SizedBox(height: 4),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFEF4444)
.withValues(alpha: isDark ? 0.16 : 0.08),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: const Color(0xFFEF4444)
.withValues(alpha: isDark ? 0.38 : 0.25),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(
Icons.error_outline_rounded,
size: 16,
color: Color(0xFFEF4444),
),
const SizedBox(width: 8),
Expanded(
child: Text(
errorMessage,
style: const TextStyle(
fontSize: 12,
fontFamily: 'monospace',
color: Color(0xFFEF4444),
height: 1.35,
),
),
),
],
),
),
],
],
),
),
],
],
),
),
),
);
}
}
class _DiagItem extends StatelessWidget {
const _DiagItem({
required this.icon,
required this.label,
required this.value,
this.isMonospace = false,
});
final IconData icon;
final String label;
final String value;
final bool isMonospace;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
icon,
size: 15,
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.7),
),
const SizedBox(width: 8),
Text(
'$label: ',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: theme.colorScheme.onSurfaceVariant,
),
),
Expanded(
child: Text(
value,
style: TextStyle(
fontSize: 12,
fontFamily: isMonospace ? 'monospace' : null,
color: theme.colorScheme.onSurface,
),
),
),
],
);
}
}
@@ -87,10 +437,11 @@ class ProviderQualityHint {
required ContentProviderConfig config,
required ProviderHealth? health,
required ProviderDiagnostics? diagnostics,
required bool isRu,
}) {
if (!config.enabled) {
return ProviderQualityHint._(
'Disabled',
isRu ? 'Выключен' : 'Disabled',
Icons.pause_circle_outline_rounded,
(scheme) => scheme.outline,
);
@@ -98,34 +449,34 @@ class ProviderQualityHint {
if (diagnostics?.lastErrorMessage != null ||
health?.status == ProviderStatus.offline) {
return ProviderQualityHint._(
'Search failing',
isRu ? 'Ошибка поиска' : 'Search failing',
Icons.error_outline_rounded,
(scheme) => scheme.error,
);
}
if (diagnostics != null && diagnostics.lastResultCount == 0) {
return ProviderQualityHint._(
'No recent results',
isRu ? 'Нет результатов' : 'No recent results',
Icons.search_off_rounded,
(scheme) => scheme.tertiary,
);
}
if (health != null && health.pingMs > 2500) {
return ProviderQualityHint._(
'Slow',
isRu ? 'Медленно' : 'Slow',
Icons.speed_rounded,
(scheme) => scheme.secondary,
);
}
if (health != null || diagnostics != null) {
return ProviderQualityHint._(
'Healthy',
isRu ? 'Стабилен' : 'Healthy',
Icons.check_circle_outline_rounded,
(scheme) => scheme.primary,
);
}
return ProviderQualityHint._(
'Not checked',
isRu ? 'Не проверен' : 'Not checked',
Icons.help_outline_rounded,
(scheme) => scheme.outline,
);
@@ -1,4 +1,7 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
@@ -47,6 +50,7 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
final strings = AppStrings(settings.languageCode);
final isRu = strings.ru;
final theme = Theme.of(context);
final bottomInset = MediaQuery.paddingOf(context).bottom;
return AdaptiveScaffold(
title: strings.search,
@@ -78,19 +82,12 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 860),
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
// Extended bottom padding so the cheat sheet card is never obscured by the floating dock
padding: EdgeInsets.fromLTRB(16, 14, 16, 140 + bottomInset),
children: [
// 1. Search Bar with Quick Operators
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: theme.colorScheme.outlineVariant
.withValues(alpha: 0.3),
),
),
_SearchLiquidCard(
glowColor: theme.colorScheme.primary,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -171,18 +168,58 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
const SizedBox(height: 16),
// 2. Recent Searches Card
_SearchSectionCard(
_SearchLiquidCard(
glowColor: const Color(0xFF6366F1),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const _SearchIconBadge(
icon: Icons.history_rounded,
accentColor: const Color(0xFF6366F1),
title: isRu ? 'Недавние запросы' : 'Recent searches',
badgeCount: data.recent
.map((e) => e.query.trim().toLowerCase())
.where((q) => q.isNotEmpty)
.toSet()
.length,
trailing: data.recent.isEmpty
? null
: TextButton(
color: Color(0xFF6366F1),
),
const SizedBox(width: 12),
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Text(
isRu ? 'Недавние запросы' : 'Recent searches',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
fontSize: 15,
letterSpacing: -0.2,
),
),
),
if (data.recent.isNotEmpty) ...[
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7, vertical: 2),
decoration: BoxDecoration(
color: const Color(0xFF6366F1)
.withValues(alpha: 0.16),
borderRadius: BorderRadius.circular(10),
),
child: Text(
'${data.recent.map((e) => e.query.trim().toLowerCase()).where((q) => q.isNotEmpty).toSet().length}',
style: theme.textTheme.labelSmall?.copyWith(
fontWeight: FontWeight.bold,
color: const Color(0xFF6366F1),
),
),
),
],
],
),
),
if (data.recent.isNotEmpty)
TextButton(
style: TextButton.styleFrom(
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.symmetric(
@@ -190,9 +227,12 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: () => ref
onPressed: () {
HapticFeedback.selectionClick();
ref
.read(searchControllerProvider.notifier)
.clearHistory(),
.clearHistory();
},
child: Text(
isRu ? 'Очистить' : 'Clear',
style: TextStyle(
@@ -202,7 +242,10 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
),
),
),
child: RecentSearches(
],
),
const SizedBox(height: 14),
RecentSearches(
items: data.recent,
onTap: (query) =>
context.go('/?q=${Uri.encodeQueryComponent(query)}'),
@@ -210,17 +253,39 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
.read(searchControllerProvider.notifier)
.deleteHistory(id),
),
],
),
),
const SizedBox(height: 16),
// 3. Explore Popular Categories & Tags
_SearchSectionCard(
icon: Icons.explore_rounded,
accentColor: const Color(0xFF10B981),
title: isRu ? 'Популярные категории' : 'Explore categories',
_SearchLiquidCard(
glowColor: const Color(0xFF10B981),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const _SearchIconBadge(
icon: Icons.explore_rounded,
color: Color(0xFF10B981),
),
const SizedBox(width: 12),
Expanded(
child: Text(
isRu ? 'Популярные категории' : 'Explore categories',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
fontSize: 15,
letterSpacing: -0.2,
),
),
),
],
),
const SizedBox(height: 16),
_CategoryTagRow(
categoryName: isRu ? 'Тематика' : 'Theme & Ambience',
color: const Color(0xFF0EA5E9),
@@ -234,7 +299,7 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
],
onTap: (tag) => _onTagTap(tag, data.query),
),
const SizedBox(height: 14),
const SizedBox(height: 16),
_CategoryTagRow(
categoryName:
isRu ? 'Персонажи и детали' : 'Characters & Attire',
@@ -250,7 +315,7 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
],
onTap: (tag) => _onTagTap(tag, data.query),
),
const SizedBox(height: 14),
const SizedBox(height: 16),
_CategoryTagRow(
categoryName: isRu ? 'Провайдеры' : 'Providers',
color: const Color(0xFF8B5CF6),
@@ -268,40 +333,33 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
),
const SizedBox(height: 16),
// 4. Search Tips / Cheat Sheet Card
Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: theme.colorScheme.outlineVariant
.withValues(alpha: 0.3),
),
),
// 4. Search Tips / Cheat Sheet Card (Full Liquid Glass Container)
_SearchLiquidCard(
padding: EdgeInsets.zero,
glowColor: const Color(0xFFF59E0B),
child: Theme(
data: theme.copyWith(dividerColor: Colors.transparent),
child: ExpansionTile(
shape: const Border(),
collapsedShape: const Border(),
leading: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
color: const Color(0xFFF59E0B).withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(10),
),
child: const Icon(
Icons.lightbulb_outline_rounded,
size: 18,
tilePadding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 4),
leading: const _SearchIconBadge(
icon: Icons.lightbulb_rounded,
color: Color(0xFFF59E0B),
),
),
title: Text(
isRu ? 'Шпаргалка по поиску' : 'Search tips & operators',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
),
initiallyExpanded: _showTips,
onExpansionChanged: (exp) => setState(() => _showTips = exp),
onExpansionChanged: (exp) {
HapticFeedback.selectionClick();
setState(() => _showTips = exp);
},
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
@@ -348,6 +406,7 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
],
),
),
),
const SizedBox(height: 24),
],
),
@@ -358,92 +417,116 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
}
}
class _SearchSectionCard extends StatelessWidget {
const _SearchSectionCard({
required this.icon,
required this.accentColor,
required this.title,
class _SearchLiquidCard extends StatelessWidget {
const _SearchLiquidCard({
required this.child,
this.badgeCount,
this.trailing,
this.padding,
this.glowColor,
});
final IconData icon;
final Color accentColor;
final String title;
final Widget child;
final int? badgeCount;
final Widget? trailing;
final EdgeInsetsGeometry? padding;
final Color? glowColor;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final accent = glowColor ?? theme.colorScheme.primary;
return Container(
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: isDark
? Colors.black.withValues(alpha: 0.35)
: accent.withValues(alpha: 0.08),
blurRadius: 18,
offset: const Offset(0, 6),
spreadRadius: -2,
),
BoxShadow(
color: accent.withValues(alpha: isDark ? 0.06 : 0.03),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
child: Container(
padding: padding ?? const EdgeInsets.all(16),
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.38),
]
: [
Colors.white.withValues(alpha: 0.88),
Colors.white.withValues(alpha: 0.72),
],
),
border: Border.all(
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.3),
color: isDark
? Colors.white.withValues(alpha: 0.14)
: Colors.white.withValues(alpha: 0.85),
width: 1.2,
),
),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 32,
height: 32,
child: child,
),
),
),
);
}
}
class _SearchIconBadge extends StatelessWidget {
const _SearchIconBadge({
required this.icon,
required this.color,
});
final IconData icon;
final Color color;
@override
Widget build(BuildContext context) {
const size = 34.0;
const iconSize = 18.0;
return Container(
width: size,
height: size,
decoration: BoxDecoration(
color: accentColor.withValues(alpha: 0.14),
borderRadius: BorderRadius.circular(10),
),
child: Icon(icon, size: 18, color: accentColor),
),
const SizedBox(width: 10),
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w700,
fontSize: 15,
),
),
),
if (badgeCount != null && badgeCount! > 0) ...[
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7, vertical: 2),
decoration: BoxDecoration(
color: accentColor.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(10),
),
child: Text(
'$badgeCount',
style: theme.textTheme.labelSmall?.copyWith(
fontWeight: FontWeight.bold,
color: accentColor,
),
),
),
],
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),
),
if (trailing != null) trailing!,
],
),
const SizedBox(height: 14),
child,
],
child: Center(
child: Icon(icon, size: iconSize, color: Colors.white),
),
);
}
@@ -465,19 +548,33 @@ class _QuickOperatorChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
return Material(
color: color.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(12),
color: Colors.transparent,
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(12),
onTap: onTap,
borderRadius: BorderRadius.circular(14),
onTap: () {
HapticFeedback.selectionClick();
onTap();
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: color.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: color.withValues(alpha: 0.35),
color: color.withValues(alpha: isDark ? 0.40 : 0.32),
width: 1.1,
),
boxShadow: [
BoxShadow(
color: color.withValues(alpha: isDark ? 0.14 : 0.06),
blurRadius: 6,
offset: const Offset(0, 1.5),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -490,6 +587,7 @@ class _QuickOperatorChip extends StatelessWidget {
fontWeight: FontWeight.w700,
color: color,
fontFamily: 'monospace',
letterSpacing: -0.2,
),
),
],
@@ -516,44 +614,76 @@ class _CategoryTagRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 7,
height: 7,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: color.withValues(alpha: 0.6),
blurRadius: 4,
),
],
),
),
const SizedBox(width: 8),
Text(
categoryName,
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.w600,
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w700,
color: theme.colorScheme.onSurface,
letterSpacing: -0.2,
),
),
const SizedBox(height: 8),
],
),
const SizedBox(height: 10),
Wrap(
spacing: 8,
runSpacing: 8,
children: [
for (final tag in tags)
Material(
color: theme.colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(12),
color: Colors.transparent,
borderRadius: BorderRadius.circular(14),
child: InkWell(
borderRadius: BorderRadius.circular(12),
onTap: () => onTap(tag),
borderRadius: BorderRadius.circular(14),
onTap: () {
HapticFeedback.selectionClick();
onTap(tag);
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 5),
horizontal: 11, vertical: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: isDark
? theme.colorScheme.surfaceContainerHighest
.withValues(alpha: 0.45)
: Colors.white.withValues(alpha: 0.60),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: theme.colorScheme.outlineVariant
.withValues(alpha: 0.3),
color: isDark
? Colors.white.withValues(alpha: 0.10)
: theme.colorScheme.outlineVariant
.withValues(alpha: 0.35),
width: 1.0,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 6,
height: 6,
width: 5,
height: 5,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
@@ -563,7 +693,8 @@ class _CategoryTagRow extends StatelessWidget {
Text(
tag,
style: theme.textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
letterSpacing: -0.1,
),
),
],
@@ -587,14 +718,23 @@ class _TipRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(6),
color: isDark
? theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.6)
: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.08)
: theme.colorScheme.outlineVariant.withValues(alpha: 0.25),
),
),
child: Text(
code,
@@ -608,10 +748,14 @@ class _TipRow extends StatelessWidget {
),
const SizedBox(width: 10),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 2),
child: Text(
description,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
height: 1.35,
),
),
),
),
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../../backend/backend.dart';
@@ -95,20 +96,40 @@ class _RecentSearchesState extends State<RecentSearches> {
children: [
for (final item in visibleItems)
Material(
color: theme.colorScheme.surfaceContainer,
color: Colors.transparent,
borderRadius: BorderRadius.circular(16),
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () => widget.onTap(item.query),
onTap: () {
HapticFeedback.selectionClick();
widget.onTap(item.query);
},
child: Container(
padding:
const EdgeInsets.only(left: 10, right: 6, top: 6, bottom: 6),
decoration: BoxDecoration(
color: Theme.of(context).brightness == Brightness.dark
? theme.colorScheme.surfaceContainerHighest
.withValues(alpha: 0.45)
: Colors.white.withValues(alpha: 0.65),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: theme.colorScheme.outlineVariant
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.12)
: theme.colorScheme.outlineVariant
.withValues(alpha: 0.35),
width: 1.0,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(
alpha: Theme.of(context).brightness == Brightness.dark
? 0.15
: 0.04),
blurRadius: 6,
offset: const Offset(0, 1.5),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -140,7 +161,7 @@ class _RecentSearchesState extends State<RecentSearches> {
padding: const EdgeInsets.symmetric(
horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: theme.colorScheme.primary.withValues(alpha: 0.12),
color: theme.colorScheme.primary.withValues(alpha: 0.14),
borderRadius: BorderRadius.circular(8),
),
child: Text(
@@ -161,7 +182,10 @@ class _RecentSearchesState extends State<RecentSearches> {
clipBehavior: Clip.antiAlias,
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => widget.onDelete!(item.id),
onTap: () {
HapticFeedback.lightImpact();
widget.onDelete!(item.id);
},
child: Padding(
padding: const EdgeInsets.all(4),
child: Icon(
@@ -23,6 +23,16 @@ class SettingsController extends AsyncNotifier<AppSettings> {
ref.invalidate(appSettingsProvider);
}
Future<void> setVideoPlayerVolume(double volume) async {
final current = state.value ?? AppSettings.defaults;
final clamped = volume.clamp(0.0, 100.0);
if ((current.videoPlayerVolume - clamped).abs() < 0.01) return;
final updated = current.copyWith(videoPlayerVolume: clamped);
state = AsyncData(updated);
await ref.read(settingsServiceProvider).setVideoPlayerVolume(clamped);
ref.invalidate(appSettingsProvider);
}
Future<void> clearCache() async {
await ref.read(cacheServiceProvider).clear();
}
@@ -976,42 +976,69 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
final isRu = settings.languageCode == 'ru';
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final selectedSource = await showModalBottomSheet<UpdateSource>(
context: context,
useRootNavigator: true,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (sheetContext) {
return Container(
decoration: BoxDecoration(
color: theme.colorScheme.surface,
return ClipRRect(
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 24, sigmaY: 24),
child: Container(
decoration: BoxDecoration(
color: isDark
? theme.colorScheme.surface.withValues(alpha: 0.88)
: Colors.white.withValues(alpha: 0.94),
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
border: Border(
top: BorderSide(
color: isDark
? Colors.white.withValues(alpha: 0.18)
: Colors.white.withValues(alpha: 0.85),
width: 1.2,
),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: EdgeInsets.fromLTRB(
20,
14,
20,
24 + MediaQuery.paddingOf(sheetContext).bottom,
),
padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Center(
child: Container(
width: 36,
height: 4,
width: 38,
height: 4.5,
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(2),
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.35),
borderRadius: BorderRadius.circular(3),
),
),
),
Text(
isRu ? 'Источник обновлений' : 'Update Source',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w800,
letterSpacing: -0.3,
),
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,
@@ -1022,28 +1049,55 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
// Option 1: GitHub (Recommended for speed)
Material(
color: theme.colorScheme.primaryContainer.withValues(alpha: 0.35),
borderRadius: BorderRadius.circular(16),
color: isDark
? theme.colorScheme.primaryContainer.withValues(alpha: 0.35)
: theme.colorScheme.primary.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(18),
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () => Navigator.pop(sheetContext, UpdateSource.github),
child: Padding(
borderRadius: BorderRadius.circular(18),
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(sheetContext, UpdateSource.github);
},
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.15)
: theme.colorScheme.primary.withValues(alpha: 0.35),
width: 1.2,
),
),
child: Row(
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
color: theme.colorScheme.primary.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(12),
gradient: const LinearGradient(
colors: [Color(0xFF6366F1), Color(0xFF4F46E5)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(13),
boxShadow: [
BoxShadow(
color: const Color(0xFF6366F1).withValues(alpha: 0.40),
blurRadius: 10,
offset: const Offset(0, 3),
),
],
),
child: const Center(
child: Icon(
Icons.bolt_rounded,
color: theme.colorScheme.primary,
color: Colors.white,
size: 24,
),
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
@@ -1054,24 +1108,24 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
Text(
'GitHub',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w700,
),
),
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 2,
horizontal: 7,
vertical: 2.5,
),
decoration: BoxDecoration(
color: Colors.green.withValues(alpha: 0.2),
color: Colors.green.withValues(alpha: 0.20),
borderRadius: BorderRadius.circular(6),
),
child: Text(
isRu ? 'Рекомендуется для скорости' : 'Recommended for speed',
isRu ? 'Рекомендуется' : 'Recommended',
style: const TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
fontSize: 10.5,
fontWeight: FontWeight.w700,
color: Colors.green,
),
),
@@ -1081,7 +1135,7 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
const SizedBox(height: 3),
Text(
isRu
? 'Прямая быстрая загрузка без ограничений'
? 'Прямая быстрая загрузка релизов без задержек'
: 'Direct fast download without limits',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
@@ -1092,7 +1146,7 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 14,
size: 15,
color: theme.colorScheme.onSurfaceVariant,
),
],
@@ -1102,49 +1156,75 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
),
const SizedBox(height: 12),
// Option 2: Gitea (Muted / neutral grey)
// Option 2: Gitea
Material(
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.25),
borderRadius: BorderRadius.circular(16),
color: isDark
? theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.35)
: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.40),
borderRadius: BorderRadius.circular(18),
child: InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () => Navigator.pop(sheetContext, UpdateSource.gitea),
child: Padding(
borderRadius: BorderRadius.circular(18),
onTap: () {
HapticFeedback.selectionClick();
Navigator.pop(sheetContext, UpdateSource.gitea);
},
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.12)
: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
width: 1.2,
),
),
child: Row(
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
color: theme.colorScheme.onSurface.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(12),
gradient: const LinearGradient(
colors: [Color(0xFF0EA5E9), Color(0xFF0284C7)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(13),
boxShadow: [
BoxShadow(
color: const Color(0xFF0EA5E9).withValues(alpha: 0.35),
blurRadius: 10,
offset: const Offset(0, 3),
),
],
),
child: const Center(
child: Icon(
Icons.dns_rounded,
color: theme.colorScheme.onSurfaceVariant,
color: Colors.white,
size: 22,
),
),
),
const SizedBox(width: 14),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Gitea',
'Gitea (Synapse)',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w600,
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 3),
Text(
isRu
? 'Сервер релизов'
: 'Release server',
? 'Альтернативный независимый сервер релизов'
: 'Alternative independent release mirror',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.7),
color: theme.colorScheme.onSurfaceVariant,
),
),
],
@@ -1152,8 +1232,8 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
),
Icon(
Icons.arrow_forward_ios_rounded,
size: 14,
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
size: 15,
color: theme.colorScheme.onSurfaceVariant,
),
],
),
@@ -1162,6 +1242,10 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
),
],
),
),
),
),
),
);
},
);
@@ -1,5 +1,8 @@
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
@@ -156,28 +159,56 @@ class _ViewedScreenState extends ConsumerState<ViewedScreen> {
);
}
final bottomInset = MediaQuery.paddingOf(context).bottom;
return RefreshIndicator(
onRefresh: () =>
ref.read(viewedControllerProvider.notifier).refresh(),
child: ListView(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 24),
padding: EdgeInsets.fromLTRB(16, 8, 16, 140 + bottomInset),
children: [
for (final group in groups) ...[
Padding(
padding: const EdgeInsets.fromLTRB(4, 16, 4, 10),
padding: const EdgeInsets.fromLTRB(2, 16, 2, 10),
child: Row(
children: [
Icon(
Icons.calendar_today_rounded,
size: 16,
color: Theme.of(context).colorScheme.primary,
Container(
width: 28,
height: 28,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primary.withValues(alpha: 0.82),
],
),
const SizedBox(width: 8),
borderRadius: BorderRadius.circular(9),
boxShadow: [
BoxShadow(
color: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.32),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
child: const Center(
child: Icon(
Icons.calendar_today_rounded,
size: 14,
color: Colors.white,
),
),
),
const SizedBox(width: 10),
Text(
_localizedGroupLabel(group.label, isRu),
style:
Theme.of(context).textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold,
letterSpacing: -0.2,
),
),
const SizedBox(width: 8),
@@ -187,10 +218,24 @@ class _ViewedScreenState extends ConsumerState<ViewedScreen> {
vertical: 2,
),
decoration: BoxDecoration(
color: Theme.of(context)
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context)
.colorScheme
.surfaceContainerHighest,
.surfaceContainerHighest
.withValues(alpha: 0.5)
: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Theme.of(context).brightness == Brightness.dark
? Colors.white.withValues(alpha: 0.08)
: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.20),
),
),
child: Text(
'${group.items.length}',
@@ -198,7 +243,10 @@ class _ViewedScreenState extends ConsumerState<ViewedScreen> {
.textTheme
.labelSmall
?.copyWith(
fontWeight: FontWeight.w600,
fontWeight: FontWeight.w700,
color: Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.onSurfaceVariant
: Theme.of(context).colorScheme.primary,
),
),
),
@@ -299,40 +347,86 @@ class _ViewedPostTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final isDark = Theme.of(context).brightness == Brightness.dark;
final image = MediaUrlSelector.preview(post).firstOrNull;
final timeStr =
'${viewedAt.hour.toString().padLeft(2, '0')}:${viewedAt.minute.toString().padLeft(2, '0')}';
return Card(
elevation: 0,
color: scheme.surfaceContainerLow,
margin: const EdgeInsets.only(bottom: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(
color: scheme.outlineVariant.withValues(alpha: 0.3),
return Container(
margin: const EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: isDark ? 0.28 : 0.05),
blurRadius: 14,
offset: const Offset(0, 4),
spreadRadius: -2,
),
],
),
clipBehavior: Clip.antiAlias,
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onOpen,
child: Padding(
borderRadius: BorderRadius.circular(20),
onTap: () {
HapticFeedback.selectionClick();
onOpen();
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: isDark
? [
scheme.surfaceContainerHigh
.withValues(alpha: 0.58),
scheme.surfaceContainerLow
.withValues(alpha: 0.36),
]
: [
Colors.white.withValues(alpha: 0.88),
Colors.white.withValues(alpha: 0.72),
],
),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.13)
: Colors.white.withValues(alpha: 0.85),
width: 1.1,
),
),
child: Row(
children: [
// Squircle Thumbnail
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: SizedBox(
borderRadius: BorderRadius.circular(13),
child: Container(
width: 68,
height: 68,
decoration: BoxDecoration(
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.10)
: scheme.outlineVariant.withValues(alpha: 0.30),
),
borderRadius: BorderRadius.circular(13),
),
child: Stack(
fit: StackFit.expand,
children: [
image == null
? Container(
color: scheme.surfaceContainerHighest,
child: const Icon(Icons.image_not_supported_rounded),
child: const Icon(
Icons.image_not_supported_rounded),
)
: CachedNetworkImage(
imageUrl: image,
@@ -356,7 +450,7 @@ class _ViewedPostTile extends StatelessWidget {
padding: const EdgeInsets.all(3),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.65),
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(5),
),
child: const Icon(
Icons.play_arrow_rounded,
@@ -380,13 +474,17 @@ class _ViewedPostTile extends StatelessWidget {
Flexible(
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 6,
horizontal: 7,
vertical: 2,
),
decoration: BoxDecoration(
color:
scheme.primaryContainer.withValues(alpha: 0.5),
color: scheme.primary
.withValues(alpha: isDark ? 0.20 : 0.12),
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: scheme.primary.withValues(
alpha: isDark ? 0.30 : 0.20),
),
),
child: Text(
post.providerName,
@@ -396,8 +494,8 @@ class _ViewedPostTile extends StatelessWidget {
.textTheme
.labelSmall
?.copyWith(
fontWeight: FontWeight.w600,
color: scheme.onPrimaryContainer,
fontWeight: FontWeight.w700,
color: scheme.primary,
),
),
),
@@ -410,6 +508,7 @@ class _ViewedPostTile extends StatelessWidget {
.labelSmall
?.copyWith(
color: scheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
),
],
@@ -420,7 +519,8 @@ class _ViewedPostTile extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
letterSpacing: -0.1,
),
),
if (post.score != 0) ...[
@@ -440,6 +540,7 @@ class _ViewedPostTile extends StatelessWidget {
.labelSmall
?.copyWith(
color: scheme.outline,
fontWeight: FontWeight.w600,
),
),
],
@@ -452,24 +553,35 @@ class _ViewedPostTile extends StatelessWidget {
IconButton(
visualDensity: VisualDensity.compact,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
constraints:
const BoxConstraints(minWidth: 36, minHeight: 36),
tooltip: isFavorite
? (isRu ? 'В избранном' : 'In favorites')
: (isRu ? 'В избранное' : 'Add to favorites'),
onPressed: onFavorite,
onPressed: () {
HapticFeedback.selectionClick();
onFavorite();
},
icon: Icon(
isFavorite
? Icons.favorite_rounded
: Icons.favorite_border_rounded,
color: isFavorite ? Colors.redAccent : scheme.onSurfaceVariant,
color: isFavorite
? Colors.redAccent
: scheme.onSurfaceVariant,
),
),
IconButton(
visualDensity: VisualDensity.compact,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
tooltip: isRu ? 'Удалить из истории' : 'Delete from history',
onPressed: onDelete,
constraints:
const BoxConstraints(minWidth: 36, minHeight: 36),
tooltip:
isRu ? 'Удалить из истории' : 'Delete from history',
onPressed: () {
HapticFeedback.lightImpact();
onDelete();
},
icon: Icon(
Icons.close_rounded,
size: 20,
@@ -480,6 +592,9 @@ class _ViewedPostTile extends StatelessWidget {
),
),
),
),
),
),
);
}
}
+6 -4
View File
@@ -167,8 +167,10 @@ class _TagInputSearchBarState extends State<TagInputSearchBar> {
void _scrollToEnd() {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (_tagScrollController.hasClients) {
final max = _tagScrollController.position.maxScrollExtent;
final target = (max - 40).clamp(0.0, max);
_tagScrollController.animateTo(
_tagScrollController.position.maxScrollExtent,
target,
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
);
@@ -286,8 +288,8 @@ class _TagInputSearchBarState extends State<TagInputSearchBar> {
const SizedBox(width: 6),
],
ConstrainedBox(
constraints: const BoxConstraints(
minWidth: 120,
constraints: BoxConstraints(
minWidth: _tags.isEmpty ? 120 : 64,
maxWidth: 300,
),
child: Focus(
@@ -567,7 +569,7 @@ class _TagInputSearchBarState extends State<TagInputSearchBar> {
final draft = _controller.text.trim().toLowerCase();
if (draft.isEmpty) return '';
final raw = draft.split(RegExp(r'\s+')).last;
return raw.replaceAll(RegExp(r'^[\(\)]+|[\(\)]+$'), '').trim();
return raw.trim();
}
bool get _isEditing => _focusNode.hasFocus || _localDirty;
+88 -18
View File
@@ -10,7 +10,7 @@ import '../../app/responsive.dart';
import '../../backend/backend.dart';
import '../../core/utils/result.dart';
class AppShell extends ConsumerWidget {
class AppShell extends ConsumerStatefulWidget {
const AppShell({required this.child, super.key});
final Widget child;
@@ -33,16 +33,96 @@ class AppShell extends ConsumerWidget {
_Destination('settings', 'Settings', Icons.settings_rounded, '/settings'),
];
static List<_Destination> _visibleDestinations(
AppSettings settings,
bool hasArtists,
) {
return destinations.where((item) {
if (settings.hiddenTabs.contains(item.id)) return false;
if (item.id == 'artists' && !hasArtists) return false;
return true;
}).toList(growable: false);
}
@override
Widget build(BuildContext context, WidgetRef ref) {
ConsumerState<AppShell> createState() => _AppShellState();
}
class _AppShellState extends ConsumerState<AppShell> {
final List<String> _tabHistory = [];
String? _currentPath;
bool _isBackNavigating = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final path = GoRouterState.of(context).uri.path;
if (_isBackNavigating) {
_isBackNavigating = false;
_currentPath = path;
return;
}
if (_currentPath != null && _currentPath != path) {
if (path == '/') {
_tabHistory.clear();
} else {
_tabHistory.remove(_currentPath);
_tabHistory.add(_currentPath!);
if (_tabHistory.length > 25) {
_tabHistory.removeAt(0);
}
}
}
_currentPath = path;
}
bool _handleBack() {
if (Navigator.of(context).canPop()) {
Navigator.of(context).pop();
return true;
}
final currentPath = GoRouterState.of(context).uri.path;
while (_tabHistory.isNotEmpty && _tabHistory.last == currentPath) {
_tabHistory.removeLast();
}
if (_tabHistory.isNotEmpty) {
final previous = _tabHistory.removeLast();
_isBackNavigating = true;
context.go(previous);
return true;
}
if (currentPath != '/') {
_isBackNavigating = true;
context.go('/');
return true;
}
return false;
}
@override
Widget build(BuildContext context) {
final settings =
ref.watch(appSettingsProvider).value ?? AppSettings.defaults;
final artistConfigs =
ref.watch(_enabledArtistConfigsProvider).value ?? const [];
final destinations =
_visibleDestinations(settings, artistConfigs.isNotEmpty);
AppShell._visibleDestinations(settings, artistConfigs.isNotEmpty);
final ru = settings.languageCode == 'ru';
return Shortcuts(
return PopScope(
canPop: false,
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
final handled = _handleBack();
if (!handled) {
SystemNavigator.pop();
}
},
child: Shortcuts(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyF):
const _NavigateIntent('/search'),
@@ -73,7 +153,7 @@ class AppShell extends ConsumerWidget {
),
_BackIntent: CallbackAction<_BackIntent>(
onInvoke: (_) {
if (Navigator.of(context).canPop()) Navigator.of(context).pop();
_handleBack();
return null;
},
),
@@ -84,28 +164,18 @@ class AppShell extends ConsumerWidget {
? _DesktopShell(
destinations: destinations,
ru: ru,
child: child,
child: widget.child,
)
: _MobileShell(
destinations: destinations,
ru: ru,
child: child,
child: widget.child,
),
),
),
),
);
}
static List<_Destination> _visibleDestinations(
AppSettings settings,
bool hasArtists,
) {
return destinations.where((item) {
if (settings.hiddenTabs.contains(item.id)) return false;
if (item.id == 'artists' && !hasArtists) return false;
return true;
}).toList(growable: false);
}
}
class _DesktopShell extends StatefulWidget {
+168 -5
View File
@@ -117,9 +117,14 @@ class _PostCardState extends ConsumerState<PostCard>
Widget build(BuildContext context) {
final post = _resolvedPost ?? widget.post;
final sensitive = _isSensitive(post.rating);
final isTextPost = post.fileType == 'text' ||
(post.previewUrl.trim().isEmpty &&
post.sampleUrl.trim().isEmpty &&
post.fileUrl.trim().isEmpty &&
!MediaUrlSelector.isVideo(post));
final aspect = post.width > 0 && post.height > 0
? post.width / post.height
: _fallbackAspect(post.fileType);
: _fallbackAspect(isTextPost ? 'text' : post.fileType);
final mobile = MediaQuery.sizeOf(context).width < 700;
final urls = _feedUrls(post, mobile: mobile);
final imageUrl = urls.isEmpty ? post.previewUrl : urls.first;
@@ -202,6 +207,12 @@ class _PostCardState extends ConsumerState<PostCard>
enabled: widget.blurExplicit && sensitive,
child: LayoutBuilder(
builder: (context, constraints) {
if (isTextPost) {
return _TextPostCardPreview(
post: post,
hovered: _hovered && !mobile,
);
}
final dpr = MediaQuery.devicePixelRatioOf(context);
final cacheWidth =
(constraints.maxWidth * dpr).round().clamp(320, 1800);
@@ -239,7 +250,8 @@ class _PostCardState extends ConsumerState<PostCard>
),
),
),
// Bottom cinematic gradient overlay for badges and favorite
// Bottom cinematic gradient overlay for badges and favorite (only on media posts)
if (!isTextPost)
Positioned(
left: 0,
right: 0,
@@ -269,11 +281,14 @@ class _PostCardState extends ConsumerState<PostCard>
if (post.fileType.toLowerCase().contains('video') ||
post.fileType.toLowerCase().contains('webm') ||
post.fileType.toLowerCase().contains('mp4') ||
post.fileType.toLowerCase().contains('gif'))
post.fileType.toLowerCase().contains('gif') ||
isTextPost)
Positioned(
right: 8,
top: 8,
child: _MediaBadge(fileType: post.fileType),
child: _MediaBadge(
fileType: isTextPost ? 'text' : post.fileType,
),
),
Positioned(
left: 8,
@@ -434,6 +449,7 @@ class _PostCardState extends ConsumerState<PostCard>
double _fallbackAspect(String fileType) {
final normalized = fileType.toLowerCase();
if (normalized == 'text') return 0.95;
if (normalized.contains('video') || normalized.contains('webm')) {
return 16 / 9;
}
@@ -596,6 +612,8 @@ class _FeedVideoPreviewState extends State<_FeedVideoPreview> {
controller: _controller,
fit: BoxFit.cover,
controls: null,
pauseUponEnteringBackgroundMode: false,
resumeUponEnteringForegroundMode: false,
),
),
),
@@ -773,7 +791,7 @@ class _MediaBadge extends StatelessWidget {
Icon(_icon(type), size: 13, color: Colors.white),
const SizedBox(width: 3.5),
Text(
type,
_label(type),
style: const TextStyle(
fontSize: 10.5,
color: Colors.white,
@@ -794,14 +812,159 @@ class _MediaBadge extends StatelessWidget {
return 'video';
}
if (value.contains('gif')) return 'gif';
if (value.contains('text')) return 'text';
return 'photo';
}
IconData _icon(String type) => switch (type) {
'video' => Icons.play_arrow_rounded,
'gif' => Icons.gif_box_rounded,
'text' => Icons.article_rounded,
_ => Icons.image_rounded,
};
String _label(String type) => switch (type) {
'video' => 'VIDEO',
'gif' => 'GIF',
'text' => 'ТЕКСТ',
_ => 'PHOTO',
};
}
class _TextPostCardPreview extends StatelessWidget {
const _TextPostCardPreview({
required this.post,
required this.hovered,
});
final Post post;
final bool hovered;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final title = (post.title ?? '').trim();
final cleanContent =
CloudLinkExtractor.cleanCommentary(post.description ?? '');
final hasTitle = title.isNotEmpty;
final snippet = cleanContent.isNotEmpty
? cleanContent
: (hasTitle ? '' : 'Текстовая публикация автора без вложений');
final cloudCount = post.cloudLinks.length;
return Container(
padding: const EdgeInsets.fromLTRB(14, 14, 14, 14),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
theme.colorScheme.surfaceContainerHigh,
theme.colorScheme.surfaceContainer,
],
),
border: Border.all(
color: hovered
? theme.colorScheme.primary.withValues(alpha: 0.5)
: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
width: 1,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: theme.colorScheme.primary.withValues(alpha: 0.14),
shape: BoxShape.circle,
),
child: Icon(
Icons.notes_rounded,
size: 15,
color: theme.colorScheme.primary,
),
),
const SizedBox(width: 8),
Expanded(
child: Text(
'${post.createdAt.day.toString().padLeft(2, '0')}.${post.createdAt.month.toString().padLeft(2, '0')}.${post.createdAt.year}',
style: TextStyle(
fontSize: 11,
color: theme.colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w500,
),
),
),
],
),
const SizedBox(height: 10),
if (hasTitle) ...[
Text(
title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold,
height: 1.25,
),
),
const SizedBox(height: 6),
],
if (snippet.isNotEmpty)
Expanded(
child: Text(
snippet,
maxLines: hasTitle ? 5 : 7,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
height: 1.42,
),
),
)
else
const Spacer(),
if (cloudCount > 0) ...[
const SizedBox(height: 6),
Row(
children: [
Container(
padding:
const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
decoration: BoxDecoration(
color: theme.colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(6),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.cloud_download_outlined,
size: 12,
color: theme.colorScheme.onPrimaryContainer,
),
const SizedBox(width: 4),
Text(
'Вложения ($cloudCount)',
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: theme.colorScheme.onPrimaryContainer,
),
),
],
),
),
],
),
],
],
),
);
}
}
class _SeenBadge extends StatelessWidget {
+10 -1
View File
@@ -28,6 +28,7 @@ class PostMasonryGrid extends StatelessWidget {
this.loading = false,
this.controller,
this.gridMode = 'masonry',
this.padding,
super.key,
});
@@ -51,11 +52,19 @@ class PostMasonryGrid extends StatelessWidget {
final bool loading;
final ScrollController? controller;
final String gridMode;
final EdgeInsetsGeometry? padding;
@override
Widget build(BuildContext context) {
final mobile = Responsive.isMobile(context);
final pad = EdgeInsets.all(mobile ? 8 : 16);
final bottomInset = MediaQuery.paddingOf(context).bottom;
final pad = padding ??
EdgeInsets.fromLTRB(
mobile ? 8 : 16,
mobile ? 8 : 16,
mobile ? 8 : 16,
(mobile ? 8 : 16) + (mobile ? (120.0 + bottomInset) : 0.0),
);
final spacing = mobile ? 8.0 : 12.0;
Widget buildCard(Post post) {
+78 -9
View File
@@ -3,22 +3,91 @@ import 'package:flutter/material.dart';
import '../../backend/backend.dart';
class ProviderStatusBadge extends StatelessWidget {
const ProviderStatusBadge({required this.health, super.key});
const ProviderStatusBadge({
required this.health,
this.compact = false,
super.key,
});
final ProviderHealth? health;
final bool compact;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
final status = health?.status ?? ProviderStatus.unknown;
final color = switch (status) {
ProviderStatus.online => Colors.green,
ProviderStatus.offline => Colors.red,
ProviderStatus.unknown => Colors.grey,
final (color, labelRu, labelEn) = switch (status) {
ProviderStatus.online => (
const Color(0xFF10B981), // Emerald
'Онлайн',
'Online',
),
ProviderStatus.offline => (
const Color(0xFFEF4444), // Crimson Red
'Офлайн',
'Offline',
),
ProviderStatus.unknown => (
const Color(0xFF94A3B8), // Slate
'Не проверен',
'Unknown',
),
};
return Chip(
avatar: Icon(Icons.circle, color: color, size: 10),
label: Text(status.name),
visualDensity: VisualDensity.compact,
final isRu = Localizations.maybeLocaleOf(context)?.languageCode == 'ru';
final label = isRu ? labelRu : labelEn;
return Container(
padding: EdgeInsets.symmetric(
horizontal: compact ? 8 : 10,
vertical: compact ? 3 : 5,
),
decoration: BoxDecoration(
color: color.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: color.withValues(alpha: isDark ? 0.45 : 0.32),
width: 1.1,
),
boxShadow: [
BoxShadow(
color: color.withValues(alpha: isDark ? 0.18 : 0.08),
blurRadius: 6,
offset: const Offset(0, 1.5),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 7,
height: 7,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: color.withValues(alpha: 0.8),
blurRadius: 5,
spreadRadius: 0.5,
),
],
),
),
const SizedBox(width: 6),
Text(
label,
style: theme.textTheme.labelSmall?.copyWith(
color: color,
fontWeight: FontWeight.w700,
letterSpacing: -0.2,
),
),
],
),
);
}
}
+102 -10
View File
@@ -1,36 +1,128 @@
import 'package:flutter/material.dart';
import '../../backend/models/tag_suggestion.dart';
class TagChip extends StatelessWidget {
const TagChip({
required this.tag,
this.category,
this.group,
this.onTap,
this.onLongPress,
super.key,
});
final String tag;
final TagCategory? category;
final String? group;
final VoidCallback? onTap;
final VoidCallback? onLongPress;
TagCategory get _resolvedCategory {
if (category != null) return category!;
final g = (group ?? '').toLowerCase();
return switch (g) {
'artist' => TagCategory.artist,
'character' => TagCategory.character,
'copyright' => TagCategory.copyright,
'species' => TagCategory.species,
'meta' => TagCategory.meta,
'general' => TagCategory.general,
_ => tagCategoryFromString(g),
};
}
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
final chip = ActionChip(
onPressed: onTap,
label: Text(tag),
labelStyle: TextStyle(
color: scheme.onSecondaryContainer,
final isDark = Theme.of(context).brightness == Brightness.dark;
final cat = _resolvedCategory;
final (Color baseColor, Color textColor) = _colorsForCategory(cat, scheme, isDark);
final chipWidget = Container(
decoration: BoxDecoration(
color: baseColor.withValues(alpha: isDark ? 0.16 : 0.10),
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: baseColor.withValues(alpha: isDark ? 0.40 : 0.28),
width: 1.0,
),
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(10),
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 6,
height: 6,
margin: const EdgeInsets.only(right: 6),
decoration: BoxDecoration(
color: baseColor,
shape: BoxShape.circle,
),
),
Text(
tag,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w700,
fontSize: 13,
letterSpacing: -0.1,
),
),
],
),
),
),
),
backgroundColor: scheme.secondaryContainer.withValues(alpha: 0.62),
side: BorderSide(color: scheme.outlineVariant.withValues(alpha: 0.65)),
visualDensity: VisualDensity.compact,
);
if (onLongPress == null) return chip;
if (onLongPress == null) return chipWidget;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onLongPress: onLongPress,
child: chip,
child: chipWidget,
);
}
static (Color, Color) _colorsForCategory(
TagCategory cat,
ColorScheme scheme,
bool isDark,
) {
return switch (cat) {
TagCategory.artist => (
const Color(0xFFFF4757), // e621 / Gelbooru red/coral
isDark ? const Color(0xFFFF6B81) : const Color(0xFFD63031),
),
TagCategory.character => (
const Color(0xFF2ED573), // Vibrant character green
isDark ? const Color(0xFF7BED9F) : const Color(0xFF10AC84),
),
TagCategory.copyright => (
const Color(0xFFA55EEA), // Classic anime series purple
isDark ? const Color(0xFFD980FA) : const Color(0xFF8854D0),
),
TagCategory.species => (
const Color(0xFFFFA502), // e621 species amber/orange
isDark ? const Color(0xFFFFC048) : const Color(0xFFE67E22),
),
TagCategory.meta => (
const Color(0xFF1E90FF), // Meta / format cyan / ice blue
isDark ? const Color(0xFF70A1FF) : const Color(0xFF0984E3),
),
TagCategory.general || TagCategory.unknown => (
isDark ? scheme.primary : scheme.primary,
isDark ? scheme.onSurface : scheme.onSurface,
),
};
}
}
+4 -4
View File
@@ -899,18 +899,18 @@ packages:
dependency: transitive
description:
name: screen_brightness_android
sha256: "2df5e0488a22a73271a43d92dbcd80643df6910cf69690faacaf9929ae9ade3b"
sha256: "2008ad8e9527cc968f7a4de1ec58b476d495b3c612a149dbd6550c4f046da147"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.1.6"
screen_brightness_platform_interface:
dependency: transitive
description:
name: screen_brightness_platform_interface
sha256: "59d50850d6735d677780fc7359c8e997d0ff6df91c8465161c9e617a7b0a11d8"
sha256: "2de60c0ba569b898950029cc1f7e9dd72bda44a22beb5054aac331cb6fce2ff2"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
share_plus:
dependency: "direct main"
description:
+1 -2
View File
@@ -1,7 +1,7 @@
name: gel_rule_app
description: Local backend/core layer for a Flutter booru browser app.
publish_to: "none"
version: 3.0.9+60
version: 3.3.1+73
environment:
sdk: ">=3.3.0 <4.0.0"
@@ -33,7 +33,6 @@ dependencies:
media_kit_libs_android_video: ^1.3.8
share_plus: ^10.0.0
dynamic_color: ^1.7.0
dev_dependencies:
flutter_test:
sdk: flutter
+11 -5
View File
@@ -55,15 +55,21 @@ void main() {
expect(find.text('Google Drive'), findsOneWidget);
expect(find.text('Google Drive Stream'), findsOneWidget);
// Verify commentary
expect(find.text('Описание от автора'), findsOneWidget);
expect(find.text('Special Patreon bonus animation for all patrons.'), findsOneWidget);
// Verify play button triggers callback
// Verify play button triggers callback on mirrors tab
final playBtn = find.text('Смотреть');
expect(playBtn, findsOneWidget);
await tester.tap(playBtn);
expect(playedStream, 'https://drive.google.com/uc?export=download&id=123');
// Switch to description tab and verify commentary
final descTab = find.text('Описание');
expect(descTab, findsOneWidget);
await tester.tap(descTab);
await tester.pumpAndSettle();
// Verify commentary
expect(find.text('Описание от автора'), findsOneWidget);
expect(find.text('Special Patreon bonus animation for all patrons.'), findsOneWidget);
});
testWidgets('CloudMirrorsCard renders nothing if no links and no commentary', (tester) async {
+155
View File
@@ -0,0 +1,155 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gel_rule_app/backend/backend.dart';
import 'package:gel_rule_app/features/providers/presentation/provider_check_screen.dart';
import 'package:gel_rule_app/features/providers/presentation/provider_form_screen.dart';
import 'package:gel_rule_app/features/providers/presentation/providers_controller.dart';
import 'package:gel_rule_app/features/providers/presentation/providers_screen.dart';
ContentProviderConfig _sampleConfig({
required String id,
required String name,
String apiType = 'gelbooru',
String baseUrl = 'https://gelbooru.com',
bool enabled = true,
int priority = 10,
}) {
return ContentProviderConfig(
id: id,
name: name,
baseUrl: baseUrl,
apiType: apiType,
enabled: enabled,
priority: priority,
timeoutSeconds: 20,
customHeaders: const {},
createdAt: DateTime(2025, 1, 1),
updatedAt: DateTime(2025, 1, 1),
);
}
class _FakeProvidersController extends ProvidersController {
_FakeProvidersController(this._items);
final List<ContentProviderConfig> _items;
@override
Future<List<ContentProviderConfig>> build() async => _items;
}
void main() {
setUp(() {
TestWidgetsFlutterBinding.ensureInitialized();
});
testWidgets('ProvidersScreen renders overview card, provider cards, and actions',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1.0;
addTearDown(() {
tester.view.resetPhysicalSize();
tester.view.resetDevicePixelRatio();
});
final sampleProviders = [
_sampleConfig(id: 'gelbooru', name: 'Gelbooru', apiType: 'gelbooru'),
_sampleConfig(
id: 'rule34',
name: 'Rule34',
apiType: 'rule34',
baseUrl: 'https://api.rule34.xxx'),
];
await tester.pumpWidget(
ProviderScope(
overrides: [
providersControllerProvider.overrideWith(
() => _FakeProvidersController(sampleProviders),
),
],
child: const MaterialApp(
home: ProvidersScreen(),
),
),
);
await tester.pumpAndSettle();
expect(find.text('Gelbooru'), findsWidgets);
expect(find.text('Rule34'), findsWidgets);
expect(find.byType(Switch), findsNWidgets(2));
expect(find.byIcon(Icons.network_check_rounded), findsWidgets);
expect(find.byIcon(Icons.add_rounded), findsOneWidget);
});
testWidgets('ProviderFormScreen renders presets, sections, and input fields',
(tester) async {
tester.view.physicalSize = const Size(400, 1600);
tester.view.devicePixelRatio = 1.0;
addTearDown(() {
tester.view.resetPhysicalSize();
tester.view.resetDevicePixelRatio();
});
await tester.pumpWidget(
const ProviderScope(
child: MaterialApp(
home: ProviderFormScreen(),
),
),
);
await tester.pumpAndSettle();
// Check presets are visible
expect(find.text('Danbooru'), findsOneWidget);
expect(find.text('e621'), findsOneWidget);
expect(find.byIcon(Icons.check_rounded), findsOneWidget);
});
testWidgets('ProviderCheckScreen renders metrics and health tiles',
(tester) async {
tester.view.physicalSize = const Size(390, 844);
tester.view.devicePixelRatio = 1.0;
addTearDown(() {
tester.view.resetPhysicalSize();
tester.view.resetDevicePixelRatio();
});
final sampleProviders = [
_sampleConfig(id: 'gelbooru', name: 'Gelbooru', apiType: 'gelbooru'),
];
await tester.pumpWidget(
ProviderScope(
overrides: [
providersControllerProvider.overrideWith(
() => _FakeProvidersController(sampleProviders),
),
providerDiagnosticsProvider.overrideWith(
(ref) async => const {},
),
providerHealthProvider.overrideWith(
(ref) => {
'gelbooru': ProviderHealth(
providerId: 'gelbooru',
status: ProviderStatus.online,
pingMs: 85,
apiVersion: '0.2.5',
lastCheckedAt: DateTime(2026, 1, 1),
),
},
),
],
child: const MaterialApp(
home: ProviderCheckScreen(),
),
),
);
await tester.pumpAndSettle();
expect(find.text('Gelbooru'), findsOneWidget);
expect(find.text('85 ms'), findsOneWidget);
});
}