2023-01-18 05:34:54 -05:00
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
/// A custom-styled adaptive [Slider].
|
|
|
|
|
class SettingsListSlider extends StatelessWidget {
|
|
|
|
|
final String title;
|
|
|
|
|
final String trailing;
|
|
|
|
|
final String? subtitle;
|
|
|
|
|
final double value;
|
|
|
|
|
final ValueChanged<double>? onChanged;
|
|
|
|
|
final double min;
|
|
|
|
|
final double max;
|
|
|
|
|
final int? divisions;
|
|
|
|
|
|
|
|
|
|
const SettingsListSlider({
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.title,
|
|
|
|
|
required this.trailing,
|
|
|
|
|
this.subtitle,
|
|
|
|
|
required this.value,
|
|
|
|
|
this.onChanged,
|
|
|
|
|
this.min = 0.0,
|
|
|
|
|
this.max = 1.0,
|
|
|
|
|
this.divisions,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
static const _textStyle = TextStyle(fontWeight: FontWeight.w500);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return ListTile(
|
2023-04-29 11:34:28 -04:00
|
|
|
contentPadding:
|
|
|
|
|
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
2023-01-18 05:34:54 -05:00
|
|
|
title: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(title, style: _textStyle),
|
|
|
|
|
const Spacer(),
|
2023-10-22 18:38:32 -04:00
|
|
|
Text(
|
|
|
|
|
trailing,
|
|
|
|
|
style: _textStyle.copyWith(
|
|
|
|
|
fontFeatures: [const FontFeature.tabularFigures()],
|
|
|
|
|
),
|
|
|
|
|
),
|
2023-01-18 05:34:54 -05:00
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
subtitle: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Slider.adaptive(
|
|
|
|
|
value: value,
|
|
|
|
|
min: min,
|
|
|
|
|
max: max,
|
|
|
|
|
divisions: divisions,
|
|
|
|
|
onChanged: onChanged,
|
|
|
|
|
),
|
|
|
|
|
if (subtitle != null) Text(subtitle!),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|