import 'package:flutter/material.dart'; import '../theme/app_theme.dart'; class AppSlider extends StatelessWidget { const AppSlider({ super.key, required this.value, required this.onChanged, this.min = 0, this.max = 1, this.divisions, this.label, this.focusNode, this.semanticFormatterCallback, this.onChangeStart, this.onChangeEnd, }); final double value; final double min; final double max; final int? divisions; final String? label; final FocusNode? focusNode; final SemanticFormatterCallback? semanticFormatterCallback; final ValueChanged? onChanged; final ValueChanged? onChangeStart; final ValueChanged? onChangeEnd; @override Widget build(BuildContext context) { final theme = Theme.of(context); final colors = theme.colorScheme; final accent = colors.primary; return SizedBox( height: AppTheme.isCompactInspector(context) ? AppInspectorMetrics.input : AppTheme.isDesktop(context) ? AppDesktopMetrics.input : AppControlSize.standard, child: SliderTheme( data: SliderTheme.of(context).copyWith( trackHeight: 4, trackGap: 0, padding: const EdgeInsets.symmetric(horizontal: AppSpacing.compact), activeTrackColor: accent, inactiveTrackColor: colors.secondaryContainer, disabledActiveTrackColor: colors.onSurface.withValues(alpha: 0.24), disabledInactiveTrackColor: colors.outlineVariant, thumbColor: colors.onPrimary, disabledThumbColor: colors.onSurface.withValues(alpha: 0.38), overlayColor: accent.withValues(alpha: 0.14), thumbShape: const RoundSliderThumbShape( enabledThumbRadius: 6, disabledThumbRadius: 6, elevation: 1, pressedElevation: 1, ), overlayShape: const RoundSliderOverlayShape(overlayRadius: 12), trackShape: const RoundedRectSliderTrackShape(), showValueIndicator: ShowValueIndicator.never, ), child: Slider( value: value, min: min, max: max, divisions: divisions, label: label, focusNode: focusNode, semanticFormatterCallback: semanticFormatterCallback, onChanged: onChanged, onChangeStart: onChangeStart, onChangeEnd: onChangeEnd, ), ), ); } }