норм отображение памяти

This commit is contained in:
jganenok
2025-11-17 15:05:02 +07:00
parent 2c405b49e3
commit ff42723f6f
3 changed files with 23 additions and 43 deletions

View File

@@ -180,7 +180,7 @@ class _HomeScreenState extends State<HomeScreen> {
return;
}
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? false;
final showUpdateNotification =
prefs.getBool('show_update_notification') ?? true;
@@ -640,7 +640,7 @@ class _HomeScreenState extends State<HomeScreen> {
try {
final prefs = await SharedPreferences.getInstance();
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? false;
final currentVersion = prefs.getString('spoof_appversion') ?? '0.0.0';
final latestVersion = await VersionChecker.getLatestVersion();

View File

@@ -14,7 +14,7 @@ class KometMiscScreen extends StatefulWidget {
class _KometMiscScreenState extends State<KometMiscScreen> {
bool? _isBatteryOptimizationDisabled;
bool _isAutoUpdateEnabled = true;
bool _isAutoUpdateEnabled = false;
bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true;
@@ -29,7 +29,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Future<void> _loadUpdateSettings() async {
final prefs = await SharedPreferences.getInstance();
setState(() {
_isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
_isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? false;
_showUpdateNotification =
prefs.getBool('show_update_notification') ?? true;
_enableWebVersionCheck =

View File

@@ -28,15 +28,12 @@ class _StorageScreenState extends State<StorageScreen>
padding: const EdgeInsets.all(16),
child: Column(
children: [
_buildStorageChart(colors),
const SizedBox(height: 20),
_buildStorageDetails(colors),
const SizedBox(height: 20),
_buildActionButtons(colors),
],
),
@@ -85,15 +82,16 @@ class _StorageScreenState extends State<StorageScreen>
final cacheSize = await _getDirectorySize(cacheDir);
final totalSize = appSize + cacheSize;
final messagesSize = (totalSize * 0.4).round();
final mediaSize = (totalSize * 0.3).round();
final otherSize = totalSize - messagesSize - mediaSize;
final messagesSize = totalSize > 0 ? (totalSize * 0.3).round() : 0;
final mediaSize = totalSize > 0 ? (totalSize * 0.25).round() : 0;
final cacheSizeAdjusted = totalSize > 0 ? (totalSize * 0.2).round() : 0;
final otherSize = totalSize - messagesSize - mediaSize - cacheSizeAdjusted;
return StorageInfo(
totalSize: totalSize,
messagesSize: messagesSize,
mediaSize: mediaSize,
cacheSize: cacheSize,
cacheSize: cacheSizeAdjusted,
otherSize: otherSize,
);
}
@@ -109,8 +107,8 @@ class _StorageScreenState extends State<StorageScreen>
}
}
} catch (e) {
totalSize = Random().nextInt(50) * 1024 * 1024; // 0-50 MB
print('Ошибка при подсчете размера директории ${dir.path}: $e');
totalSize = 0; // В случае ошибки возвращаем 0
}
return totalSize;
}
@@ -260,17 +258,14 @@ class _StorageScreenState extends State<StorageScreen>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildStorageChart(colors),
const SizedBox(height: 32),
_buildStorageDetails(colors),
const SizedBox(height: 32),
_buildActionButtons(colors),
],
),
@@ -283,7 +278,6 @@ class _StorageScreenState extends State<StorageScreen>
backgroundColor: Colors.transparent,
body: Stack(
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
@@ -293,7 +287,6 @@ class _StorageScreenState extends State<StorageScreen>
),
),
Center(
child: Container(
width: 400,
@@ -312,7 +305,6 @@ class _StorageScreenState extends State<StorageScreen>
),
child: Column(
children: [
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
@@ -347,7 +339,6 @@ class _StorageScreenState extends State<StorageScreen>
),
),
Expanded(
child: _isLoading
? const Center(child: CircularProgressIndicator())
@@ -355,15 +346,12 @@ class _StorageScreenState extends State<StorageScreen>
padding: const EdgeInsets.all(16),
child: Column(
children: [
_buildStorageChart(colors),
const SizedBox(height: 20),
_buildStorageDetails(colors),
const SizedBox(height: 20),
_buildActionButtons(colors),
],
),
@@ -406,7 +394,6 @@ class _StorageScreenState extends State<StorageScreen>
),
const SizedBox(height: 24),
AnimatedBuilder(
animation: _animation,
builder: (context, child) {
@@ -415,7 +402,6 @@ class _StorageScreenState extends State<StorageScreen>
height: 200,
child: Stack(
children: [
Container(
width: 200,
height: 200,
@@ -425,7 +411,6 @@ class _StorageScreenState extends State<StorageScreen>
),
),
CustomPaint(
size: const Size(200, 200),
painter: StorageChartPainter(
@@ -436,7 +421,6 @@ class _StorageScreenState extends State<StorageScreen>
),
),
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -467,7 +451,6 @@ class _StorageScreenState extends State<StorageScreen>
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
@@ -725,35 +708,32 @@ class StorageChartPainter extends CustomPainter {
final paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 24 // Увеличиваем толщину с 16 до 24
..strokeCap = StrokeCap.round;
..strokeWidth = 20
..strokeCap = StrokeCap.butt;
paint.color = colors.surfaceContainerHighest;
canvas.drawCircle(center, radius, paint);
final totalSize = storageInfo.totalSize;
if (totalSize > 0) {
double startAngle = -pi / 2;
final messagesRatio = storageInfo.messagesSize / totalSize;
final mediaRatio = storageInfo.mediaSize / totalSize;
final cacheRatio = storageInfo.cacheSize / totalSize;
final otherRatio = storageInfo.otherSize / totalSize;
double currentAngle = -pi / 2;
if (messagesRatio > 0) {
paint.color = Colors.blue;
final sweepAngle = 2 * pi * messagesRatio * animationValue;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
currentAngle,
sweepAngle,
false,
paint,
);
startAngle += 2 * pi * messagesRatio; // Обновляем без анимации
currentAngle += sweepAngle;
}
if (mediaRatio > 0) {
@@ -761,12 +741,12 @@ class StorageChartPainter extends CustomPainter {
final sweepAngle = 2 * pi * mediaRatio * animationValue;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
currentAngle,
sweepAngle,
false,
paint,
);
startAngle += 2 * pi * mediaRatio; // Обновляем без анимации
currentAngle += sweepAngle;
}
if (cacheRatio > 0) {
@@ -774,12 +754,12 @@ class StorageChartPainter extends CustomPainter {
final sweepAngle = 2 * pi * cacheRatio * animationValue;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
currentAngle,
sweepAngle,
false,
paint,
);
startAngle += 2 * pi * cacheRatio; // Обновляем без анимации
currentAngle += sweepAngle;
}
if (otherRatio > 0) {
@@ -787,7 +767,7 @@ class StorageChartPainter extends CustomPainter {
final sweepAngle = 2 * pi * otherRatio * animationValue;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
currentAngle,
sweepAngle,
false,
paint,