fix: кто этот поганый impeller сделал

This commit is contained in:
Jganenokk
2026-08-16 14:26:43 +07:00
parent 3f4c627276
commit 53f0587c31
5 changed files with 62 additions and 33 deletions
+9
View File
@@ -7,6 +7,15 @@
# The following line activates a set of recommended lints for Flutter apps, # The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices. # packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
linter: linter:
@@ -612,7 +612,8 @@ class _ChatListScreenState extends State<ChatListScreen>
_shimmerController = AnimationController( _shimmerController = AnimationController(
vsync: this, vsync: this,
duration: const Duration(milliseconds: 1500), duration: const Duration(milliseconds: 1500),
)..repeat(); );
_syncShimmer();
_storiesRevealController = _storiesRevealController =
AnimationController( AnimationController(
@@ -631,6 +632,7 @@ class _ChatListScreenState extends State<ChatListScreen>
setState(() { setState(() {
_sessionState = state; _sessionState = state;
}); });
_syncShimmer();
if (state == SessionState.online) { if (state == SessionState.online) {
_requestReload(); _requestReload();
_maybeLoadStories(); _maybeLoadStories();
@@ -836,6 +838,7 @@ class _ChatListScreenState extends State<ChatListScreen>
_foldersListKnown = null; _foldersListKnown = null;
_isInitialLoading = false; _isInitialLoading = false;
}); });
_syncShimmer();
} }
return; return;
} }
@@ -928,6 +931,7 @@ class _ChatListScreenState extends State<ChatListScreen>
} }
_isInitialLoading = false; _isInitialLoading = false;
}); });
_syncShimmer();
_prefetchContactsForChats(loadedChats); _prefetchContactsForChats(loadedChats);
if (widget.archiveMode) { if (widget.archiveMode) {
if (filteredChats.isNotEmpty) { if (filteredChats.isNotEmpty) {
@@ -953,6 +957,7 @@ class _ChatListScreenState extends State<ChatListScreen>
_foldersListKnown = null; _foldersListKnown = null;
_isInitialLoading = false; _isInitialLoading = false;
}); });
_syncShimmer();
} }
} finally { } finally {
if (mounted) { if (mounted) {
@@ -970,6 +975,16 @@ class _ChatListScreenState extends State<ChatListScreen>
return _sessionState != SessionState.disconnected; return _sessionState != SessionState.disconnected;
} }
void _syncShimmer() {
final needed = _isInitialLoading || _showFoldersShimmer;
if (needed == _shimmerController.isAnimating) return;
if (needed) {
_shimmerController.repeat();
} else {
_shimmerController.stop();
}
}
int get _folderPageCount => _folders.isEmpty ? 1 : _folders.length; int get _folderPageCount => _folders.isEmpty ? 1 : _folders.length;
int get _selectedFolderIndex { int get _selectedFolderIndex {
@@ -392,8 +392,13 @@ class _FolderEditSheetState extends State<_FolderEditSheet> {
color: cs.onSurfaceVariant, color: cs.onSurfaceVariant,
size: 20, size: 20,
), ),
prefixIconConstraints: const BoxConstraints(
minWidth: 48,
minHeight: 0,
),
isDense: true, isDense: true,
border: InputBorder.none, border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(vertical: 14),
), ),
), ),
), ),
+22 -22
View File
@@ -1,6 +1,5 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@@ -320,9 +319,6 @@ class _SpectrumPalette {
bool uniform = true; bool uniform = true;
bool _targetUniform = true; bool _targetUniform = true;
ui.Shader? _shader;
double _shaderLeft = double.nan;
double _shaderRight = double.nan;
static void _writeUniform(Float32List channels, Color color) { static void _writeUniform(Float32List channels, Color color) {
for (var i = 0; i < channels.length; i += 3) { for (var i = 0; i < channels.length; i += 3) {
@@ -418,21 +414,21 @@ class _SpectrumPalette {
); );
} }
uniform = false; uniform = false;
_shader = null;
} }
ui.Shader shaderFor(double left, double right) { Color sampleAt(double t) {
final cached = _shader; if (t <= 0) return colors.first;
if (cached != null && _shaderLeft == left && _shaderRight == right) { if (t >= 1) return colors.last;
return cached; final scaled = t * (stopCount - 1);
} final lower = scaled.floor();
_shaderLeft = left; final fraction = scaled - lower;
_shaderRight = right; final a = lower * 3;
return _shader = ui.Gradient.linear( final b = a + 3;
Offset(left, 0), return Color.from(
Offset(right, 0), alpha: 1,
colors, red: _current[a] + (_current[b] - _current[a]) * fraction,
_stops, green: _current[a + 1] + (_current[b + 1] - _current[a + 1]) * fraction,
blue: _current[a + 2] + (_current[b + 2] - _current[a + 2]) * fraction,
); );
} }
} }
@@ -463,17 +459,21 @@ class _SpectrumPainter extends CustomPainter {
final maxHeight = size.height * SpectrumTuning.heightFraction; final maxHeight = size.height * SpectrumTuning.heightFraction;
final baseline = size.height; final baseline = size.height;
final uniform = palette.uniform;
final span = zoneRight - zoneLeft;
final paint = Paint(); final paint = Paint();
if (palette.uniform) { if (uniform) paint.color = palette.colors.first;
paint.color = palette.colors.first;
} else {
paint.shader = palette.shaderFor(zoneLeft, zoneRight);
}
for (var i = 0; i < heights.length; i++) { for (var i = 0; i < heights.length; i++) {
final height = heights[i] * maxHeight; final height = heights[i] * maxHeight;
if (height < _minVisibleHeight) continue; if (height < _minVisibleHeight) continue;
final left = leftInset + pitch * i; final left = leftInset + pitch * i;
if (!uniform) {
final center = left + SpectrumTuning.barWidth / 2;
paint.color = palette.sampleAt(
span <= 0 ? 0 : (center - zoneLeft) / span,
);
}
canvas.drawRect( canvas.drawRect(
Rect.fromLTRB( Rect.fromLTRB(
left, left,
+10 -10
View File
@@ -857,10 +857,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: intl name: intl
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.20.2" version: "0.20.3"
jni: jni:
dependency: transitive dependency: transitive
description: description:
@@ -992,10 +992,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.19" version: "0.12.20"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
@@ -1064,10 +1064,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.18.0" version: "1.19.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@@ -1685,10 +1685,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.11" version: "0.7.12"
timezone: timezone:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1829,10 +1829,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b sha256: f36f9f3be64c6198714492bb455c11056e33e2f85d9a0b676a48301e44fdcf47
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.0" version: "2.4.2"
video_player: video_player:
dependency: "direct main" dependency: "direct main"
description: description: