import 'package:ikar/frontend/debug/dev_menu_widgets.dart'; import 'package:flutter/material.dart'; import 'package:material_symbols_icons/symbols.dart'; import '../../core/utils/format.dart'; import '../../l10n/app_localizations.dart'; import '../widgets/small_spinner.dart'; class DebugCacheSection extends StatelessWidget { final int cacheSize; final bool clearingCache; final String cacheLimitLabel; final VoidCallback onPickCacheLimit; final VoidCallback onClearCache; const DebugCacheSection({ super.key, required this.cacheSize, required this.clearingCache, required this.cacheLimitLabel, required this.onPickCacheLimit, required this.onClearCache, }); @override Widget build(BuildContext context) { final cs = Theme.of(context).colorScheme; final l10n = AppLocalizations.of(context)!; return DevGroup( children: [ Padding( padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), child: Material( color: cs.surfaceContainerHigh, borderRadius: BorderRadius.circular(20), child: InkWell( borderRadius: BorderRadius.circular(20), onTap: onPickCacheLimit, child: Padding( padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 17, ), child: Row( children: [ Icon( Symbols.data_usage, color: cs.onSurfaceVariant, size: 22, weight: 400, ), const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Лимит кэша медиа', style: TextStyle( color: cs.onSurface, fontSize: 16, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 2), Text( cacheLimitLabel, style: TextStyle( color: cs.onSurfaceVariant, fontSize: 13, ), ), ], ), ), Icon( Symbols.chevron_right, color: cs.onSurfaceVariant, size: 22, weight: 400, ), ], ), ), ), ), ), DevRow( caption: clearingCache ? 'Очистка…' : 'Занято: ${formatBytes(l10n, cacheSize)}', title: 'Очистить кэш медиа', onTap: clearingCache ? null : onClearCache, trailing: clearingCache ? SmallSpinner(size: 20, color: cs.onSurfaceVariant) : null, ), ], ); } }