Compare commits

..
2 Commits
Author SHA1 Message Date
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
13 changed files with 588 additions and 393 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
<application <application
android:label="Prisma" android:label="Prisma"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
android:largeHeap="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
+19
View File
@@ -1,4 +1,23 @@
const prismaChangelog = [ const prismaChangelog = [
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: 'Редизайн интерфейса для ПК и система горячих клавиш (хоткеи)',
@@ -1474,6 +1474,8 @@ class _FavoriteArtistsSection extends ConsumerWidget {
fav.avatarUrl!.isNotEmpty fav.avatarUrl!.isNotEmpty
? CachedNetworkImage( ? CachedNetworkImage(
imageUrl: fav.avatarUrl!, imageUrl: fav.avatarUrl!,
memCacheWidth: 120,
memCacheHeight: 120,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => const Icon( placeholder: (_, __) => const Icon(
Icons.person_rounded, Icons.person_rounded,
@@ -1599,6 +1601,8 @@ class _FavoriteArtistMediaStrip extends ConsumerWidget {
imageUrl: post.previewUrl.isNotEmpty imageUrl: post.previewUrl.isNotEmpty
? post.previewUrl ? post.previewUrl
: post.sampleUrl, : post.sampleUrl,
memCacheWidth: 200,
memCacheHeight: 200,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: (_, __) => ColoredBox( placeholder: (_, __) => ColoredBox(
color: Theme.of(context) color: Theme.of(context)
@@ -1706,6 +1710,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()),
@@ -2190,29 +2196,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 +2212,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,9 +2229,17 @@ class _ZoomableImageState extends State<_ZoomableImage> {
if (mounted) setState(() => _zoomed = nextZoomed); if (mounted) setState(() => _zoomed = nextZoomed);
_setLocked(nextZoomed || _pointerCount >= 2); _setLocked(nextZoomed || _pointerCount >= 2);
}, },
child: Listener(
onPointerSignal: (event) {
if (event is PointerScrollEvent) {
GestureBinding.instance.pointerSignalResolver
.register(event, (_) {});
}
},
child: child, child: child,
), ),
), ),
),
); );
}, },
), ),
@@ -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,
+3
View File
@@ -5,5 +5,8 @@ import 'app/app.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.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()));
} }
+243 -81
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,47 +444,61 @@ 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;
final width = lerpDouble(74.0, 260.0, progress)!;
final contentOpacity =
(progress - 0.25).clamp(0.0, 0.75) / 0.75;
final isFullyExpanded = progress > 0.85;
return Container(
width: width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDark color: isDark
? scheme.surfaceContainerHigh.withValues(alpha: 0.75) ? scheme.surfaceContainerHigh
: scheme.surface.withValues(alpha: 0.85), : scheme.surface,
border: Border( border: Border(
right: BorderSide( right: BorderSide(
color: isDark color: isDark
? Colors.white.withValues(alpha: 0.12) ? Colors.white.withValues(alpha: 0.1)
: scheme.outlineVariant.withValues(alpha: 0.35), : scheme.outlineVariant.withValues(alpha: 0.35),
width: 1, width: 1,
), ),
), ),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05), color:
blurRadius: 18, Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
offset: const Offset(4, 0), blurRadius: 16,
offset: const Offset(3, 0),
), ),
], ],
), ),
child: ClipRect( child: ClipRect(
child: BackdropFilter( child: OverflowBox(
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20), minWidth: 260,
maxWidth: 260,
alignment: Alignment.topLeft,
child: SizedBox(
width: 260,
child: SafeArea( child: SafeArea(
child: Column( child: Column(
children: [ children: [
// App Brand Header // App Brand Header
Padding( Padding(
padding: const EdgeInsets.fromLTRB(14, 16, 12, 14), padding:
const EdgeInsets.fromLTRB(15, 16, 12, 14),
child: SizedBox(
height: 44,
child: Row( child: Row(
children: [ children: [
Container( Container(
@@ -455,10 +513,12 @@ class _DesktopShellState extends State<_DesktopShell> {
scheme.tertiary, scheme.tertiary,
], ],
), ),
borderRadius: BorderRadius.circular(14), borderRadius:
BorderRadius.circular(14),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: scheme.primary.withValues(alpha: 0.35), color: scheme.primary
.withValues(alpha: 0.35),
blurRadius: 12, blurRadius: 12,
offset: const Offset(0, 3), offset: const Offset(0, 3),
), ),
@@ -472,39 +532,59 @@ class _DesktopShellState extends State<_DesktopShell> {
), ),
), ),
), ),
if (isExpanded) ...[
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
mainAxisSize: MainAxisSize.min, CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
Text( Text(
'Lunaris', 'Lunaris',
style: theme.textTheme.titleMedium?.copyWith( maxLines: 1,
fontWeight: FontWeight.w800, softWrap: false,
style: theme
.textTheme
.titleMedium
?.copyWith(
fontWeight:
FontWeight.w800,
letterSpacing: 0.2, letterSpacing: 0.2,
), ),
), ),
const SizedBox(height: 2), const SizedBox(height: 2),
Container( Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets
.symmetric(
horizontal: 6, horizontal: 6,
vertical: 1.5, vertical: 1.5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: scheme.primary.withValues(alpha: 0.15), color: scheme.primary
borderRadius: BorderRadius.circular(6), .withValues(
alpha: 0.15),
borderRadius:
BorderRadius
.circular(6),
border: Border.all( border: Border.all(
color: scheme.primary.withValues(alpha: 0.3), color: scheme.primary
.withValues(
alpha: 0.3),
width: 0.8, width: 0.8,
), ),
), ),
child: Text( child: Text(
'v3.6.0', 'v3.6.2',
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
color: scheme.primary, color: scheme.primary,
letterSpacing: 0.4, letterSpacing: 0.4,
), ),
@@ -514,32 +594,43 @@ class _DesktopShellState extends State<_DesktopShell> {
), ),
), ),
IconButton( IconButton(
visualDensity: VisualDensity.compact, visualDensity:
VisualDensity.compact,
tooltip: _pinned tooltip: _pinned
? (widget.ru ? 'Открепить панель' : 'Unpin panel') ? (widget.ru
: (widget.ru ? 'Закрепить панель' : 'Pin panel'), ? 'Открепить панель'
onPressed: () { : 'Unpin panel')
setState(() => _pinned = !_pinned); : (widget.ru
}, ? 'Закрепить панель'
: 'Pin panel'),
onPressed: _togglePinned,
icon: Icon( icon: Icon(
_pinned _pinned
? Icons.push_pin_rounded ? Icons.push_pin_rounded
: Icons.push_pin_outlined, : Icons.push_pin_outlined,
size: 19, size: 19,
color: _pinned ? scheme.primary : scheme.onSurfaceVariant, color: _pinned
? scheme.primary
: scheme
.onSurfaceVariant,
), ),
), ),
], ],
),
),
),
], ],
), ),
), ),
),
const Divider(height: 1), const Divider(height: 1),
const SizedBox(height: 8), const SizedBox(height: 8),
// Destinations List // Destinations List
Expanded( Expanded(
child: ListView( child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 8), padding:
const EdgeInsets.symmetric(horizontal: 8),
children: [ children: [
for (var index = 0; for (var index = 0;
index < widget.destinations.length; index < widget.destinations.length;
@@ -547,12 +638,15 @@ class _DesktopShellState extends State<_DesktopShell> {
_RailButton( _RailButton(
destination: widget.destinations[index], destination: widget.destinations[index],
ru: widget.ru, ru: widget.ru,
selected: (selected < 0 ? 0 : selected) == index, selected: (selected < 0 ? 0 : selected) ==
expanded: isExpanded, index,
contentOpacity: contentOpacity,
isFullyExpanded: isFullyExpanded,
shortcutKey: 'Ctrl+${index + 1}', shortcutKey: 'Ctrl+${index + 1}',
onTap: () { onTap: () {
widget.onNavigate( widget.onNavigate(
widget.destinations[index].location); widget.destinations[index]
.location);
}, },
), ),
], ],
@@ -564,22 +658,28 @@ class _DesktopShellState extends State<_DesktopShell> {
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 8), horizontal: 8, vertical: 8),
child: Column( child: SizedBox(
width: 244,
child: Row(
children: [ children: [
// Shortcuts helper button Expanded(
Tooltip( child: Tooltip(
message: isExpanded message: isFullyExpanded
? '' ? ''
: (widget.ru : (widget.ru
? 'Горячие клавиши (F1 / ?)' ? 'Горячие клавиши (F1 / ?)'
: 'Keyboard Shortcuts (F1 / ?)'), : 'Keyboard Shortcuts (F1 / ?)'),
waitDuration: const Duration(milliseconds: 350), waitDuration: const Duration(
milliseconds: 350),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
borderRadius: BorderRadius.circular(14), borderRadius:
BorderRadius.circular(14),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: InkWell( child: InkWell(
onTap: () => DesktopShortcutsDialog.show(context), onTap: () =>
DesktopShortcutsDialog.show(
context),
child: SizedBox( child: SizedBox(
height: 44, height: 44,
child: Row( child: Row(
@@ -589,68 +689,110 @@ class _DesktopShellState extends State<_DesktopShell> {
child: Icon( child: Icon(
Icons.keyboard_rounded, Icons.keyboard_rounded,
size: 22, size: 22,
color: scheme.onSurfaceVariant, color: scheme
.onSurfaceVariant,
), ),
), ),
if (isExpanded) ...[ Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded( Expanded(
child: Text( child: Text(
widget.ru widget.ru
? 'Горячие клавиши' ? 'Горячие клавиши'
: 'Shortcuts', : 'Shortcuts',
style: TextStyle( maxLines: 1,
fontWeight: FontWeight.w600, softWrap: false,
overflow:
TextOverflow
.ellipsis,
style:
TextStyle(
fontWeight:
FontWeight
.w600,
fontSize: 13, fontSize: 13,
color: scheme.onSurface, color: scheme
.onSurface,
), ),
overflow: TextOverflow.ellipsis,
), ),
), ),
Container( Container(
padding: const EdgeInsets.symmetric( padding:
const EdgeInsets
.symmetric(
horizontal: 6, horizontal: 6,
vertical: 2, vertical: 2,
), ),
decoration: BoxDecoration( decoration:
BoxDecoration(
color: isDark color: isDark
? Colors.white.withValues(alpha: 0.1) ? Colors
: Colors.black.withValues(alpha: 0.06), .white
borderRadius: BorderRadius.circular(6), .withValues(
alpha:
0.1)
: Colors
.black
.withValues(
alpha:
0.06),
borderRadius:
BorderRadius
.circular(
6),
), ),
child: const Text( child: const Text(
'?', '?',
style: TextStyle( style:
TextStyle(
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.bold, fontWeight:
fontFamily: 'monospace', FontWeight
.bold,
fontFamily:
'monospace',
), ),
), ),
), ),
const SizedBox(width: 8), const SizedBox(
width: 8),
], ],
),
),
),
], ],
), ),
), ),
), ),
), ),
), ),
),
// Quick pin toggle button when collapsed if (!_pinned && progress < 0.4)
if (!isExpanded)
IconButton( IconButton(
tooltip: widget.ru ? 'Закрепить панель' : 'Pin sidebar', tooltip: widget.ru
onPressed: () => setState(() => _pinned = true), ? 'Закрепить панель'
icon: const Icon(Icons.chevron_right_rounded, size: 20), : '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,13 +840,16 @@ 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,
child: DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
border: selected border: selected
? Border.all( ? Border.all(
color: scheme.primary.withValues(alpha: isDark ? 0.45 : 0.28), color: scheme.primary
.withValues(alpha: isDark ? 0.45 : 0.28),
width: 1.1, width: 1.1,
) )
: null, : null,
@@ -735,21 +882,31 @@ class _RailButton extends StatelessWidget {
color: selected color: selected
? scheme.primary ? scheme.primary
: (isDark : (isDark
? scheme.onSurfaceVariant.withValues(alpha: 0.85) ? scheme.onSurfaceVariant
.withValues(alpha: 0.85)
: scheme.onSurfaceVariant), : scheme.onSurfaceVariant),
), ),
), ),
), ),
if (expanded) ...[ Expanded(
child: Opacity(
opacity: contentOpacity,
child: Row(
children: [
Expanded( Expanded(
child: Text( child: Text(
label, label,
maxLines: 1, maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 13.5, fontSize: 13.5,
fontWeight: selected ? FontWeight.w700 : FontWeight.w500, fontWeight: selected
color: selected ? scheme.primary : scheme.onSurface, ? FontWeight.w700
: FontWeight.w500,
color: selected
? scheme.primary
: scheme.onSurface,
), ),
), ),
), ),
@@ -778,18 +935,23 @@ class _RailButton extends StatelessWidget {
fontFamily: 'monospace', fontFamily: 'monospace',
color: selected color: selected
? scheme.primary ? scheme.primary
: scheme.onSurfaceVariant.withValues(alpha: 0.8), : scheme.onSurfaceVariant
.withValues(alpha: 0.8),
), ),
), ),
), ),
const SizedBox(width: 10), const SizedBox(width: 8),
], ],
),
),
),
], ],
), ),
), ),
), ),
), ),
), ),
),
); );
} }
} }
+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 &&
+3 -1
View File
@@ -68,7 +68,8 @@ 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(
child: PostCard(
post: post, post: post,
blurExplicit: blurExplicit && !nsfwEnabled, blurExplicit: blurExplicit && !nsfwEnabled,
showBadges: showBadges, showBadges: showBadges,
@@ -86,6 +87,7 @@ class PostMasonryGrid extends StatelessWidget {
onToggleSelected == null ? null : () => onToggleSelected!(post), onToggleSelected == null ? null : () => onToggleSelected!(post),
onAddToCollection: onAddToCollection:
onAddToCollection == null ? null : () => onAddToCollection!(post), 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.2+84
environment: environment:
sdk: ">=3.3.0 <4.0.0" sdk: ">=3.3.0 <4.0.0"