Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67c6994311 | ||
|
|
a88a8b5050 |
@@ -10,7 +10,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.1.9-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.1.9" /></a>
|
||||
<a href="https://github.com/RarDog/Lunaris/releases"><img src="https://img.shields.io/badge/Version-3.3.0-8A2BE2?style=for-the-badge&logo=semver&logoColor=white" alt="Version 3.3.0" /></a>
|
||||
<img src="https://img.shields.io/badge/Flutter-3.47+-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter" />
|
||||
<img src="https://img.shields.io/badge/Platform-Android%20%7C%20Linux%20%7C%20Windows-00C853?style=for-the-badge" alt="Platforms" />
|
||||
<a href="https://github.com/RarDog/Lunaris/wiki"><img src="https://img.shields.io/badge/Wiki-Documentation-FF6F00?style=for-the-badge&logo=gitbook&logoColor=white" alt="Wiki" /></a>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const appDisplayVersion = '3.1.9';
|
||||
const appBuildNumber = 70;
|
||||
const appDisplayVersion = '3.3.0';
|
||||
const appBuildNumber = 72;
|
||||
const appReleaseChannel = 'Stable';
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
const lunarisChangelog = [
|
||||
LunarisChange(
|
||||
version: '3.3.0',
|
||||
title: 'Редизайн личных сообщений и рассылок артиста, нативная поддержка текстовых публикаций',
|
||||
bullets: [
|
||||
'Центр сообщений и рассылок автора: полностью переработан диалог по кнопке-рупору на экране артиста — аккуратные карточки сообщений в стиле мессенджера, бейджи сервисов, точное время публикации и кнопка быстрого копирования текста в буфер обмена.',
|
||||
'Нативная поддержка текстовых постов: публикации без медиафайлов больше не вызывают ошибок и пустых плейсхолдеров — в сетке они отображаются как стильные заметки с заголовком и выдержкой текста.',
|
||||
'Удобное чтение статей и заметок: при открытии текстового поста отображается комфортный ридер с форматированным текстом, ссылками автора и тегами.',
|
||||
'Фильтрация по типу контента: на экране автора добавлен фильтр «Текст» с подсчетом количества публикаций наряду с фото, видео и GIF.',
|
||||
'Поддержка анонсов в Kemono и Coomer: API анонсов и персональных сообщений теперь полноценно работает для всех поддерживаемых провайдеров.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.2.0',
|
||||
title: 'Стабильный полноэкранный режим: сохранение воспроизведения, устранение вылетов плеера и чистый интерфейс',
|
||||
bullets: [
|
||||
'Сохранение воспроизведения видео при повороте экрана: исправлена логика адаптивности на смартфонах — альбомная ориентация больше не сбрасывает мобильный интерфейс и не уничтожает запущенный плеер.',
|
||||
'Защита жизненного цикла Player в фоне: плеер не уничтожается при переходе в полный экран, а кнопки «Пуск/Пауза» и перемотки работают мгновенно и безотказно.',
|
||||
'Чистый кинематографичный интерфейс: удалены старые дублирующиеся кнопки в правом верхнем углу; кнопка смены ориентации (альбомный/портретный режим) аккуратно интегрирована в верхнюю панель управления.',
|
||||
'Быстрое скрытие и показ контролов: касание свободной области видео плавно переключает видимость панели управления, а при нажатии на кнопки таймер автоскрытия автоматически обновляется.',
|
||||
],
|
||||
),
|
||||
LunarisChange(
|
||||
version: '3.1.9',
|
||||
title: 'Полноэкранный плеер 2.0: мгновенный переход без задержек, жесты яркости и скраббинг с превью',
|
||||
|
||||
+14
-4
@@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class AppBreakpoints {
|
||||
@@ -6,11 +8,19 @@ class AppBreakpoints {
|
||||
}
|
||||
|
||||
class Responsive {
|
||||
static bool isMobile(BuildContext context) =>
|
||||
MediaQuery.sizeOf(context).width < AppBreakpoints.mobile;
|
||||
static bool isMobile(BuildContext context) {
|
||||
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
return MediaQuery.sizeOf(context).shortestSide < 600;
|
||||
}
|
||||
return MediaQuery.sizeOf(context).width < AppBreakpoints.mobile;
|
||||
}
|
||||
|
||||
static bool isDesktop(BuildContext context) =>
|
||||
MediaQuery.sizeOf(context).width >= AppBreakpoints.desktop;
|
||||
static bool isDesktop(BuildContext context) {
|
||||
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
return MediaQuery.sizeOf(context).shortestSide >= 600;
|
||||
}
|
||||
return MediaQuery.sizeOf(context).width >= AppBreakpoints.desktop;
|
||||
}
|
||||
|
||||
static int columnsFor(
|
||||
BuildContext context, {
|
||||
|
||||
@@ -60,11 +60,21 @@ class Post {
|
||||
return null;
|
||||
}
|
||||
|
||||
String? get description => commentary;
|
||||
|
||||
String? get title {
|
||||
final list = tagGroups['copyright'];
|
||||
if (list != null && list.isNotEmpty) {
|
||||
return list.first;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> get cleanTags {
|
||||
return tags.where((tag) {
|
||||
final t = tag.trim();
|
||||
if (t.isEmpty) return false;
|
||||
if (t == 'cloud_mirror') return false;
|
||||
if (t == 'cloud_mirror' || t == 'text_post') return false;
|
||||
if (t.startsWith('{') && t.endsWith('}')) return false;
|
||||
if (t.contains('"url"') || t.contains('"service"')) return false;
|
||||
if (t.startsWith('http://') || t.startsWith('https://')) return false;
|
||||
|
||||
@@ -230,8 +230,23 @@ class KemonoProvider
|
||||
|
||||
@override
|
||||
Future<List<ArtistAnnouncement>> getArtistAnnouncements(
|
||||
String service, String artistId) async =>
|
||||
const [];
|
||||
String service, String artistId) async {
|
||||
final path = '/api/v1/$service/user/$artistId/announcements';
|
||||
for (final apiBase in _apiBaseCandidates()) {
|
||||
try {
|
||||
final response = await _getFromApiBase<dynamic>(apiBase, path);
|
||||
final items = response.data;
|
||||
if (items is List) {
|
||||
return items
|
||||
.whereType<Map>()
|
||||
.map((item) =>
|
||||
ArtistAnnouncement.fromJson(Map<String, dynamic>.from(item)))
|
||||
.toList(growable: false);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
return const [];
|
||||
}
|
||||
|
||||
String _creatorPath() => _isCoomer ? '/coomer' : '/kemono';
|
||||
|
||||
@@ -385,17 +400,23 @@ class KemonoProvider
|
||||
}
|
||||
|
||||
// Support link-only posts where author uploaded files to cloud drives (MEGA, GDrive, etc.)
|
||||
if (files.isEmpty && (cloudLinks.isNotEmpty || cleanDesc.isNotEmpty)) {
|
||||
// or text-only posts where author wrote an announcement, status or note
|
||||
if (files.isEmpty &&
|
||||
(cloudLinks.isNotEmpty ||
|
||||
cleanDesc.isNotEmpty ||
|
||||
rawContent.trim().isNotEmpty ||
|
||||
title.trim().isNotEmpty)) {
|
||||
final stableId = '${query.service}:${query.artistId}:$postId:0';
|
||||
final firstStreamable =
|
||||
cloudLinks.where((l) => l.isStreamable).firstOrNull;
|
||||
final firstLink = cloudLinks.isNotEmpty ? cloudLinks.first : null;
|
||||
final fileUrl = firstStreamable?.directStreamUrl ?? firstLink?.url ?? '';
|
||||
final isTextOnly = cloudLinks.isEmpty;
|
||||
final tags = [
|
||||
query.service,
|
||||
query.artistName,
|
||||
if (title.trim().isNotEmpty) title.trim(),
|
||||
'cloud_mirror',
|
||||
if (!isTextOnly) 'cloud_mirror' else 'text_post',
|
||||
];
|
||||
return [
|
||||
Post(
|
||||
@@ -411,14 +432,19 @@ class KemonoProvider
|
||||
height: 0,
|
||||
source: postSource,
|
||||
createdAt: published,
|
||||
fileType: firstStreamable != null ? 'video' : 'link',
|
||||
fileType: firstStreamable != null
|
||||
? 'video'
|
||||
: (isTextOnly ? 'text' : 'link'),
|
||||
score: 0,
|
||||
tagGroups: {
|
||||
'artist': [query.artistName],
|
||||
'meta': [query.service],
|
||||
if (title.trim().isNotEmpty) 'copyright': [title.trim()],
|
||||
if (cloudLinksJson.isNotEmpty) 'cloud_links': cloudLinksJson,
|
||||
if (cleanDesc.isNotEmpty) 'description': [cleanDesc],
|
||||
if (cleanDesc.isNotEmpty)
|
||||
'description': [cleanDesc]
|
||||
else if (rawContent.trim().isNotEmpty)
|
||||
'description': [rawContent.trim()],
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
@@ -418,17 +418,23 @@ class PawchiveProvider
|
||||
}
|
||||
|
||||
// Support link-only posts where author uploaded files to cloud drives (MEGA, GDrive, etc.)
|
||||
if (files.isEmpty && (cloudLinks.isNotEmpty || cleanDesc.isNotEmpty)) {
|
||||
// or text-only posts where author wrote an announcement, status or note
|
||||
if (files.isEmpty &&
|
||||
(cloudLinks.isNotEmpty ||
|
||||
cleanDesc.isNotEmpty ||
|
||||
rawContent.trim().isNotEmpty ||
|
||||
title.trim().isNotEmpty)) {
|
||||
final stableId = '${query.service}:${query.artistId}:$postId:0';
|
||||
final firstStreamable =
|
||||
cloudLinks.where((l) => l.isStreamable).firstOrNull;
|
||||
final firstLink = cloudLinks.isNotEmpty ? cloudLinks.first : null;
|
||||
final fileUrl = firstStreamable?.directStreamUrl ?? firstLink?.url ?? '';
|
||||
final isTextOnly = cloudLinks.isEmpty;
|
||||
final tags = [
|
||||
query.service,
|
||||
query.artistName,
|
||||
if (title.trim().isNotEmpty) title.trim(),
|
||||
'cloud_mirror',
|
||||
if (!isTextOnly) 'cloud_mirror' else 'text_post',
|
||||
];
|
||||
return [
|
||||
Post(
|
||||
@@ -444,14 +450,19 @@ class PawchiveProvider
|
||||
height: 0,
|
||||
source: postSource,
|
||||
createdAt: published,
|
||||
fileType: firstStreamable != null ? 'video' : 'link',
|
||||
fileType: firstStreamable != null
|
||||
? 'video'
|
||||
: (isTextOnly ? 'text' : 'link'),
|
||||
score: 0,
|
||||
tagGroups: {
|
||||
'artist': [query.artistName],
|
||||
'meta': [query.service],
|
||||
if (title.trim().isNotEmpty) 'copyright': [title.trim()],
|
||||
if (cloudLinksJson.isNotEmpty) 'cloud_links': cloudLinksJson,
|
||||
if (cleanDesc.isNotEmpty) 'description': [cleanDesc],
|
||||
if (cleanDesc.isNotEmpty)
|
||||
'description': [cleanDesc]
|
||||
else if (rawContent.trim().isNotEmpty)
|
||||
'description': [rawContent.trim()],
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -191,11 +192,13 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
if (_selectedTypes.isEmpty) return true;
|
||||
final isVid = MediaUrlSelector.isVideo(post);
|
||||
final isGif = MediaUrlSelector.isGif(post);
|
||||
final isPhoto = !isVid && !isGif;
|
||||
final isText = post.fileType == 'text';
|
||||
final isPhoto = !isVid && !isGif && !isText;
|
||||
|
||||
if (_selectedTypes.contains('video') && isVid) return true;
|
||||
if (_selectedTypes.contains('gif') && isGif) return true;
|
||||
if (_selectedTypes.contains('photo') && isPhoto) return true;
|
||||
if (_selectedTypes.contains('text') && isText) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,94 +208,246 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
showDragHandle: true,
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
||||
),
|
||||
builder: (ctx) => DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: 0.6,
|
||||
maxChildSize: 0.9,
|
||||
initialChildSize: 0.65,
|
||||
maxChildSize: 0.92,
|
||||
builder: (_, scroll) => Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 16, 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.campaign_rounded, color: theme.colorScheme.primary),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'Анонсы автора (${_announcements.length})',
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.campaign_rounded,
|
||||
color: theme.colorScheme.onPrimaryContainer,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Личные сообщения и анонсы',
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: -0.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'${widget.artistName} • ${widget.service.toUpperCase()}',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
'${_announcements.length}',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onSecondaryContainer,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.4),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
controller: scroll,
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: _announcements.length,
|
||||
separatorBuilder: (_, __) => const Divider(height: 24),
|
||||
itemBuilder: (context, index) {
|
||||
final a = _announcements[index];
|
||||
final cleanContent = CloudLinkExtractor.cleanCommentary(a.content);
|
||||
final detectedCloudLinks = CloudLinkExtractor.extractLinks(content: a.content);
|
||||
final creatorLinks = CreatorLink.extractLinks(a.content);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (a.added != null)
|
||||
Text(
|
||||
'${a.added!.year}-${a.added!.month.toString().padLeft(2, '0')}-${a.added!.day.toString().padLeft(2, '0')}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
child: _announcements.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.mark_email_read_outlined,
|
||||
size: 48,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
FormattedContentText(
|
||||
text: cleanContent.isNotEmpty ? cleanContent : a.content,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
height: 1.45,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Нет сообщений или рассылок',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (creatorLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
CreatorLinkChips(
|
||||
links: creatorLinks,
|
||||
title: 'Ссылки автора',
|
||||
),
|
||||
],
|
||||
if (detectedCloudLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 6,
|
||||
children: detectedCloudLinks.map((link) {
|
||||
return ActionChip(
|
||||
avatar: Icon(
|
||||
link.iconData,
|
||||
size: 16,
|
||||
color: link.brandColor,
|
||||
)
|
||||
: ListView.separated(
|
||||
controller: scroll,
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
|
||||
itemCount: _announcements.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
final a = _announcements[index];
|
||||
final cleanContent =
|
||||
CloudLinkExtractor.cleanCommentary(a.content);
|
||||
final detectedCloudLinks =
|
||||
CloudLinkExtractor.extractLinks(content: a.content);
|
||||
final creatorLinks =
|
||||
CreatorLink.extractLinks(a.content);
|
||||
final displayContent = cleanContent.isNotEmpty
|
||||
? cleanContent
|
||||
: a.content;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outlineVariant
|
||||
.withValues(alpha: 0.45),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary
|
||||
.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
(a.service.isNotEmpty
|
||||
? a.service
|
||||
: widget.service)
|
||||
.toUpperCase(),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (a.added != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.access_time_rounded,
|
||||
size: 13,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${a.added!.day.toString().padLeft(2, '0')}.${a.added!.month.toString().padLeft(2, '0')}.${a.added!.year} ${a.added!.hour.toString().padLeft(2, '0')}:${a.added!.minute.toString().padLeft(2, '0')}',
|
||||
style: TextStyle(
|
||||
fontSize: 11.5,
|
||||
color:
|
||||
theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded,
|
||||
size: 17),
|
||||
tooltip: 'Скопировать текст',
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: displayContent),
|
||||
);
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content:
|
||||
Text('Текст сообщения скопирован'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
label: Text(
|
||||
link.title.isNotEmpty ? link.title : link.serviceName,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
const SizedBox(height: 10),
|
||||
FormattedContentText(
|
||||
text: displayContent,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
height: 1.5,
|
||||
letterSpacing: 0.15,
|
||||
),
|
||||
),
|
||||
onPressed: () => launchUrl(
|
||||
Uri.parse(link.url),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
if (creatorLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
CreatorLinkChips(
|
||||
links: creatorLinks,
|
||||
title: 'Ссылки из сообщения',
|
||||
),
|
||||
],
|
||||
if (detectedCloudLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 6,
|
||||
children: detectedCloudLinks.map((link) {
|
||||
return ActionChip(
|
||||
avatar: Icon(
|
||||
link.iconData,
|
||||
size: 16,
|
||||
color: link.brandColor,
|
||||
),
|
||||
label: Text(
|
||||
link.title.isNotEmpty
|
||||
? link.title
|
||||
: link.serviceName,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
onPressed: () => launchUrl(
|
||||
Uri.parse(link.url),
|
||||
mode: LaunchMode.externalApplication,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -303,10 +458,14 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
Widget _buildMediaTypeFilters() {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final photoCount = _posts
|
||||
.where((p) => !MediaUrlSelector.isVideo(p) && !MediaUrlSelector.isGif(p))
|
||||
.where((p) =>
|
||||
p.fileType != 'text' &&
|
||||
!MediaUrlSelector.isVideo(p) &&
|
||||
!MediaUrlSelector.isGif(p))
|
||||
.length;
|
||||
final videoCount = _posts.where(MediaUrlSelector.isVideo).length;
|
||||
final gifCount = _posts.where(MediaUrlSelector.isGif).length;
|
||||
final textCount = _posts.where((p) => p.fileType == 'text').length;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 6, 16, 4),
|
||||
@@ -376,6 +535,27 @@ class _ArtistPostsScreenState extends ConsumerState<ArtistPostsScreen> {
|
||||
});
|
||||
},
|
||||
),
|
||||
if (textCount > 0) ...[
|
||||
const SizedBox(width: 8),
|
||||
FilterChip(
|
||||
selected: _selectedTypes.contains('text'),
|
||||
avatar: Icon(Icons.article_outlined,
|
||||
size: 16,
|
||||
color: _selectedTypes.contains('text')
|
||||
? scheme.onPrimaryContainer
|
||||
: scheme.onSurfaceVariant),
|
||||
label: Text('Текст ($textCount)'),
|
||||
onSelected: (selected) {
|
||||
setState(() {
|
||||
if (selected) {
|
||||
_selectedTypes.add('text');
|
||||
} else {
|
||||
_selectedTypes.remove('text');
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -3,16 +3,17 @@ import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:screen_brightness/screen_brightness.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../../app/motion.dart';
|
||||
import '../../../../backend/backend.dart';
|
||||
import '../../../../shared/widgets/formatted_content_text.dart';
|
||||
|
||||
final Map<String, VideoPlaybackSnapshot> _playbackMemory =
|
||||
<String, VideoPlaybackSnapshot>{};
|
||||
@@ -143,7 +144,9 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_disposeVideo();
|
||||
if (!_inFullscreen) {
|
||||
_disposeVideo();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -205,6 +208,7 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
},
|
||||
fullscreen: widget.fullscreen,
|
||||
errorMessage: _videoError,
|
||||
onTapSurface: _toggleControls,
|
||||
onInteract: _showControls,
|
||||
onRetry: _retryVideo,
|
||||
onToggleFit: () {
|
||||
@@ -248,17 +252,20 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
}
|
||||
|
||||
if (_imageUrls.isEmpty) {
|
||||
return _CloudMediaHero(
|
||||
post: widget.post,
|
||||
onOpenPrimary: () {
|
||||
final links = widget.post.cloudLinks;
|
||||
final first = links.isNotEmpty ? links.first : null;
|
||||
if (first != null) {
|
||||
launchUrl(Uri.parse(first.url),
|
||||
mode: LaunchMode.externalApplication);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (widget.post.cloudLinks.isNotEmpty) {
|
||||
return _CloudMediaHero(
|
||||
post: widget.post,
|
||||
onOpenPrimary: () {
|
||||
final links = widget.post.cloudLinks;
|
||||
final first = links.isNotEmpty ? links.first : null;
|
||||
if (first != null) {
|
||||
launchUrl(Uri.parse(first.url),
|
||||
mode: LaunchMode.externalApplication);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
return _TextArticleHero(post: widget.post);
|
||||
}
|
||||
|
||||
final url = _imageUrls[_imageIndex];
|
||||
@@ -553,6 +560,16 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
});
|
||||
}
|
||||
|
||||
void _toggleControls() {
|
||||
if (!mounted) return;
|
||||
if (_controlsVisible) {
|
||||
_hideTimer?.cancel();
|
||||
setState(() => _controlsVisible = false);
|
||||
} else {
|
||||
_showControls();
|
||||
}
|
||||
}
|
||||
|
||||
void _showControls() {
|
||||
if (!mounted) return;
|
||||
setState(() => _controlsVisible = true);
|
||||
@@ -601,7 +618,12 @@ class _PostMediaViewerState extends State<PostMediaViewer>
|
||||
),
|
||||
),
|
||||
);
|
||||
if (mounted) setState(() => _inFullscreen = false);
|
||||
if (mounted) {
|
||||
setState(() => _inFullscreen = false);
|
||||
} else {
|
||||
player.dispose();
|
||||
return;
|
||||
}
|
||||
if (result != null) {
|
||||
await _applyPlaybackSnapshot(result);
|
||||
if (result.playing && !player.state.playing) {
|
||||
@@ -816,14 +838,28 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
_showControls();
|
||||
}
|
||||
|
||||
void _toggleControls() {
|
||||
if (!mounted) return;
|
||||
if (_controlsVisible) {
|
||||
_hideTimer?.cancel();
|
||||
setState(() => _controlsVisible = false);
|
||||
} else {
|
||||
_showControls();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_hideTimer?.cancel();
|
||||
try {
|
||||
ScreenBrightness.instance.resetApplicationScreenBrightness();
|
||||
} catch (_) {}
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
|
||||
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
Future.delayed(const Duration(milliseconds: 300), () {
|
||||
SystemChrome.setPreferredOrientations([]);
|
||||
});
|
||||
} else {
|
||||
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -860,91 +896,59 @@ class _FullscreenVideoPageState extends State<_FullscreenVideoPage> {
|
||||
},
|
||||
child: Focus(
|
||||
autofocus: true,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: _VideoSurface(
|
||||
player: widget.player,
|
||||
controller: widget.controller,
|
||||
aspectRatio: widget.aspectRatio,
|
||||
controlsVisible: _controlsVisible,
|
||||
coverVideo: _coverVideo,
|
||||
muted: _muted,
|
||||
loopVideo: _loopVideo,
|
||||
halfVolume: _halfVolume,
|
||||
initialVolume: _currentVolume,
|
||||
onVolumeChanged: (vol) {
|
||||
_currentVolume = vol;
|
||||
widget.onChanged(_snapshot());
|
||||
},
|
||||
fullscreen: true,
|
||||
errorMessage: widget.errorMessage,
|
||||
onInteract: _showControls,
|
||||
onRetry: widget.onRetry,
|
||||
onToggleFit: () {
|
||||
setState(() => _coverVideo = !_coverVideo);
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleMute: () async {
|
||||
setState(() => _muted = !_muted);
|
||||
await _applyVolume();
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleHalfVolume: () async {
|
||||
setState(() {
|
||||
_halfVolume = !_halfVolume;
|
||||
if (_halfVolume) _muted = false;
|
||||
});
|
||||
await _applyVolume();
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleLoop: () async {
|
||||
setState(() => _loopVideo = !_loopVideo);
|
||||
await widget.player.setPlaylistMode(
|
||||
_loopVideo ? PlaylistMode.single : PlaylistMode.none,
|
||||
);
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onFullscreen: () => Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop(_snapshot()),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 12,
|
||||
right: 12,
|
||||
child: SafeArea(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton.filledTonal(
|
||||
tooltip: _isLandscape
|
||||
? 'Портретная ориентация'
|
||||
: 'Альбомная ориентация',
|
||||
onPressed: _toggleOrientation,
|
||||
icon: Icon(_isLandscape
|
||||
? Icons.screen_lock_portrait_rounded
|
||||
: Icons.screen_lock_landscape_rounded),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
IconButton.filledTonal(
|
||||
tooltip: 'Close fullscreen',
|
||||
onPressed: () => Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop(_snapshot()),
|
||||
icon: const Icon(Icons.close_rounded),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: _VideoSurface(
|
||||
player: widget.player,
|
||||
controller: widget.controller,
|
||||
aspectRatio: widget.aspectRatio,
|
||||
controlsVisible: _controlsVisible,
|
||||
coverVideo: _coverVideo,
|
||||
muted: _muted,
|
||||
loopVideo: _loopVideo,
|
||||
halfVolume: _halfVolume,
|
||||
initialVolume: _currentVolume,
|
||||
onVolumeChanged: (vol) {
|
||||
_currentVolume = vol;
|
||||
widget.onChanged(_snapshot());
|
||||
},
|
||||
fullscreen: true,
|
||||
errorMessage: widget.errorMessage,
|
||||
onTapSurface: _toggleControls,
|
||||
onInteract: _showControls,
|
||||
isLandscape: _isLandscape,
|
||||
onToggleOrientation: _toggleOrientation,
|
||||
onRetry: widget.onRetry,
|
||||
onToggleFit: () {
|
||||
setState(() => _coverVideo = !_coverVideo);
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleMute: () async {
|
||||
setState(() => _muted = !_muted);
|
||||
await _applyVolume();
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleHalfVolume: () async {
|
||||
setState(() {
|
||||
_halfVolume = !_halfVolume;
|
||||
if (_halfVolume) _muted = false;
|
||||
});
|
||||
await _applyVolume();
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onToggleLoop: () async {
|
||||
setState(() => _loopVideo = !_loopVideo);
|
||||
await widget.player.setPlaylistMode(
|
||||
_loopVideo ? PlaylistMode.single : PlaylistMode.none,
|
||||
);
|
||||
widget.onChanged(_snapshot());
|
||||
_showControls();
|
||||
},
|
||||
onFullscreen: () => Navigator.of(
|
||||
context,
|
||||
rootNavigator: true,
|
||||
).pop(_snapshot()),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1007,6 +1011,7 @@ class _VideoSurface extends StatefulWidget {
|
||||
this.onVolumeChanged,
|
||||
required this.fullscreen,
|
||||
required this.errorMessage,
|
||||
this.onTapSurface,
|
||||
required this.onInteract,
|
||||
required this.onRetry,
|
||||
required this.onToggleFit,
|
||||
@@ -1014,6 +1019,8 @@ class _VideoSurface extends StatefulWidget {
|
||||
required this.onToggleHalfVolume,
|
||||
required this.onToggleLoop,
|
||||
required this.onFullscreen,
|
||||
this.isLandscape,
|
||||
this.onToggleOrientation,
|
||||
});
|
||||
|
||||
final Player player;
|
||||
@@ -1028,6 +1035,7 @@ class _VideoSurface extends StatefulWidget {
|
||||
final ValueChanged<double>? onVolumeChanged;
|
||||
final bool fullscreen;
|
||||
final String? errorMessage;
|
||||
final VoidCallback? onTapSurface;
|
||||
final VoidCallback onInteract;
|
||||
final VoidCallback onRetry;
|
||||
final VoidCallback onToggleFit;
|
||||
@@ -1035,6 +1043,8 @@ class _VideoSurface extends StatefulWidget {
|
||||
final VoidCallback onToggleHalfVolume;
|
||||
final VoidCallback onToggleLoop;
|
||||
final VoidCallback onFullscreen;
|
||||
final bool? isLandscape;
|
||||
final VoidCallback? onToggleOrientation;
|
||||
|
||||
@override
|
||||
State<_VideoSurface> createState() => _VideoSurfaceState();
|
||||
@@ -1055,7 +1065,7 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
Timer? _volumeTimer;
|
||||
|
||||
bool _showBrightnessIndicator = false;
|
||||
double _currentBrightness = 0.5;
|
||||
double _currentBrightness = 1.0;
|
||||
Timer? _brightnessTimer;
|
||||
|
||||
@override
|
||||
@@ -1063,14 +1073,6 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
super.initState();
|
||||
_currentVolume = widget.initialVolume;
|
||||
widget.player.setVolume(_currentVolume);
|
||||
_initBrightness();
|
||||
}
|
||||
|
||||
Future<void> _initBrightness() async {
|
||||
try {
|
||||
final b = await ScreenBrightness.instance.application;
|
||||
if (mounted) setState(() => _currentBrightness = b);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1159,14 +1161,13 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
});
|
||||
}
|
||||
|
||||
void _adjustBrightness(double deltaY) async {
|
||||
void _adjustBrightness(double deltaY) {
|
||||
if (_isLocked) return;
|
||||
final newB = (_currentBrightness - deltaY * 0.004).clamp(0.02, 1.0);
|
||||
_currentBrightness = newB;
|
||||
try {
|
||||
await ScreenBrightness.instance.setApplicationScreenBrightness(newB);
|
||||
} catch (_) {}
|
||||
setState(() => _showBrightnessIndicator = true);
|
||||
final newB = (_currentBrightness - deltaY * 0.004).clamp(0.08, 1.0);
|
||||
setState(() {
|
||||
_currentBrightness = newB;
|
||||
_showBrightnessIndicator = true;
|
||||
});
|
||||
_brightnessTimer?.cancel();
|
||||
_brightnessTimer = Timer(const Duration(milliseconds: 1100), () {
|
||||
if (mounted) setState(() => _showBrightnessIndicator = false);
|
||||
@@ -1193,11 +1194,21 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
resumeUponEnteringForegroundMode: false,
|
||||
),
|
||||
),
|
||||
if (_currentBrightness < 0.99)
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: ColoredBox(
|
||||
color: Colors.black.withValues(
|
||||
alpha: (1.0 - _currentBrightness).clamp(0.0, 0.92),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: (details) => lastTapDown = details.localPosition,
|
||||
onTap: widget.onInteract,
|
||||
onTap: widget.onTapSurface ?? widget.onInteract,
|
||||
onDoubleTap: () {
|
||||
if (lastTapDown != null) {
|
||||
_onDoubleTapAt(
|
||||
@@ -1259,6 +1270,8 @@ class _VideoSurfaceState extends State<_VideoSurface> {
|
||||
coverVideo: widget.coverVideo,
|
||||
fullscreen: widget.fullscreen,
|
||||
isLocked: _isLocked,
|
||||
isLandscape: widget.isLandscape,
|
||||
onToggleOrientation: widget.onToggleOrientation,
|
||||
onToggleLock: () => setState(() => _isLocked = !_isLocked),
|
||||
onToggleFit: widget.onToggleFit,
|
||||
onToggleMute: widget.onToggleMute,
|
||||
@@ -1944,6 +1957,8 @@ class _VideoControls extends StatefulWidget {
|
||||
required this.coverVideo,
|
||||
required this.fullscreen,
|
||||
required this.isLocked,
|
||||
this.isLandscape,
|
||||
this.onToggleOrientation,
|
||||
required this.onToggleLock,
|
||||
required this.onToggleFit,
|
||||
required this.onToggleMute,
|
||||
@@ -1961,6 +1976,8 @@ class _VideoControls extends StatefulWidget {
|
||||
final bool coverVideo;
|
||||
final bool fullscreen;
|
||||
final bool isLocked;
|
||||
final bool? isLandscape;
|
||||
final VoidCallback? onToggleOrientation;
|
||||
final VoidCallback onToggleLock;
|
||||
final VoidCallback onToggleFit;
|
||||
final VoidCallback onToggleMute;
|
||||
@@ -2038,6 +2055,21 @@ class _VideoControlsState extends State<_VideoControls> {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
if (widget.fullscreen && widget.onToggleOrientation != null) ...[
|
||||
_RoundControlButton(
|
||||
tooltip: (widget.isLandscape ?? false)
|
||||
? 'Портретная ориентация'
|
||||
: 'Альбомная ориентация',
|
||||
icon: (widget.isLandscape ?? false)
|
||||
? Icons.screen_lock_portrait_rounded
|
||||
: Icons.screen_lock_landscape_rounded,
|
||||
onPressed: () {
|
||||
widget.onToggleOrientation?.call();
|
||||
widget.onInteract?.call();
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
_RoundControlButton(
|
||||
tooltip: 'Заблокировать экран',
|
||||
icon: Icons.lock_outline_rounded,
|
||||
@@ -2121,11 +2153,9 @@ class _VideoControlsState extends State<_VideoControls> {
|
||||
await widget.player.play();
|
||||
}
|
||||
} catch (_) {
|
||||
if (widget.player.state.playing) {
|
||||
await widget.player.pause();
|
||||
} else {
|
||||
await widget.player.play();
|
||||
}
|
||||
try {
|
||||
await widget.player.playOrPause();
|
||||
} catch (_) {}
|
||||
}
|
||||
widget.onInteract?.call();
|
||||
},
|
||||
@@ -2484,3 +2514,169 @@ class _CloudMediaHero extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _TextArticleHero extends StatelessWidget {
|
||||
const _TextArticleHero({required this.post});
|
||||
|
||||
final Post post;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final title = (post.title ?? '').trim();
|
||||
final cleanContent =
|
||||
CloudLinkExtractor.cleanCommentary(post.description ?? '');
|
||||
final displayContent = cleanContent.isNotEmpty
|
||||
? cleanContent
|
||||
: (title.isNotEmpty ? '' : 'Публикация автора без текста и вложений');
|
||||
final creatorLinks = CreatorLink.extractLinks(post.description ?? '');
|
||||
final cleanTags = post.cleanTags;
|
||||
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 680),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.4),
|
||||
width: 1.2,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.15),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.14),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.article_rounded,
|
||||
color: theme.colorScheme.primary,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Текстовая публикация',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: theme.colorScheme.primary,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${post.providerName} • ${post.createdAt.day.toString().padLeft(2, '0')}.${post.createdAt.month.toString().padLeft(2, '0')}.${post.createdAt.year}',
|
||||
style: TextStyle(
|
||||
fontSize: 11.5,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded, size: 18),
|
||||
tooltip: 'Скопировать текст',
|
||||
onPressed: () {
|
||||
final textToCopy = [
|
||||
if (title.isNotEmpty) title,
|
||||
if (displayContent.isNotEmpty) displayContent,
|
||||
].join('\n\n');
|
||||
Clipboard.setData(ClipboardData(text: textToCopy));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Текст скопирован в буфер обмена'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
if (title.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
title,
|
||||
style: theme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: -0.3,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 14),
|
||||
Divider(
|
||||
height: 1,
|
||||
color: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (displayContent.isNotEmpty)
|
||||
FormattedContentText(
|
||||
text: displayContent,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
height: 1.6,
|
||||
letterSpacing: 0.15,
|
||||
),
|
||||
),
|
||||
if (creatorLinks.isNotEmpty) ...[
|
||||
const SizedBox(height: 18),
|
||||
CreatorLinkChips(
|
||||
links: creatorLinks,
|
||||
title: 'Ссылки из публикации',
|
||||
),
|
||||
],
|
||||
if (cleanTags.isNotEmpty) ...[
|
||||
const SizedBox(height: 18),
|
||||
Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
children: cleanTags.take(8).map((t) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 3.5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'#$t',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,9 +117,14 @@ class _PostCardState extends ConsumerState<PostCard>
|
||||
Widget build(BuildContext context) {
|
||||
final post = _resolvedPost ?? widget.post;
|
||||
final sensitive = _isSensitive(post.rating);
|
||||
final isTextPost = post.fileType == 'text' ||
|
||||
(post.previewUrl.trim().isEmpty &&
|
||||
post.sampleUrl.trim().isEmpty &&
|
||||
post.fileUrl.trim().isEmpty &&
|
||||
!MediaUrlSelector.isVideo(post));
|
||||
final aspect = post.width > 0 && post.height > 0
|
||||
? post.width / post.height
|
||||
: _fallbackAspect(post.fileType);
|
||||
: _fallbackAspect(isTextPost ? 'text' : post.fileType);
|
||||
final mobile = MediaQuery.sizeOf(context).width < 700;
|
||||
final urls = _feedUrls(post, mobile: mobile);
|
||||
final imageUrl = urls.isEmpty ? post.previewUrl : urls.first;
|
||||
@@ -202,6 +207,12 @@ class _PostCardState extends ConsumerState<PostCard>
|
||||
enabled: widget.blurExplicit && sensitive,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (isTextPost) {
|
||||
return _TextPostCardPreview(
|
||||
post: post,
|
||||
hovered: _hovered && !mobile,
|
||||
);
|
||||
}
|
||||
final dpr = MediaQuery.devicePixelRatioOf(context);
|
||||
final cacheWidth =
|
||||
(constraints.maxWidth * dpr).round().clamp(320, 1800);
|
||||
@@ -239,27 +250,28 @@ class _PostCardState extends ConsumerState<PostCard>
|
||||
),
|
||||
),
|
||||
),
|
||||
// Bottom cinematic gradient overlay for badges and favorite
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
height: 64,
|
||||
child: IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.72),
|
||||
Colors.transparent,
|
||||
],
|
||||
// Bottom cinematic gradient overlay for badges and favorite (only on media posts)
|
||||
if (!isTextPost)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
height: 64,
|
||||
child: IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.72),
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.showBadges) ...[
|
||||
Positioned(
|
||||
left: 8,
|
||||
@@ -269,11 +281,14 @@ class _PostCardState extends ConsumerState<PostCard>
|
||||
if (post.fileType.toLowerCase().contains('video') ||
|
||||
post.fileType.toLowerCase().contains('webm') ||
|
||||
post.fileType.toLowerCase().contains('mp4') ||
|
||||
post.fileType.toLowerCase().contains('gif'))
|
||||
post.fileType.toLowerCase().contains('gif') ||
|
||||
isTextPost)
|
||||
Positioned(
|
||||
right: 8,
|
||||
top: 8,
|
||||
child: _MediaBadge(fileType: post.fileType),
|
||||
child: _MediaBadge(
|
||||
fileType: isTextPost ? 'text' : post.fileType,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 8,
|
||||
@@ -434,6 +449,7 @@ class _PostCardState extends ConsumerState<PostCard>
|
||||
|
||||
double _fallbackAspect(String fileType) {
|
||||
final normalized = fileType.toLowerCase();
|
||||
if (normalized == 'text') return 0.95;
|
||||
if (normalized.contains('video') || normalized.contains('webm')) {
|
||||
return 16 / 9;
|
||||
}
|
||||
@@ -775,7 +791,7 @@ class _MediaBadge extends StatelessWidget {
|
||||
Icon(_icon(type), size: 13, color: Colors.white),
|
||||
const SizedBox(width: 3.5),
|
||||
Text(
|
||||
type,
|
||||
_label(type),
|
||||
style: const TextStyle(
|
||||
fontSize: 10.5,
|
||||
color: Colors.white,
|
||||
@@ -796,14 +812,159 @@ class _MediaBadge extends StatelessWidget {
|
||||
return 'video';
|
||||
}
|
||||
if (value.contains('gif')) return 'gif';
|
||||
if (value.contains('text')) return 'text';
|
||||
return 'photo';
|
||||
}
|
||||
|
||||
IconData _icon(String type) => switch (type) {
|
||||
'video' => Icons.play_arrow_rounded,
|
||||
'gif' => Icons.gif_box_rounded,
|
||||
'text' => Icons.article_rounded,
|
||||
_ => Icons.image_rounded,
|
||||
};
|
||||
|
||||
String _label(String type) => switch (type) {
|
||||
'video' => 'VIDEO',
|
||||
'gif' => 'GIF',
|
||||
'text' => 'ТЕКСТ',
|
||||
_ => 'PHOTO',
|
||||
};
|
||||
}
|
||||
|
||||
class _TextPostCardPreview extends StatelessWidget {
|
||||
const _TextPostCardPreview({
|
||||
required this.post,
|
||||
required this.hovered,
|
||||
});
|
||||
|
||||
final Post post;
|
||||
final bool hovered;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final title = (post.title ?? '').trim();
|
||||
final cleanContent =
|
||||
CloudLinkExtractor.cleanCommentary(post.description ?? '');
|
||||
final hasTitle = title.isNotEmpty;
|
||||
final snippet = cleanContent.isNotEmpty
|
||||
? cleanContent
|
||||
: (hasTitle ? '' : 'Текстовая публикация автора без вложений');
|
||||
final cloudCount = post.cloudLinks.length;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 14, 14, 14),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
theme.colorScheme.surfaceContainerHigh,
|
||||
theme.colorScheme.surfaceContainer,
|
||||
],
|
||||
),
|
||||
border: Border.all(
|
||||
color: hovered
|
||||
? theme.colorScheme.primary.withValues(alpha: 0.5)
|
||||
: theme.colorScheme.outlineVariant.withValues(alpha: 0.35),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.14),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.notes_rounded,
|
||||
size: 15,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${post.createdAt.day.toString().padLeft(2, '0')}.${post.createdAt.month.toString().padLeft(2, '0')}.${post.createdAt.year}',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (hasTitle) ...[
|
||||
Text(
|
||||
title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 1.25,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
if (snippet.isNotEmpty)
|
||||
Expanded(
|
||||
child: Text(
|
||||
snippet,
|
||||
maxLines: hasTitle ? 5 : 7,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
height: 1.42,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
const Spacer(),
|
||||
if (cloudCount > 0) ...[
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.cloud_download_outlined,
|
||||
size: 12,
|
||||
color: theme.colorScheme.onPrimaryContainer,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Вложения ($cloudCount)',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SeenBadge extends StatelessWidget {
|
||||
|
||||
@@ -895,14 +895,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
screen_brightness:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: screen_brightness
|
||||
sha256: e0edf92c08889e8f493cde291e7c687db2b4a1471f2371c074070b75d7c7d79b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.11"
|
||||
screen_brightness_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -911,30 +903,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.6"
|
||||
screen_brightness_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_ios
|
||||
sha256: "352d355e8523a186ba1e494b74218e5ca96e51975a0630b8ed89fbb7ff609762"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
screen_brightness_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_macos
|
||||
sha256: b0957237b842d846a84363b69f229b339a8f91faced55041e245b2ebff7b0142
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
screen_brightness_ohos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_ohos
|
||||
sha256: "569a2c97909a50894b81487619eb7654f5358443a5af05f840c19261f49c0940"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
screen_brightness_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -943,14 +911,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
screen_brightness_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: screen_brightness_windows
|
||||
sha256: "368b9c822e1671de81616e48150006e39eff2a434957e47ee638b09a32b2297c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
share_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
+1
-3
@@ -1,7 +1,7 @@
|
||||
name: gel_rule_app
|
||||
description: Local backend/core layer for a Flutter booru browser app.
|
||||
publish_to: "none"
|
||||
version: 3.1.9+70
|
||||
version: 3.3.0+72
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.0 <4.0.0"
|
||||
@@ -33,8 +33,6 @@ dependencies:
|
||||
media_kit_libs_android_video: ^1.3.8
|
||||
share_plus: ^10.0.0
|
||||
dynamic_color: ^1.7.0
|
||||
screen_brightness: ^2.1.11
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user