Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
295499ca4b | ||
|
|
9a0fd282b7 | ||
|
|
254f0e3d59 | ||
|
|
5a568a3df9 | ||
|
|
d58b512020 | ||
|
|
384c07955c | ||
|
|
ec594595c9 | ||
|
|
586e3fc4db | ||
|
|
61c2d0561c | ||
|
|
dff2cd806d | ||
|
|
6f902740c1 | ||
|
|
bae64cd8c2 | ||
|
|
5586fea6b3 | ||
|
|
d0419fdf80 | ||
|
|
f60c767a0d | ||
|
|
40ac7cd055 | ||
|
|
0d0eac4481 | ||
|
|
4c9813b37b | ||
|
|
105b32bf76 | ||
|
|
23b73bd290 | ||
|
|
725980ed3a | ||
|
|
96affe60e7 |
@@ -0,0 +1,48 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
name: Build Windows x64
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.27.4'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
|
||||
- name: Install Dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build Windows Release
|
||||
run: flutter build windows --release
|
||||
|
||||
- name: Package Windows Zip
|
||||
shell: pwsh
|
||||
run: |
|
||||
$tag = "${{ github.ref_name }}"
|
||||
if (-not $tag) { $tag = "v3.0.0" }
|
||||
$zipName = "Lunaris-$tag-windows-x64.zip"
|
||||
Compress-Archive -Path "build\windows\x64\runner\Release\*" -DestinationPath $zipName
|
||||
echo "ZIP_NAME=$zipName" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Upload to GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ env.ZIP_NAME }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,149 +1,172 @@
|
||||
# 🌙 Lunaris
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/branding/app_icon.png" width="128" height="128" alt="Lunaris Logo" />
|
||||
<img src="android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" width="128" height="128" alt="Lunaris Logo" style="border-radius: 28px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<strong>Современный кроссплатформенный клиент для Booru и Creator-архивов</strong><br>
|
||||
Плавный Pinterest-стиль, поддержка фото, видео и GIF, умный черный список, встроенный менеджер загрузок и автообновление.
|
||||
<strong>Современный кроссплатформенный клиент для Booru и Creator-архивов нового поколения</strong><br>
|
||||
Плавный Pinterest-стиль, интеграция Pawchive 2.0, двусторонняя синхронизация, интеллектуальное автообновление и воспроизведение медиа без задержек.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Version-2.3.1-blueviolet?style=for-the-badge" alt="Version 2.3.1" />
|
||||
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.1.5-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.1.5" /></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-brightgreen?style=for-the-badge" alt="Platforms" />
|
||||
<img src="https://img.shields.io/badge/Gitea-RarDog%2FLunaris-orange?style=for-the-badge&logo=gitea&logoColor=white" alt="Gitea" />
|
||||
<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>
|
||||
<img src="https://img.shields.io/badge/License-MIT-blue?style=for-the-badge" alt="License MIT" />
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## ✨ Основные возможности
|
||||
## 🚀 Что нового в Lunaris 3.0 (Major Release)
|
||||
|
||||
- **💾 Офлайн 2.0 и Sync Hub**: 100% честное воспроизведение видео и просмотр фото прямо с диска без единого запроса в сеть, карточка аналитики хранилища (`💾 X.X ГБ на устройстве`), кнопка пакетного скачивания недостающих в 1 тап и удобная сортировка по дате, размеру и авторам.
|
||||
- **🖼️ Экран поста 2.0**: Action Dock 2.0 (чистый док из 5 главных действий + модальный лист вторичных функций), современная карточка инфо с автором, провайдером, разрешением, форматом и оценкой, лента соседних постов на мобильных и ПК, стильные блоки тегов и комментарии в виде чат-бабблов.
|
||||
- **🔍 Поиск 2.0**: Hero-панель поиска, быстрые чипы операторов (`and`, `type:video`, `rating:safe`), облако недавних поисков с быстрым удалением крестиком `✕`, карточки популярных категорий и шпаргалка по синтаксису запросов.
|
||||
- **❤️ Избранное 2.0**: Живые счетчики в сегментах (Все, Офлайн, Авторы), быстрый фильтр по типу медиа (Все / Видео / Фото), мгновенный поиск среди сохраненных работ и карточки авторов в стиле Spotify с мини-коллажем из 3 превью.
|
||||
- **🕒 История 2.0**: Группировка по дням (Сегодня, Вчера, даты), переключение между подробным списком (с 68x68 миниатюрами, бэйджами провайдеров и быстрым удалением из истории) и галерейной Masonry-сеткой, а также диалог подтверждения очистки.
|
||||
- **📁 Коллекции 2.0**: Мозаичные обложки 2x2 с превью постов, счетчики работ со стеклянным бейджем, современный экран деталей коллекции и обновленный диалог создания.
|
||||
- **⚙️ Settings 2.0**: Полный редизайн настроек с современными squircle-карточками, горизонтальной быстрой навигацией по разделам, мгновенными Segmented-кнопками выбора темы/языка/качества и стильной карточкой о приложении.
|
||||
### 🎨 Дизайн 2.0
|
||||
- **Современный визуальный стиль**: Полный переход на squircle-карточки, адаптивную цветовую палитру и улучшенную Material You динамическую тему.
|
||||
- **Интеллектуальный Action Dock 2.0**: Компактный док ключевых действий под контентом с быстрым доступом к скачиванию, шерингу, тегам и инфо.
|
||||
- **Плавные анимации и микро-взаимодействия**: Открытие медиа с эффектом Hero, интерактивное листание свайпами и анимированный лайк по двойному тапу.
|
||||
|
||||
- **⚡ Мгновенные подсказки тегов (0 мс) и постоянный файловый кэш**: Локальный JSON-кэш на телефоне и ПК обеспечивает мгновенный отклик при наборе, а Danbooru, Gelbooru, Moebooru и e621 динамически дополняют базу тегов.
|
||||
- **🎨 Цветные бейджи категорий и подсветка совпадений**: Выделение введенных букв жирным цветом акцента и четкая цветовая палитра категорий (художник — красный, персонаж — зеленый, копирайт — фиолетовый, вид — голубой).
|
||||
- **📚 Расширенная история поиска и гибкие настройки**: До 2000 записей истории и до 20000 закэшированных тегов с ручным управлением и кнопками очистки в Настройках.
|
||||
- **🎯 Общие модификаторы в мультипоиске**: При вводе `cat and dog anthro` модификатор `anthro` автоматически применится к обоим тегам (`cat anthro` + `dog anthro`).
|
||||
- **🔀 Раздельный мульти-поиск по тегам через `and`**: Оператор `and` опрашивает серверную базу по каждому тегу независимо и плавно чередует посты обоих тегов в общей ленте.
|
||||
- **🌐 Pawchive в главной ленте**: Глобальная лента недавних постов с Pawchive подключена прямо в общий Feed наравне с Rule34, Gelbooru, e621 и Realbooru.
|
||||
- **🏷️ Интерактивные теги автора**: Быстрая фильтрация по темам с живыми счётчиками постов (`#tag (count)`).
|
||||
- **📢 Анонсы и новости авторов**: Всплывающее окно анонсов автора с датами и текстом обращений к аудитории.
|
||||
- **⚡ Мгновенный фильтр фото, видео и GIF**: Локальная быстрая фильтрация постов автора без задержек.
|
||||
- **📱 Плавная лента в стиле Pinterest**: Masonry-сетка с переключением режима (Masonry, 1:1 Сетка, Список) в шапке ленты.
|
||||
- **⚡ Сверхбыстрые видео-превью**: Мгновенная загрузка превью без фризов и лишней нагрузки на процессор и память смартфона.
|
||||
- **↔️ Листание постов влево и вправо**: Полноэкранный пейджер с плавными свайпами между фото и видео во всех разделах.
|
||||
- **❤️ Двойной тап для лайка и свайп вниз для закрытия**: Анимированное сердечко по двойному тапу и закрытие экрана просмотра свайпом вниз.
|
||||
- **📤 Прямая отправка файла (Share)**: Мгновенный экспорт оригинальных медиафайлов через системное меню «Поделиться».
|
||||
- **🔖 Сохраненные поисковые пресеты**: Быстрое сохранение комбинаций тегов и фильтров в закладки.
|
||||
- **📁 Умная структура папок скачивания**: Настраиваемые шаблоны поддиректорий (`{Artist}`, `{Provider}`, `{Service}`, `{ID}`, `{Date}`).
|
||||
- **🗑️ Менеджер кэша**: Детальная визуализация занятой памяти и выборочная очистка.
|
||||
- **📦 Бэкап и синхронизация**: Экспорт и импорт полной конфигурации в JSON-файл для переноса на другие устройства.
|
||||
- **🌑 AMOLED Pure Black тема**: Истинно черный фон (`#000000`) для экономии батареи на OLED дисплеях.
|
||||
- **🎨 Динамические цвета Material You**: Поддержка системной палитры Android из обоев устройства.
|
||||
- **⭐ Любимые авторы**: Компактная кнопка-звёздочка сверху справа для быстрого доступа ко всем любимым авторам.
|
||||
- **🏷️ Мультивыбор платформ**: Выбор нескольких платформ (Patreon, Fanbox, Fantia, Boosty, Discord).
|
||||
- **📜 Бесконечная подгрузка постов автора**: Умная пагинация при прокрутке вниз загружает всю историю работ.
|
||||
- **🔍 Умный поиск и автодополнение**: Интерактивные чипсы тегов с подсказками от активных API.
|
||||
- **🛡️ Продвинутый Blacklist / Whitelist**: Фильтрация по тегам, категориям, рейтингу контента и минимальному score.
|
||||
- **🎬 Встроенный плеер**: Удобное воспроизведение WebM / MP4, запоминание звука, fullscreen и повтор.
|
||||
- **💾 Менеджер загрузок и коллекции**: Скачивание оригиналов в высоком качестве и тематические папки-коллекции.
|
||||
- **🔄 Встроенное автообновление**: Проверка и скачивание свежих релизов напрямую из личного репозитория Gitea.
|
||||
### 🐾 Глубокая интеграция Pawchive 2.0
|
||||
- **Мульти-аккаунты**: Поддержка авторизации по логину и паролю, а также прямому вводу `Session Cookie`.
|
||||
- **Двусторонняя синхронизация (Two-Way Sync)**: Автоматическая синхронизация избранного между локальной базой Lunaris и профилем Pawchive. Новые авторы с сервера добавляются в приложение, а локальные авторы выгружаются на сервер в один тап.
|
||||
- **Моментальная синхронизация**: При нажатии кнопки «В избранное» у любого автора (Fanbox, Patreon, Fantia, Boosty, Gumroad, DLsite, Discord) статус синхронизируется с сервером на лету.
|
||||
|
||||
### 🎬 Умный медиаплеер и определение разрешения
|
||||
- **Ленивое вычисление габаритов (1920×1080 и др.)**: Определение точного разрешения картинок и видео без полной предварительной загрузки тяжелых файлов.
|
||||
- **Автоповорот в полноэкранном режиме**: Видеоплеер автоматически ориентирует экран (альбомный или портретный режим) в зависимости от аспектного соотношения медиа.
|
||||
|
||||
### 📦 Разделение APK и умное автообновление по ABI
|
||||
- Сборка облегчённых APK с разделением по архитектурам процессора (`arm64-v8a`, `armeabi-v7a`, `x86_64`).
|
||||
- Встроенная система обновлений автоматически определяет архитектуру вашего Android-устройства и скачивает только нужный APK, экономя трафик и ускоряя загрузку.
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Активные провайдеры
|
||||
## 📚 Документация и Вики (Руководство пользователя)
|
||||
|
||||
| Провайдер | Тип API | Назначение |
|
||||
Подробные иллюстрированные руководства доступны в **[Lunaris Wiki](https://github.com/RarDog/Lunaris/wiki)** и прямо в репозитории:
|
||||
|
||||
- 🚀 **[Быстрый старт и установка](docs/wiki/Getting-Started.md)** — выбор правильного APK под процессор, запуск на Linux.
|
||||
- 🌐 **[Провайдеры контента](docs/wiki/Providers.md)** — особенности Booru (Gelbooru, Rule34, Realbooru, e621) и архивов Pawchive.
|
||||
- 🔍 **[Умный поиск и теги](docs/wiki/Search-and-Tags.md)** — оператор `and`, общие модификаторы и подсказки за 0 мс.
|
||||
- 🐾 **[Интеграция с Pawchive](docs/wiki/Pawchive-Sync.md)** — вход по паролю/куки, двусторонняя синхронизация и выгрузка авторов.
|
||||
- 🎬 **[Медиаплеер и просмотр](docs/wiki/Media-Viewer.md)** — жесты, автоповорот видео, разрешение 1920×1080 и Action Dock 2.0.
|
||||
- 💾 **[Офлайн-режим и загрузки](docs/wiki/Offline-and-Downloads.md)** — Sync Hub, шаблоны папок и сохранение оригиналов.
|
||||
- 🛡️ **[Черный список и фильтрация](docs/wiki/Safety-and-Blacklist.md)** — настройка Blacklist, Safe Mode и очистка кэша.
|
||||
- ❓ **[Часто задаваемые вопросы (FAQ)](docs/wiki/FAQ.md)** — автообновление, звук в видео и решение проблем.
|
||||
|
||||
---
|
||||
|
||||
## ✨ Ключевые возможности
|
||||
|
||||
- **📱 Плавная лента в стиле Pinterest**: Masonry-сетка с переключением режима отображения (Masonry, 1:1 Сетка, Компактный список).
|
||||
- **💾 Офлайн 2.0 и Sync Hub**: Просмотр фото и видео прямо из локального хранилища без запросов в сеть, аналитика занятого места и пакетная выгрузка.
|
||||
- **🔍 Поиск 2.0 с операторами**: Быстрые подсказки тегов со скоростью отклика 0 мс, оператор `and` для мульти-поиска, фильтры `type:video`, `rating:safe`.
|
||||
- **🛡️ Продвинутый Blacklist / Whitelist**: Фильтрация нежелательного контента по тегам, категориям, рейтингу и минимальному score.
|
||||
- **📁 Умный менеджер загрузок**: Шаблоны поддиректорий (`{Artist}`, `{Provider}`, `{Service}`, `{ID}`, `{Date}`) для аккуратного архива.
|
||||
- **🌑 AMOLED Pure Black**: Истинно черный фон для максимальной энергоэффективности на OLED/AMOLED дисплеях.
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Поддерживаемые провайдеры
|
||||
|
||||
| Провайдер | Тип API | Поддерживаемый контент |
|
||||
|---|---|---|
|
||||
| **Gelbooru** | XML / JSON API | Основная база аниме-артов |
|
||||
| **Rule34** | Booru API | Популярный booru-источник |
|
||||
| **Realbooru** | HTML Scraper | Фото и реалистичный контент |
|
||||
| **e621 / e926** | JSON API | Фурри- и антро-арт с богатой системой тегов |
|
||||
| **Pawchive** | REST API v1 | Архивы авторов Patreon, Pixiv Fanbox, Fantia и др. |
|
||||
| **Pawchive** | REST API v1 | Patreon, Pixiv Fanbox, Fantia, Boosty, Gumroad, DLsite, Discord |
|
||||
| **Gelbooru** | JSON / XML API | Аниме-арты, теги, авторы, рейтинги |
|
||||
| **Rule34** | Booru API | Огромная база booru-контента, видео и GIF |
|
||||
| **Realbooru** | Scraper / API | Фотосессии и реалистичный контент |
|
||||
| **e621 / e926** | REST JSON API | Фурри- и антро-арт с богатейшей таксономией тегов |
|
||||
|
||||
---
|
||||
|
||||
## 📥 Скачать приложение
|
||||
## 📥 Загрузка (Скачать сборки)
|
||||
|
||||
Готовые сборки для всех поддерживаемых платформ доступны на странице релизов:
|
||||
Релизы доступны на странице **[GitHub Releases](https://github.com/RarDog/Lunaris/releases)**.
|
||||
|
||||
🔗 **[Gitea Releases (RarDog/Lunaris)](https://gitea.rardogsynapse.online/RarDog/Lunaris/releases)**
|
||||
|
||||
- **Android**: `Lunaris-v2.0.10.apk`
|
||||
- **Linux (x64)**: `Lunaris-v2.0.10-linux-x64.tar.gz`
|
||||
- **Windows**: `LunarisSetup-v2.0.10.exe` / `LunarisPortable-v2.0.10.zip`
|
||||
| Платформа | Архитектура | Формат | Описание |
|
||||
|---|---|---|---|
|
||||
| **Android** | `arm64-v8a` | `.apk` | Оптимизировано для современных смартфонов (64-bit) |
|
||||
| **Android** | `armeabi-v7a` | `.apk` | Для более старых Android-устройств (32-bit) |
|
||||
| **Android** | `x86_64` | `.apk` | Для эмуляторов Android и x86-планшетов |
|
||||
| **Linux** | `x86_64` | `.tar.gz` | Портативный архив для Linux-дистрибутивов |
|
||||
| **Windows** | `x64` | `.zip` / `.exe` | Портативная и установочная сборка для Windows 10/11 |
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Сборка из исходников
|
||||
|
||||
### Требования
|
||||
- Flutter SDK `>= 3.19.0`
|
||||
- OpenJDK 17
|
||||
- Android SDK (для сборки APK)
|
||||
- Clang / CMake / GTK-3 (для сборки под Linux)
|
||||
- **Flutter SDK**: `>= 3.22.0` (Dart `>= 3.4.0`)
|
||||
- **Android SDK**: Build-Tools & Platform-Tools (для Android)
|
||||
- **Linux**: `clang`, `cmake`, `ninja-build`, `pkg-config`, `libgtk-3-dev`
|
||||
- **Windows**: Visual Studio 2022 с компонентом «Desktop development with C++»
|
||||
|
||||
### Команды разработки
|
||||
### Быстрый старт
|
||||
|
||||
```bash
|
||||
# Клонирование репозитория
|
||||
git clone https://gitea.rardogsynapse.online/RarDog/Lunaris.git
|
||||
git clone https://github.com/RarDog/Lunaris.git
|
||||
cd Lunaris
|
||||
|
||||
# Установка зависимостей
|
||||
flutter pub get
|
||||
|
||||
# Запуск тестов и анализатора
|
||||
# Проверка анализатора и запуск тестов
|
||||
flutter analyze
|
||||
flutter test
|
||||
|
||||
# Запуск на подключенном устройстве
|
||||
# Запуск в режиме разработки
|
||||
flutter run
|
||||
```
|
||||
|
||||
### Сборка релизов
|
||||
### Сборка релизных пакетов
|
||||
|
||||
```bash
|
||||
# Android APK
|
||||
flutter build apk --release
|
||||
# Android (раздельные APK по архитектурам)
|
||||
flutter build apk --release --split-per-abi
|
||||
|
||||
# Linux x64 Bundle
|
||||
# Linux (Desktop bundle)
|
||||
flutter build linux --release
|
||||
|
||||
# Windows Bundle
|
||||
# Windows (Desktop bundle)
|
||||
flutter build windows --release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🏛️ Архитектура
|
||||
## 🏛️ Архитектура проекта
|
||||
|
||||
```
|
||||
```text
|
||||
lib/
|
||||
├── app/ # Роутер, тема, локализация (RU/EN), анимации
|
||||
├── app/ # Роутер (GoRouter), темы, локализация (RU/EN), анимации
|
||||
├── backend/
|
||||
│ ├── di/ # Riverpod providers для сервисов
|
||||
│ ├── models/ # Post, ArtistProfile, AppSettings, AppUpdateInfo
|
||||
│ ├── providers/ # Реализации API (Gelbooru, Rule34, Pawchive и др.)
|
||||
│ ├── repositories/ # Доступ к локальной БД Isar
|
||||
│ └── services/ # Бизнес-логика (Feed, Search, Favorites, Downloads, Updates)
|
||||
├── core/ # Сеть (Dio), база данных (Isar), ошибки и кеши
|
||||
├── features/ # Модули экранов (feed, post, artists, favorites, settings)
|
||||
└── shared/widgets/ # Переиспользуемые виджеты (PostCard, MasonryGrid, TagChip)
|
||||
│ ├── di/ # Внедрение зависимостей (Riverpod providers)
|
||||
│ ├── models/ # Post, ArtistProfile, PawchiveAccount, AppSettings
|
||||
│ ├── providers/ # Клиенты API (Gelbooru, Rule34, Pawchive, e621)
|
||||
│ ├── repositories/ # Локальная база данных Isar и кэширование
|
||||
│ └── services/ # Сервисы: PawchiveSync, Feed, Search, Downloads, Updates
|
||||
├── core/ # Сетевой клиент (Dio), база данных, утилиты
|
||||
├── features/ # Модули экранов: feed, post, artists, favorites, settings
|
||||
└── shared/widgets/ # Переиспользуемые компоненты (PostCard, MasonryGrid, Dock)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Приватность и безопасность
|
||||
## 🔒 Безопасность и конфиденциальность
|
||||
|
||||
- **Полная автономность**: Приложение не отправляет телеметрию и работает без внешних серверов-посредников.
|
||||
- **Локальное хранение**: Все настройки, история поиска, черный список и избранное хранятся исключительно на вашем устройстве в локальной базе Isar.
|
||||
- **Бережное отношение к трафику**: В ленте загружаются только оптимизированные превью. Тяжелые оригиналы и видео загружаются только при открытии или скачивании.
|
||||
- **100% локальное хранение**: Вся история, закладки, локальные авторы и конфигурации хранятся только в вашей локальной базе на устройстве.
|
||||
- **Никакой телеметрии**: Lunaris не собирает аналитику, не отправляет логи и уважает вашу приватность.
|
||||
- **Прямое соединение**: Запросы отправляются напрямую к выбранным API без прокси-серверов посредников.
|
||||
|
||||
---
|
||||
|
||||
## 👥 Разработчики
|
||||
|
||||
<p align="center">
|
||||
<strong>Разработчики:</strong> <a href="https://github.com/RarDog">RarDog</a> & <a href="https://deepmind.google/technologies/gemini/">Antigravity (Gemini)</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/RarDog"><img src="https://img.shields.io/badge/Developer-RarDog-blue?style=for-the-badge&logo=github&logoColor=white" alt="RarDog" /></a>
|
||||
<a href="https://deepmind.google/technologies/gemini/"><img src="https://img.shields.io/badge/AI%20Pair-Antigravity%20(Gemini)-8A2BE2?style=for-the-badge&logo=google&logoColor=white" alt="Antigravity" /></a>
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# ❓ Часто задаваемые вопросы (FAQ)
|
||||
|
||||
### 1. Как обновить приложение?
|
||||
Lunaris проверяет наличие свежих версий автоматически при запуске.
|
||||
Вы также можете нажать **«Проверить обновления»** в Настройках.
|
||||
Приложение определит архитектуру вашего Android-устройства и скачает оптимальный APK напрямую из репозитория.
|
||||
|
||||
---
|
||||
|
||||
### 2. Почему видео воспроизводится без звука?
|
||||
По умолчанию звук в плеере приглушен, чтобы избежать неожиданно громкого воспроизведения. Нажмите на значок динамика в плеере, чтобы включить звук. Приложение запомнит ваш выбор для текущей сессии.
|
||||
|
||||
---
|
||||
|
||||
### 3. Где сохраняются скачанные файлы?
|
||||
- **На Android**: В стандартную папку `Pictures/Lunaris` или `Download/Lunaris` (в зависимости от настроек системы). Файлы сразу видны в стандартной Галерее телефона.
|
||||
- **На Linux**: В директорию `~/Pictures/Lunaris` или папку загрузок.
|
||||
|
||||
---
|
||||
|
||||
### 4. Безопасно ли вводить логин и пароль от Pawchive?
|
||||
Абсолютно безопасно. Lunaris не отправляет ваши учетные данные никуда, кроме официального защищенного API Pawchive по HTTPS. Пароли не логируются и сохраняются в зашифрованном системном хранилище. Для дополнительного спокойствия вы можете использовать вход через **Session Cookie**.
|
||||
|
||||
---
|
||||
|
||||
### 5. Что делать, если посты перестали загружаться?
|
||||
1. Проверьте стабильность интернет-соединения или работу VPN (некоторые провайдеры Booru могут быть заблокированы региональными провайдерами).
|
||||
2. Зайдите в **«Настройки» ➔ «Хранилище и кэш»** и нажмите **«Очистить кэш сети»**.
|
||||
3. Проверьте доступность источника через браузер (иногда Booru-серверы уходят на техническое обслуживание).
|
||||
@@ -0,0 +1,53 @@
|
||||
# 🚀 Быстрый старт и установка
|
||||
|
||||
### 📥 1. Установка на Android
|
||||
|
||||
Релизы приложения публикуются на странице **[GitHub Releases](https://github.com/RarDog/Lunaris/releases)**.
|
||||
|
||||
Начиная с версии **Lunaris 3.0**, APK разделены по архитектуре процессора, чтобы уменьшить размер скачиваемого файла:
|
||||
|
||||
| Файл APK | Для каких устройств |
|
||||
|---|---|
|
||||
| **`app-arm64-v8a-release.apk`** | **Рекомендуется.** 99% современных смартфонов и планшетов (64-битные процессоры ARM). |
|
||||
| **`app-armeabi-v7a-release.apk`** | Старые 32-битные Android-смартфоны или бюджетные ТВ-приставки. |
|
||||
| **`app-x86_64-release.apk`** | Эмуляторы Android на ПК (Bluestacks, Android Studio) или планшеты с процессорами Intel/AMD. |
|
||||
|
||||
> [!TIP]
|
||||
> **Умное автообновление:** При проверке обновлений прямо внутри Lunaris приложение **самостоятельно определит архитектуру** вашего процессора и автоматически скачает правильный файл!
|
||||
|
||||
#### Шаги установки:
|
||||
1. Скачайте нужный `.apk` файл на устройство.
|
||||
2. Откройте файл через менеджер файлов и подтвердите установку («Разрешить установку из этого источника»).
|
||||
3. Запустите **Lunaris**.
|
||||
|
||||
---
|
||||
|
||||
### 🐧 2. Установка на Linux
|
||||
|
||||
Lunaris распространяется для 64-битных Linux в виде готового автономного архива:
|
||||
|
||||
1. Скачайте **`Lunaris-v3.0.0-linux-x64.tar.gz`**.
|
||||
2. Распакуйте архив в любую удобную папку:
|
||||
```bash
|
||||
tar -xzf Lunaris-v3.0.0-linux-x64.tar.gz -C ~/Lunaris
|
||||
```
|
||||
3. Запустите приложение:
|
||||
```bash
|
||||
cd ~/Lunaris
|
||||
./lunaris
|
||||
```
|
||||
|
||||
*Системные требования Linux:* GTK-3, GLibc 2.31+, поддержка OpenGL/Vulkan для аппаратного ускорения видео.
|
||||
|
||||
---
|
||||
|
||||
### 🎨 3. Первый запуск и базовая настройка
|
||||
|
||||
После первого запуска рекомендуем заглянуть в раздел **Настройки**:
|
||||
- **Тема оформления**:
|
||||
- *Системная*: следует за темой устройства.
|
||||
- *Светлая / Тёмная*.
|
||||
- *AMOLED Pure Black*: истинно черный фон (`#000000`) для экономии заряда на экранах OLED.
|
||||
- *Динамические цвета (Material You)*: адаптация акцентных цветов под ваши системные обои Android.
|
||||
- **Интерфейс**: выбор языка (Русский / Английский).
|
||||
- **Провайдер по умолчанию**: выберите сервис, лента которого будет открываться первой при старте.
|
||||
@@ -0,0 +1,28 @@
|
||||
# 🌙 Добро пожаловать в Lunaris Wiki!
|
||||
|
||||
**Lunaris** — это современный, быстрый и функциональный кроссплатформенный клиент для Booru-борд и архивов независимых авторов (Creator Archives).
|
||||
|
||||
Приложение разработано на Flutter для **Android**, **Linux** и **Windows** с акцентом на плавный интерфейс в стиле Pinterest, глубокую кастомизацию, приватность и удобную работу с медиа.
|
||||
|
||||
---
|
||||
|
||||
## 🧭 Разделы документации
|
||||
|
||||
| Раздел | Описание |
|
||||
|---|---|
|
||||
| 🚀 **[Быстрый старт и установка](Getting-Started)** | Как выбрать правильный APK под ваш процессор Android, установка на Linux и первый запуск. |
|
||||
| 🌐 **[Провайдеры контента](Providers)** | Подключение Booru (Gelbooru, Rule34, Realbooru, e621) и архивов Pawchive. |
|
||||
| 🔍 **[Умный поиск и теги](Search-and-Tags)** | Оператор `and`, мультипоиск, общие модификаторы, подсказки тегов со скоростью отклика 0 мс. |
|
||||
| 🐾 **[Синхронизация Pawchive](Pawchive-Sync)** | Вход по логину или куки, двусторонняя синхронизация избранного, экспорт авторов. |
|
||||
| 🎬 **[Медиаплеер и просмотр](Media-Viewer)** | Управление жестами, автоповорот в полный экран, определение разрешения 1920x1080. |
|
||||
| 💾 **[Офлайн-режим и загрузки](Offline-and-Downloads)** | Локальный архив, шаблоны папок скачивания, пакетный экспорт. |
|
||||
| 🛡️ **[Черный список и фильтрация](Safety-and-Blacklist)** | Защита от нежелательного контента по тегам, категориям и рейтингу. |
|
||||
| ❓ **[Частые вопросы (FAQ)](FAQ)** | Автообновление приложения, решение проблем с сетью и кэшем. |
|
||||
|
||||
---
|
||||
|
||||
## 💡 Философия проекта
|
||||
|
||||
1. **Никакой телеметрии и слежки**: Все ваши закладки, история поиска и избранные авторы хранятся локально на вашем устройстве.
|
||||
2. **Максимальная скорость**: Локальное кэширование метаданных и тегов позволяет интерфейсу летать без сетевых задержек.
|
||||
3. **Современная эстетика**: Дизайн 2.0 с динамическими цветами Material You, истинно черной AMOLED-темой и мягкими squircle-формами.
|
||||
@@ -0,0 +1,41 @@
|
||||
# 🎬 Медиаплеер и просмотр
|
||||
|
||||
Экран просмотра в Lunaris оптимизирован для быстрого, плавного и естественного взаимодействия с контентом.
|
||||
|
||||
---
|
||||
|
||||
## 👆 Управление жестами
|
||||
|
||||
| Жест | Действие |
|
||||
|---|---|
|
||||
| **Свайп влево / вправо** | Листание к следующему или предыдущему посту в текущей ленте. |
|
||||
| **Двойной тап по экрану** | Быстрое добавление в «Любимое» с красивой всплывающей анимацией сердца. |
|
||||
| **Свайп вниз (Pull down)** | Быстрое и плавное закрытие экрана просмотра и возврат в ленту. |
|
||||
| **Pinch-to-zoom** | Плавное масштабирование картинки двумя пальцами с автовозвратом границ. |
|
||||
|
||||
---
|
||||
|
||||
## 📐 Определение разрешения медиа (1920×1080 и др.)
|
||||
|
||||
В Lunaris 3.0 внедрено **интеллектуальное ленивое определение разрешения**:
|
||||
- Для изображений и видео в инфо-панели поста отображаются точные физические размеры (например, `1920 × 1080`, `3840 × 2160`).
|
||||
- Определение происходит динамически через заголовки и потоковый декодер — приложению не требуется скачивать многомегабайтный файл целиком только ради того, чтобы узнать его габариты.
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Автоповорот видео в полноэкранном режиме
|
||||
|
||||
- При нажатии кнопки разворота на весь экран видеоплеер анализирует соотношение сторон (`aspect ratio`).
|
||||
- **Широкоформатные видео (16:9, 21:9)** автоматически ориентируют смартфон в альбомный режим (горизонтально).
|
||||
- **Вертикальные видео (9:16, Shorts, Reels)** остаются в удобном портретном режиме.
|
||||
|
||||
---
|
||||
|
||||
## ⚓ Action Dock 2.0
|
||||
|
||||
Под медиафайлом расположен чистый, компактный док с 5 главными действиями:
|
||||
1. **❤️ Избранное**: добавить работу в локальные закладки.
|
||||
2. **💾 Скачать**: сохранить оригинал файла в высоком качестве.
|
||||
3. **📤 Поделиться**: отправка оригинального файла напрямую в Telegram, Discord, мессенджеры через системное меню Share.
|
||||
4. **🏷️ Теги**: открытие всплывающего окна со всеми тегами поста (с подсветкой категорий и возможностью скопировать или начать поиск по тегу).
|
||||
5. **ℹ️ Подробнее**: метаданные, автор, провайдер, дата публикации, рейтинг и комментарии.
|
||||
@@ -0,0 +1,39 @@
|
||||
# 💾 Офлайн-режим и загрузки
|
||||
|
||||
Lunaris предоставляет полноценный оффлайн-хаб для работы с вашей личной коллекцией без подключения к интернету.
|
||||
|
||||
---
|
||||
|
||||
## 📴 Офлайн 2.0 (Sync Hub)
|
||||
|
||||
В разделе **«Любимое»** переключитесь на вкладку **«Офлайн»**:
|
||||
- **Честное воспроизведение**: Видеоролики и фотографии загружаются напрямую из памяти вашего смартфона без единого сетевого запроса.
|
||||
- **Аналитика хранилища**: Информационная карточка в шапке отображает точный объем памяти, занятый сохранённым контентом (например, `💾 4.2 ГБ на устройстве`).
|
||||
- **Пакетная выгрузка**: Кнопка скачивания недостающих постов в 1 тап проверяет избранное и загружает все еще не сохраненные оригиналы в фоновом режиме.
|
||||
|
||||
---
|
||||
|
||||
## 📁 Настройка шаблонов папок для скачивания
|
||||
|
||||
В разделе **«Настройки» ➔ «Загрузки»** можно настроить структуру каталогов на диске:
|
||||
|
||||
Доступные теги шаблона:
|
||||
- `{Artist}` — имя автора работы
|
||||
- `{Provider}` — название источника (`gelbooru`, `rule34`, `pawchive`)
|
||||
- `{Service}` — сервис автора (`patreon`, `fanbox`)
|
||||
- `{ID}` — уникальный номер поста
|
||||
- `{Date}` — дата сохранения
|
||||
|
||||
*Пример шаблона:*
|
||||
```text
|
||||
Lunaris/{Provider}/{Artist}/{ID}.{ext}
|
||||
```
|
||||
Файлы будут аккуратно раскладываться по папкам авторов и провайдеров, сохраняя порядок в вашей галерее.
|
||||
|
||||
---
|
||||
|
||||
## 📦 Бэкап и перенос данных
|
||||
|
||||
В настройках доступна функция **«Резервное копирование»**:
|
||||
- **Экспорт в JSON**: выгружает все настройки, избранные посты, любимых авторов и черный список в один файл.
|
||||
- **Импорт из JSON**: быстрое восстановление всей вашей коллекции на новом смартфоне или ПК за считанные секунды.
|
||||
@@ -0,0 +1,42 @@
|
||||
# 🐾 Интеграция и синхронизация с Pawchive
|
||||
|
||||
Начиная с версии **Lunaris 3.0**, в приложении реализована глубокая интеграция с личным профилем Pawchive.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Вход в аккаунт
|
||||
|
||||
1. Перейдите во вкладку **«Артисты»** в нижнем баре.
|
||||
2. В верхнем правом углу нажмите на иконку профиля / облака.
|
||||
3. Откроется шторка **«Аккаунты Pawchive»**.
|
||||
4. Доступно два способа авторизации:
|
||||
- **Логин и пароль**: введите свои учётные данные от Pawchive.
|
||||
- **Session Cookie**: если используется сложная авторизация через провайдеров или включена двухфакторная аутентификация, вставьте значение куки `session` из браузера.
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Двусторонняя синхронизация (Two-Way Sync)
|
||||
|
||||
В шторке управления аккаунтами расположен переключатель **«Двусторонняя синхронизация»**:
|
||||
|
||||
- **Выключена (по умолчанию)**: При обычной синхронизации список авторов импортируется с сервера Pawchive в приложение. Локальные изменения остаются нетронутыми.
|
||||
- **Включена**: При синхронизации приложение не только загружает новых авторов с сервера, но и **автоматически выгружает всех ваших локальных любимых авторов** на сервер Pawchive!
|
||||
|
||||
---
|
||||
|
||||
## 📤 Ручной экспорт локального избранного
|
||||
|
||||
Если у вас уже накоплена коллекция авторов на устройстве и вы хотите добавить их в свой аккаунт Pawchive:
|
||||
1. Откройте шторку **«Аккаунты Pawchive»**.
|
||||
2. Нажмите кнопку:
|
||||
**«Выгрузить избранное (N) в @username»**
|
||||
3. Приложение проверит текущий список на сервере и в фоновом режиме отправит недостающих авторов.
|
||||
|
||||
---
|
||||
|
||||
## ⭐ Мгновенная синхронизация на лету
|
||||
|
||||
Когда у вас подключен хотя бы один активный аккаунт Pawchive:
|
||||
- Нажатие на звёздочку/сердечко автора в любом месте приложения (в ленте, профиле автора, карточке поста) **моментально отправляет запрос на сервер Pawchive**.
|
||||
- Автор добавляется в ваш профиль без необходимости ручной синхронизации.
|
||||
- Поддерживаются авторы с любых платформ: `fanbox`, `patreon`, `fantia`, `boosty`, `subscribestar`, `gumroad`, `dlsite`, `discord`.
|
||||
@@ -0,0 +1,47 @@
|
||||
# 🌐 Провайдеры контента
|
||||
|
||||
Lunaris объединяет два фундаментальных класса источников: классические **Booru-доски** и современные **архивы авторов (Pawchive)**.
|
||||
|
||||
---
|
||||
|
||||
## 📋 Список поддерживаемых провайдеров
|
||||
|
||||
### 1. 🐾 Pawchive (REST API v1)
|
||||
Крупнейший агрегатор контента независимых авторов с платных подписочных сервисов:
|
||||
- **Поддерживаемые сервисы авторов:**
|
||||
- `fanbox` (Pixiv Fanbox)
|
||||
- `patreon` (Patreon)
|
||||
- `fantia` (Fantia)
|
||||
- `boosty` (Boosty.to)
|
||||
- `subscribestar` (SubscribeStar)
|
||||
- `gumroad` (Gumroad)
|
||||
- `dlsite` (DLsite)
|
||||
- `discord` (Серверы Discord)
|
||||
- **Возможности в Lunaris:**
|
||||
- Просмотр глобальной ленты свежих постов.
|
||||
- Персональные карточки авторов с аватаром, баннером, анонсами и ссылками на оригинальные профили.
|
||||
- Полноценная авторизация в профиль Pawchive (логин/пароль или Session Cookie).
|
||||
- Двусторонняя синхронизация любимых авторов.
|
||||
|
||||
### 2. 🌸 Gelbooru
|
||||
Популярнейшая база аниме-иллюстраций с подробной системой классификации:
|
||||
- Теги художников, персонажей, авторских прав (copyright), общие описания.
|
||||
- Высокое разрешение оригиналов.
|
||||
- Полнотекстовый поиск и рекомендации.
|
||||
|
||||
### 3. 🔞 Rule34 & Realbooru
|
||||
- **Rule34**: Огромное сообщество, поддержка анимированных GIF и видеофайлов WebM/MP4.
|
||||
- **Realbooru**: Специализируется на косплее, 3D-рендерах и реалистичном контенте.
|
||||
|
||||
### 4. 🐺 e621 / e926
|
||||
Крупнейший архив фурри-, антро- и тематического арта:
|
||||
- Богатейшая иерархическая система тегов (виды существ, анатомия, стили).
|
||||
- Полная поддержка `e926` (безопасный режим с фильтром безопасного рейтинга).
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Как переключаться между провайдерами
|
||||
|
||||
1. В верхней панели ленты (**Feed**) нажмите на чип с текущим названием провайдера (например, `Gelbooru`).
|
||||
2. В появившемся меню выберите желаемый источник.
|
||||
3. Лента мгновенно перезагрузится с сохранением выбранного режима отображения (Masonry / Сетка / Список).
|
||||
@@ -0,0 +1,31 @@
|
||||
# 🛡️ Черный список и фильтрация
|
||||
|
||||
Lunaris оснащен многоуровневой системой защиты от нежелательного контента, работающей прямо на устройстве.
|
||||
|
||||
---
|
||||
|
||||
## 🚫 Как настроить Blacklist (Черный список)
|
||||
|
||||
1. Откройте раздел **«Настройки» ➔ «Фильтрация и Blacklist»**.
|
||||
2. Введите тег или комбинацию тегов, которую вы хотите скрыть из выдачи.
|
||||
3. Посты с указанными тегами будут **автоматически исключены** из всех лент, поисковых запросов и рекомендаций.
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Безопасный режим (SFW)
|
||||
|
||||
Для комфортного использования приложения в общественных местах доступен переключатель **«Безопасный режим (Safe Mode)»**:
|
||||
- Автоматически скрывает работы с рейтингами `questionable` и `explicit`.
|
||||
- Включает безопасное зеркало `e926` при переключении на провайдер e621.
|
||||
- Фильтрует обложки и превью в ленте.
|
||||
|
||||
---
|
||||
|
||||
## 🧹 Управление кэшем
|
||||
|
||||
В настройках приложения предусмотрен детальный мониторинг занятой памяти:
|
||||
- **Кэш изображений**: временные миниатюры ленты.
|
||||
- **Кэш видео**: фрагменты буферизации видеоплеера.
|
||||
- **База тегов**: локальный словарь поисковых подсказок.
|
||||
|
||||
Вы можете очистить любой из разделов по отдельности нажатием одной кнопки.
|
||||
@@ -0,0 +1,58 @@
|
||||
# 🔍 Умный поиск и теги
|
||||
|
||||
Поиск в Lunaris спроектирован для мгновенного отклика и максимальной гибкости в построении сложных запросов.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Мгновенные подсказки тегов (0 мс)
|
||||
|
||||
- Приложение сохраняет локальный кэш десятков тысяч популярных тегов на вашем устройстве.
|
||||
- При начале ввода в поисковую строку подсказки появляются **мгновенно (0 мс)** без ожидания ответа сервера.
|
||||
- Категории тегов подсвечиваются фирменными цветами:
|
||||
- 🔴 **Художник / Автор** (`artist`) — красный
|
||||
- 🟢 **Персонаж** (`character`) — зеленый
|
||||
- 🟣 **Копирайт / Произведение** (`copyright`) — фиолетовый
|
||||
- 🔵 **Вид / Существо** (`species`) — синий
|
||||
- ⚪ **Общие теги** (`general`) — нейтральный
|
||||
|
||||
---
|
||||
|
||||
## 🔀 Оператор мультипоиска `and`
|
||||
|
||||
Классические Booru-серверы при поиске нескольких тегов (`tag1 tag2`) возвращают только посты, где **присутствуют оба тега одновременно**.
|
||||
|
||||
Lunaris поддерживает специальный оператор **`and`**:
|
||||
```text
|
||||
genshin_impact and honkai_star_rail
|
||||
```
|
||||
**Как это работает:**
|
||||
1. Приложение одновременно делает независимые запросы по каждому из тегов.
|
||||
2. Результаты плавно чередуются в единой бесконечной ленте.
|
||||
3. Вы получаете сбалансированную выборку сразу по нескольким интересующим вас темам.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Общие модификаторы в мультипоиске
|
||||
|
||||
При составлении сложных запросов модификатор, указанный в конце, автоматически распространяется на все части запроса:
|
||||
```text
|
||||
cat and dog anthro
|
||||
```
|
||||
Автоматически преобразуется в поиск:
|
||||
- `cat anthro`
|
||||
- `dog anthro`
|
||||
|
||||
---
|
||||
|
||||
## 🎛️ Поисковые фильтры и операторы
|
||||
|
||||
Вы можете уточнять выдачу с помощью операторов:
|
||||
|
||||
| Фильтр | Назначение | Пример |
|
||||
|---|---|---|
|
||||
| `type:video` | Показывать только видеоролики и WebM | `cat type:video` |
|
||||
| `type:image` | Показывать только статичные изображения | `landscape type:image` |
|
||||
| `rating:safe` | Только безопасный контент (SFW) | `wallpaper rating:safe` |
|
||||
| `rating:explicit` | Контент 18+ | `rating:explicit` |
|
||||
| `score:>50` | Работы с рейтингом выше 50 лайков | `dragon score:>100` |
|
||||
| `-tag` | Исключить тег из результатов | `solo -comic` |
|
||||
@@ -0,0 +1,16 @@
|
||||
### 🌙 Lunaris Wiki
|
||||
|
||||
- **[Главная](Home)**
|
||||
- **[Быстрый старт и установка](Getting-Started)**
|
||||
- **[Провайдеры контента](Providers)**
|
||||
- **[Умный поиск и теги](Search-and-Tags)**
|
||||
- **[Интеграция и синхронизация с Pawchive](Pawchive-Sync)**
|
||||
- **[Медиаплеер и просмотр](Media-Viewer)**
|
||||
- **[Офлайн-режим и загрузки](Offline-and-Downloads)**
|
||||
- **[Черный список и фильтрация](Safety-and-Blacklist)**
|
||||
- **[Частые вопросы (FAQ)](FAQ)**
|
||||
|
||||
---
|
||||
|
||||
**[Скачать Lunaris](https://github.com/RarDog/Lunaris/releases)**
|
||||
**[Репозиторий GitHub](https://github.com/RarDog/Lunaris)**
|
||||
@@ -1,3 +1,3 @@
|
||||
const appDisplayVersion = '2.3.1';
|
||||
const appBuildNumber = 41;
|
||||
const appDisplayVersion = '3.1.5';
|
||||
const appBuildNumber = 66;
|
||||
const appReleaseChannel = 'Stable';
|
||||
|
||||
+137
-4
@@ -1,4 +1,137 @@
|
||||
const lunarisChangelog = [
|
||||
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 и бэкапа',
|
||||
bullets: [
|
||||
'Оптимальная позиция кнопки настроек: парящая стеклянная кнопка опущена прямо к нижней навигационной панели, без избыточного завышения над карточками контента.',
|
||||
'Полная видимость кнопок JSON и бэкапа: добавлен увеличенный нижний отступ прокрутки в настройках, чтобы панель навигации не перекрывала кнопки при скролле до конца.',
|
||||
'Улучшенный дизайн и сетка кнопок экспорта/импорта: кнопки бэкапа и JSON организованы в симметричные аккуратные строки с яркими акцентными бейджами.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.0.8',
|
||||
title: 'iPhone Liquid Glass — раздел «Настройки» и парящая стеклянная кнопка',
|
||||
bullets: [
|
||||
'Парящая стеклянная кнопка настроек (Liquid Glass Floating Button): круглая сфера из матового стекла с эффектом BackdropFilter blur, зеркальным радиальным градиентом, подсветкой ободка, пружинящей анимацией масштабирования и вращения при нажатии.',
|
||||
'Карточки настроек в стиле Liquid Glass (1:1 iOS): группы настроек переработаны в матовые стеклянные карточки с мягким градиентом, зеркальной рамкой и многослойными тенями глубины.',
|
||||
'Иконки разделов и пунктов в стиле iOS: яркие сквиркл-бейджи с акцентными градиентами, мягким свечением и четкими белыми иконками, как в нативных настройках iPhone.',
|
||||
'Стеклянная быстрая навигация по категориям: зафиксированная панель категорий с размытием фона и тактильным откликом при переключении разделов.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.0.7',
|
||||
title: 'Liquid Glass Navigation Bar — парящая стеклянная панель и анимированная пилюля',
|
||||
bullets: [
|
||||
'Парящая панель Liquid Glass: нижняя панель навигации преобразована в парящий стеклянный док со скруглением, полупрозрачным градиентом и размытием фона (BackdropFilter blur).',
|
||||
'Плавающая пилюля-индикатор (Liquid Pill): плавный анимированный бегунок перетекает под активную вкладку со сглаженной пружинящей физикой (easeOutBack).',
|
||||
'Микроанимации нажатия и тактильный отклик: иконки мягко сжимаются при тапе и отпружинивают назад с легким тактильным виброоткликом (Haptic Feedback).',
|
||||
'Глубина контента: контент ленты, поиска и галереи плавно просвечивает и размывается под стеклянной панелью при прокрутке.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.0.6',
|
||||
title: 'Улучшение недавних запросов и отображения тегов',
|
||||
bullets: [
|
||||
'Полная видимость тегов и запросов: сняты тесные ограничения ширины (140px), теги и поисковые запросы теперь отображаются целиком без усечения.',
|
||||
'Устранение дубликатов в истории: автоматическая дедупликация поисковых запросов в базе данных и интерфейсе. Устранены повторяющиеся пары запросов с пустыми счетчиками.',
|
||||
'Исправление заголовка карточки поиска: заголовок «Недавние запросы» и счетчик больше не обрезаются на экранах смартфонов.',
|
||||
'Удобное удаление: увеличенная область нажатия для кнопки удаления (крестика) предотвращает случайные нажатия на сам запрос.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.0.5',
|
||||
title: 'Интерактивные ссылки на соцсети и авторов в объявлениях и описаниях',
|
||||
bullets: [
|
||||
'Кликабельные ссылки в объявлениях автора и описании постов: все URL в тексте подсвечиваются и открываются во внешнем браузере по клику.',
|
||||
'Красивые бейджи соцсетей (CreatorLinkChips): автоматическое распознавание и стилизация ссылок на YouTube, X (Twitter), Instagram, TikTok, Discord, Patreon, Fanbox, Fantia, Boosty, Pixiv, Twitch, Telegram, Gumroad и другие платформы с фирменными иконками и цветами.',
|
||||
'Корректная очистка пунктуации: знаки препинания в конце URL (!, ?, :, ., ,, ;, >) больше не ломают ссылки.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.0.0',
|
||||
title: 'Lunaris 3.0 — Глобальное обновление: Дизайн 2.0, Интеграция Pawchive и умная синхронизация',
|
||||
bullets: [
|
||||
'Дизайн 2.0 (Modern Booru Experience): обновлённый современный интерфейс в стиле Material 3, адаптивные сетки галереи (Masonry / Staggered), улучшенная типографика и плавные микроанимации.',
|
||||
'Полноэкранный видеоплеер нового поколения: умный автоматический поворот экрана в ландшафтную ориентацию для горизонтальных видео и быстрый ручной переключатель ориентации в одно касание.',
|
||||
'Новая архитектура поиска (OverlayPortal): подсказки тегов отображаются через нативный портал Flutter без блокировки кнопок панели, очистки и сброса фильтров.',
|
||||
'Pawchive 2.0 & Двусторонняя синхронизация: подключение аккаунтов через логин/пароль или Session Cookie, импорт избранного с сервера, экспорт локальных коллекций в аккаунт на сервере и сквозная синхронизация со всех поддерживаемых платформ.',
|
||||
'Ленивое автоопределение разрешения: фоновый декодер автоматически рассчитывает и выводит точные размеры медиа (например, 1920 × 1080) для постов Pawchive без серверных метаданных.',
|
||||
'Умные per-ABI обновления: автообновление через GitHub скачивает точный APK под архитектуру вашего процессора (arm64-v8a, armeabi-v7a, x86_64), сокращая вес загрузки.',
|
||||
'Исправление вёрстки: устранены переносы текста в заголовке окна аккаунтов и карточках пользователей на экранах смартфонов.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '2.3.10',
|
||||
title: 'Выгрузка локального избранного в Pawchive и двусторонняя синхронизация',
|
||||
bullets: [
|
||||
'Экспорт локального избранного: добавлена возможность выгрузить всех ваших локальных авторов из приложения прямо в аккаунт Pawchive на сервере в 1 клик.',
|
||||
'Двусторонняя синхронизация: переключатель двусторонней синхронизации объединяет коллекции — скачивает новых авторов с сервера и отправляет локальных на сервер Pawchive.',
|
||||
'Кнопка выгрузки в карточке аккаунта: быстрая кнопка со стрелкой вверх и пункт контекстного меню «Выгрузить в Pawchive» для любого подключённого аккаунта.',
|
||||
'Синхронизация в реальном времени с любых провайдеров: при добавлении автора в избранное в лентах Kemono, Coomer или Pawchive изменение мгновенно передаётся на сервер Pawchive.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '2.3.9',
|
||||
title: 'Исправление входа и синхронизации аккаунтов Pawchive',
|
||||
@@ -13,7 +146,7 @@ const lunarisChangelog = [
|
||||
title: 'ABI-Aware Auto-Update — правильный APK для вашего процессора',
|
||||
bullets: [
|
||||
'Определение архитектуры Android: приложение читает Build.SUPPORTED_ABIS (arm64-v8a, armeabi-v7a, x86_64) через нативный канал.',
|
||||
'Точный APK из Gitea: при обновлении скачивается per-ABI APK (app-arm64-v8a-release.apk и т.д.), а не один общий файл.',
|
||||
'Точный APK из GitHub: при обновлении скачивается per-ABI APK (app-arm64-v8a-release.apk и т.д.), а не один общий файл.',
|
||||
'Fallback: нет per-ABI APK → универсальный APK → страница релиза в браузере.',
|
||||
'Кеш ABI: архитектура определяется один раз за сеанс.',
|
||||
],
|
||||
@@ -140,7 +273,7 @@ const lunarisChangelog = [
|
||||
'Instant Segmented Controls: replaced tedious dropdowns with fast 1-tap SegmentedButtons for Theme (Dark/Light/Auto), Language (RU/EN), and Media Quality (Auto/Data saver/HQ).',
|
||||
'Folder Structure Bottom Sheet: intuitive download directory template picker with preset chips and custom pattern editor.',
|
||||
'Interactive Stepper & Limit Controls: modernized desktop & mobile column steppers and disk cache limits with accent pill badges.',
|
||||
'Hero Brand Banner: polished app presentation card in About section with glowing icon, version build badge, update checker, and Gitea repository link.',
|
||||
'Hero Brand Banner: polished app presentation card in About section with glowing icon, version build badge, update checker, and GitHub repository link.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
@@ -278,7 +411,7 @@ const lunarisChangelog = [
|
||||
'Added favorite artists bar at the top of the Artists tab with quick access and recent photos/videos stream.',
|
||||
'Multi-image posts now feature an in-post navigation indicator with image switching.',
|
||||
'New Pawchive provider support and cleaned up deprecated providers.',
|
||||
'In-app update checks and downloads connected directly to RarDog Gitea releases.',
|
||||
'In-app update checks and downloads connected directly to RarDog GitHub releases.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
@@ -346,7 +479,7 @@ const lunarisChangelog = [
|
||||
version: '1.0.1',
|
||||
title: 'Mobile polish',
|
||||
bullets: [
|
||||
'Startup update checks now look for new Gitea releases every launch.',
|
||||
'Startup update checks now look for new GitHub releases every launch.',
|
||||
'Refresh-rate controls are Android-only; desktop keeps stable app motion.',
|
||||
'Tag chip input no longer jumps while typing.',
|
||||
],
|
||||
|
||||
@@ -8,6 +8,7 @@ export 'models/artist_tag.dart';
|
||||
export 'models/artist_link.dart';
|
||||
export 'models/artist_announcement.dart';
|
||||
export 'models/cloud_media_link.dart';
|
||||
export 'models/creator_link.dart';
|
||||
export 'models/download_task.dart';
|
||||
export 'models/downloaded_media.dart';
|
||||
export 'models/favorite.dart';
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum CreatorLinkType {
|
||||
youtube,
|
||||
twitter,
|
||||
instagram,
|
||||
tiktok,
|
||||
discord,
|
||||
pixiv,
|
||||
fanbox,
|
||||
patreon,
|
||||
fantia,
|
||||
boosty,
|
||||
twitch,
|
||||
telegram,
|
||||
gumroad,
|
||||
subscribestar,
|
||||
artstation,
|
||||
deviantart,
|
||||
linkhub,
|
||||
other,
|
||||
}
|
||||
|
||||
class CreatorLink {
|
||||
const CreatorLink({
|
||||
required this.url,
|
||||
required this.type,
|
||||
required this.title,
|
||||
this.customLabel,
|
||||
});
|
||||
|
||||
final String url;
|
||||
final CreatorLinkType type;
|
||||
final String title;
|
||||
final String? customLabel;
|
||||
|
||||
String get serviceName {
|
||||
switch (type) {
|
||||
case CreatorLinkType.youtube:
|
||||
return 'YouTube';
|
||||
case CreatorLinkType.twitter:
|
||||
return 'X (Twitter)';
|
||||
case CreatorLinkType.instagram:
|
||||
return 'Instagram';
|
||||
case CreatorLinkType.tiktok:
|
||||
return 'TikTok';
|
||||
case CreatorLinkType.discord:
|
||||
return 'Discord';
|
||||
case CreatorLinkType.pixiv:
|
||||
return 'Pixiv';
|
||||
case CreatorLinkType.fanbox:
|
||||
return 'Fanbox';
|
||||
case CreatorLinkType.patreon:
|
||||
return 'Patreon';
|
||||
case CreatorLinkType.fantia:
|
||||
return 'Fantia';
|
||||
case CreatorLinkType.boosty:
|
||||
return 'Boosty';
|
||||
case CreatorLinkType.twitch:
|
||||
return 'Twitch';
|
||||
case CreatorLinkType.telegram:
|
||||
return 'Telegram';
|
||||
case CreatorLinkType.gumroad:
|
||||
return 'Gumroad';
|
||||
case CreatorLinkType.subscribestar:
|
||||
return 'SubscribeStar';
|
||||
case CreatorLinkType.artstation:
|
||||
return 'ArtStation';
|
||||
case CreatorLinkType.deviantart:
|
||||
return 'DeviantArt';
|
||||
case CreatorLinkType.linkhub:
|
||||
return 'Links Hub';
|
||||
case CreatorLinkType.other:
|
||||
return title.isNotEmpty ? title : 'Web Link';
|
||||
}
|
||||
}
|
||||
|
||||
Color get brandColor {
|
||||
switch (type) {
|
||||
case CreatorLinkType.youtube:
|
||||
return const Color(0xFFFF0000); // YouTube Red
|
||||
case CreatorLinkType.twitter:
|
||||
return const Color(0xFF1D9BF0); // Twitter Blue
|
||||
case CreatorLinkType.instagram:
|
||||
return const Color(0xFFE1306C); // Instagram Gradient Magenta
|
||||
case CreatorLinkType.tiktok:
|
||||
return const Color(0xFF00F2FE); // TikTok Cyan
|
||||
case CreatorLinkType.discord:
|
||||
return const Color(0xFF5865F2); // Discord Blurple
|
||||
case CreatorLinkType.pixiv:
|
||||
return const Color(0xFF0096FA); // Pixiv Blue
|
||||
case CreatorLinkType.fanbox:
|
||||
return const Color(0xFFF1A12F); // Fanbox Orange
|
||||
case CreatorLinkType.patreon:
|
||||
return const Color(0xFFFF424D); // Patreon Coral
|
||||
case CreatorLinkType.fantia:
|
||||
return const Color(0xFFE0245E); // Fantia Pink
|
||||
case CreatorLinkType.boosty:
|
||||
return const Color(0xFFF15A24); // Boosty Orange
|
||||
case CreatorLinkType.twitch:
|
||||
return const Color(0xFF9146FF); // Twitch Purple
|
||||
case CreatorLinkType.telegram:
|
||||
return const Color(0xFF2AABEE); // Telegram Blue
|
||||
case CreatorLinkType.gumroad:
|
||||
return const Color(0xFFFF90E8); // Gumroad Pink
|
||||
case CreatorLinkType.subscribestar:
|
||||
return const Color(0xFF00ADB5); // SubscribeStar Teal
|
||||
case CreatorLinkType.artstation:
|
||||
return const Color(0xFF13AFF0); // ArtStation Blue
|
||||
case CreatorLinkType.deviantart:
|
||||
return const Color(0xFF05CC47); // DeviantArt Green
|
||||
case CreatorLinkType.linkhub:
|
||||
return const Color(0xFF43E660); // Linktree Green
|
||||
case CreatorLinkType.other:
|
||||
return const Color(0xFF5C6BC0); // Indigo
|
||||
}
|
||||
}
|
||||
|
||||
IconData get iconData {
|
||||
switch (type) {
|
||||
case CreatorLinkType.youtube:
|
||||
return Icons.smart_display_rounded;
|
||||
case CreatorLinkType.twitter:
|
||||
return Icons.alternate_email_rounded;
|
||||
case CreatorLinkType.instagram:
|
||||
return Icons.camera_alt_rounded;
|
||||
case CreatorLinkType.tiktok:
|
||||
return Icons.music_note_rounded;
|
||||
case CreatorLinkType.discord:
|
||||
return Icons.forum_rounded;
|
||||
case CreatorLinkType.pixiv:
|
||||
return Icons.palette_rounded;
|
||||
case CreatorLinkType.fanbox:
|
||||
return Icons.favorite_rounded;
|
||||
case CreatorLinkType.patreon:
|
||||
return Icons.volunteer_activism_rounded;
|
||||
case CreatorLinkType.fantia:
|
||||
return Icons.stars_rounded;
|
||||
case CreatorLinkType.boosty:
|
||||
return Icons.rocket_launch_rounded;
|
||||
case CreatorLinkType.twitch:
|
||||
return Icons.live_tv_rounded;
|
||||
case CreatorLinkType.telegram:
|
||||
return Icons.send_rounded;
|
||||
case CreatorLinkType.gumroad:
|
||||
return Icons.shopping_bag_rounded;
|
||||
case CreatorLinkType.subscribestar:
|
||||
return Icons.star_rounded;
|
||||
case CreatorLinkType.artstation:
|
||||
case CreatorLinkType.deviantart:
|
||||
return Icons.brush_rounded;
|
||||
case CreatorLinkType.linkhub:
|
||||
return Icons.link_rounded;
|
||||
case CreatorLinkType.other:
|
||||
return Icons.language_rounded;
|
||||
}
|
||||
}
|
||||
|
||||
static final _urlRegex = RegExp(
|
||||
r'''https?://[^\s<>"{}|\\^`\[\]]+''',
|
||||
caseSensitive: false,
|
||||
);
|
||||
|
||||
static final _htmlLinkRegex = RegExp(
|
||||
r"""<a\s+[^>]*href=["']([^"']+)["'][^>]*>(.*?)</a>""",
|
||||
caseSensitive: false,
|
||||
dotAll: true,
|
||||
);
|
||||
|
||||
static const _cloudDriveHosts = {
|
||||
'drive.google.com',
|
||||
'mega.nz',
|
||||
'mega.co.nz',
|
||||
'dropbox.com',
|
||||
'pixeldrain.com',
|
||||
'mediafire.com',
|
||||
'catbox.moe',
|
||||
'bunkr.',
|
||||
'gofile.io',
|
||||
'terabox.com',
|
||||
'1024tera.com',
|
||||
'dubox.com',
|
||||
};
|
||||
|
||||
/// Extracts all social media, creator profiles and external web links from text.
|
||||
static List<CreatorLink> extractLinks(
|
||||
String? text, {
|
||||
bool excludeCloudDrives = true,
|
||||
}) {
|
||||
if (text == null || text.trim().isEmpty) return const [];
|
||||
final results = <CreatorLink>[];
|
||||
final seenUrls = <String>{};
|
||||
|
||||
void processUrl(String rawUrl, {String? customTitle}) {
|
||||
var url = rawUrl.trim();
|
||||
while (url.isNotEmpty &&
|
||||
(url.endsWith(')') ||
|
||||
url.endsWith('.') ||
|
||||
url.endsWith(',') ||
|
||||
url.endsWith(';') ||
|
||||
url.endsWith('!') ||
|
||||
url.endsWith('?') ||
|
||||
url.endsWith(':') ||
|
||||
url.endsWith('>'))) {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri == null || !uri.hasScheme || !uri.scheme.startsWith('http')) {
|
||||
return;
|
||||
}
|
||||
if (seenUrls.contains(url)) return;
|
||||
seenUrls.add(url);
|
||||
|
||||
final host = uri.host.toLowerCase();
|
||||
if (excludeCloudDrives) {
|
||||
if (_cloudDriveHosts.any((ch) => host.contains(ch))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final (type, defaultTitle) = _classifyHost(uri);
|
||||
results.add(CreatorLink(
|
||||
url: url,
|
||||
type: type,
|
||||
title: (customTitle != null && customTitle.isNotEmpty && customTitle != url)
|
||||
? customTitle
|
||||
: defaultTitle,
|
||||
));
|
||||
}
|
||||
|
||||
// 1. Process HTML anchors
|
||||
if (text.contains('<a ')) {
|
||||
for (final match in _htmlLinkRegex.allMatches(text)) {
|
||||
final href = match.group(1);
|
||||
final rawTitle = match.group(2);
|
||||
final cleanTitle =
|
||||
rawTitle?.replaceAll(RegExp(r'<[^>]*>'), '').trim() ?? '';
|
||||
if (href != null && href.isNotEmpty) {
|
||||
processUrl(href, customTitle: cleanTitle.isNotEmpty ? cleanTitle : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Process all plain URLs
|
||||
for (final match in _urlRegex.allMatches(text)) {
|
||||
final url = match.group(0);
|
||||
if (url != null) processUrl(url);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
static (CreatorLinkType, String) _classifyHost(Uri uri) {
|
||||
final host = uri.host.toLowerCase();
|
||||
|
||||
// YouTube
|
||||
if (host.contains('youtube.com') || host.contains('youtu.be')) {
|
||||
return (CreatorLinkType.youtube, 'YouTube');
|
||||
}
|
||||
// X / Twitter
|
||||
if (host.contains('twitter.com') || host.contains('x.com') || host == 't.co') {
|
||||
return (CreatorLinkType.twitter, 'X (Twitter)');
|
||||
}
|
||||
// Instagram
|
||||
if (host.contains('instagram.com') || host.contains('instagr.am')) {
|
||||
return (CreatorLinkType.instagram, 'Instagram');
|
||||
}
|
||||
// TikTok
|
||||
if (host.contains('tiktok.com')) {
|
||||
return (CreatorLinkType.tiktok, 'TikTok');
|
||||
}
|
||||
// Discord
|
||||
if (host.contains('discord.gg') || host.contains('discord.com')) {
|
||||
return (CreatorLinkType.discord, 'Discord');
|
||||
}
|
||||
// Pixiv
|
||||
if (host.contains('pixiv.net')) {
|
||||
return (CreatorLinkType.pixiv, 'Pixiv');
|
||||
}
|
||||
// Fanbox
|
||||
if (host.contains('fanbox.cc')) {
|
||||
return (CreatorLinkType.fanbox, 'Fanbox');
|
||||
}
|
||||
// Patreon
|
||||
if (host.contains('patreon.com')) {
|
||||
return (CreatorLinkType.patreon, 'Patreon');
|
||||
}
|
||||
// Fantia
|
||||
if (host.contains('fantia.jp')) {
|
||||
return (CreatorLinkType.fantia, 'Fantia');
|
||||
}
|
||||
// Boosty
|
||||
if (host.contains('boosty.to')) {
|
||||
return (CreatorLinkType.boosty, 'Boosty');
|
||||
}
|
||||
// Twitch
|
||||
if (host.contains('twitch.tv')) {
|
||||
return (CreatorLinkType.twitch, 'Twitch');
|
||||
}
|
||||
// Telegram
|
||||
if (host.contains('t.me') || host.contains('telegram.me')) {
|
||||
return (CreatorLinkType.telegram, 'Telegram');
|
||||
}
|
||||
// Gumroad
|
||||
if (host.contains('gumroad.com')) {
|
||||
return (CreatorLinkType.gumroad, 'Gumroad');
|
||||
}
|
||||
// SubscribeStar
|
||||
if (host.contains('subscribestar.adult') || host.contains('subscribestar.com')) {
|
||||
return (CreatorLinkType.subscribestar, 'SubscribeStar');
|
||||
}
|
||||
// ArtStation
|
||||
if (host.contains('artstation.com')) {
|
||||
return (CreatorLinkType.artstation, 'ArtStation');
|
||||
}
|
||||
// DeviantArt
|
||||
if (host.contains('deviantart.com')) {
|
||||
return (CreatorLinkType.deviantart, 'DeviantArt');
|
||||
}
|
||||
// Link hubs
|
||||
if (host.contains('linktr.ee') || host.contains('carrd.co') || host.contains('lit.link')) {
|
||||
return (CreatorLinkType.linkhub, 'Links Hub');
|
||||
}
|
||||
|
||||
// Default clean host name
|
||||
var cleanHost = host.replaceFirst(RegExp(r'^www\.'), '');
|
||||
if (cleanHost.length > 25) {
|
||||
cleanHost = cleanHost.substring(0, 25);
|
||||
}
|
||||
return (CreatorLinkType.other, cleanHost.isNotEmpty ? cleanHost : 'Web Link');
|
||||
}
|
||||
}
|
||||
@@ -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') {
|
||||
|
||||
@@ -12,6 +12,15 @@ class SearchRepository {
|
||||
|
||||
Future<Result<void>> save(SearchHistory history, {int maxItems = 500}) {
|
||||
return _databaseService.safeWrite((isar) async {
|
||||
final norm = history.query.trim().toLowerCase();
|
||||
// Remove any existing duplicate records with same query
|
||||
final all = await isar.searchHistoryEntitys.where().findAll();
|
||||
for (final item in all) {
|
||||
if (item.query.trim().toLowerCase() == norm) {
|
||||
await isar.searchHistoryEntitys.delete(item.isarId);
|
||||
}
|
||||
}
|
||||
|
||||
await isar.searchHistoryEntitys.put(
|
||||
SearchHistoryEntity()
|
||||
..historyId = history.id
|
||||
@@ -42,13 +51,40 @@ class SearchRepository {
|
||||
return _databaseService.safeRead((isar) async {
|
||||
final items = await isar.searchHistoryEntitys.where().findAll();
|
||||
items.sort((a, b) => b.searchedAt.compareTo(a.searchedAt));
|
||||
final limited = limit == null ? items : items.take(limit);
|
||||
|
||||
final seen = <String>{};
|
||||
final deduplicated = <SearchHistoryEntity>[];
|
||||
for (final item in items) {
|
||||
final key = item.query.trim().toLowerCase();
|
||||
if (key.isEmpty) continue;
|
||||
if (seen.add(key)) {
|
||||
deduplicated.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
final limited = limit == null ? deduplicated : deduplicated.take(limit);
|
||||
return limited.map((entity) => entity.toModel()).toList();
|
||||
});
|
||||
}
|
||||
|
||||
Future<Result<bool>> delete(String historyId) {
|
||||
return _databaseService.safeWrite((isar) async {
|
||||
final target = await isar.searchHistoryEntitys
|
||||
.where()
|
||||
.filter()
|
||||
.historyIdEqualTo(historyId)
|
||||
.findFirst();
|
||||
if (target != null) {
|
||||
final norm = target.query.trim().toLowerCase();
|
||||
final all = await isar.searchHistoryEntitys.where().findAll();
|
||||
for (final item in all) {
|
||||
if (item.query.trim().toLowerCase() == norm ||
|
||||
item.historyId == historyId) {
|
||||
await isar.searchHistoryEntitys.delete(item.isarId);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return await isar.searchHistoryEntitys.deleteByHistoryId(historyId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,12 +16,32 @@ class PawchiveSyncResult {
|
||||
required this.updatedSettings,
|
||||
required this.newlyAddedToLocal,
|
||||
required this.totalSyncedCount,
|
||||
this.pushedToRemoteCount = 0,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
final AppSettings updatedSettings;
|
||||
final int newlyAddedToLocal;
|
||||
final int totalSyncedCount;
|
||||
final int pushedToRemoteCount;
|
||||
final String? errorMessage;
|
||||
|
||||
bool get isSuccess => errorMessage == null;
|
||||
}
|
||||
|
||||
class PawchivePushResult {
|
||||
const PawchivePushResult({
|
||||
required this.pushedCount,
|
||||
required this.totalRemoteCount,
|
||||
required this.totalLocalCandidates,
|
||||
this.updatedSettings,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
final int pushedCount;
|
||||
final int totalRemoteCount;
|
||||
final int totalLocalCandidates;
|
||||
final AppSettings? updatedSettings;
|
||||
final String? errorMessage;
|
||||
|
||||
bool get isSuccess => errorMessage == null;
|
||||
@@ -249,10 +269,12 @@ class PawchiveSyncService {
|
||||
}
|
||||
|
||||
/// Synchronizes a specific Pawchive account with current local AppSettings.
|
||||
/// If [pushLocalPawchiveArtists] is true (or [settings.pawchiveBidirectionalSync] is enabled),
|
||||
/// local favorites are also pushed to the Pawchive server.
|
||||
Future<PawchiveSyncResult> syncAccountFavorites({
|
||||
required PawchiveAccount account,
|
||||
required AppSettings settings,
|
||||
bool pushLocalPawchiveArtists = false,
|
||||
bool? pushLocalPawchiveArtists,
|
||||
}) async {
|
||||
try {
|
||||
final remoteArtists = await fetchRemoteFavoriteArtists(
|
||||
@@ -262,40 +284,57 @@ class PawchiveSyncService {
|
||||
|
||||
final currentFavorites = List<String>.from(settings.favoriteArtists);
|
||||
final existingKeys = <String>{};
|
||||
final existingServiceId = <String>{};
|
||||
for (final raw in currentFavorites) {
|
||||
try {
|
||||
final parsed = FavoriteArtistItem.fromJson(
|
||||
jsonDecode(raw) as Map<String, dynamic>,
|
||||
);
|
||||
existingKeys.add(parsed.key);
|
||||
if (parsed.service.isNotEmpty && parsed.id.isNotEmpty) {
|
||||
existingServiceId.add('${parsed.service}:${parsed.id}'.toLowerCase());
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
var addedCount = 0;
|
||||
for (final artist in remoteArtists) {
|
||||
if (!existingKeys.contains(artist.key)) {
|
||||
final pair = '${artist.service}:${artist.id}'.toLowerCase();
|
||||
if (!existingKeys.contains(artist.key) && !existingServiceId.contains(pair)) {
|
||||
currentFavorites.insert(0, jsonEncode(artist.toJson()));
|
||||
existingKeys.add(artist.key);
|
||||
existingServiceId.add(pair);
|
||||
addedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Optionally push local Pawchive artists to remote
|
||||
if (pushLocalPawchiveArtists) {
|
||||
final remoteKeys = remoteArtists.map((a) => a.key).toSet();
|
||||
var pushedCount = 0;
|
||||
final shouldPush =
|
||||
pushLocalPawchiveArtists ?? settings.pawchiveBidirectionalSync;
|
||||
if (shouldPush) {
|
||||
final remotePairSet = remoteArtists
|
||||
.map((a) => '${a.service}:${a.id}'.toLowerCase())
|
||||
.toSet();
|
||||
|
||||
for (final raw in currentFavorites) {
|
||||
try {
|
||||
final parsed = FavoriteArtistItem.fromJson(
|
||||
jsonDecode(raw) as Map<String, dynamic>,
|
||||
);
|
||||
if (parsed.providerId == 'pawchive' &&
|
||||
!remoteKeys.contains(parsed.key)) {
|
||||
await toggleRemoteFavorite(
|
||||
account: account,
|
||||
service: parsed.service,
|
||||
artistId: parsed.id,
|
||||
isFavorite: true,
|
||||
);
|
||||
if (parsed.service.isNotEmpty && parsed.id.isNotEmpty) {
|
||||
final pair = '${parsed.service}:${parsed.id}'.toLowerCase();
|
||||
if (!remotePairSet.contains(pair)) {
|
||||
final ok = await toggleRemoteFavorite(
|
||||
account: account,
|
||||
service: parsed.service,
|
||||
artistId: parsed.id,
|
||||
isFavorite: true,
|
||||
);
|
||||
if (ok) {
|
||||
pushedCount++;
|
||||
remotePairSet.add(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
@@ -304,7 +343,7 @@ class PawchiveSyncService {
|
||||
// Update account sync stats in settings
|
||||
final updatedAccount = account.copyWith(
|
||||
lastSyncedAt: DateTime.now(),
|
||||
syncedArtistsCount: remoteArtists.length,
|
||||
syncedArtistsCount: remoteArtists.length + pushedCount,
|
||||
);
|
||||
|
||||
final updatedAccountsList = settings.parsedPawchiveAccounts.map((a) {
|
||||
@@ -320,45 +359,125 @@ class PawchiveSyncService {
|
||||
return PawchiveSyncResult(
|
||||
updatedSettings: newSettings,
|
||||
newlyAddedToLocal: addedCount,
|
||||
totalSyncedCount: remoteArtists.length,
|
||||
pushedToRemoteCount: pushedCount,
|
||||
totalSyncedCount: remoteArtists.length + pushedCount,
|
||||
);
|
||||
} catch (e) {
|
||||
return PawchiveSyncResult(
|
||||
updatedSettings: settings,
|
||||
newlyAddedToLocal: 0,
|
||||
pushedToRemoteCount: 0,
|
||||
totalSyncedCount: 0,
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Explicitly pushes all local favorite artists into a specified Pawchive account.
|
||||
Future<PawchivePushResult> pushLocalFavoritesToAccount({
|
||||
required PawchiveAccount account,
|
||||
required AppSettings settings,
|
||||
}) async {
|
||||
try {
|
||||
final remoteArtists = await fetchRemoteFavoriteArtists(
|
||||
baseUrl: account.baseUrl,
|
||||
sessionCookie: account.sessionCookie,
|
||||
);
|
||||
|
||||
final remotePairSet = remoteArtists
|
||||
.map((a) => '${a.service}:${a.id}'.toLowerCase())
|
||||
.toSet();
|
||||
|
||||
var pushedCount = 0;
|
||||
var totalLocalCandidates = 0;
|
||||
|
||||
for (final raw in settings.favoriteArtists) {
|
||||
try {
|
||||
final parsed = FavoriteArtistItem.fromJson(
|
||||
jsonDecode(raw) as Map<String, dynamic>,
|
||||
);
|
||||
if (parsed.service.isNotEmpty && parsed.id.isNotEmpty) {
|
||||
totalLocalCandidates++;
|
||||
final pair = '${parsed.service}:${parsed.id}'.toLowerCase();
|
||||
if (!remotePairSet.contains(pair)) {
|
||||
final ok = await toggleRemoteFavorite(
|
||||
account: account,
|
||||
service: parsed.service,
|
||||
artistId: parsed.id,
|
||||
isFavorite: true,
|
||||
);
|
||||
if (ok) {
|
||||
pushedCount++;
|
||||
remotePairSet.add(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
final updatedAccount = account.copyWith(
|
||||
lastSyncedAt: DateTime.now(),
|
||||
syncedArtistsCount: remoteArtists.length + pushedCount,
|
||||
);
|
||||
|
||||
final updatedAccountsList = settings.parsedPawchiveAccounts.map((a) {
|
||||
return a.id == updatedAccount.id ? updatedAccount : a;
|
||||
}).toList();
|
||||
|
||||
final newSettings = settings.copyWith(
|
||||
pawchiveAccounts:
|
||||
updatedAccountsList.map((a) => jsonEncode(a.toJson())).toList(),
|
||||
);
|
||||
|
||||
return PawchivePushResult(
|
||||
pushedCount: pushedCount,
|
||||
totalRemoteCount: remoteArtists.length + pushedCount,
|
||||
totalLocalCandidates: totalLocalCandidates,
|
||||
updatedSettings: newSettings,
|
||||
);
|
||||
} catch (e) {
|
||||
return PawchivePushResult(
|
||||
pushedCount: 0,
|
||||
totalRemoteCount: 0,
|
||||
totalLocalCandidates: 0,
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Synchronizes ALL connected Pawchive accounts with local AppSettings.
|
||||
Future<PawchiveSyncResult> syncAllAccounts({
|
||||
required AppSettings settings,
|
||||
bool? pushLocalArtists,
|
||||
}) async {
|
||||
final accounts = settings.parsedPawchiveAccounts;
|
||||
if (accounts.isEmpty) {
|
||||
return PawchiveSyncResult(
|
||||
updatedSettings: settings,
|
||||
newlyAddedToLocal: 0,
|
||||
pushedToRemoteCount: 0,
|
||||
totalSyncedCount: 0,
|
||||
errorMessage: 'Нет добавленных аккаунтов Pawchive',
|
||||
);
|
||||
}
|
||||
|
||||
final doPush = pushLocalArtists ?? settings.pawchiveBidirectionalSync;
|
||||
var runningSettings = settings;
|
||||
var totalAdded = 0;
|
||||
var totalSynced = 0;
|
||||
var totalPushed = 0;
|
||||
String? firstError;
|
||||
|
||||
for (final account in accounts) {
|
||||
final res = await syncAccountFavorites(
|
||||
account: account,
|
||||
settings: runningSettings,
|
||||
pushLocalPawchiveArtists: doPush,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
runningSettings = res.updatedSettings;
|
||||
totalAdded += res.newlyAddedToLocal;
|
||||
totalPushed += res.pushedToRemoteCount;
|
||||
totalSynced += res.totalSyncedCount;
|
||||
} else {
|
||||
firstError ??= res.errorMessage;
|
||||
@@ -368,6 +487,7 @@ class PawchiveSyncService {
|
||||
return PawchiveSyncResult(
|
||||
updatedSettings: runningSettings,
|
||||
newlyAddedToLocal: totalAdded,
|
||||
pushedToRemoteCount: totalPushed,
|
||||
totalSyncedCount: totalSynced,
|
||||
errorMessage: firstError,
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
@@ -51,6 +52,7 @@ class AppSettings {
|
||||
required this.lastFeedScrollOffset,
|
||||
this.favoriteArtists = const [],
|
||||
this.pawchiveAccounts = const [],
|
||||
this.pawchiveBidirectionalSync = false,
|
||||
this.skippedUpdateVersion,
|
||||
this.lastUpdateCheckAt,
|
||||
this.defaultRatingFilter,
|
||||
@@ -66,6 +68,7 @@ class AppSettings {
|
||||
|
||||
final List<String> favoriteArtists;
|
||||
final List<String> pawchiveAccounts;
|
||||
final bool pawchiveBidirectionalSync;
|
||||
final List<String> enabledProviderIds;
|
||||
final bool nsfwEnabled;
|
||||
final int cacheTtlHours;
|
||||
@@ -92,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;
|
||||
@@ -122,6 +126,7 @@ class AppSettings {
|
||||
providerPriority: {'gelbooru': 0, 'rule34': 1, 'realbooru': 2},
|
||||
favoriteArtists: [],
|
||||
pawchiveAccounts: [],
|
||||
pawchiveBidirectionalSync: false,
|
||||
themeMode: 'dark',
|
||||
languageCode: 'ru',
|
||||
appSeedColor: 0xFFE84D8A,
|
||||
@@ -143,6 +148,7 @@ class AppSettings {
|
||||
motionRefreshMode: 'auto',
|
||||
autoBatterySaver60Hz: true,
|
||||
videoPlayerMuted: false,
|
||||
videoPlayerVolume: 100.0,
|
||||
videoPlayerHalfVolume: false,
|
||||
videoPlayerLoop: false,
|
||||
videoPlayerCover: false,
|
||||
@@ -188,6 +194,7 @@ class AppSettings {
|
||||
String? motionRefreshMode,
|
||||
bool? autoBatterySaver60Hz,
|
||||
bool? videoPlayerMuted,
|
||||
double? videoPlayerVolume,
|
||||
bool? videoPlayerHalfVolume,
|
||||
bool? videoPlayerLoop,
|
||||
bool? videoPlayerCover,
|
||||
@@ -205,6 +212,7 @@ class AppSettings {
|
||||
bool clearLastFeedRating = false,
|
||||
List<String>? favoriteArtists,
|
||||
List<String>? pawchiveAccounts,
|
||||
bool? pawchiveBidirectionalSync,
|
||||
bool? amoledMode,
|
||||
bool? useDynamicColor,
|
||||
String? gridMode,
|
||||
@@ -216,6 +224,8 @@ class AppSettings {
|
||||
return AppSettings(
|
||||
favoriteArtists: favoriteArtists ?? this.favoriteArtists,
|
||||
pawchiveAccounts: pawchiveAccounts ?? this.pawchiveAccounts,
|
||||
pawchiveBidirectionalSync:
|
||||
pawchiveBidirectionalSync ?? this.pawchiveBidirectionalSync,
|
||||
enabledProviderIds: enabledProviderIds ?? this.enabledProviderIds,
|
||||
nsfwEnabled: nsfwEnabled ?? this.nsfwEnabled,
|
||||
cacheTtlHours: cacheTtlHours ?? this.cacheTtlHours,
|
||||
@@ -246,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,
|
||||
@@ -276,6 +287,7 @@ class AppSettings {
|
||||
Map<String, dynamic> toJson() => {
|
||||
'favoriteArtists': favoriteArtists,
|
||||
'pawchiveAccounts': pawchiveAccounts,
|
||||
'pawchiveBidirectionalSync': pawchiveBidirectionalSync,
|
||||
'enabledProviderIds': enabledProviderIds,
|
||||
'nsfwEnabled': nsfwEnabled,
|
||||
'cacheTtlHours': cacheTtlHours,
|
||||
@@ -302,6 +314,7 @@ class AppSettings {
|
||||
'motionRefreshMode': motionRefreshMode,
|
||||
'autoBatterySaver60Hz': autoBatterySaver60Hz,
|
||||
'videoPlayerMuted': videoPlayerMuted,
|
||||
'videoPlayerVolume': videoPlayerVolume,
|
||||
'videoPlayerHalfVolume': videoPlayerHalfVolume,
|
||||
'videoPlayerLoop': videoPlayerLoop,
|
||||
'videoPlayerCover': videoPlayerCover,
|
||||
@@ -385,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:
|
||||
@@ -421,6 +436,9 @@ class AppSettings {
|
||||
pawchiveAccounts: List<String>.from(
|
||||
(json['pawchiveAccounts'] as List?) ?? defaults.pawchiveAccounts,
|
||||
),
|
||||
pawchiveBidirectionalSync:
|
||||
(json['pawchiveBidirectionalSync'] as bool?) ??
|
||||
defaults.pawchiveBidirectionalSync,
|
||||
skippedUpdateVersion: json['skippedUpdateVersion'] as String?,
|
||||
lastUpdateCheckAt: json['lastUpdateCheckAt'] as String?,
|
||||
defaultRatingFilter: json['defaultRatingFilter'] as String?,
|
||||
@@ -591,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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,14 +9,27 @@ import '../../core/utils/result.dart';
|
||||
import '../models/app_update_info.dart';
|
||||
import 'settings_service.dart';
|
||||
|
||||
enum UpdateSource {
|
||||
gitea,
|
||||
github,
|
||||
}
|
||||
|
||||
class UpdateService {
|
||||
UpdateService(this._dio, this._settingsService);
|
||||
|
||||
static const latestReleaseUrl =
|
||||
static const giteaLatestReleaseUrl =
|
||||
'https://gitea.rardogsynapse.online/api/v1/repos/RarDog/Lunaris/releases/latest';
|
||||
static const releasesUrl =
|
||||
static const giteaReleasesUrl =
|
||||
'https://gitea.rardogsynapse.online/api/v1/repos/RarDog/Lunaris/releases';
|
||||
|
||||
static const githubLatestReleaseUrl =
|
||||
'https://api.github.com/repos/RarDog/Lunaris/releases/latest';
|
||||
static const githubReleasesUrl =
|
||||
'https://api.github.com/repos/RarDog/Lunaris/releases';
|
||||
|
||||
static const latestReleaseUrl = githubLatestReleaseUrl;
|
||||
static const releasesUrl = githubReleasesUrl;
|
||||
|
||||
static const _deviceChannel = MethodChannel('rulegel/device');
|
||||
|
||||
final Dio _dio;
|
||||
@@ -50,14 +63,17 @@ class UpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<Result<AppUpdateInfo?>> checkForUpdates({bool force = false}) async {
|
||||
Future<Result<AppUpdateInfo?>> checkForUpdates({
|
||||
bool force = false,
|
||||
UpdateSource source = UpdateSource.gitea,
|
||||
}) async {
|
||||
final settingsResult = await _settingsService.getSettings();
|
||||
final settings = settingsResult is Success<AppSettings>
|
||||
? settingsResult.data
|
||||
: AppSettings.defaults;
|
||||
|
||||
try {
|
||||
final info = await _latestAllowedRelease(settings);
|
||||
final info = await _latestAllowedRelease(settings, source: source);
|
||||
final nextSettings = settings.copyWith(
|
||||
lastUpdateCheckAt: DateTime.now().toIso8601String(),
|
||||
);
|
||||
@@ -81,10 +97,29 @@ class UpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<AppUpdateInfo> _latestAllowedRelease(AppSettings settings) async {
|
||||
Future<AppUpdateInfo> _latestAllowedRelease(
|
||||
AppSettings settings, {
|
||||
UpdateSource source = UpdateSource.gitea,
|
||||
}) async {
|
||||
final isGitea = source == UpdateSource.gitea;
|
||||
final rUrl = isGitea ? giteaReleasesUrl : githubReleasesUrl;
|
||||
final latestUrl = isGitea ? giteaLatestReleaseUrl : githubLatestReleaseUrl;
|
||||
|
||||
final options = Options(
|
||||
headers: isGitea
|
||||
? {
|
||||
'Authorization': 'token 1c744d6044d756759d7b1f693c94c80cf70d75fa',
|
||||
}
|
||||
: {
|
||||
'User-Agent': 'Lunaris-App',
|
||||
'Accept': 'application/vnd.github+json',
|
||||
},
|
||||
);
|
||||
|
||||
final response = await _dio.get<dynamic>(
|
||||
releasesUrl,
|
||||
queryParameters: {'limit': 30},
|
||||
rUrl,
|
||||
queryParameters: isGitea ? {'limit': 30} : {'per_page': 30},
|
||||
options: options,
|
||||
);
|
||||
final items = (response.data as List?) ?? const [];
|
||||
final releases = items
|
||||
@@ -95,7 +130,10 @@ class UpdateService {
|
||||
.map((item) => _releaseFromJson(Map<String, dynamic>.from(item)))
|
||||
.toList(growable: false);
|
||||
if (releases.isEmpty) {
|
||||
final latest = await _dio.get<dynamic>(latestReleaseUrl);
|
||||
final latest = await _dio.get<dynamic>(
|
||||
latestUrl,
|
||||
options: options,
|
||||
);
|
||||
return _releaseFromJson(Map<String, dynamic>.from(latest.data as Map));
|
||||
}
|
||||
releases.sort((a, b) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import '../../../core/utils/result.dart';
|
||||
import '../../../shared/widgets/adaptive_scaffold.dart';
|
||||
import '../../../shared/widgets/empty_view.dart';
|
||||
import '../../../shared/widgets/error_view.dart';
|
||||
import '../../../shared/widgets/formatted_content_text.dart';
|
||||
import '../../../shared/widgets/post_masonry_grid.dart';
|
||||
import '../../favorites/presentation/favorites_controller.dart';
|
||||
import '../../settings/presentation/settings_controller.dart';
|
||||
@@ -235,7 +236,8 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
itemBuilder: (context, index) {
|
||||
final a = _announcements[index];
|
||||
final cleanContent = CloudLinkExtractor.cleanCommentary(a.content);
|
||||
final detectedLinks = CloudLinkExtractor.extractLinks(content: a.content);
|
||||
final detectedCloudLinks = CloudLinkExtractor.extractLinks(content: a.content);
|
||||
final creatorLinks = CreatorLink.extractLinks(a.content);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -250,18 +252,25 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
SelectableText(
|
||||
cleanContent.isNotEmpty ? cleanContent : a.content,
|
||||
FormattedContentText(
|
||||
text: cleanContent.isNotEmpty ? cleanContent : a.content,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
height: 1.45,
|
||||
),
|
||||
),
|
||||
if (detectedLinks.isNotEmpty) ...[
|
||||
if (creatorLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
CreatorLinkChips(
|
||||
links: creatorLinks,
|
||||
title: 'Ссылки автора',
|
||||
),
|
||||
],
|
||||
if (detectedCloudLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 6,
|
||||
children: detectedLinks.map((link) {
|
||||
children: detectedCloudLinks.map((link) {
|
||||
return ActionChip(
|
||||
avatar: Icon(
|
||||
link.iconData,
|
||||
@@ -439,7 +448,7 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
settings.copyWith(favoriteArtists: current),
|
||||
);
|
||||
|
||||
if (widget.providerId == 'pawchive') {
|
||||
if (widget.service.isNotEmpty && widget.artistId.isNotEmpty) {
|
||||
final activeAcc = settings.activePawchiveAccount;
|
||||
if (activeAcc != null) {
|
||||
unawaited(ref.read(pawchiveSyncServiceProvider).toggleRemoteFavorite(
|
||||
|
||||
@@ -78,8 +78,8 @@ class _ArtistsScreenState extends ConsumerState<ArtistsScreen> {
|
||||
settings.copyWith(favoriteArtists: current),
|
||||
);
|
||||
|
||||
// Sync with active Pawchive account if artist belongs to Pawchive
|
||||
if (artist.providerId == 'pawchive') {
|
||||
// Sync with active Pawchive account if available
|
||||
if (artist.service.isNotEmpty && artist.id.isNotEmpty) {
|
||||
final activeAcc = settings.activePawchiveAccount;
|
||||
if (activeAcc != null) {
|
||||
unawaited(ref.read(pawchiveSyncServiceProvider).toggleRemoteFavorite(
|
||||
|
||||
@@ -33,6 +33,7 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
bool _isAdding = false;
|
||||
bool _obscurePassword = true;
|
||||
String? _syncingAccountId;
|
||||
String? _pushingAccountId;
|
||||
bool _syncingAll = false;
|
||||
String? _errorMessage;
|
||||
|
||||
@@ -207,10 +208,13 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
.read(settingsControllerProvider.notifier)
|
||||
.saveSettings(result.updatedSettings);
|
||||
if (mounted) {
|
||||
final pushedMsg = result.pushedToRemoteCount > 0
|
||||
? ', выгружено в Pawchive: +${result.pushedToRemoteCount}'
|
||||
: '';
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Синхронизировано: ${result.totalSyncedCount} авторов (+${result.newlyAddedToLocal} новых)',
|
||||
'Синхронизировано: ${result.totalSyncedCount} авторов (+${result.newlyAddedToLocal} новых в приложении$pushedMsg)',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -232,6 +236,92 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pushFavoritesToAccount(PawchiveAccount account) async {
|
||||
final settings =
|
||||
ref.read(appSettingsProvider).value ?? AppSettings.defaults;
|
||||
final totalLocal = settings.favoriteArtists.length;
|
||||
if (totalLocal == 0) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('В локальном избранном пока нет авторов')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Выгрузить избранное в Pawchive?'),
|
||||
content: Text(
|
||||
'Все локальные авторы из приложения ($totalLocal) будут добавлены в избранное аккаунта @${account.username} на сервере Pawchive.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: const Text('Отмена'),
|
||||
),
|
||||
FilledButton.icon(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
icon: const Icon(Icons.cloud_upload_rounded),
|
||||
label: const Text('Выгрузить'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed != true) return;
|
||||
|
||||
setState(() => _pushingAccountId = account.id);
|
||||
try {
|
||||
final syncService = ref.read(pawchiveSyncServiceProvider);
|
||||
final result = await syncService.pushLocalFavoritesToAccount(
|
||||
account: account,
|
||||
settings: settings,
|
||||
);
|
||||
|
||||
if (result.isSuccess) {
|
||||
if (result.updatedSettings != null) {
|
||||
await ref
|
||||
.read(settingsControllerProvider.notifier)
|
||||
.saveSettings(result.updatedSettings!);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
if (result.pushedCount > 0) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Выгружено ${result.pushedCount} авторов в @${account.username}! Всего в аккаунте: ${result.totalRemoteCount}.',
|
||||
),
|
||||
backgroundColor: Colors.green.shade700,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Все авторы (${result.totalLocalCandidates}) уже есть в аккаунте @${account.username}.',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Ошибка выгрузки: ${result.errorMessage}'),
|
||||
backgroundColor: Colors.red.shade700,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _pushingAccountId = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _syncAllAccounts() async {
|
||||
setState(() => _syncingAll = true);
|
||||
try {
|
||||
@@ -245,10 +335,13 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
.read(settingsControllerProvider.notifier)
|
||||
.saveSettings(result.updatedSettings);
|
||||
if (mounted) {
|
||||
final pushedMsg = result.pushedToRemoteCount > 0
|
||||
? ', выгружено в Pawchive: +${result.pushedToRemoteCount}'
|
||||
: '';
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Все аккаунты синхронизированы! Всего: ${result.totalSyncedCount} (+${result.newlyAddedToLocal} новых)',
|
||||
'Все аккаунты синхронизированы! Всего: ${result.totalSyncedCount} (+${result.newlyAddedToLocal} новых в приложении$pushedMsg)',
|
||||
),
|
||||
backgroundColor: Colors.green.shade700,
|
||||
),
|
||||
@@ -373,7 +466,7 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
),
|
||||
// Header
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -395,31 +488,39 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
children: [
|
||||
Text(
|
||||
'Аккаунты Pawchive',
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
'Синхронизация авторов и избранного',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (accounts.isNotEmpty)
|
||||
FilledButton.tonalIcon(
|
||||
if (accounts.isNotEmpty) ...[
|
||||
const SizedBox(width: 8),
|
||||
IconButton.filledTonal(
|
||||
onPressed: _syncingAll ? null : _syncAllAccounts,
|
||||
icon: _syncingAll
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.sync_rounded, size: 18),
|
||||
label: const Text('Синхронизировать'),
|
||||
: const Icon(Icons.sync_rounded, size: 20),
|
||||
tooltip: 'Синхронизировать все аккаунты',
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -445,6 +546,78 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
),
|
||||
),
|
||||
...accounts.map((acc) => _buildAccountCard(acc, scheme, theme)),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Two-way sync & Export to Pawchive panel
|
||||
Card(
|
||||
elevation: 0,
|
||||
color: scheme.surfaceContainerHigh.withValues(alpha: 0.6),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: BorderSide(
|
||||
color: scheme.outlineVariant.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.swap_vert_rounded, size: 20, color: scheme.primary),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Двусторонняя синхронизация',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Switch(
|
||||
value: settings.pawchiveBidirectionalSync,
|
||||
onChanged: (val) async {
|
||||
final newSettings = settings.copyWith(
|
||||
pawchiveBidirectionalSync: val,
|
||||
);
|
||||
await ref
|
||||
.read(settingsControllerProvider.notifier)
|
||||
.saveSettings(newSettings);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'При обычной синхронизации также выгружать всех локальных авторов на сервер Pawchive.',
|
||||
style: TextStyle(
|
||||
color: scheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
OutlinedButton.icon(
|
||||
onPressed: (_syncingAll || _pushingAccountId != null)
|
||||
? null
|
||||
: () {
|
||||
final target = settings.activePawchiveAccount ?? accounts.first;
|
||||
_pushFavoritesToAccount(target);
|
||||
},
|
||||
icon: _pushingAccountId != null
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_upload_rounded, size: 18),
|
||||
label: Text(
|
||||
'Выгрузить избранное (${settings.favoriteArtists.length}) в @${(settings.activePawchiveAccount ?? accounts.first).username}',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
|
||||
@@ -622,6 +795,8 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
|
||||
Widget _buildAccountCard(PawchiveAccount acc, ColorScheme scheme, ThemeData theme) {
|
||||
final isSyncing = _syncingAccountId == acc.id;
|
||||
final isPushing = _pushingAccountId == acc.id;
|
||||
final isBusy = isSyncing || isPushing;
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
@@ -639,7 +814,7 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: acc.isActive ? scheme.primary : scheme.surfaceContainerHighest,
|
||||
foregroundColor: acc.isActive ? scheme.onPrimary : scheme.onSurfaceVariant,
|
||||
@@ -650,59 +825,86 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: Text(
|
||||
acc.username,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (acc.isActive)
|
||||
if (acc.isActive) ...[
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.primary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: scheme.primary.withValues(alpha: 0.18),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'Активен',
|
||||
style: TextStyle(
|
||||
color: scheme.onPrimary,
|
||||
fontSize: 11,
|
||||
color: scheme.primary,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'Авторов: ${acc.syncedArtistsCount} • ${acc.lastSyncedAt != null ? _formatDate(acc.lastSyncedAt!) : "не синхр."}',
|
||||
style: TextStyle(color: scheme.onSurfaceVariant, fontSize: 12),
|
||||
),
|
||||
],
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Text(
|
||||
'Авторов: ${acc.syncedArtistsCount} • ${acc.lastSyncedAt != null ? _formatDate(acc.lastSyncedAt!) : "не синхр."}',
|
||||
style: TextStyle(color: scheme.onSurfaceVariant, fontSize: 12),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||
padding: const EdgeInsets.all(6),
|
||||
iconSize: 18,
|
||||
icon: isPushing
|
||||
? const SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_upload_outlined),
|
||||
tooltip: 'Выгрузить локальное избранное в этот аккаунт',
|
||||
onPressed: isBusy ? null : () => _pushFavoritesToAccount(acc),
|
||||
),
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||
padding: const EdgeInsets.all(6),
|
||||
iconSize: 18,
|
||||
icon: isSyncing
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.sync_rounded),
|
||||
tooltip: 'Синхронизировать этот аккаунт',
|
||||
onPressed: isSyncing ? null : () => _syncSingleAccount(acc),
|
||||
onPressed: isBusy ? null : () => _syncSingleAccount(acc),
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(minWidth: 28, minHeight: 32),
|
||||
iconSize: 18,
|
||||
icon: const Icon(Icons.more_vert_rounded),
|
||||
onSelected: (val) {
|
||||
if (val == 'active') {
|
||||
_setActiveAccount(acc);
|
||||
} else if (val == 'push') {
|
||||
_pushFavoritesToAccount(acc);
|
||||
} else if (val == 'delete') {
|
||||
_removeAccount(acc);
|
||||
}
|
||||
@@ -719,6 +921,16 @@ class _PawchiveAccountsSheetState extends ConsumerState<PawchiveAccountsSheet>
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'push',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.cloud_upload_outlined, size: 20),
|
||||
SizedBox(width: 8),
|
||||
Text('Выгрузить в Pawchive'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: Row(
|
||||
|
||||
@@ -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,82 +179,154 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
|
||||
// Search input bar if active
|
||||
if (_isSearching)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
hintText: isRu
|
||||
? 'Поиск по тегам и авторам...'
|
||||
: 'Search by tags and artists...',
|
||||
prefixIcon: const Icon(Icons.search_rounded),
|
||||
suffixIcon: _searchQuery.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear_rounded),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
setState(() => _searchQuery = '');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
isDense: true,
|
||||
filled: true,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide.none,
|
||||
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,
|
||||
decoration: InputDecoration(
|
||||
hintText: isRu
|
||||
? 'Поиск по тегам и авторам...'
|
||||
: 'Search by tags and artists...',
|
||||
prefixIcon: const Icon(Icons.search_rounded),
|
||||
suffixIcon: _searchQuery.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear_rounded),
|
||||
onPressed: () {
|
||||
HapticFeedback.lightImpact();
|
||||
_searchController.clear();
|
||||
setState(() => _searchQuery = '');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
isDense: true,
|
||||
filled: false,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
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),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: SegmentedButton<int>(
|
||||
showSelectedIcon: false,
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: 0,
|
||||
icon: const Icon(Icons.favorite_rounded, size: 18),
|
||||
label: Text(
|
||||
'${isRu ? 'Все' : 'All'} (${allPosts.length})',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: 1,
|
||||
icon: const Icon(Icons.offline_pin_rounded, size: 18),
|
||||
label: Text(
|
||||
'${isRu ? 'Офлайн' : 'Offline'} (${offlinePosts.length})',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: 2,
|
||||
icon: const Icon(Icons.groups_rounded, size: 18),
|
||||
label: Text(
|
||||
'${isRu ? 'Авторы' : 'Artists'} (${artistGroups.length})',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
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),
|
||||
),
|
||||
],
|
||||
selected: {_tabIndex},
|
||||
onSelectionChanged: (value) {
|
||||
setState(() {
|
||||
_tabIndex = value.first;
|
||||
_selectedArtist = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
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, fontWeight: FontWeight.w600),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: 1,
|
||||
icon: const Icon(Icons.offline_pin_rounded,
|
||||
size: 18),
|
||||
label: Text(
|
||||
'${isRu ? 'Офлайн' : 'Offline'} (${offlinePosts.length})',
|
||||
style: const TextStyle(
|
||||
fontSize: 12, fontWeight: FontWeight.w600),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: 2,
|
||||
icon: const Icon(Icons.groups_rounded, size: 18),
|
||||
label: Text(
|
||||
'${isRu ? 'Авторы' : 'Artists'} (${artistGroups.length})',
|
||||
style: const TextStyle(
|
||||
fontSize: 12, fontWeight: FontWeight.w600),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
selected: {_tabIndex},
|
||||
onSelectionChanged: (value) {
|
||||
HapticFeedback.selectionClick();
|
||||
setState(() {
|
||||
_tabIndex = value.first;
|
||||
_selectedArtist = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -265,9 +340,12 @@ class _FavoritesScreenState extends ConsumerState<FavoritesScreen> {
|
||||
FilterChip(
|
||||
label: Text(isRu ? 'Все' : 'All'),
|
||||
selected: _mediaFilter == FavoriteMediaType.all,
|
||||
onSelected: (_) => setState(
|
||||
() => _mediaFilter = FavoriteMediaType.all,
|
||||
),
|
||||
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(
|
||||
() => _mediaFilter = FavoriteMediaType.video,
|
||||
),
|
||||
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(
|
||||
() => _mediaFilter = FavoriteMediaType.image,
|
||||
),
|
||||
onSelected: (_) {
|
||||
HapticFeedback.selectionClick();
|
||||
setState(
|
||||
() => _mediaFilter = FavoriteMediaType.image,
|
||||
);
|
||||
},
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
],
|
||||
@@ -490,31 +574,40 @@ 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),
|
||||
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: Icon(
|
||||
Icons.offline_pin_rounded,
|
||||
color: scheme.onPrimaryContainer,
|
||||
size: 22,
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.offline_pin_rounded,
|
||||
color: Colors.white,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -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,21 +647,22 @@ 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);
|
||||
}
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
isRu
|
||||
? 'В очередь загрузки добавлено: $pendingCount'
|
||||
: 'Queued $pendingCount downloads',
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
SnackBar(
|
||||
content: Text(
|
||||
isRu
|
||||
? 'В очередь загрузки добавлено: $pendingCount'
|
||||
: 'Queued $pendingCount downloads',
|
||||
),
|
||||
);
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(Icons.download_rounded, size: 16),
|
||||
label: Text(
|
||||
@@ -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(
|
||||
() => _offlineSort = OfflineSortOption.dateAddedDesc,
|
||||
),
|
||||
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(
|
||||
() => _offlineSort = OfflineSortOption.sizeDesc,
|
||||
),
|
||||
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(
|
||||
() => _offlineSort = OfflineSortOption.artist,
|
||||
),
|
||||
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,
|
||||
child: Text(
|
||||
selected.isNotEmpty ? selected[0].toUpperCase() : '?',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
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: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
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,123 +1078,182 @@ 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: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: [
|
||||
// Artist Avatar
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
onTap: () {
|
||||
HapticFeedback.selectionClick();
|
||||
onTap();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
scheme.primaryContainer,
|
||||
scheme.tertiaryContainer,
|
||||
],
|
||||
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),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
artistName.isNotEmpty ? artistName[0].toUpperCase() : '?',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: scheme.onPrimaryContainer,
|
||||
),
|
||||
border: Border.all(
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.13)
|
||||
: Colors.white.withValues(alpha: 0.85),
|
||||
width: 1.1,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Artist Name & Count
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
artistName,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
// Artist Squircle Avatar
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.secondaryContainer.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
scheme.primary,
|
||||
scheme.tertiary,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: scheme.primary.withValues(alpha: 0.35),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text(
|
||||
'$postsCount ${isRu ? 'работ' : 'posts'}',
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: scheme.onSecondaryContainer,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Thumbnails preview
|
||||
if (previewUrls.isNotEmpty) ...[
|
||||
const SizedBox(width: 8),
|
||||
Row(
|
||||
children: [
|
||||
for (final url in previewUrls)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: SizedBox(
|
||||
width: 44,
|
||||
height: 44,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (_, __) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
),
|
||||
errorWidget: (_, __, ___) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
child: const Icon(
|
||||
Icons.image_not_supported_rounded,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
artistName.isNotEmpty ? artistName[0].toUpperCase() : '?',
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Artist Name & Count
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
artistName,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
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.primary,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Thumbnails preview
|
||||
if (previewUrls.isNotEmpty) ...[
|
||||
const SizedBox(width: 8),
|
||||
Row(
|
||||
children: [
|
||||
for (final url in previewUrls)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: ClipRRect(
|
||||
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,
|
||||
placeholder: (_, __) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
),
|
||||
errorWidget: (_, __, ___) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
child: const Icon(
|
||||
Icons.image_not_supported_rounded,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
size: 20,
|
||||
color: scheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 6),
|
||||
Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
color: scheme.onSurfaceVariant.withValues(alpha: 0.6),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -123,14 +123,18 @@ class FeedController extends AsyncNotifier<FeedState> {
|
||||
final settingsRes = await ref.read(settingsServiceProvider).getSettings();
|
||||
final settings =
|
||||
settingsRes is Success<AppSettings> ? settingsRes.data : AppSettings.defaults;
|
||||
await ref
|
||||
.read(searchServiceProvider)
|
||||
.saveSearch(query, 0, maxHistory: settings.searchHistoryLimit);
|
||||
await refresh();
|
||||
final count = state.value?.posts.length ?? 0;
|
||||
await ref
|
||||
.read(searchServiceProvider)
|
||||
.saveSearch(query, count, maxHistory: settings.searchHistoryLimit);
|
||||
try {
|
||||
await refresh();
|
||||
final count = state.value?.posts.length ?? 0;
|
||||
await ref
|
||||
.read(searchServiceProvider)
|
||||
.saveSearch(query, count, maxHistory: settings.searchHistoryLimit);
|
||||
} catch (_) {
|
||||
await ref
|
||||
.read(searchServiceProvider)
|
||||
.saveSearch(query, 0, maxHistory: settings.searchHistoryLimit);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> updateTagSuggestions(String query) async {
|
||||
|
||||
@@ -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)}';
|
||||
|
||||
@@ -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';
|
||||
@@ -219,34 +220,79 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 760,
|
||||
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,
|
||||
onPlaybackSnapshot: (snapshot) =>
|
||||
_saveVideoSnapshot(ref, post, snapshot),
|
||||
onPlaybackPreferencesChanged: (snapshot) =>
|
||||
_saveVideoPreferences(ref, snapshot),
|
||||
),
|
||||
),
|
||||
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(
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton.filledTonal(
|
||||
@@ -316,14 +362,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 +401,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_CommentsSection(post: post),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -398,7 +446,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,33 +461,80 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
? null
|
||||
: () =>
|
||||
_showMobileQuickActions(context, ref, post, favoriteKeys),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.62,
|
||||
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,
|
||||
onPlaybackSnapshot: (snapshot) =>
|
||||
_saveVideoSnapshot(ref, post, snapshot),
|
||||
onPlaybackPreferencesChanged: (snapshot) =>
|
||||
_saveVideoPreferences(ref, snapshot),
|
||||
onMediaGestureLockChanged: (locked) {
|
||||
onMediaGestureLockChanged?.call(locked);
|
||||
},
|
||||
),
|
||||
),
|
||||
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(
|
||||
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);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
PostActionBar(
|
||||
@@ -493,13 +593,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 +632,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_CommentsSection(post: post),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -776,7 +879,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 +889,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
videoPlayerHalfVolume: snapshot.halfVolume,
|
||||
videoPlayerLoop: snapshot.loopVideo,
|
||||
videoPlayerCover: snapshot.coverVideo,
|
||||
videoPlayerVolume: snapshot.volume,
|
||||
),
|
||||
);
|
||||
ref.invalidate(appSettingsProvider);
|
||||
@@ -1081,7 +1186,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(),
|
||||
|
||||
@@ -4,6 +4,8 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../../app/app_strings.dart';
|
||||
import '../../../../backend/models/cloud_media_link.dart';
|
||||
import '../../../../backend/models/creator_link.dart';
|
||||
import '../../../../shared/widgets/formatted_content_text.dart';
|
||||
|
||||
class CloudMirrorsCard extends StatelessWidget {
|
||||
const CloudMirrorsCard({
|
||||
@@ -186,13 +188,26 @@ class CloudMirrorsCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SelectableText(
|
||||
commentary!.trim(),
|
||||
FormattedContentText(
|
||||
text: commentary!.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(
|
||||
links: creatorLinks,
|
||||
title: strings.ru ? 'Ссылки автора' : 'Author Links',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
@@ -27,10 +27,12 @@ class PostMediaViewer extends StatefulWidget {
|
||||
this.initialMuted = false,
|
||||
this.initialCoverVideo = false,
|
||||
this.initialHalfVolume = false,
|
||||
this.initialVolume = 100.0,
|
||||
this.qualityMode = MediaQualityMode.auto,
|
||||
this.mediaHeaders = const {},
|
||||
this.onPlaybackSnapshot,
|
||||
this.onPlaybackPreferencesChanged,
|
||||
this.onVolumeChanged,
|
||||
this.onMediaGestureLockChanged,
|
||||
super.key,
|
||||
});
|
||||
@@ -44,10 +46,12 @@ class PostMediaViewer extends StatefulWidget {
|
||||
final bool initialMuted;
|
||||
final bool initialCoverVideo;
|
||||
final bool initialHalfVolume;
|
||||
final double initialVolume;
|
||||
final MediaQualityMode qualityMode;
|
||||
final Map<String, String> mediaHeaders;
|
||||
final ValueChanged<VideoPlaybackSnapshot>? onPlaybackSnapshot;
|
||||
final ValueChanged<VideoPlaybackSnapshot>? onPlaybackPreferencesChanged;
|
||||
final ValueChanged<double>? onVolumeChanged;
|
||||
final ValueChanged<bool>? onMediaGestureLockChanged;
|
||||
|
||||
@override
|
||||
@@ -68,6 +72,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
late bool _muted;
|
||||
late bool _loopVideo;
|
||||
late bool _halfVolume;
|
||||
late double _currentVolume;
|
||||
String? _videoError;
|
||||
bool _retriedFormatError = false;
|
||||
Timer? _hideTimer;
|
||||
@@ -83,6 +88,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
_muted = widget.initialMuted;
|
||||
_loopVideo = widget.initialLoop;
|
||||
_halfVolume = widget.initialHalfVolume;
|
||||
_currentVolume = widget.initialVolume;
|
||||
_imageUrls = _buildImageUrls(widget.post);
|
||||
_videoUrls = _buildVideoUrls(widget.post);
|
||||
if (_isVideo(widget.post) && _videoUrls.isNotEmpty) {
|
||||
@@ -167,6 +173,11 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
muted: _muted,
|
||||
loopVideo: _loopVideo,
|
||||
halfVolume: _halfVolume,
|
||||
initialVolume: _currentVolume,
|
||||
onVolumeChanged: (vol) {
|
||||
_currentVolume = vol;
|
||||
widget.onVolumeChanged?.call(vol);
|
||||
},
|
||||
fullscreen: widget.fullscreen,
|
||||
errorMessage: _videoError,
|
||||
onInteract: _showControls,
|
||||
@@ -534,6 +545,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
muted: _muted,
|
||||
halfVolume: _halfVolume,
|
||||
coverVideo: _coverVideo,
|
||||
initialVolume: _currentVolume,
|
||||
errorMessage: _videoError,
|
||||
onRetry: _retryVideo,
|
||||
onChanged: (snapshot) {
|
||||
@@ -560,12 +572,14 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
_loopVideo = snapshot.loopVideo;
|
||||
_coverVideo = snapshot.coverVideo;
|
||||
_halfVolume = snapshot.halfVolume;
|
||||
_currentVolume = snapshot.volume;
|
||||
});
|
||||
await _applyVolume();
|
||||
await _player?.setPlaylistMode(
|
||||
_loopVideo ? PlaylistMode.single : PlaylistMode.none,
|
||||
);
|
||||
_emitPlaybackPreferences();
|
||||
widget.onVolumeChanged?.call(_currentVolume);
|
||||
}
|
||||
|
||||
VideoPlaybackSnapshot _snapshot() {
|
||||
@@ -577,15 +591,16 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
halfVolume: _halfVolume,
|
||||
loopVideo: _loopVideo,
|
||||
coverVideo: _coverVideo,
|
||||
volume: _currentVolume,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _applyVolume() async {
|
||||
await _player?.setVolume(_muted
|
||||
? 0
|
||||
? 0.0
|
||||
: _halfVolume
|
||||
? 50
|
||||
: 100);
|
||||
? 50.0
|
||||
: _currentVolume);
|
||||
}
|
||||
|
||||
void _emitPlaybackPreferences() {
|
||||
@@ -656,6 +671,7 @@ class VideoPlaybackSnapshot {
|
||||
required this.halfVolume,
|
||||
required this.loopVideo,
|
||||
required this.coverVideo,
|
||||
this.volume = 100.0,
|
||||
});
|
||||
|
||||
final Duration position;
|
||||
@@ -664,6 +680,7 @@ class VideoPlaybackSnapshot {
|
||||
final bool halfVolume;
|
||||
final bool loopVideo;
|
||||
final bool coverVideo;
|
||||
final double volume;
|
||||
}
|
||||
|
||||
class _FullscreenVideoPage extends StatefulWidget {
|
||||
@@ -675,6 +692,7 @@ class _FullscreenVideoPage extends StatefulWidget {
|
||||
required this.muted,
|
||||
required this.halfVolume,
|
||||
required this.coverVideo,
|
||||
this.initialVolume = 100.0,
|
||||
required this.errorMessage,
|
||||
required this.onRetry,
|
||||
required this.onChanged,
|
||||
@@ -687,6 +705,7 @@ class _FullscreenVideoPage extends StatefulWidget {
|
||||
final bool muted;
|
||||
final bool halfVolume;
|
||||
final bool coverVideo;
|
||||
final double initialVolume;
|
||||
final String? errorMessage;
|
||||
final VoidCallback onRetry;
|
||||
final ValueChanged<VideoPlaybackSnapshot> onChanged;
|
||||
@@ -701,6 +720,7 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
late bool _muted;
|
||||
late bool _loopVideo;
|
||||
late bool _halfVolume;
|
||||
late double _currentVolume;
|
||||
late bool _isLandscape;
|
||||
Timer? _hideTimer;
|
||||
|
||||
@@ -711,6 +731,7 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
_muted = widget.muted;
|
||||
_loopVideo = widget.loopVideo;
|
||||
_halfVolume = widget.halfVolume;
|
||||
_currentVolume = widget.initialVolume;
|
||||
_isLandscape = widget.aspectRatio > 1.05;
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
||||
_applyOrientation();
|
||||
@@ -790,6 +811,11 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
muted: _muted,
|
||||
loopVideo: _loopVideo,
|
||||
halfVolume: _halfVolume,
|
||||
initialVolume: _currentVolume,
|
||||
onVolumeChanged: (vol) {
|
||||
_currentVolume = vol;
|
||||
widget.onChanged(_snapshot());
|
||||
},
|
||||
fullscreen: true,
|
||||
errorMessage: widget.errorMessage,
|
||||
onInteract: _showControls,
|
||||
@@ -883,10 +909,10 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
|
||||
Future<void> _applyVolume() async {
|
||||
await widget.player.setVolume(_muted
|
||||
? 0
|
||||
? 0.0
|
||||
: _halfVolume
|
||||
? 50
|
||||
: 100);
|
||||
? 50.0
|
||||
: _currentVolume);
|
||||
}
|
||||
|
||||
VideoPlaybackSnapshot _snapshot() {
|
||||
@@ -897,6 +923,7 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
halfVolume: _halfVolume,
|
||||
loopVideo: _loopVideo,
|
||||
coverVideo: _coverVideo,
|
||||
volume: _currentVolume,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -915,6 +942,8 @@ class _VideoSurface extends StatefulWidget {
|
||||
required this.muted,
|
||||
required this.halfVolume,
|
||||
required this.loopVideo,
|
||||
this.initialVolume = 100.0,
|
||||
this.onVolumeChanged,
|
||||
required this.fullscreen,
|
||||
required this.errorMessage,
|
||||
required this.onInteract,
|
||||
@@ -934,6 +963,8 @@ class _VideoSurface extends StatefulWidget {
|
||||
final bool muted;
|
||||
final bool halfVolume;
|
||||
final bool loopVideo;
|
||||
final double initialVolume;
|
||||
final ValueChanged<double>? onVolumeChanged;
|
||||
final bool fullscreen;
|
||||
final String? errorMessage;
|
||||
final VoidCallback onInteract;
|
||||
@@ -965,7 +996,9 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_currentVolume = widget.player.state.volume;
|
||||
_currentVolume = widget.player.state.volume > 0
|
||||
? widget.player.state.volume
|
||||
: widget.initialVolume;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -983,26 +1016,37 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
if (target < Duration.zero) target = Duration.zero;
|
||||
if (dur > Duration.zero && target > dur) target = dur;
|
||||
widget.player.seek(target);
|
||||
widget.onInteract();
|
||||
if (delta.inSeconds < 0) {
|
||||
setState(() => _showLeftSeek = true);
|
||||
_seekLeftTimer?.cancel();
|
||||
_seekLeftTimer = Timer(const Duration(milliseconds: 650), () {
|
||||
if (mounted) setState(() => _showLeftSeek = false);
|
||||
});
|
||||
} else if (delta.inSeconds > 0) {
|
||||
setState(() => _showRightSeek = true);
|
||||
_seekRightTimer?.cancel();
|
||||
_seekRightTimer = Timer(const Duration(milliseconds: 650), () {
|
||||
if (mounted) setState(() => _showRightSeek = false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onDoubleTapAt(Offset localPosition, double width) {
|
||||
if (_isLocked) return;
|
||||
if (localPosition.dx < width * 0.4) {
|
||||
_seekBy(const Duration(seconds: -10));
|
||||
setState(() => _showLeftSeek = true);
|
||||
_seekLeftTimer?.cancel();
|
||||
_seekLeftTimer = Timer(const Duration(milliseconds: 650), () {
|
||||
if (mounted) setState(() => _showLeftSeek = false);
|
||||
});
|
||||
} else if (localPosition.dx > width * 0.6) {
|
||||
_seekBy(const Duration(seconds: 10));
|
||||
setState(() => _showRightSeek = true);
|
||||
_seekRightTimer?.cancel();
|
||||
_seekRightTimer = Timer(const Duration(milliseconds: 650), () {
|
||||
if (mounted) setState(() => _showRightSeek = false);
|
||||
});
|
||||
} else {
|
||||
widget.player.playOrPause();
|
||||
if (widget.player.state.playing) {
|
||||
widget.player.pause();
|
||||
} else {
|
||||
if (widget.player.state.completed) {
|
||||
widget.player.seek(Duration.zero);
|
||||
}
|
||||
widget.player.play();
|
||||
}
|
||||
widget.onInteract();
|
||||
}
|
||||
}
|
||||
@@ -1025,6 +1069,7 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
final newVol = (_currentVolume - deltaY * 0.5).clamp(0.0, 100.0);
|
||||
_currentVolume = newVol;
|
||||
widget.player.setVolume(newVol);
|
||||
widget.onVolumeChanged?.call(newVol);
|
||||
setState(() => _showVolumeIndicator = true);
|
||||
_volumeTimer?.cancel();
|
||||
_volumeTimer = Timer(const Duration(milliseconds: 1100), () {
|
||||
@@ -1094,6 +1139,7 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
onToggleLoop: widget.onToggleLoop,
|
||||
onFullscreen: widget.onFullscreen,
|
||||
onSeekBy: _seekBy,
|
||||
onInteract: widget.onInteract,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1728,6 +1774,7 @@ class _VideoControls extends StatelessWidget {
|
||||
required this.onToggleLoop,
|
||||
required this.onFullscreen,
|
||||
required this.onSeekBy,
|
||||
this.onInteract,
|
||||
});
|
||||
|
||||
final Player player;
|
||||
@@ -1744,6 +1791,7 @@ class _VideoControls extends StatelessWidget {
|
||||
final VoidCallback onToggleLoop;
|
||||
final VoidCallback onFullscreen;
|
||||
final void Function(Duration) onSeekBy;
|
||||
final VoidCallback? onInteract;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -1792,7 +1840,10 @@ class _VideoControls extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
top: fullscreen,
|
||||
bottom: false,
|
||||
left: fullscreen,
|
||||
right: fullscreen,
|
||||
child: Row(
|
||||
children: [
|
||||
if (fullscreen) ...[
|
||||
@@ -1861,7 +1912,10 @@ class _VideoControls extends StatelessWidget {
|
||||
icon: Icons.replay_10_rounded,
|
||||
size: 46,
|
||||
iconSize: 26,
|
||||
onPressed: () => onSeekBy(const Duration(seconds: -10)),
|
||||
onPressed: () {
|
||||
onSeekBy(const Duration(seconds: -10));
|
||||
onInteract?.call();
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 32),
|
||||
Container(
|
||||
@@ -1882,7 +1936,17 @@ class _VideoControls extends StatelessWidget {
|
||||
tooltip: playing ? 'Пауза' : 'Воспроизведение',
|
||||
iconSize: 42,
|
||||
color: scheme.onPrimary,
|
||||
onPressed: player.playOrPause,
|
||||
onPressed: () async {
|
||||
if (player.state.playing) {
|
||||
await player.pause();
|
||||
} else {
|
||||
if (player.state.completed) {
|
||||
await player.seek(Duration.zero);
|
||||
}
|
||||
await player.play();
|
||||
}
|
||||
onInteract?.call();
|
||||
},
|
||||
icon: Icon(
|
||||
playing
|
||||
? Icons.pause_rounded
|
||||
@@ -1896,7 +1960,10 @@ class _VideoControls extends StatelessWidget {
|
||||
icon: Icons.forward_10_rounded,
|
||||
size: 46,
|
||||
iconSize: 26,
|
||||
onPressed: () => onSeekBy(const Duration(seconds: 10)),
|
||||
onPressed: () {
|
||||
onSeekBy(const Duration(seconds: 10));
|
||||
onInteract?.call();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1910,7 +1977,12 @@ class _VideoControls extends StatelessWidget {
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 10),
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
14,
|
||||
8,
|
||||
14,
|
||||
fullscreen ? 10 : 4,
|
||||
),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
@@ -1920,6 +1992,9 @@ class _VideoControls extends StatelessWidget {
|
||||
),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: fullscreen,
|
||||
left: fullscreen,
|
||||
right: fullscreen,
|
||||
child: StreamBuilder<Duration>(
|
||||
stream: player.stream.duration,
|
||||
initialData: player.state.duration,
|
||||
@@ -1967,8 +2042,8 @@ class _VideoControls extends StatelessWidget {
|
||||
// Buffer progress track
|
||||
if (maxMs > 0 && bufferMs > 0)
|
||||
Positioned(
|
||||
left: 20,
|
||||
right: 20,
|
||||
left: 14,
|
||||
right: 14,
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(2),
|
||||
@@ -1976,10 +2051,12 @@ class _VideoControls extends StatelessWidget {
|
||||
value: (bufferMs / maxMs)
|
||||
.clamp(0.0, 1.0),
|
||||
minHeight: 3.5,
|
||||
backgroundColor: Colors.transparent,
|
||||
backgroundColor:
|
||||
Colors.transparent,
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation(
|
||||
Colors.white.withValues(alpha: 0.28),
|
||||
Colors.white
|
||||
.withValues(alpha: 0.28),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1997,6 +2074,10 @@ class _VideoControls extends StatelessWidget {
|
||||
const RoundSliderThumbShape(
|
||||
enabledThumbRadius: 6,
|
||||
),
|
||||
overlayShape:
|
||||
const RoundSliderOverlayShape(
|
||||
overlayRadius: 14,
|
||||
),
|
||||
),
|
||||
child: Slider(
|
||||
value: valueMs,
|
||||
|
||||
@@ -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,13 +320,51 @@ class _TagGroupBlock extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(label, style: Theme.of(context).textTheme.labelLarge),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'${tags.length}',
|
||||
style: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
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.labelSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -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,56 +1,334 @@
|
||||
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',
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: 'Check all',
|
||||
onPressed: () => _checkAll(ref),
|
||||
icon: const Icon(Icons.playlist_add_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.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: [
|
||||
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(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return ProviderHealthTile(
|
||||
config: item,
|
||||
health: health[item.id],
|
||||
diagnostics: diagnostics[item.id],
|
||||
onCheck: () => _checkOne(ref, item.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
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),
|
||||
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();
|
||||
if (result is Success<List<ProviderHealth>>) {
|
||||
ref.read(providerHealthProvider.notifier).state = {
|
||||
for (final item in result.data) item.providerId: item,
|
||||
};
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,50 +14,371 @@ 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,
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Add provider',
|
||||
onPressed: () => context.go('/providers/new'),
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: providers.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (error, _) => ErrorView(message: error.toString()),
|
||||
data: (items) => ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return ProviderCard(
|
||||
config: item,
|
||||
onToggle: (enabled) => ref
|
||||
.read(providersControllerProvider.notifier)
|
||||
.toggle(item.id, enabled),
|
||||
onEdit: () => context.go('/providers/new', extra: item),
|
||||
onDelete: () async {
|
||||
final ok = await showConfirmDialog(
|
||||
context,
|
||||
title: 'Delete provider',
|
||||
message: 'Remove ${item.name}?',
|
||||
);
|
||||
if (ok) {
|
||||
await ref
|
||||
.read(providersControllerProvider.notifier)
|
||||
.delete(item.id);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
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),
|
||||
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.push(
|
||||
'/providers/new',
|
||||
extra: item,
|
||||
),
|
||||
onDelete: () async {
|
||||
final ok = await showConfirmDialog(
|
||||
context,
|
||||
title: isRu ? 'Удалить источник' : 'Delete provider',
|
||||
message: isRu
|
||||
? 'Вы действительно хотите удалить ${item.name}?'
|
||||
: 'Remove ${item.name}?',
|
||||
);
|
||||
if (ok) {
|
||||
await ref
|
||||
.read(providersControllerProvider.notifier)
|
||||
.delete(item.id);
|
||||
}
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../../backend/backend.dart';
|
||||
|
||||
@@ -18,27 +19,396 @@ 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,
|
||||
),
|
||||
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),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Delete',
|
||||
onPressed: onDelete,
|
||||
icon: const Icon(Icons.delete_rounded),
|
||||
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,
|
||||
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)),
|
||||
),
|
||||
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),
|
||||
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'),
|
||||
),
|
||||
|
||||
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: [
|
||||
// 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,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
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,45 +168,124 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 2. Recent Searches Card
|
||||
_SearchSectionCard(
|
||||
icon: Icons.history_rounded,
|
||||
accentColor: const Color(0xFF6366F1),
|
||||
title: isRu ? 'Недавние запросы' : 'Recent searches',
|
||||
badgeCount: data.recent.length,
|
||||
trailing: data.recent.isEmpty
|
||||
? null
|
||||
: TextButton(
|
||||
onPressed: () => ref
|
||||
.read(searchControllerProvider.notifier)
|
||||
.clearHistory(),
|
||||
child: Text(
|
||||
isRu ? 'Очистить' : 'Clear',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.primary,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
_SearchLiquidCard(
|
||||
glowColor: const Color(0xFF6366F1),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const _SearchIconBadge(
|
||||
icon: Icons.history_rounded,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: RecentSearches(
|
||||
items: data.recent,
|
||||
onTap: (query) =>
|
||||
context.go('/?q=${Uri.encodeQueryComponent(query)}'),
|
||||
onDelete: (id) => ref
|
||||
.read(searchControllerProvider.notifier)
|
||||
.deleteHistory(id),
|
||||
if (data.recent.isNotEmpty)
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 4),
|
||||
minimumSize: Size.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
onPressed: () {
|
||||
HapticFeedback.selectionClick();
|
||||
ref
|
||||
.read(searchControllerProvider.notifier)
|
||||
.clearHistory();
|
||||
},
|
||||
child: Text(
|
||||
isRu ? 'Очистить' : 'Clear',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.primary,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
RecentSearches(
|
||||
items: data.recent,
|
||||
onTap: (query) =>
|
||||
context.go('/?q=${Uri.encodeQueryComponent(query)}'),
|
||||
onDelete: (id) => ref
|
||||
.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),
|
||||
@@ -223,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',
|
||||
@@ -239,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),
|
||||
@@ -257,84 +333,78 @@ 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),
|
||||
),
|
||||
),
|
||||
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,
|
||||
// 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(),
|
||||
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,
|
||||
),
|
||||
),
|
||||
initiallyExpanded: _showTips,
|
||||
onExpansionChanged: (exp) => setState(() => _showTips = exp),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_TipRow(
|
||||
code: 'tag_a and tag_b',
|
||||
description: isRu
|
||||
? 'Независимый опрос обоих тегов с чередованием постов в ленте.'
|
||||
: 'Interleaves results from both queries independently.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'type:video / type:gif',
|
||||
description: isRu
|
||||
? 'Показывает только видео или анимированные GIF.'
|
||||
: 'Filters results to only videos or animated GIFs.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'rating:safe / rating:explicit',
|
||||
description: isRu
|
||||
? 'Фильтр по возрастному рейтингу медиа.'
|
||||
: 'Filter by age rating classification.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'score:>50 / score:>100',
|
||||
description: isRu
|
||||
? 'Посты с оценкой пользователей выше указанной.'
|
||||
: 'Posts with community score greater than threshold.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'provider:gelbooru',
|
||||
description: isRu
|
||||
? 'Поиск исключительно в указанном источнике.'
|
||||
: 'Search specifically on the given booru provider.',
|
||||
),
|
||||
],
|
||||
title: Text(
|
||||
isRu ? 'Шпаргалка по поиску' : 'Search tips & operators',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
],
|
||||
initiallyExpanded: _showTips,
|
||||
onExpansionChanged: (exp) {
|
||||
HapticFeedback.selectionClick();
|
||||
setState(() => _showTips = exp);
|
||||
},
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_TipRow(
|
||||
code: 'tag_a and tag_b',
|
||||
description: isRu
|
||||
? 'Независимый опрос обоих тегов с чередованием постов в ленте.'
|
||||
: 'Interleaves results from both queries independently.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'type:video / type:gif',
|
||||
description: isRu
|
||||
? 'Показывает только видео или анимированные GIF.'
|
||||
: 'Filters results to only videos or animated GIFs.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'rating:safe / rating:explicit',
|
||||
description: isRu
|
||||
? 'Фильтр по возрастному рейтингу медиа.'
|
||||
: 'Filter by age rating classification.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'score:>50 / score:>100',
|
||||
description: isRu
|
||||
? 'Посты с оценкой пользователей выше указанной.'
|
||||
: 'Posts with community score greater than threshold.',
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_TipRow(
|
||||
code: 'provider:gelbooru',
|
||||
description: isRu
|
||||
? 'Поиск исключительно в указанном источнике.'
|
||||
: 'Search specifically on the given booru provider.',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
@@ -347,91 +417,117 @@ 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),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.3),
|
||||
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: isDark
|
||||
? Colors.white.withValues(alpha: 0.14)
|
||||
: Colors.white.withValues(alpha: 0.85),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: accentColor.withValues(alpha: 0.14),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, size: 18, color: accentColor),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (badgeCount != null && badgeCount! > 0) ...[
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) trailing!,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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(
|
||||
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),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
child,
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(icon, size: iconSize, color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -452,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,
|
||||
@@ -477,6 +587,7 @@ class _QuickOperatorChip extends StatelessWidget {
|
||||
fontWeight: FontWeight.w700,
|
||||
color: color,
|
||||
fontFamily: 'monospace',
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -503,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: [
|
||||
Text(
|
||||
categoryName,
|
||||
style: theme.textTheme.labelLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
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.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,
|
||||
@@ -550,7 +693,8 @@ class _CategoryTagRow extends StatelessWidget {
|
||||
Text(
|
||||
tag,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -574,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,
|
||||
@@ -595,10 +748,14 @@ class _TipRow extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
description,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
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';
|
||||
|
||||
@@ -47,8 +48,44 @@ class _RecentSearchesState extends State<RecentSearches> {
|
||||
);
|
||||
}
|
||||
|
||||
// Deduplicate items by normalized query
|
||||
final seen = <String>{};
|
||||
final uniqueItems = <SearchHistory>[];
|
||||
for (final item in widget.items) {
|
||||
final key = item.query.trim().toLowerCase();
|
||||
if (key.isEmpty) continue;
|
||||
if (seen.add(key)) {
|
||||
uniqueItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (uniqueItems.isEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24, horizontal: 16),
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.history_toggle_off_rounded,
|
||||
size: 40,
|
||||
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.5),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'История поиска пуста',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final visibleItems =
|
||||
_expanded ? widget.items : widget.items.take(20).toList();
|
||||
_expanded ? uniqueItems : uniqueItems.take(20).toList();
|
||||
final screenW = MediaQuery.sizeOf(context).width;
|
||||
final maxQueryWidth = (screenW - 200).clamp(180.0, 480.0);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -59,38 +96,62 @@ 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.symmetric(horizontal: 12, vertical: 6),
|
||||
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
|
||||
.withValues(alpha: 0.35),
|
||||
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,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.history_rounded,
|
||||
size: 14,
|
||||
size: 15,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 140),
|
||||
child: Text(
|
||||
item.query,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
constraints: BoxConstraints(maxWidth: maxQueryWidth),
|
||||
child: Tooltip(
|
||||
message: item.query,
|
||||
waitDuration: const Duration(milliseconds: 600),
|
||||
child: Text(
|
||||
item.query,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -100,14 +161,14 @@ class _RecentSearchesState extends State<RecentSearches> {
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.14),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'${item.resultCount}',
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: theme.colorScheme.onSecondaryContainer,
|
||||
fontSize: 10,
|
||||
color: theme.colorScheme.primary,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
@@ -115,14 +176,24 @@ class _RecentSearchesState extends State<RecentSearches> {
|
||||
],
|
||||
if (widget.onDelete != null) ...[
|
||||
const SizedBox(width: 4),
|
||||
GestureDetector(
|
||||
onTap: () => widget.onDelete!(item.id),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Icon(
|
||||
Icons.close_rounded,
|
||||
size: 14,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
shape: const CircleBorder(),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
widget.onDelete!(item.id);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Icon(
|
||||
Icons.close_rounded,
|
||||
size: 15,
|
||||
color: theme.colorScheme.onSurfaceVariant
|
||||
.withValues(alpha: 0.75),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -134,7 +205,7 @@ class _RecentSearchesState extends State<RecentSearches> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.items.length > 20) ...[
|
||||
if (uniqueItems.length > 20) ...[
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: TextButton.icon(
|
||||
@@ -148,7 +219,7 @@ class _RecentSearchesState extends State<RecentSearches> {
|
||||
label: Text(
|
||||
_expanded
|
||||
? 'Свернуть'
|
||||
: 'Показать все (${widget.items.length})',
|
||||
: 'Показать все (${uniqueItems.length})',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' hide appBuildNumber;
|
||||
@@ -150,24 +151,33 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// Pinned Top Category Quick Navigation
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.scaffoldBackgroundColor,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||
// Pinned Top Category Quick Navigation (Frosted Glass)
|
||||
ClipRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.scaffoldBackgroundColor.withValues(
|
||||
alpha: theme.brightness == Brightness.dark ? 0.76 : 0.82,
|
||||
),
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: theme.brightness == Brightness.dark
|
||||
? Colors.white.withValues(alpha: 0.08)
|
||||
: Colors.black.withValues(alpha: 0.06),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 860),
|
||||
child: _CategoryQuickNav(
|
||||
categories: navCategories,
|
||||
onSelect: _scrollTo,
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 860),
|
||||
child: _CategoryQuickNav(
|
||||
categories: navCategories,
|
||||
onSelect: _scrollTo,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -177,7 +187,12 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
16,
|
||||
12,
|
||||
16,
|
||||
120 + MediaQuery.paddingOf(context).bottom,
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
@@ -958,12 +973,300 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
||||
}
|
||||
|
||||
Future<void> _checkUpdates(BuildContext context, WidgetRef ref) async {
|
||||
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 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,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 38,
|
||||
height: 4.5,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.35),
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
isRu ? 'Источник обновлений' : 'Update Source',
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
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,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Option 1: GitHub (Recommended for speed)
|
||||
Material(
|
||||
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(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(
|
||||
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: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'GitHub',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 7,
|
||||
vertical: 2.5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green.withValues(alpha: 0.20),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
isRu ? 'Рекомендуется' : 'Recommended',
|
||||
style: const TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
isRu
|
||||
? 'Прямая быстрая загрузка релизов без задержек'
|
||||
: 'Direct fast download without limits',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
size: 15,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Option 2: Gitea
|
||||
Material(
|
||||
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(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(
|
||||
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: Colors.white,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Gitea (Synapse)',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
isRu
|
||||
? 'Альтернативный независимый сервер релизов'
|
||||
: 'Alternative independent release mirror',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
size: 15,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (selectedSource == null) return;
|
||||
if (!context.mounted) return;
|
||||
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(content: Text('Checking for updates...')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
selectedSource == UpdateSource.gitea
|
||||
? (isRu ? 'Проверка обновлений на Gitea...' : 'Checking updates on Gitea...')
|
||||
: (isRu ? 'Проверка обновлений на GitHub...' : 'Checking updates on GitHub...'),
|
||||
),
|
||||
),
|
||||
);
|
||||
final result =
|
||||
await ref.read(updateServiceProvider).checkForUpdates(force: true);
|
||||
final result = await ref.read(updateServiceProvider).checkForUpdates(
|
||||
force: true,
|
||||
source: selectedSource,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
messenger.hideCurrentSnackBar();
|
||||
if (result is Error<AppUpdateInfo?>) {
|
||||
@@ -973,7 +1276,11 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
||||
final update = (result as Success<AppUpdateInfo?>).data;
|
||||
if (update == null) {
|
||||
messenger.showSnackBar(
|
||||
const SnackBar(content: Text('Lunaris is up to date')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
isRu ? 'У вас установлена последняя версия Lunaris' : 'Lunaris is up to date',
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -1089,6 +1396,49 @@ class _SettingsContentState extends ConsumerState<_SettingsContent> {
|
||||
// Settings 2.0 Modern Components
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
class _SettingsIconBadge extends StatelessWidget {
|
||||
const _SettingsIconBadge({
|
||||
required this.icon,
|
||||
required this.color,
|
||||
this.size = 34,
|
||||
this.iconSize = 18,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final double size;
|
||||
final double iconSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: size,
|
||||
height: size,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
color,
|
||||
color.withValues(alpha: 0.86),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(size * 0.28),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: color.withValues(alpha: 0.35),
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 2.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(icon, size: iconSize, color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CategoryQuickNav extends StatelessWidget {
|
||||
const _CategoryQuickNav({
|
||||
required this.categories,
|
||||
@@ -1102,8 +1452,10 @@ class _CategoryQuickNav extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
return SizedBox(
|
||||
height: 40,
|
||||
height: 44,
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -1111,32 +1463,84 @@ class _CategoryQuickNav extends StatelessWidget {
|
||||
separatorBuilder: (_, __) => const SizedBox(width: 8),
|
||||
itemBuilder: (context, index) {
|
||||
final cat = categories[index];
|
||||
return Material(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
onTap: () => onSelect(cat.key),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
|
||||
),
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: isDark
|
||||
? Colors.black.withValues(alpha: 0.25)
|
||||
: cat.color.withValues(alpha: 0.12),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2.5),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(cat.icon, size: 16, color: cat.color),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
cat.label,
|
||||
style: theme.textTheme.labelLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
|
||||
child: Material(
|
||||
color: isDark
|
||||
? theme.colorScheme.surfaceContainerHigh.withValues(alpha: 0.60)
|
||||
: Colors.white.withValues(alpha: 0.82),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
onTap: () {
|
||||
HapticFeedback.selectionClick();
|
||||
onSelect(cat.key);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
border: Border.all(
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.18)
|
||||
: Colors.white.withValues(alpha: 0.85),
|
||||
width: 1.1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
cat.color,
|
||||
cat.color.withValues(alpha: 0.82),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: cat.color.withValues(alpha: 0.35),
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 1.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(cat.icon, size: 14, color: Colors.white),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
cat.label,
|
||||
style: theme.textTheme.labelLarge?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1165,50 +1569,95 @@ class _SettingsCardGroup extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
return Container(
|
||||
key: sectionKey,
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
margin: const EdgeInsets.only(bottom: 18),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.3),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: isDark
|
||||
? Colors.black.withValues(alpha: 0.40)
|
||||
: accentColor.withValues(alpha: 0.08),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 6),
|
||||
spreadRadius: -2,
|
||||
),
|
||||
BoxShadow(
|
||||
color: accentColor.withValues(alpha: isDark ? 0.08 : 0.04),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Header
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 10),
|
||||
child: Row(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: isDark
|
||||
? [
|
||||
theme.colorScheme.surfaceContainerHigh.withValues(alpha: 0.60),
|
||||
theme.colorScheme.surfaceContainerLow.withValues(alpha: 0.40),
|
||||
]
|
||||
: [
|
||||
Colors.white.withValues(alpha: 0.88),
|
||||
Colors.white.withValues(alpha: 0.72),
|
||||
],
|
||||
),
|
||||
border: Border.all(
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.15)
|
||||
: Colors.white.withValues(alpha: 0.85),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// iOS Liquid Glass Card Header
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 12),
|
||||
child: Row(
|
||||
children: [
|
||||
_SettingsIconBadge(
|
||||
icon: icon,
|
||||
color: accentColor,
|
||||
size: 34,
|
||||
iconSize: 19,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.3,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: accentColor.withValues(alpha: 0.14),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, size: 18, color: accentColor),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
height: 1,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.08)
|
||||
: theme.colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||
),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1, thickness: 1, indent: 0, endIndent: 0),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1219,12 +1668,15 @@ class _SettingsDivider extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
return Divider(
|
||||
height: 1,
|
||||
thickness: 0.7,
|
||||
indent: 68,
|
||||
indent: 64,
|
||||
endIndent: 16,
|
||||
color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.07)
|
||||
: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.25),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1255,14 +1707,11 @@ class _SettingsTile extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: iconColor),
|
||||
_SettingsIconBadge(
|
||||
icon: icon,
|
||||
color: iconColor,
|
||||
size: 34,
|
||||
iconSize: 18,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
@@ -1328,14 +1777,11 @@ class _SettingsSegmentedTile<T> extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: iconColor),
|
||||
_SettingsIconBadge(
|
||||
icon: icon,
|
||||
color: iconColor,
|
||||
size: 34,
|
||||
iconSize: 18,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
@@ -1445,14 +1891,11 @@ class _SettingsStepperTile extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(icon, size: 20, color: iconColor),
|
||||
_SettingsIconBadge(
|
||||
icon: icon,
|
||||
color: iconColor,
|
||||
size: 34,
|
||||
iconSize: 18,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
@@ -1545,18 +1988,11 @@ class _SettingsFolderStructureTile extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0EA5E9).withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.folder_copy_rounded,
|
||||
size: 20,
|
||||
color: Color(0xFF0EA5E9),
|
||||
),
|
||||
const _SettingsIconBadge(
|
||||
icon: Icons.folder_copy_rounded,
|
||||
color: Color(0xFF0EA5E9),
|
||||
size: 34,
|
||||
iconSize: 18,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
@@ -2183,12 +2619,12 @@ class _HeroBrandBanner extends StatelessWidget {
|
||||
OutlinedButton.icon(
|
||||
onPressed: () async {
|
||||
final url = Uri.parse(
|
||||
'https://gitea.rardogsynapse.online/RarDog/Lunaris',
|
||||
'https://github.com/RarDog/Lunaris',
|
||||
);
|
||||
await launchUrl(url, mode: LaunchMode.externalApplication);
|
||||
},
|
||||
icon: const Icon(Icons.code_rounded, size: 18),
|
||||
label: const Text('Gitea'),
|
||||
label: const Text('GitHub'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -2200,35 +2636,64 @@ class _HeroBrandBanner extends StatelessWidget {
|
||||
Text(
|
||||
isRu ? 'Резервное копирование и экспорт' : 'Backup & JSON Export',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
alignment: WrapAlignment.center,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
onPressed: onExportBackup,
|
||||
icon: const Icon(Icons.file_upload_rounded, size: 18),
|
||||
label: Text(isRu ? 'Экспорт бэкапа' : 'Export backup'),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: onExportBackup,
|
||||
icon: const Icon(Icons.file_upload_rounded, size: 18),
|
||||
label: Text(
|
||||
isRu ? 'Экспорт бэкапа' : 'Export backup',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: onImportBackup,
|
||||
icon: const Icon(Icons.file_download_rounded, size: 18),
|
||||
label: Text(
|
||||
isRu ? 'Импорт бэкапа' : 'Import backup',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: onImportBackup,
|
||||
icon: const Icon(Icons.file_download_rounded, size: 18),
|
||||
label: Text(isRu ? 'Импорт бэкапа' : 'Import backup'),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: onExportJson,
|
||||
icon: const Icon(Icons.upload_file_rounded, size: 18),
|
||||
label: const Text('JSON Export'),
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
onPressed: onImportJson,
|
||||
icon: const Icon(Icons.download_for_offline_rounded, size: 18),
|
||||
label: const Text('JSON Import'),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.tonalIcon(
|
||||
onPressed: onExportJson,
|
||||
icon: const Icon(Icons.data_object_rounded, size: 18),
|
||||
label: Text(
|
||||
isRu ? 'JSON Экспорт' : 'JSON Export',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: FilledButton.tonalIcon(
|
||||
onPressed: onImportJson,
|
||||
icon: const Icon(Icons.download_for_offline_rounded, size: 18),
|
||||
label: Text(
|
||||
isRu ? 'JSON Импорт' : 'JSON Import',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
),
|
||||
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: 8),
|
||||
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)
|
||||
.colorScheme
|
||||
.surfaceContainerHighest,
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.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,184 +347,251 @@ 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: InkWell(
|
||||
onTap: onOpen,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
children: [
|
||||
// Squircle Thumbnail
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: SizedBox(
|
||||
width: 68,
|
||||
height: 68,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
image == null
|
||||
? Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
child: const Icon(Icons.image_not_supported_rounded),
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: image,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (_, __) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
),
|
||||
errorWidget: (_, __, ___) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
child: const Icon(
|
||||
Icons.broken_image_rounded,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_isVideo)
|
||||
Positioned(
|
||||
right: 4,
|
||||
bottom: 4,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.65),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.play_arrow_rounded,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Post details
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
scheme.primaryContainer.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
post.providerName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onPrimaryContainer,
|
||||
// Squircle Thumbnail
|
||||
ClipRRect(
|
||||
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),
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: image,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (_, __) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
),
|
||||
errorWidget: (_, __, ___) => Container(
|
||||
color: scheme.surfaceContainerHighest,
|
||||
child: const Icon(
|
||||
Icons.broken_image_rounded,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
timeStr,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
if (_isVideo)
|
||||
Positioned(
|
||||
right: 4,
|
||||
bottom: 4,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.65),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.play_arrow_rounded,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
post.tags.isEmpty ? '#${post.id}' : post.tags.take(4).join(' '),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (post.score != 0) ...[
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
const SizedBox(width: 12),
|
||||
// Post details
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.thumb_up_rounded,
|
||||
size: 12,
|
||||
color: scheme.outline,
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 7,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
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,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: scheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
timeStr,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${post.score}',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
color: scheme.outline,
|
||||
post.tags.isEmpty ? '#${post.id}' : post.tags.take(4).join(' '),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: -0.1,
|
||||
),
|
||||
),
|
||||
if (post.score != 0) ...[
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.thumb_up_rounded,
|
||||
size: 12,
|
||||
color: scheme.outline,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${post.score}',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
?.copyWith(
|
||||
color: scheme.outline,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
// Action buttons
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints:
|
||||
const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
tooltip: isFavorite
|
||||
? (isRu ? 'В избранном' : 'In favorites')
|
||||
: (isRu ? 'В избранное' : 'Add to favorites'),
|
||||
onPressed: () {
|
||||
HapticFeedback.selectionClick();
|
||||
onFavorite();
|
||||
},
|
||||
icon: Icon(
|
||||
isFavorite
|
||||
? Icons.favorite_rounded
|
||||
: Icons.favorite_border_rounded,
|
||||
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: () {
|
||||
HapticFeedback.lightImpact();
|
||||
onDelete();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.close_rounded,
|
||||
size: 20,
|
||||
color: scheme.onSurfaceVariant.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Action buttons
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
tooltip: isFavorite
|
||||
? (isRu ? 'В избранном' : 'In favorites')
|
||||
: (isRu ? 'В избранное' : 'Add to favorites'),
|
||||
onPressed: onFavorite,
|
||||
icon: Icon(
|
||||
isFavorite
|
||||
? Icons.favorite_rounded
|
||||
: Icons.favorite_border_rounded,
|
||||
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,
|
||||
icon: Icon(
|
||||
Icons.close_rounded,
|
||||
size: 20,
|
||||
color: scheme.onSurfaceVariant.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
@@ -192,23 +194,46 @@ class _TagInputSearchBarState extends State<TagInputSearchBar> {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
final screenSize = MediaQuery.sizeOf(context);
|
||||
final renderBox =
|
||||
_fieldKey.currentContext?.findRenderObject() as RenderBox?;
|
||||
final width =
|
||||
final fieldWidth =
|
||||
renderBox?.hasSize == true ? renderBox!.size.width : 360.0;
|
||||
final height =
|
||||
final fieldHeight =
|
||||
renderBox?.hasSize == true ? renderBox!.size.height : 48.0;
|
||||
|
||||
final screenW = screenSize.width;
|
||||
// Substantially wider dropdown:
|
||||
// Mobile (< 600px): use full screen width minus comfortable 24px margins.
|
||||
// Desktop/Tablet (>= 600px): expand to 1.35x field width, up to 780px.
|
||||
final dropdownWidth = screenW < 600
|
||||
? (screenW - 24.0).clamp(fieldWidth, 580.0)
|
||||
: (fieldWidth * 1.35).clamp(fieldWidth, (screenW - 32.0).clamp(fieldWidth, 780.0));
|
||||
|
||||
// Ensure dropdown stays fully on screen and doesn't get clipped
|
||||
double dxOffset = 0.0;
|
||||
if (renderBox?.hasSize == true && renderBox?.attached == true) {
|
||||
final globalPos = renderBox!.localToGlobal(Offset.zero);
|
||||
final globalRight = globalPos.dx + dropdownWidth;
|
||||
final maxRight = screenW - 12.0;
|
||||
if (globalRight > maxRight) {
|
||||
dxOffset = maxRight - globalRight;
|
||||
}
|
||||
if (globalPos.dx + dxOffset < 12.0) {
|
||||
dxOffset = 12.0 - globalPos.dx;
|
||||
}
|
||||
}
|
||||
|
||||
return CompositedTransformFollower(
|
||||
link: _layerLink,
|
||||
showWhenUnlinked: false,
|
||||
offset: Offset(0, height + 6),
|
||||
offset: Offset(dxOffset, fieldHeight + 6),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: TapRegion(
|
||||
groupId: _fieldKey,
|
||||
child: SizedBox(
|
||||
width: width.clamp(280.0, 620.0),
|
||||
width: dropdownWidth,
|
||||
child: _TagSuggestionDropdown(
|
||||
suggestions: suggestions,
|
||||
query: token,
|
||||
@@ -263,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(
|
||||
@@ -544,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;
|
||||
@@ -565,7 +590,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 620),
|
||||
constraints: const BoxConstraints(maxWidth: 820),
|
||||
child: Material(
|
||||
elevation: 8,
|
||||
shadowColor: Colors.black.withValues(alpha: 0.18),
|
||||
@@ -641,7 +666,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
||||
if (cleanToken.isEmpty) {
|
||||
return Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: defaultStyle,
|
||||
);
|
||||
@@ -653,7 +678,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
||||
if (matchIndex < 0) {
|
||||
return Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: defaultStyle,
|
||||
);
|
||||
@@ -678,7 +703,7 @@ class _TagSuggestionDropdown extends StatelessWidget {
|
||||
if (after.isNotEmpty) TextSpan(text: after),
|
||||
],
|
||||
),
|
||||
maxLines: 1,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@@ -9,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;
|
||||
@@ -32,69 +33,6 @@ class AppShell extends ConsumerWidget {
|
||||
_Destination('settings', 'Settings', Icons.settings_rounded, '/settings'),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final settings =
|
||||
ref.watch(appSettingsProvider).value ?? AppSettings.defaults;
|
||||
final artistConfigs =
|
||||
ref.watch(_enabledArtistConfigsProvider).value ?? const [];
|
||||
final destinations =
|
||||
_visibleDestinations(settings, artistConfigs.isNotEmpty);
|
||||
final ru = settings.languageCode == 'ru';
|
||||
return Shortcuts(
|
||||
shortcuts: {
|
||||
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyF):
|
||||
const _NavigateIntent('/search'),
|
||||
LogicalKeySet(LogicalKeyboardKey.escape): const _BackIntent(),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit1): const _NavigateIntent('/'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit2):
|
||||
const _NavigateIntent('/search'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit3):
|
||||
const _NavigateIntent('/favorites'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit4):
|
||||
const _NavigateIntent('/viewed'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit5):
|
||||
const _NavigateIntent('/collections'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit6):
|
||||
const _NavigateIntent('/artists'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit7):
|
||||
const _NavigateIntent('/providers'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit8):
|
||||
const _NavigateIntent('/settings'),
|
||||
},
|
||||
child: Actions(
|
||||
actions: {
|
||||
_NavigateIntent: CallbackAction<_NavigateIntent>(
|
||||
onInvoke: (intent) {
|
||||
context.go(intent.location);
|
||||
return null;
|
||||
},
|
||||
),
|
||||
_BackIntent: CallbackAction<_BackIntent>(
|
||||
onInvoke: (_) {
|
||||
if (Navigator.of(context).canPop()) Navigator.of(context).pop();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
child: Responsive.isDesktop(context)
|
||||
? _DesktopShell(
|
||||
destinations: destinations,
|
||||
ru: ru,
|
||||
child: child,
|
||||
)
|
||||
: _MobileShell(
|
||||
destinations: destinations,
|
||||
ru: ru,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static List<_Destination> _visibleDestinations(
|
||||
AppSettings settings,
|
||||
bool hasArtists,
|
||||
@@ -105,6 +43,139 @@ class AppShell extends ConsumerWidget {
|
||||
return true;
|
||||
}).toList(growable: false);
|
||||
}
|
||||
|
||||
@override
|
||||
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 =
|
||||
AppShell._visibleDestinations(settings, artistConfigs.isNotEmpty);
|
||||
final ru = settings.languageCode == 'ru';
|
||||
|
||||
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'),
|
||||
LogicalKeySet(LogicalKeyboardKey.escape): const _BackIntent(),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit1): const _NavigateIntent('/'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit2):
|
||||
const _NavigateIntent('/search'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit3):
|
||||
const _NavigateIntent('/favorites'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit4):
|
||||
const _NavigateIntent('/viewed'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit5):
|
||||
const _NavigateIntent('/collections'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit6):
|
||||
const _NavigateIntent('/artists'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit7):
|
||||
const _NavigateIntent('/providers'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit8):
|
||||
const _NavigateIntent('/settings'),
|
||||
},
|
||||
child: Actions(
|
||||
actions: {
|
||||
_NavigateIntent: CallbackAction<_NavigateIntent>(
|
||||
onInvoke: (intent) {
|
||||
context.go(intent.location);
|
||||
return null;
|
||||
},
|
||||
),
|
||||
_BackIntent: CallbackAction<_BackIntent>(
|
||||
onInvoke: (_) {
|
||||
_handleBack();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
child: Responsive.isDesktop(context)
|
||||
? _DesktopShell(
|
||||
destinations: destinations,
|
||||
ru: ru,
|
||||
child: widget.child,
|
||||
)
|
||||
: _MobileShell(
|
||||
destinations: destinations,
|
||||
ru: ru,
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DesktopShell extends StatefulWidget {
|
||||
@@ -281,29 +352,393 @@ class _MobileShell extends StatelessWidget {
|
||||
? location == '/'
|
||||
: location.startsWith(item.location),
|
||||
);
|
||||
final bottomInset = 76.0 + MediaQuery.paddingOf(context).bottom;
|
||||
|
||||
return Scaffold(
|
||||
body: child,
|
||||
extendBody: true,
|
||||
body: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
padding: MediaQuery.of(context).padding.copyWith(
|
||||
bottom: bottomInset,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
floatingActionButton: location == '/settings'
|
||||
? null
|
||||
: FloatingActionButton.small(
|
||||
heroTag: 'mobile-settings',
|
||||
tooltip: ru
|
||||
? '\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438'
|
||||
: 'Settings',
|
||||
onPressed: () => context.go('/settings'),
|
||||
child: const Icon(Icons.settings_rounded),
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 0, right: 2),
|
||||
child: _LiquidGlassSettingsButton(
|
||||
ru: ru,
|
||||
onTap: () => context.go('/settings'),
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
bottomNavigationBar: NavigationBar(
|
||||
bottomNavigationBar: _LiquidGlassBottomBar(
|
||||
selectedIndex: selected < 0 ? 0 : selected,
|
||||
onDestinationSelected: (index) => context.go(items[index].location),
|
||||
destinations: [
|
||||
for (final item in items)
|
||||
NavigationDestination(
|
||||
icon: Icon(item.icon),
|
||||
label: item.mobileLabelFor(ru),
|
||||
items: items,
|
||||
ru: ru,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LiquidGlassBottomBar extends StatefulWidget {
|
||||
const _LiquidGlassBottomBar({
|
||||
required this.selectedIndex,
|
||||
required this.onDestinationSelected,
|
||||
required this.items,
|
||||
required this.ru,
|
||||
});
|
||||
|
||||
final int selectedIndex;
|
||||
final ValueChanged<int> onDestinationSelected;
|
||||
final List<_Destination> items;
|
||||
final bool ru;
|
||||
|
||||
@override
|
||||
State<_LiquidGlassBottomBar> createState() => _LiquidGlassBottomBarState();
|
||||
}
|
||||
|
||||
class _LiquidGlassBottomBarState extends State<_LiquidGlassBottomBar> {
|
||||
int? _pressedIndex;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
final scheme = theme.colorScheme;
|
||||
final count = widget.items.length;
|
||||
if (count == 0) return const SizedBox.shrink();
|
||||
|
||||
return SafeArea(
|
||||
top: false,
|
||||
left: false,
|
||||
right: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(14, 0, 14, 10),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final barWidth = constraints.maxWidth;
|
||||
final itemWidth = barWidth / count;
|
||||
final pillWidth = (itemWidth - 6).clamp(36.0, 64.0);
|
||||
final pillLeft =
|
||||
widget.selectedIndex * itemWidth + (itemWidth - pillWidth) / 2;
|
||||
|
||||
return Container(
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: isDark ? 0.38 : 0.09),
|
||||
blurRadius: 22,
|
||||
offset: const Offset(0, 8),
|
||||
spreadRadius: -2,
|
||||
),
|
||||
if (isDark)
|
||||
BoxShadow(
|
||||
color: scheme.primary.withValues(alpha: 0.07),
|
||||
blurRadius: 18,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: isDark
|
||||
? [
|
||||
scheme.surfaceContainerHigh
|
||||
.withValues(alpha: 0.70),
|
||||
scheme.surface.withValues(alpha: 0.82),
|
||||
]
|
||||
: [
|
||||
Colors.white.withValues(alpha: 0.84),
|
||||
Colors.white.withValues(alpha: 0.68),
|
||||
],
|
||||
),
|
||||
border: Border.all(
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.16)
|
||||
: Colors.white.withValues(alpha: 0.75),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: [
|
||||
// Animated sliding liquid pill indicator
|
||||
AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOutBack,
|
||||
left: pillLeft,
|
||||
top: 7,
|
||||
child: Container(
|
||||
width: pillWidth,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.primaryContainer.withValues(
|
||||
alpha: isDark ? 0.75 : 0.88,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: scheme.primary.withValues(
|
||||
alpha: isDark ? 0.35 : 0.22,
|
||||
),
|
||||
width: 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: scheme.primary.withValues(
|
||||
alpha: isDark ? 0.22 : 0.12,
|
||||
),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Navigation item buttons
|
||||
Row(
|
||||
children: [
|
||||
for (var i = 0; i < count; i++)
|
||||
Expanded(
|
||||
child: _LiquidNavItem(
|
||||
destination: widget.items[i],
|
||||
label: widget.items[i]
|
||||
.mobileLabelFor(widget.ru),
|
||||
isSelected: widget.selectedIndex == i,
|
||||
isPressed: _pressedIndex == i,
|
||||
onTapDown: () =>
|
||||
setState(() => _pressedIndex = i),
|
||||
onTapUp: () =>
|
||||
setState(() => _pressedIndex = null),
|
||||
onTapCancel: () =>
|
||||
setState(() => _pressedIndex = null),
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
widget.onDestinationSelected(i);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LiquidNavItem extends StatelessWidget {
|
||||
const _LiquidNavItem({
|
||||
required this.destination,
|
||||
required this.label,
|
||||
required this.isSelected,
|
||||
required this.isPressed,
|
||||
required this.onTapDown,
|
||||
required this.onTapUp,
|
||||
required this.onTapCancel,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final _Destination destination;
|
||||
final String label;
|
||||
final bool isSelected;
|
||||
final bool isPressed;
|
||||
final VoidCallback onTapDown;
|
||||
final VoidCallback onTapUp;
|
||||
final VoidCallback onTapCancel;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
final targetScale = isPressed ? 0.86 : (isSelected ? 1.05 : 1.0);
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: (_) => onTapDown(),
|
||||
onTapUp: (_) => onTapUp(),
|
||||
onTapCancel: onTapCancel,
|
||||
onTap: onTap,
|
||||
child: Center(
|
||||
child: AnimatedScale(
|
||||
scale: targetScale,
|
||||
duration: const Duration(milliseconds: 180),
|
||||
curve: Curves.easeOutCubic,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 32,
|
||||
child: Center(
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (child, anim) => ScaleTransition(
|
||||
scale: anim,
|
||||
child: child,
|
||||
),
|
||||
child: Icon(
|
||||
destination.icon,
|
||||
key: ValueKey('${destination.id}_$isSelected'),
|
||||
size: isSelected ? 22 : 20,
|
||||
color: isSelected
|
||||
? scheme.onPrimaryContainer
|
||||
: (isDark
|
||||
? scheme.onSurfaceVariant
|
||||
.withValues(alpha: 0.78)
|
||||
: scheme.onSurfaceVariant
|
||||
.withValues(alpha: 0.85)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
AnimatedDefaultTextStyle(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight:
|
||||
isSelected ? FontWeight.w700 : FontWeight.w500,
|
||||
color: isSelected
|
||||
? (isDark ? scheme.primary : scheme.onSurface)
|
||||
: scheme.onSurfaceVariant.withValues(alpha: 0.75),
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
child: Text(label),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LiquidGlassSettingsButton extends StatefulWidget {
|
||||
const _LiquidGlassSettingsButton({
|
||||
required this.ru,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final bool ru;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
State<_LiquidGlassSettingsButton> createState() =>
|
||||
_LiquidGlassSettingsButtonState();
|
||||
}
|
||||
|
||||
class _LiquidGlassSettingsButtonState extends State<_LiquidGlassSettingsButton> {
|
||||
bool _pressed = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
final scheme = theme.colorScheme;
|
||||
|
||||
return Tooltip(
|
||||
message: widget.ru ? 'Настройки' : 'Settings',
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: (_) => setState(() => _pressed = true),
|
||||
onTapUp: (_) => setState(() => _pressed = false),
|
||||
onTapCancel: () => setState(() => _pressed = false),
|
||||
onTap: () {
|
||||
HapticFeedback.mediumImpact();
|
||||
widget.onTap();
|
||||
},
|
||||
child: AnimatedScale(
|
||||
scale: _pressed ? 0.88 : 1.0,
|
||||
duration: const Duration(milliseconds: 160),
|
||||
curve: Curves.easeOutCubic,
|
||||
child: Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: isDark ? 0.38 : 0.12),
|
||||
blurRadius: 18,
|
||||
offset: const Offset(0, 6),
|
||||
spreadRadius: -1,
|
||||
),
|
||||
BoxShadow(
|
||||
color: scheme.primary.withValues(alpha: isDark ? 0.20 : 0.12),
|
||||
blurRadius: 12,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
child: ClipOval(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: RadialGradient(
|
||||
center: const Alignment(-0.3, -0.4),
|
||||
radius: 1.1,
|
||||
colors: isDark
|
||||
? [
|
||||
scheme.surfaceContainerHigh.withValues(alpha: 0.85),
|
||||
scheme.surface.withValues(alpha: 0.75),
|
||||
]
|
||||
: [
|
||||
Colors.white.withValues(alpha: 0.92),
|
||||
Colors.white.withValues(alpha: 0.70),
|
||||
],
|
||||
),
|
||||
border: Border.all(
|
||||
color: isDark
|
||||
? Colors.white.withValues(alpha: 0.24)
|
||||
: Colors.white.withValues(alpha: 0.85),
|
||||
width: 1.4,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: AnimatedRotation(
|
||||
turns: _pressed ? 0.125 : 0.0,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
curve: Curves.easeOutBack,
|
||||
child: Icon(
|
||||
Icons.settings_rounded,
|
||||
size: 23,
|
||||
color: scheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../backend/models/creator_link.dart';
|
||||
|
||||
class FormattedContentText extends StatefulWidget {
|
||||
const FormattedContentText({
|
||||
super.key,
|
||||
required this.text,
|
||||
this.style,
|
||||
this.linkColor,
|
||||
this.selectable = true,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
final Color? linkColor;
|
||||
final bool selectable;
|
||||
|
||||
@override
|
||||
State<FormattedContentText> createState() => _FormattedContentTextState();
|
||||
}
|
||||
|
||||
class _FormattedContentTextState extends State<FormattedContentText> {
|
||||
final List<TapGestureRecognizer> _recognizers = [];
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
for (final r in _recognizers) {
|
||||
r.dispose();
|
||||
}
|
||||
_recognizers.clear();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _clearRecognizers() {
|
||||
for (final r in _recognizers) {
|
||||
r.dispose();
|
||||
}
|
||||
_recognizers.clear();
|
||||
}
|
||||
|
||||
Future<void> _launch(String url) async {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri != null) {
|
||||
try {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Не удалось открыть ссылку: $url')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_clearRecognizers();
|
||||
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final defaultStyle = widget.style ?? theme.textTheme.bodyMedium ?? const TextStyle();
|
||||
final linkStyle = defaultStyle.copyWith(
|
||||
color: widget.linkColor ?? scheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: (widget.linkColor ?? scheme.primary).withValues(alpha: 0.45),
|
||||
);
|
||||
|
||||
final text = widget.text;
|
||||
if (text.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
final urlRegex = RegExp(r'''https?://[^\s<>"{}|\\^`\[\]]+''', caseSensitive: false);
|
||||
final spans = <InlineSpan>[];
|
||||
var lastIndex = 0;
|
||||
|
||||
for (final match in urlRegex.allMatches(text)) {
|
||||
if (match.start > lastIndex) {
|
||||
spans.add(TextSpan(
|
||||
text: text.substring(lastIndex, match.start),
|
||||
style: defaultStyle,
|
||||
));
|
||||
}
|
||||
|
||||
var rawUrl = match.group(0)!;
|
||||
var cleanUrl = rawUrl;
|
||||
var trailing = '';
|
||||
while (cleanUrl.isNotEmpty &&
|
||||
(cleanUrl.endsWith(')') ||
|
||||
cleanUrl.endsWith('.') ||
|
||||
cleanUrl.endsWith(',') ||
|
||||
cleanUrl.endsWith(';') ||
|
||||
cleanUrl.endsWith('!') ||
|
||||
cleanUrl.endsWith('?') ||
|
||||
cleanUrl.endsWith(':') ||
|
||||
cleanUrl.endsWith('>'))) {
|
||||
trailing = cleanUrl[cleanUrl.length - 1] + trailing;
|
||||
cleanUrl = cleanUrl.substring(0, cleanUrl.length - 1);
|
||||
}
|
||||
|
||||
final recognizer = TapGestureRecognizer()
|
||||
..onTap = () => _launch(cleanUrl);
|
||||
_recognizers.add(recognizer);
|
||||
|
||||
spans.add(TextSpan(
|
||||
text: cleanUrl,
|
||||
style: linkStyle,
|
||||
recognizer: recognizer,
|
||||
));
|
||||
|
||||
if (trailing.isNotEmpty) {
|
||||
spans.add(TextSpan(
|
||||
text: trailing,
|
||||
style: defaultStyle,
|
||||
));
|
||||
}
|
||||
|
||||
lastIndex = match.end;
|
||||
}
|
||||
|
||||
if (lastIndex < text.length) {
|
||||
spans.add(TextSpan(
|
||||
text: text.substring(lastIndex),
|
||||
style: defaultStyle,
|
||||
));
|
||||
}
|
||||
|
||||
if (widget.selectable) {
|
||||
return SelectableText.rich(
|
||||
TextSpan(children: spans),
|
||||
style: defaultStyle,
|
||||
);
|
||||
}
|
||||
|
||||
return Text.rich(
|
||||
TextSpan(children: spans),
|
||||
style: defaultStyle,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CreatorLinkChips extends StatelessWidget {
|
||||
const CreatorLinkChips({
|
||||
super.key,
|
||||
required this.links,
|
||||
this.title,
|
||||
});
|
||||
|
||||
final List<CreatorLink> links;
|
||||
final String? title;
|
||||
|
||||
Future<void> _openLink(BuildContext context, String url) async {
|
||||
final uri = Uri.tryParse(url);
|
||||
if (uri != null) {
|
||||
try {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} catch (_) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Не удалось открыть ссылку: $url')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (links.isEmpty) return const SizedBox.shrink();
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (title != null && title!.isNotEmpty) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.link_rounded,
|
||||
size: 15,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
title!,
|
||||
style: theme.textTheme.labelMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 6,
|
||||
children: links.map((link) {
|
||||
final brand = link.brandColor;
|
||||
final labelText = link.title.isNotEmpty ? link.title : link.serviceName;
|
||||
|
||||
return Material(
|
||||
color: brand.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: () => _openLink(context, link.url),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: brand.withValues(alpha: 0.35),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
link.iconData,
|
||||
size: 16,
|
||||
color: brand,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 240),
|
||||
child: Text(
|
||||
labelText,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.arrow_outward_rounded,
|
||||
size: 12,
|
||||
color: brand.withValues(alpha: 0.75),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
fontWeight: FontWeight.w700,
|
||||
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,
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
name: gel_rule_app
|
||||
description: Local backend/core layer for a Flutter booru browser app.
|
||||
publish_to: "none"
|
||||
version: 2.3.9+49
|
||||
version: 3.1.5+66
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.0 <4.0.0"
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gel_rule_app/backend/models/creator_link.dart';
|
||||
|
||||
void main() {
|
||||
group('CreatorLink extractor and classification tests', () {
|
||||
test('extracts and classifies social and creator links accurately', () {
|
||||
const text = '''
|
||||
Check out my latest speedpaint on YouTube: https://youtu.be/dQw4w9WgXcQ
|
||||
Also follow my X account https://x.com/artist_handle and Instagram: https://instagram.com/p/C1234567/!
|
||||
Support me on Patreon: https://www.patreon.com/my_art or Fanbox: https://artist.fanbox.cc
|
||||
Join my Discord: https://discord.gg/invitelink
|
||||
Other links: https://carrd.co/myportfolio and https://example.com/blog.
|
||||
Cloud links like https://drive.google.com/file/d/123/view and https://mega.nz/file/abc should be excluded by default.
|
||||
''';
|
||||
|
||||
final links = CreatorLink.extractLinks(text);
|
||||
|
||||
expect(links.length, 8);
|
||||
|
||||
final yt = links.firstWhere((l) => l.type == CreatorLinkType.youtube);
|
||||
expect(yt.serviceName, 'YouTube');
|
||||
expect(yt.url, 'https://youtu.be/dQw4w9WgXcQ');
|
||||
|
||||
final twitter = links.firstWhere((l) => l.type == CreatorLinkType.twitter);
|
||||
expect(twitter.serviceName, 'X (Twitter)');
|
||||
expect(twitter.url, 'https://x.com/artist_handle');
|
||||
|
||||
final insta = links.firstWhere((l) => l.type == CreatorLinkType.instagram);
|
||||
expect(insta.serviceName, 'Instagram');
|
||||
expect(insta.url, 'https://instagram.com/p/C1234567/');
|
||||
|
||||
final patreon = links.firstWhere((l) => l.type == CreatorLinkType.patreon);
|
||||
expect(patreon.serviceName, 'Patreon');
|
||||
|
||||
final fanbox = links.firstWhere((l) => l.type == CreatorLinkType.fanbox);
|
||||
expect(fanbox.serviceName, 'Fanbox');
|
||||
|
||||
final discord = links.firstWhere((l) => l.type == CreatorLinkType.discord);
|
||||
expect(discord.serviceName, 'Discord');
|
||||
|
||||
final hub = links.firstWhere((l) => l.type == CreatorLinkType.linkhub);
|
||||
expect(hub.serviceName, 'Links Hub');
|
||||
|
||||
final web = links.firstWhere((l) => l.type == CreatorLinkType.other);
|
||||
expect(web.url, 'https://example.com/blog');
|
||||
|
||||
// Verify cloud storage was excluded
|
||||
expect(links.any((l) => l.url.contains('drive.google.com')), isFalse);
|
||||
expect(links.any((l) => l.url.contains('mega.nz')), isFalse);
|
||||
});
|
||||
|
||||
test('handles HTML anchor links with custom titles', () {
|
||||
const html = '''
|
||||
<p>Visit my <a href="https://twitter.com/draws">Twitter Profile</a> and watch on <a href="https://www.youtube.com/channel/123">YouTube Stream</a>!</p>
|
||||
''';
|
||||
|
||||
final links = CreatorLink.extractLinks(html);
|
||||
expect(links.length, 2);
|
||||
|
||||
final tw = links.firstWhere((l) => l.type == CreatorLinkType.twitter);
|
||||
expect(tw.title, 'Twitter Profile');
|
||||
|
||||
final yt = links.firstWhere((l) => l.type == CreatorLinkType.youtube);
|
||||
expect(yt.title, 'YouTube Stream');
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -265,5 +265,83 @@ void main() {
|
||||
expect(lastMethod, equals('DELETE'));
|
||||
expect(lastPath, equals('https://pawchive.pw/api/v1/favorites/creator/fanbox/12345'));
|
||||
});
|
||||
|
||||
test('pushLocalFavoritesToAccount exports local artists to Pawchive', () async {
|
||||
final postedPaths = <String>[];
|
||||
final dio = Dio();
|
||||
dio.httpClientAdapter = _FakeAdapter((options) async {
|
||||
if (options.path.endsWith('/api/v1/account/favorites')) {
|
||||
final payload = jsonEncode([
|
||||
{
|
||||
'id': 'already_remote_1',
|
||||
'service': 'fanbox',
|
||||
'name': 'AlreadyRemote',
|
||||
},
|
||||
]);
|
||||
return ResponseBody.fromString(
|
||||
payload,
|
||||
200,
|
||||
headers: {
|
||||
Headers.contentTypeHeader: [Headers.jsonContentType],
|
||||
},
|
||||
);
|
||||
}
|
||||
if (options.method == 'POST' &&
|
||||
options.path.contains('/api/v1/favorites/creator/')) {
|
||||
postedPaths.add(options.path);
|
||||
return ResponseBody.fromString('ok', 204);
|
||||
}
|
||||
return ResponseBody.fromString('Not found', 404);
|
||||
});
|
||||
|
||||
final service = PawchiveSyncService(dio: dio);
|
||||
|
||||
const itemAlreadyRemote = FavoriteArtistItem(
|
||||
id: 'already_remote_1',
|
||||
service: 'fanbox',
|
||||
providerId: 'pawchive',
|
||||
name: 'AlreadyRemote',
|
||||
);
|
||||
const itemToUpload1 = FavoriteArtistItem(
|
||||
id: 'local_creator_99',
|
||||
service: 'patreon',
|
||||
providerId: 'kemono',
|
||||
name: 'LocalPatreonCreator',
|
||||
);
|
||||
const itemToUpload2 = FavoriteArtistItem(
|
||||
id: 'local_creator_88',
|
||||
service: 'subscribestar',
|
||||
providerId: 'coomer',
|
||||
name: 'LocalSubscribeStarCreator',
|
||||
);
|
||||
|
||||
final settings = AppSettings.defaults.copyWith(
|
||||
favoriteArtists: [
|
||||
jsonEncode(itemAlreadyRemote.toJson()),
|
||||
jsonEncode(itemToUpload1.toJson()),
|
||||
jsonEncode(itemToUpload2.toJson()),
|
||||
],
|
||||
);
|
||||
|
||||
final account = PawchiveAccount(
|
||||
id: 'myacc',
|
||||
username: 'myacc',
|
||||
sessionCookie: 'session=123',
|
||||
createdAt: DateTime.now(),
|
||||
);
|
||||
|
||||
final pushResult = await service.pushLocalFavoritesToAccount(
|
||||
account: account,
|
||||
settings: settings,
|
||||
);
|
||||
|
||||
expect(pushResult.isSuccess, isTrue);
|
||||
expect(pushResult.pushedCount, equals(2));
|
||||
expect(pushResult.totalLocalCandidates, equals(3));
|
||||
expect(pushResult.totalRemoteCount, equals(3)); // 1 existing + 2 pushed
|
||||
expect(postedPaths.length, equals(2));
|
||||
expect(postedPaths[0], contains('/api/v1/favorites/creator/patreon/local_creator_99'));
|
||||
expect(postedPaths[1], contains('/api/v1/favorites/creator/subscribestar/local_creator_88'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:gel_rule_app/backend/services/update_service.dart';
|
||||
import 'package:gel_rule_app/core/database/database_service.dart';
|
||||
|
||||
void main() {
|
||||
test('UpdateService parses Gitea release JSON correctly', () {
|
||||
test('UpdateService parses GitHub release JSON correctly', () {
|
||||
final service = UpdateService(Dio(), SettingsService(_MockDatabaseService()));
|
||||
|
||||
// Use reflection or constructor to test info
|
||||
@@ -15,21 +15,21 @@ void main() {
|
||||
tagName: 'v2.0.2',
|
||||
name: 'Lunaris 2.0.2',
|
||||
body: 'Release notes',
|
||||
htmlUrl: 'https://gitea.rardogsynapse.online/RarDog/Lunaris/releases/tag/v2.0.2',
|
||||
htmlUrl: 'https://github.com/RarDog/Lunaris/releases/tag/v2.0.2',
|
||||
publishedAt: DateTime.parse('2026-09-03T18:00:00Z'),
|
||||
apkUrl: 'https://gitea.rardogsynapse.online/attachments/apk',
|
||||
linuxTarGzUrl: 'https://gitea.rardogsynapse.online/attachments/linux',
|
||||
apkUrl: 'https://github.com/RarDog/Lunaris/releases/download/v2.0.2/Lunaris.apk',
|
||||
linuxTarGzUrl: 'https://github.com/RarDog/Lunaris/releases/download/v2.0.2/linux.tar.gz',
|
||||
);
|
||||
|
||||
expect(info.hasAssets, isTrue);
|
||||
expect(info.apkUrl, contains('apk'));
|
||||
expect(info.linuxTarGzUrl, contains('linux'));
|
||||
expect(
|
||||
service.assetFileName(info, 'https://gitea.rardogsynapse.online/attachments/Lunaris-v2.0.2.apk'),
|
||||
service.assetFileName(info, 'https://github.com/RarDog/Lunaris/releases/download/v2.0.2/Lunaris-v2.0.2.apk'),
|
||||
'Lunaris-v2.0.2.apk',
|
||||
);
|
||||
expect(
|
||||
service.assetFileName(info, info.apkUrl!),
|
||||
service.assetFileName(info, 'https://github.com/RarDog/Lunaris/releases/download/v2.0.2/unknown-linux'),
|
||||
'Lunaris-v2.0.2-linux-x64.tar.gz',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user