Compare commits

...
3 Commits
Author SHA1 Message Date
RarDog 4aedde9b3f feat: desktop horizontal mouse-wheel scroll & fix PC video player blue screen (v3.6.3)
Build and Release / Build Windows x64 (push) Has been cancelled
Build and Release / Build macOS (push) Has been cancelled
2026-09-05 18:32:45 +03:00
RarDog 5b2c8eb53e fix(perf): memory optimization, prevent OOM on mobile, and completely disable mouse wheel zoom
Build and Release / Build Windows x64 (push) Has been cancelled
Build and Release / Build macOS (push) Has been cancelled
2026-09-05 18:09:58 +03:00
RarDog d7d9cad423 fix(desktop): smooth sidebar hover animation without text jitter and remove mouse wheel zoom
Build and Release / Build Windows x64 (push) Has been cancelled
Build and Release / Build macOS (push) Has been cancelled
2026-09-05 17:58:49 +03:00
14 changed files with 991 additions and 664 deletions
+39 -38
View File
@@ -4,32 +4,33 @@
<application <application
android:label="Prisma" android:label="Prisma"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
<activity android:largeHeap="true">
android:name=".MainActivity" <activity
android:exported="true" android:name=".MainActivity"
android:launchMode="singleTop" android:exported="true"
android:taskAffinity="" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:taskAffinity=""
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:theme="@style/LaunchTheme"
android:hardwareAccelerated="true" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:windowSoftInputMode="adjustResize"> android:hardwareAccelerated="true"
<!-- Specifies an Android theme to apply to this Activity as soon as android:windowSoftInputMode="adjustResize">
the Android process has started. This theme is visible to the user <!-- Specifies an Android theme to apply to this Activity as soon as
while the Flutter UI initializes. After that, this theme continues the Android process has started. This theme is visible to the user
to determine the Window background behind the Flutter UI. --> while the Flutter UI initializes. After that, this theme continues
<meta-data to determine the Window background behind the Flutter UI. -->
android:name="io.flutter.embedding.android.NormalTheme" <meta-data
android:resource="@style/NormalTheme" android:name="io.flutter.embedding.android.NormalTheme"
/> android:resource="@style/NormalTheme"
<intent-filter> />
<action android:name="android.intent.action.MAIN"/> <intent-filter>
<category android:name="android.intent.category.LAUNCHER"/> <action android:name="android.intent.action.MAIN"/>
</intent-filter> <category android:name="android.intent.category.LAUNCHER"/>
</activity> </intent-filter>
<!-- Don't delete the meta-data below. </activity>
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
@@ -43,15 +44,15 @@
android:resource="@xml/file_paths" /> android:resource="@xml/file_paths" />
</provider> </provider>
</application> </application>
<!-- Required to query activities that can process text, see: <!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT. https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries> <queries>
<intent> <intent>
<action android:name="android.intent.action.PROCESS_TEXT"/> <action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain"/>
</intent> </intent>
</queries> </queries>
</manifest> </manifest>
+28
View File
@@ -1,4 +1,32 @@
const prismaChangelog = [ const prismaChangelog = [
PrismaChange(
version: '3.6.3',
title: 'Горизонтальный скролл колесиком мыши на ПК и исправление синего экрана в видеоплеере',
bullets: [
'Горизонтальная прокрутка колесиком мыши в настройках: верхняя панель категорий настроек теперь плавно прокручивается колесиком мыши строго при наведении курсора.',
'Горизонтальная прокрутка колесиком мыши в авторах: полоса любимых авторов и лента их медиа теперь поддерживают быструю прокрутку колесиком мыши при наведении курсора.',
'Устранение «синего экрана» в видеоплеере на ПК: исправлена нативная инициализация MediaKit перед запуском Flutter-движка и настроен оптимальный режим аппаратного ускорения для десктопных платформ.',
],
),
PrismaChange(
version: '3.6.2',
title: 'Комплексная оптимизация памяти на телефоне и ПК, полное отключение зума колесиком',
bullets: [
'Полное отключение масштабирования колесиком мыши: перехвачен внутренний обработчик PointerScrollEvent в интерактивном вьюере, что навсегда исключило нежелательный зум при прокрутке.',
'Предотвращение вылетов на смартфонах (OOM): включен флаг android:largeHeap="true", расширяющий доступный лимит оперативной памяти процесса до 512–1024 МБ.',
'Ограничение аппетита кэша изображений: глобальный ImageCache в Flutter ограничен безопасным лимитом в 180 МБ и 120 изображений (вместо неограниченного роста до 1 ГБ+), неактивные растры своевременно выгружаются сборщиком мусора.',
'Оптимизация декодирования тяжелых артов: полноразмерные изображения с экстремальным разрешением (до 10K+) теперь безопасно декодируются с ограничением memCacheWidth под экран устройства, снижая расход RAM на 80–90%.',
'Оптимизация сетки и миниатюр: карточки ленты изолированы в RepaintBoundary для гладкого 120 FPS скролла без паразитных перерисовок, а всем каруселям, аватаркам и мозаикам заданы строгие границы кэширования.',
],
),
PrismaChange(
version: '3.6.1',
title: 'Плавная боковая панель без лагов и отключение зума колесиком',
bullets: [
'Устранение лагов боковой панели: полностью переработана анимация наведения на боковую панель на ПК. Убран тяжелый шейдерный блюр при изменении ширины и зафиксирована верстка элементов — текст больше не сжимается, не дергается и раскрывается на 120 FPS максимально плавно.',
'Отключение зума фото по колесику мыши: исключено случайное и резкое масштабирование изображений при прокрутке колесиком мыши. Масштабирование фото доступно через горячие клавиши (+, -, 0, F) или двойной клик.',
],
),
PrismaChange( PrismaChange(
version: '3.6.0', version: '3.6.0',
title: 'Редизайн интерфейса для ПК и система горячих клавиш (хоткеи)', title: 'Редизайн интерфейса для ПК и система горячих клавиш (хоткеи)',
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:ui'; import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@@ -1328,7 +1329,7 @@ class _FavoriteArtistsModalState extends State<_FavoriteArtistsModal> {
} }
} }
class _FavoriteArtistsSection extends ConsumerWidget { class _FavoriteArtistsSection extends StatefulWidget {
const _FavoriteArtistsSection({ const _FavoriteArtistsSection({
required this.favorites, required this.favorites,
required this.selectedKey, required this.selectedKey,
@@ -1344,8 +1345,23 @@ class _FavoriteArtistsSection extends ConsumerWidget {
final ValueChanged<FavoriteArtistItem> onRemoveFavorite; final ValueChanged<FavoriteArtistItem> onRemoveFavorite;
@override @override
Widget build(BuildContext context, WidgetRef ref) { State<_FavoriteArtistsSection> createState() =>
if (favorites.isEmpty) { _FavoriteArtistsSectionState();
}
class _FavoriteArtistsSectionState extends State<_FavoriteArtistsSection> {
final ScrollController _scrollController = ScrollController();
bool _isHovered = false;
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (widget.favorites.isEmpty) {
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 8), padding: const EdgeInsets.fromLTRB(16, 4, 16, 8),
child: _ArtistsLiquidCard( child: _ArtistsLiquidCard(
@@ -1368,9 +1384,9 @@ class _FavoriteArtistsSection extends ConsumerWidget {
); );
} }
final selected = favorites.firstWhere( final selected = widget.favorites.firstWhere(
(f) => f.key == selectedKey, (f) => f.key == widget.selectedKey,
orElse: () => favorites.first, orElse: () => widget.favorites.first,
); );
return Padding( return Padding(
@@ -1385,14 +1401,14 @@ class _FavoriteArtistsSection extends ConsumerWidget {
const Icon(Icons.star_rounded, color: Colors.amber, size: 20), const Icon(Icons.star_rounded, color: Colors.amber, size: 20),
const SizedBox(width: 6), const SizedBox(width: 6),
Text( Text(
'Любимые авторы (${favorites.length})', 'Любимые авторы (${widget.favorites.length})',
style: Theme.of(context).textTheme.titleSmall?.copyWith( style: Theme.of(context).textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
const Spacer(), const Spacer(),
TextButton( TextButton(
onPressed: () => onOpenArtist(selected), onPressed: () => widget.onOpenArtist(selected),
style: TextButton.styleFrom( style: TextButton.styleFrom(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
@@ -1409,111 +1425,136 @@ class _FavoriteArtistsSection extends ConsumerWidget {
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
SizedBox( MouseRegion(
height: 88, onEnter: (_) => _isHovered = true,
child: ListView.separated( onExit: (_) => _isHovered = false,
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4), child: Listener(
scrollDirection: Axis.horizontal, onPointerSignal: (event) {
itemCount: favorites.length, if (!_isHovered ||
separatorBuilder: (_, __) => const SizedBox(width: 10), event is! PointerScrollEvent ||
itemBuilder: (context, index) { !_scrollController.hasClients) {
final fav = favorites[index]; return;
final isSelected = fav.key == selected.key; }
final sColor = _serviceColor(fav.service); final delta = event.scrollDelta.dy != 0
? event.scrollDelta.dy
return InkWell( : event.scrollDelta.dx;
borderRadius: BorderRadius.circular(16), if (delta == 0) return;
onTap: () => onSelect(fav), final target = (_scrollController.offset + delta * 1.5).clamp(
child: AnimatedContainer( 0.0,
duration: const Duration(milliseconds: 200), _scrollController.position.maxScrollExtent,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
decoration: BoxDecoration(
color: isSelected
? Theme.of(context)
.colorScheme
.primaryContainer
.withValues(alpha: 0.45)
: Colors.transparent,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: isSelected
? Theme.of(context).colorScheme.primary
: Colors.transparent,
width: 1.5,
),
boxShadow: isSelected
? [
BoxShadow(
color: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.25),
blurRadius: 8,
),
]
: null,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: isSelected
? Theme.of(context).colorScheme.primary
: sColor.withValues(alpha: 0.4),
width: 1.2,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(13),
child: fav.avatarUrl != null &&
fav.avatarUrl!.isNotEmpty
? CachedNetworkImage(
imageUrl: fav.avatarUrl!,
fit: BoxFit.cover,
placeholder: (_, __) => const Icon(
Icons.person_rounded,
size: 20),
errorWidget: (_, __, ___) => const Icon(
Icons.person_rounded,
size: 20),
)
: Center(
child: Text(
fav.name.isNotEmpty
? fav.name[0].toUpperCase()
: '?',
style: const TextStyle(
fontWeight: FontWeight.bold),
),
),
),
),
const SizedBox(height: 4),
SizedBox(
width: 68,
child: Text(
fav.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 11,
fontWeight: isSelected
? FontWeight.bold
: FontWeight.normal,
),
),
),
],
),
),
); );
_scrollController.jumpTo(target);
}, },
child: SizedBox(
height: 88,
child: ListView.separated(
controller: _scrollController,
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
scrollDirection: Axis.horizontal,
itemCount: widget.favorites.length,
separatorBuilder: (_, __) => const SizedBox(width: 10),
itemBuilder: (context, index) {
final fav = widget.favorites[index];
final isSelected = fav.key == selected.key;
final sColor = _serviceColor(fav.service);
return InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () => widget.onSelect(fav),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
decoration: BoxDecoration(
color: isSelected
? Theme.of(context)
.colorScheme
.primaryContainer
.withValues(alpha: 0.45)
: Colors.transparent,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: isSelected
? Theme.of(context).colorScheme.primary
: Colors.transparent,
width: 1.5,
),
boxShadow: isSelected
? [
BoxShadow(
color: Theme.of(context)
.colorScheme
.primary
.withValues(alpha: 0.25),
blurRadius: 8,
),
]
: null,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: isSelected
? Theme.of(context).colorScheme.primary
: sColor.withValues(alpha: 0.4),
width: 1.2,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(13),
child: fav.avatarUrl != null &&
fav.avatarUrl!.isNotEmpty
? CachedNetworkImage(
imageUrl: fav.avatarUrl!,
memCacheWidth: 120,
memCacheHeight: 120,
fit: BoxFit.cover,
placeholder: (_, __) => const Icon(
Icons.person_rounded,
size: 20),
errorWidget: (_, __, ___) => const Icon(
Icons.person_rounded,
size: 20),
)
: Center(
child: Text(
fav.name.isNotEmpty
? fav.name[0].toUpperCase()
: '?',
style: const TextStyle(
fontWeight: FontWeight.bold),
),
),
),
),
const SizedBox(height: 4),
SizedBox(
width: 68,
child: Text(
fav.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 11,
fontWeight: isSelected
? FontWeight.bold
: FontWeight.normal,
),
),
),
],
),
),
);
},
),
),
), ),
), ),
const SizedBox(height: 6), const SizedBox(height: 6),
@@ -1525,18 +1566,34 @@ class _FavoriteArtistsSection extends ConsumerWidget {
} }
} }
class _FavoriteArtistMediaStrip extends ConsumerWidget { class _FavoriteArtistMediaStrip extends ConsumerStatefulWidget {
const _FavoriteArtistMediaStrip({required this.artist}); const _FavoriteArtistMediaStrip({required this.artist});
final FavoriteArtistItem artist; final FavoriteArtistItem artist;
@override @override
Widget build(BuildContext context, WidgetRef ref) { ConsumerState<_FavoriteArtistMediaStrip> createState() =>
_FavoriteArtistMediaStripState();
}
class _FavoriteArtistMediaStripState
extends ConsumerState<_FavoriteArtistMediaStrip> {
final ScrollController _scrollController = ScrollController();
bool _isHovered = false;
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final query = ArtistWorkQuery( final query = ArtistWorkQuery(
providerId: artist.providerId, providerId: widget.artist.providerId,
service: artist.service, service: widget.artist.service,
artistId: artist.id, artistId: widget.artist.id,
artistName: artist.name, artistName: widget.artist.name,
); );
final asyncPosts = ref.watch(artistPostsProvider(query)); final asyncPosts = ref.watch(artistPostsProvider(query));
@@ -1564,76 +1621,101 @@ class _FavoriteArtistMediaStrip extends ConsumerWidget {
), ),
); );
} }
return SizedBox( return MouseRegion(
height: 96, onEnter: (_) => _isHovered = true,
child: ListView.separated( onExit: (_) => _isHovered = false,
scrollDirection: Axis.horizontal, child: Listener(
itemCount: posts.length.clamp(0, 15), onPointerSignal: (event) {
separatorBuilder: (_, __) => const SizedBox(width: 8), if (!_isHovered ||
itemBuilder: (context, index) { event is! PointerScrollEvent ||
final post = posts[index]; !_scrollController.hasClients) {
final isVideo = MediaUrlSelector.isVideo(post); return;
return InkWell( }
borderRadius: BorderRadius.circular(14), final delta = event.scrollDelta.dy != 0
onTap: () => AppNavigator.openPost( ? event.scrollDelta.dy
context, : event.scrollDelta.dx;
post: post, if (delta == 0) return;
postsList: posts, final target = (_scrollController.offset + delta * 1.5).clamp(
), 0.0,
child: Container( _scrollController.position.maxScrollExtent,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: Colors.white.withValues(alpha: 0.15),
width: 1.0,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(13),
child: Stack(
children: [
SizedBox(
width: 96,
height: 96,
child: CachedNetworkImage(
imageUrl: post.previewUrl.isNotEmpty
? post.previewUrl
: post.sampleUrl,
fit: BoxFit.cover,
placeholder: (_, __) => ColoredBox(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
),
errorWidget: (_, __, ___) => ColoredBox(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
child: const Icon(Icons.broken_image_rounded,
size: 24),
),
),
),
if (isVideo)
Positioned(
bottom: 6,
right: 6,
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.7),
shape: BoxShape.circle,
),
child: const Icon(Icons.play_arrow_rounded,
color: Colors.white, size: 14),
),
),
],
),
),
),
); );
_scrollController.jumpTo(target);
}, },
child: SizedBox(
height: 96,
child: ListView.separated(
controller: _scrollController,
scrollDirection: Axis.horizontal,
itemCount: posts.length.clamp(0, 15),
separatorBuilder: (_, __) => const SizedBox(width: 8),
itemBuilder: (context, index) {
final post = posts[index];
final isVideo = MediaUrlSelector.isVideo(post);
return InkWell(
borderRadius: BorderRadius.circular(14),
onTap: () => AppNavigator.openPost(
context,
post: post,
postsList: posts,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
color: Colors.white.withValues(alpha: 0.15),
width: 1.0,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(13),
child: Stack(
children: [
SizedBox(
width: 96,
height: 96,
child: CachedNetworkImage(
imageUrl: post.previewUrl.isNotEmpty
? post.previewUrl
: post.sampleUrl,
memCacheWidth: 200,
memCacheHeight: 200,
fit: BoxFit.cover,
placeholder: (_, __) => ColoredBox(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
),
errorWidget: (_, __, ___) => ColoredBox(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
child: const Icon(Icons.broken_image_rounded,
size: 24),
),
),
),
if (isVideo)
Positioned(
bottom: 6,
right: 6,
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.7),
shape: BoxShape.circle,
),
child: const Icon(Icons.play_arrow_rounded,
color: Colors.white, size: 14),
),
),
],
),
),
),
);
},
),
),
), ),
); );
}, },
@@ -1706,6 +1788,8 @@ class _ArtistAvatar extends StatelessWidget {
? fallback ? fallback
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: artist.avatarUrl!, imageUrl: artist.avatarUrl!,
memCacheWidth: 140,
memCacheHeight: 140,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => fallback, placeholder: (_, __) => fallback,
errorWidget: (_, __, ___) => fallback, errorWidget: (_, __, ___) => fallback,
@@ -314,6 +314,8 @@ class _CollectionCard extends ConsumerWidget {
if (urls.length == 1) { if (urls.length == 1) {
return CachedNetworkImage( return CachedNetworkImage(
imageUrl: urls[0], imageUrl: urls[0],
memCacheWidth: 260,
memCacheHeight: 260,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => Container(color: scheme.surfaceContainerHighest), placeholder: (_, __) => Container(color: scheme.surfaceContainerHighest),
errorWidget: (_, __, ___) => Container( errorWidget: (_, __, ___) => Container(
@@ -333,6 +335,8 @@ class _CollectionCard extends ConsumerWidget {
if (i < urls.length) if (i < urls.length)
CachedNetworkImage( CachedNetworkImage(
imageUrl: urls[i], imageUrl: urls[i],
memCacheWidth: 200,
memCacheHeight: 200,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => placeholder: (_, __) =>
Container(color: scheme.surfaceContainerHighest), Container(color: scheme.surfaceContainerHighest),
@@ -1225,6 +1225,8 @@ class _ArtistCard extends StatelessWidget {
), ),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: url, imageUrl: url,
memCacheWidth: 128,
memCacheHeight: 128,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => Container( placeholder: (_, __) => Container(
color: scheme.surfaceContainerHighest, color: scheme.surfaceContainerHighest,
@@ -1155,6 +1155,8 @@ class _NeighborStrip extends StatelessWidget {
imageUrl: post.previewUrl.isNotEmpty imageUrl: post.previewUrl.isNotEmpty
? post.previewUrl ? post.previewUrl
: post.sampleUrl, : post.sampleUrl,
memCacheWidth: 160,
memCacheHeight: 160,
fit: BoxFit.cover, fit: BoxFit.cover,
errorWidget: (_, __, ___) => errorWidget: (_, __, ___) =>
const Center(child: Icon(Icons.broken_image_rounded)), const Center(child: Icon(Icons.broken_image_rounded)),
@@ -317,10 +317,16 @@ class _PostMediaViewerState extends State<PostMediaViewer>
), ),
); );
} else { } else {
final mq = MediaQuery.maybeOf(context);
final dpr = mq?.devicePixelRatio ?? 1.5;
final screenWidth = mq?.size.width ?? 1280;
final maxCacheWidth =
(screenWidth * dpr * 1.5).round().clamp(1080, 2560);
image = CachedNetworkImage( image = CachedNetworkImage(
key: ValueKey(url), key: ValueKey(url),
imageUrl: url, imageUrl: url,
httpHeaders: headers, httpHeaders: headers,
memCacheWidth: maxCacheWidth,
fit: BoxFit.contain, fit: BoxFit.contain,
placeholder: (context, url) => placeholder: (context, url) =>
const Center(child: CircularProgressIndicator()), const Center(child: CircularProgressIndicator()),
@@ -442,7 +448,9 @@ class _PostMediaViewerState extends State<PostMediaViewer>
_player!, _player!,
configuration: VideoControllerConfiguration( configuration: VideoControllerConfiguration(
enableHardwareAcceleration: !_softwareDecodingFallback, enableHardwareAcceleration: !_softwareDecodingFallback,
hwdec: _softwareDecodingFallback ? 'no' : 'auto-safe', hwdec: _softwareDecodingFallback
? 'no'
: (Platform.isAndroid ? 'auto-safe' : 'auto'),
), ),
); );
_applyVolume(); _applyVolume();
@@ -2190,29 +2198,6 @@ class _ZoomableImageState extends State<_ZoomableImage> {
) )
: widget.child; : widget.child;
return Listener( return Listener(
onPointerSignal: (signal) {
if (signal is PointerScrollEvent) {
final scaleDelta = signal.scrollDelta.dy < 0 ? 1.15 : 0.85;
final currentScale = _controller.value.getMaxScaleOnAxis();
final newScale = (currentScale * scaleDelta).clamp(1.0, 6.0);
if (newScale <= 1.02) {
_controller.value = Matrix4.identity();
if (mounted) setState(() => _zoomed = false);
_setLocked(false);
} else {
final focalPoint = signal.localPosition;
_controller.value = Matrix4.identity()
..translateByDouble(
-focalPoint.dx * (newScale - 1),
-focalPoint.dy * (newScale - 1),
0,
1)
..scaleByDouble(newScale, newScale, 1, 1);
if (mounted) setState(() => _zoomed = true);
_setLocked(true);
}
}
},
onPointerDown: (_) { onPointerDown: (_) {
_pointerCount++; _pointerCount++;
if (_pointerCount >= 2 || _zoomed) { if (_pointerCount >= 2 || _zoomed) {
@@ -2229,6 +2214,7 @@ class _ZoomableImageState extends State<_ZoomableImage> {
transformationController: _controller, transformationController: _controller,
minScale: 1, minScale: 1,
maxScale: 6, maxScale: 6,
scaleFactor: 1000000.0,
boundaryMargin: const EdgeInsets.all(160), boundaryMargin: const EdgeInsets.all(160),
panEnabled: _zoomed, panEnabled: _zoomed,
scaleEnabled: true, scaleEnabled: true,
@@ -2245,7 +2231,15 @@ class _ZoomableImageState extends State<_ZoomableImage> {
if (mounted) setState(() => _zoomed = nextZoomed); if (mounted) setState(() => _zoomed = nextZoomed);
_setLocked(nextZoomed || _pointerCount >= 2); _setLocked(nextZoomed || _pointerCount >= 2);
}, },
child: child, child: Listener(
onPointerSignal: (event) {
if (event is PointerScrollEvent) {
GestureBinding.instance.pointerSignalResolver
.register(event, (_) {});
}
},
child: child,
),
), ),
), ),
); );
@@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart' hide appBuildNumber; import 'package:flutter/services.dart' hide appBuildNumber;
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -1439,7 +1440,7 @@ class _SettingsIconBadge extends StatelessWidget {
} }
} }
class _CategoryQuickNav extends StatelessWidget { class _CategoryQuickNav extends StatefulWidget {
const _CategoryQuickNav({ const _CategoryQuickNav({
required this.categories, required this.categories,
required this.onSelect, required this.onSelect,
@@ -1449,103 +1450,143 @@ class _CategoryQuickNav extends StatelessWidget {
categories; categories;
final ValueChanged<GlobalKey> onSelect; final ValueChanged<GlobalKey> onSelect;
@override
State<_CategoryQuickNav> createState() => _CategoryQuickNavState();
}
class _CategoryQuickNavState extends State<_CategoryQuickNav> {
final ScrollController _scrollController = ScrollController();
bool _isHovered = false;
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark; final isDark = theme.brightness == Brightness.dark;
return SizedBox( return MouseRegion(
height: 44, onEnter: (_) => _isHovered = true,
child: ListView.separated( onExit: (_) => _isHovered = false,
padding: const EdgeInsets.symmetric(horizontal: 16), child: Listener(
scrollDirection: Axis.horizontal, onPointerSignal: (event) {
itemCount: categories.length, if (!_isHovered ||
separatorBuilder: (_, __) => const SizedBox(width: 8), event is! PointerScrollEvent ||
itemBuilder: (context, index) { !_scrollController.hasClients) {
final cat = categories[index]; return;
return Container( }
decoration: BoxDecoration( final delta = event.scrollDelta.dy != 0
borderRadius: BorderRadius.circular(22), ? event.scrollDelta.dy
boxShadow: [ : event.scrollDelta.dx;
BoxShadow( if (delta == 0) return;
color: isDark final target = (_scrollController.offset + delta * 1.5).clamp(
? Colors.black.withValues(alpha: 0.25) 0.0,
: cat.color.withValues(alpha: 0.12), _scrollController.position.maxScrollExtent,
blurRadius: 8, );
offset: const Offset(0, 2.5), _scrollController.jumpTo(target);
},
child: SizedBox(
height: 44,
child: ListView.separated(
controller: _scrollController,
padding: const EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
itemCount: widget.categories.length,
separatorBuilder: (_, __) => const SizedBox(width: 8),
itemBuilder: (context, index) {
final cat = widget.categories[index];
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: ClipRRect(
), borderRadius: BorderRadius.circular(22),
child: ClipRRect( child: BackdropFilter(
borderRadius: BorderRadius.circular(22), filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16),
child: BackdropFilter( child: Material(
filter: ImageFilter.blur(sigmaX: 16, sigmaY: 16), color: isDark
child: Material( ? theme.colorScheme.surfaceContainerHigh
color: isDark .withValues(alpha: 0.60)
? theme.colorScheme.surfaceContainerHigh.withValues(alpha: 0.60) : Colors.white.withValues(alpha: 0.82),
: Colors.white.withValues(alpha: 0.82), child: InkWell(
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), borderRadius: BorderRadius.circular(22),
border: Border.all( onTap: () {
color: isDark HapticFeedback.selectionClick();
? Colors.white.withValues(alpha: 0.18) widget.onSelect(cat.key);
: Colors.white.withValues(alpha: 0.85), },
width: 1.1, child: Container(
), padding: const EdgeInsets.symmetric(
), horizontal: 12, vertical: 7),
child: Row( decoration: BoxDecoration(
mainAxisSize: MainAxisSize.min, borderRadius: BorderRadius.circular(22),
children: [ border: Border.all(
Container( color: isDark
width: 24, ? Colors.white.withValues(alpha: 0.18)
height: 24, : Colors.white.withValues(alpha: 0.85),
decoration: BoxDecoration( width: 1.1,
gradient: LinearGradient( ),
begin: Alignment.topLeft, ),
end: Alignment.bottomRight, child: Row(
colors: [ mainAxisSize: MainAxisSize.min,
cat.color, children: [
cat.color.withValues(alpha: 0.82), Container(
], width: 24,
), height: 24,
borderRadius: BorderRadius.circular(7), decoration: BoxDecoration(
boxShadow: [ gradient: LinearGradient(
BoxShadow( begin: Alignment.topLeft,
color: cat.color.withValues(alpha: 0.35), end: Alignment.bottomRight,
blurRadius: 5, colors: [
offset: const Offset(0, 1.5), 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,
child: Center( size: 14, color: Colors.white),
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,
),
),
],
), ),
const SizedBox(width: 8), ),
Text(
cat.label,
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: -0.2,
),
),
],
), ),
), ),
), ),
), ),
), );
), },
); ),
}, ),
), ),
); );
} }
@@ -427,6 +427,8 @@ class _ViewedPostTile extends StatelessWidget {
) )
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: image, imageUrl: image,
memCacheWidth: 320,
memCacheHeight: 320,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => Container( placeholder: (_, __) => Container(
color: scheme.surfaceContainerHighest, color: scheme.surfaceContainerHighest,
+5
View File
@@ -1,9 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:media_kit/media_kit.dart';
import 'app/app.dart'; import 'app/app.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
// Optimize image cache to prevent memory bloat and OOM crashes
PaintingBinding.instance.imageCache.maximumSizeBytes = 180 * 1024 * 1024; // 180 MB
PaintingBinding.instance.imageCache.maximumSize = 120; // 120 images
runApp(const ProviderScope(child: GelRuleApp())); runApp(const ProviderScope(child: GelRuleApp()));
} }
+473 -311
View File
@@ -5,7 +5,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import '../../app/app.dart'; import '../../app/app.dart';
import '../../app/motion.dart';
import '../../app/responsive.dart'; import '../../app/responsive.dart';
import '../../app/router.dart'; import '../../app/router.dart';
import '../../backend/backend.dart'; import '../../backend/backend.dart';
@@ -385,10 +384,55 @@ class _DesktopShell extends StatefulWidget {
State<_DesktopShell> createState() => _DesktopShellState(); State<_DesktopShell> createState() => _DesktopShellState();
} }
class _DesktopShellState extends State<_DesktopShell> { class _DesktopShellState extends State<_DesktopShell>
with SingleTickerProviderStateMixin {
late final AnimationController _controller;
late final Animation<double> _animation;
bool _hovered = false; bool _hovered = false;
bool _pinned = false; bool _pinned = false;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 220),
);
_animation = CurvedAnimation(
parent: _controller,
curve: Curves.easeOutCubic,
reverseCurve: Curves.easeInCubic,
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
void _handleHover(bool hovered) {
if (_hovered == hovered) return;
setState(() => _hovered = hovered);
if (_pinned) return;
if (hovered) {
_controller.forward();
} else {
_controller.reverse();
}
}
void _togglePinned() {
setState(() {
_pinned = !_pinned;
if (_pinned) {
_controller.forward();
} else if (!_hovered) {
_controller.reverse();
}
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
@@ -400,256 +444,354 @@ class _DesktopShellState extends State<_DesktopShell> {
final selected = widget.destinations.indexWhere( final selected = widget.destinations.indexWhere(
(item) => AppShell.branchIndexForLocation(item.location) == activeBranch, (item) => AppShell.branchIndexForLocation(item.location) == activeBranch,
); );
final isExpanded = _pinned || _hovered;
return Scaffold( return Scaffold(
body: Row( body: Row(
children: [ children: [
MouseRegion( MouseRegion(
onEnter: (_) => setState(() => _hovered = true), onEnter: (_) => _handleHover(true),
onExit: (_) => setState(() => _hovered = false), onExit: (_) => _handleHover(false),
child: AnimatedContainer( child: AnimatedBuilder(
duration: AppMotion.duration(context, 200), animation: _animation,
curve: Curves.easeOutCubic, builder: (context, _) {
width: isExpanded ? 260 : 74, final progress = _animation.value;
decoration: BoxDecoration( final width = lerpDouble(74.0, 260.0, progress)!;
color: isDark final contentOpacity =
? scheme.surfaceContainerHigh.withValues(alpha: 0.75) (progress - 0.25).clamp(0.0, 0.75) / 0.75;
: scheme.surface.withValues(alpha: 0.85), final isFullyExpanded = progress > 0.85;
border: Border(
right: BorderSide( return Container(
width: width,
decoration: BoxDecoration(
color: isDark color: isDark
? Colors.white.withValues(alpha: 0.12) ? scheme.surfaceContainerHigh
: scheme.outlineVariant.withValues(alpha: 0.35), : scheme.surface,
width: 1, border: Border(
right: BorderSide(
color: isDark
? Colors.white.withValues(alpha: 0.1)
: scheme.outlineVariant.withValues(alpha: 0.35),
width: 1,
),
),
boxShadow: [
BoxShadow(
color:
Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
blurRadius: 16,
offset: const Offset(3, 0),
),
],
), ),
), child: ClipRect(
boxShadow: [ child: OverflowBox(
BoxShadow( minWidth: 260,
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05), maxWidth: 260,
blurRadius: 18, alignment: Alignment.topLeft,
offset: const Offset(4, 0), child: SizedBox(
), width: 260,
], child: SafeArea(
),
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
child: SafeArea(
child: Column(
children: [
// App Brand Header
Padding(
padding: const EdgeInsets.fromLTRB(14, 16, 12, 14),
child: Row(
children: [
Container(
width: 44,
height: 44,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
scheme.primary,
scheme.tertiary,
],
),
borderRadius: BorderRadius.circular(14),
boxShadow: [
BoxShadow(
color: scheme.primary.withValues(alpha: 0.35),
blurRadius: 12,
offset: const Offset(0, 3),
),
],
),
child: const Center(
child: Icon(
Icons.auto_awesome_rounded,
color: Colors.white,
size: 24,
),
),
),
if (isExpanded) ...[
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Lunaris',
style: theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w800,
letterSpacing: 0.2,
),
),
const SizedBox(height: 2),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 1.5,
),
decoration: BoxDecoration(
color: scheme.primary.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: scheme.primary.withValues(alpha: 0.3),
width: 0.8,
),
),
child: Text(
'v3.6.0',
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: scheme.primary,
letterSpacing: 0.4,
),
),
),
],
),
),
IconButton(
visualDensity: VisualDensity.compact,
tooltip: _pinned
? (widget.ru ? 'Открепить панель' : 'Unpin panel')
: (widget.ru ? 'Закрепить панель' : 'Pin panel'),
onPressed: () {
setState(() => _pinned = !_pinned);
},
icon: Icon(
_pinned
? Icons.push_pin_rounded
: Icons.push_pin_outlined,
size: 19,
color: _pinned ? scheme.primary : scheme.onSurfaceVariant,
),
),
],
],
),
),
const Divider(height: 1),
const SizedBox(height: 8),
// Destinations List
Expanded(
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 8),
children: [
for (var index = 0;
index < widget.destinations.length;
index++)
_RailButton(
destination: widget.destinations[index],
ru: widget.ru,
selected: (selected < 0 ? 0 : selected) == index,
expanded: isExpanded,
shortcutKey: 'Ctrl+${index + 1}',
onTap: () {
widget.onNavigate(
widget.destinations[index].location);
},
),
],
),
),
// Bottom Actions
const Divider(height: 1),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 8),
child: Column( child: Column(
children: [ children: [
// Shortcuts helper button // App Brand Header
Tooltip( Padding(
message: isExpanded padding:
? '' const EdgeInsets.fromLTRB(15, 16, 12, 14),
: (widget.ru child: SizedBox(
? 'Горячие клавиши (F1 / ?)' height: 44,
: 'Keyboard Shortcuts (F1 / ?)'), child: Row(
waitDuration: const Duration(milliseconds: 350), children: [
child: Material( Container(
color: Colors.transparent, width: 44,
borderRadius: BorderRadius.circular(14), height: 44,
clipBehavior: Clip.antiAlias, decoration: BoxDecoration(
child: InkWell( gradient: LinearGradient(
onTap: () => DesktopShortcutsDialog.show(context), begin: Alignment.topLeft,
child: SizedBox( end: Alignment.bottomRight,
height: 44, colors: [
child: Row( scheme.primary,
children: [ scheme.tertiary,
SizedBox( ],
width: 58,
child: Icon(
Icons.keyboard_rounded,
size: 22,
color: scheme.onSurfaceVariant,
),
), ),
if (isExpanded) ...[ borderRadius:
Expanded( BorderRadius.circular(14),
child: Text( boxShadow: [
widget.ru BoxShadow(
? 'Горячие клавиши' color: scheme.primary
: 'Shortcuts', .withValues(alpha: 0.35),
style: TextStyle( blurRadius: 12,
fontWeight: FontWeight.w600, offset: const Offset(0, 3),
fontSize: 13,
color: scheme.onSurface,
),
overflow: TextOverflow.ellipsis,
),
), ),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 2,
),
decoration: BoxDecoration(
color: isDark
? Colors.white.withValues(alpha: 0.1)
: Colors.black.withValues(alpha: 0.06),
borderRadius: BorderRadius.circular(6),
),
child: const Text(
'?',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
fontFamily: 'monospace',
),
),
),
const SizedBox(width: 8),
], ],
], ),
child: const Center(
child: Icon(
Icons.auto_awesome_rounded,
color: Colors.white,
size: 24,
),
),
), ),
), const SizedBox(width: 12),
Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
'Lunaris',
maxLines: 1,
softWrap: false,
style: theme
.textTheme
.titleMedium
?.copyWith(
fontWeight:
FontWeight.w800,
letterSpacing: 0.2,
),
),
const SizedBox(height: 2),
Container(
padding: const EdgeInsets
.symmetric(
horizontal: 6,
vertical: 1.5,
),
decoration: BoxDecoration(
color: scheme.primary
.withValues(
alpha: 0.15),
borderRadius:
BorderRadius
.circular(6),
border: Border.all(
color: scheme.primary
.withValues(
alpha: 0.3),
width: 0.8,
),
),
child: Text(
'v3.6.3',
style: TextStyle(
fontSize: 10,
fontWeight:
FontWeight.bold,
color: scheme.primary,
letterSpacing: 0.4,
),
),
),
],
),
),
IconButton(
visualDensity:
VisualDensity.compact,
tooltip: _pinned
? (widget.ru
? 'Открепить панель'
: 'Unpin panel')
: (widget.ru
? 'Закрепить панель'
: 'Pin panel'),
onPressed: _togglePinned,
icon: Icon(
_pinned
? Icons.push_pin_rounded
: Icons.push_pin_outlined,
size: 19,
color: _pinned
? scheme.primary
: scheme
.onSurfaceVariant,
),
),
],
),
),
),
],
), ),
), ),
), ),
const Divider(height: 1),
const SizedBox(height: 8),
// Quick pin toggle button when collapsed // Destinations List
if (!isExpanded) Expanded(
IconButton( child: ListView(
tooltip: widget.ru ? 'Закрепить панель' : 'Pin sidebar', padding:
onPressed: () => setState(() => _pinned = true), const EdgeInsets.symmetric(horizontal: 8),
icon: const Icon(Icons.chevron_right_rounded, size: 20), children: [
for (var index = 0;
index < widget.destinations.length;
index++)
_RailButton(
destination: widget.destinations[index],
ru: widget.ru,
selected: (selected < 0 ? 0 : selected) ==
index,
contentOpacity: contentOpacity,
isFullyExpanded: isFullyExpanded,
shortcutKey: 'Ctrl+${index + 1}',
onTap: () {
widget.onNavigate(
widget.destinations[index]
.location);
},
),
],
), ),
),
// Bottom Actions
const Divider(height: 1),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 8),
child: SizedBox(
width: 244,
child: Row(
children: [
Expanded(
child: Tooltip(
message: isFullyExpanded
? ''
: (widget.ru
? 'Горячие клавиши (F1 / ?)'
: 'Keyboard Shortcuts (F1 / ?)'),
waitDuration: const Duration(
milliseconds: 350),
child: Material(
color: Colors.transparent,
borderRadius:
BorderRadius.circular(14),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () =>
DesktopShortcutsDialog.show(
context),
child: SizedBox(
height: 44,
child: Row(
children: [
SizedBox(
width: 58,
child: Icon(
Icons.keyboard_rounded,
size: 22,
color: scheme
.onSurfaceVariant,
),
),
Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded(
child: Text(
widget.ru
? 'Горячие клавиши'
: 'Shortcuts',
maxLines: 1,
softWrap: false,
overflow:
TextOverflow
.ellipsis,
style:
TextStyle(
fontWeight:
FontWeight
.w600,
fontSize: 13,
color: scheme
.onSurface,
),
),
),
Container(
padding:
const EdgeInsets
.symmetric(
horizontal: 6,
vertical: 2,
),
decoration:
BoxDecoration(
color: isDark
? Colors
.white
.withValues(
alpha:
0.1)
: Colors
.black
.withValues(
alpha:
0.06),
borderRadius:
BorderRadius
.circular(
6),
),
child: const Text(
'?',
style:
TextStyle(
fontSize: 11,
fontWeight:
FontWeight
.bold,
fontFamily:
'monospace',
),
),
),
const SizedBox(
width: 8),
],
),
),
),
],
),
),
),
),
),
),
if (!_pinned && progress < 0.4)
IconButton(
tooltip: widget.ru
? 'Закрепить панель'
: 'Pin sidebar',
onPressed: _togglePinned,
icon: const Icon(
Icons.chevron_right_rounded,
size: 20),
),
],
),
),
),
], ],
), ),
), ),
], ),
), ),
), ),
), );
), },
), ),
), ),
Expanded(child: widget.child), Expanded(child: widget.child),
@@ -663,7 +805,8 @@ class _RailButton extends StatelessWidget {
const _RailButton({ const _RailButton({
required this.destination, required this.destination,
required this.selected, required this.selected,
required this.expanded, required this.contentOpacity,
required this.isFullyExpanded,
required this.ru, required this.ru,
required this.shortcutKey, required this.shortcutKey,
required this.onTap, required this.onTap,
@@ -671,7 +814,8 @@ class _RailButton extends StatelessWidget {
final _Destination destination; final _Destination destination;
final bool selected; final bool selected;
final bool expanded; final double contentOpacity;
final bool isFullyExpanded;
final bool ru; final bool ru;
final String shortcutKey; final String shortcutKey;
final VoidCallback onTap; final VoidCallback onTap;
@@ -686,7 +830,7 @@ class _RailButton extends StatelessWidget {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 2), padding: const EdgeInsets.symmetric(vertical: 2),
child: Tooltip( child: Tooltip(
message: expanded ? '' : '$label ($shortcutKey)', message: isFullyExpanded ? '' : '$label ($shortcutKey)',
waitDuration: const Duration(milliseconds: 350), waitDuration: const Duration(milliseconds: 350),
child: Material( child: Material(
color: selected color: selected
@@ -696,95 +840,113 @@ class _RailButton extends StatelessWidget {
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: InkWell( child: InkWell(
onTap: onTap, onTap: onTap,
child: Container( child: SizedBox(
width: 244,
height: 46, height: 46,
decoration: BoxDecoration( child: DecoratedBox(
borderRadius: BorderRadius.circular(14), decoration: BoxDecoration(
border: selected borderRadius: BorderRadius.circular(14),
? Border.all( border: selected
color: scheme.primary.withValues(alpha: isDark ? 0.45 : 0.28), ? Border.all(
width: 1.1, color: scheme.primary
) .withValues(alpha: isDark ? 0.45 : 0.28),
: null, width: 1.1,
), )
child: Row( : null,
children: [ ),
// Active left indicator bar child: Row(
Container( children: [
width: 3.5, // Active left indicator bar
height: 22,
decoration: BoxDecoration(
color: selected ? scheme.primary : Colors.transparent,
borderRadius: BorderRadius.circular(2),
boxShadow: selected
? [
BoxShadow(
color: scheme.primary.withValues(alpha: 0.6),
blurRadius: 6,
),
]
: null,
),
),
SizedBox(
width: 54.5,
child: Center(
child: Icon(
destination.icon,
size: 22,
color: selected
? scheme.primary
: (isDark
? scheme.onSurfaceVariant.withValues(alpha: 0.85)
: scheme.onSurfaceVariant),
),
),
),
if (expanded) ...[
Expanded(
child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.5,
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
color: selected ? scheme.primary : scheme.onSurface,
),
),
),
Container( Container(
padding: const EdgeInsets.symmetric( width: 3.5,
horizontal: 5.5, height: 22,
vertical: 2,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDark color: selected ? scheme.primary : Colors.transparent,
? Colors.white.withValues(alpha: 0.08) borderRadius: BorderRadius.circular(2),
: Colors.black.withValues(alpha: 0.05), boxShadow: selected
borderRadius: BorderRadius.circular(6), ? [
border: Border.all( BoxShadow(
color: isDark color: scheme.primary.withValues(alpha: 0.6),
? Colors.white.withValues(alpha: 0.12) blurRadius: 6,
: Colors.black.withValues(alpha: 0.08), ),
width: 0.8, ]
), : null,
), ),
child: Text( ),
shortcutKey, SizedBox(
style: TextStyle( width: 54.5,
fontSize: 10, child: Center(
fontWeight: FontWeight.bold, child: Icon(
fontFamily: 'monospace', destination.icon,
size: 22,
color: selected color: selected
? scheme.primary ? scheme.primary
: scheme.onSurfaceVariant.withValues(alpha: 0.8), : (isDark
? scheme.onSurfaceVariant
.withValues(alpha: 0.85)
: scheme.onSurfaceVariant),
),
),
),
Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded(
child: Text(
label,
maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.5,
fontWeight: selected
? FontWeight.w700
: FontWeight.w500,
color: selected
? scheme.primary
: scheme.onSurface,
),
),
),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 5.5,
vertical: 2,
),
decoration: BoxDecoration(
color: isDark
? Colors.white.withValues(alpha: 0.08)
: Colors.black.withValues(alpha: 0.05),
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: isDark
? Colors.white.withValues(alpha: 0.12)
: Colors.black.withValues(alpha: 0.08),
width: 0.8,
),
),
child: Text(
shortcutKey,
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
fontFamily: 'monospace',
color: selected
? scheme.primary
: scheme.onSurfaceVariant
.withValues(alpha: 0.8),
),
),
),
const SizedBox(width: 8),
],
), ),
), ),
), ),
const SizedBox(width: 10),
], ],
], ),
), ),
), ),
), ),
+1 -1
View File
@@ -232,7 +232,7 @@ class _PostCardState extends ConsumerState<PostCard>
} }
final dpr = MediaQuery.devicePixelRatioOf(context); final dpr = MediaQuery.devicePixelRatioOf(context);
final cacheWidth = final cacheWidth =
(constraints.maxWidth * dpr).round().clamp(320, 1800); (constraints.maxWidth * dpr).round().clamp(280, 960);
final headers = _headersFor(post); final headers = _headersFor(post);
final videoUrls = MediaUrlSelector.video(post); final videoUrls = MediaUrlSelector.video(post);
if (!mobile && if (!mobile &&
+20 -18
View File
@@ -68,24 +68,26 @@ class PostMasonryGrid extends StatelessWidget {
final spacing = mobile ? 8.0 : 12.0; final spacing = mobile ? 8.0 : 12.0;
Widget buildCard(Post post) { Widget buildCard(Post post) {
return PostCard( return RepaintBoundary(
post: post, child: PostCard(
blurExplicit: blurExplicit && !nsfwEnabled, post: post,
showBadges: showBadges, blurExplicit: blurExplicit && !nsfwEnabled,
isFavorite: favoriteKeys.contains(post.cacheKey), showBadges: showBadges,
isViewed: viewedKeys.contains(post.cacheKey), isFavorite: favoriteKeys.contains(post.cacheKey),
isDownloaded: downloadedKeys.contains(post.cacheKey), isViewed: viewedKeys.contains(post.cacheKey),
mediaQualityMode: mediaQualityMode, isDownloaded: downloadedKeys.contains(post.cacheKey),
onOpen: () => onOpen(post), mediaQualityMode: mediaQualityMode,
onFavorite: () => onFavorite(post), onOpen: () => onOpen(post),
onPreview: onPreview == null ? null : () => onPreview!(post), onFavorite: () => onFavorite(post),
onHide: onHide == null ? null : () => onHide!(post), onPreview: onPreview == null ? null : () => onPreview!(post),
selectionMode: selectionMode, onHide: onHide == null ? null : () => onHide!(post),
selected: selectedKeys.contains(post.cacheKey), selectionMode: selectionMode,
onToggleSelected: selected: selectedKeys.contains(post.cacheKey),
onToggleSelected == null ? null : () => onToggleSelected!(post), onToggleSelected:
onAddToCollection: onToggleSelected == null ? null : () => onToggleSelected!(post),
onAddToCollection == null ? null : () => onAddToCollection!(post), onAddToCollection:
onAddToCollection == null ? null : () => onAddToCollection!(post),
),
); );
} }
+1 -1
View File
@@ -1,7 +1,7 @@
name: gel_rule_app name: gel_rule_app
description: Local backend/core layer for a Flutter booru browser app. description: Local backend/core layer for a Flutter booru browser app.
publish_to: "none" publish_to: "none"
version: 3.6.0+82 version: 3.6.3+85
environment: environment:
sdk: ">=3.3.0 <4.0.0" sdk: ">=3.3.0 <4.0.0"