Skip to content

Commit

Permalink
Slider (#105)
Browse files Browse the repository at this point in the history
* Remove YaruSliderValueMarker as it was only used in one place

* Keep slider from changing width when value changes
  • Loading branch information
mivoligo committed Mar 16, 2022
1 parent b9895f4 commit c2c2fb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
18 changes: 14 additions & 4 deletions lib/src/yaru_slider_row.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:yaru_widgets/src/yaru_row.dart';
import 'package:yaru_widgets/src/yaru_slider_value_marker.dart';

class YaruSliderRow extends StatelessWidget {
/// Creates a yaru style slider.
Expand Down Expand Up @@ -91,8 +90,15 @@ class YaruSliderRow extends StatelessWidget {
child: Row(
children: [
if (showValue)
Text(
value?.toStringAsFixed(fractionDigits) ?? '',
SizedBox(
width: 40,
height: 20,
child: FittedBox(
alignment: Alignment.centerRight,
child: Text(
value?.toStringAsFixed(fractionDigits) ?? '',
),
),
),
Expanded(
child: LayoutBuilder(
Expand All @@ -105,7 +111,11 @@ class YaruSliderRow extends StatelessWidget {
(constraints.maxWidth - thumbRadius * 2) *
(defaultValue! - min) /
(max - min),
child: const YaruSliderValueMarker(),
child: Container(
width: 1,
height: 40,
color: Theme.of(context).dividerColor,
),
),
Slider(
label: value?.toStringAsFixed(0),
Expand Down
14 changes: 0 additions & 14 deletions lib/src/yaru_slider_value_marker.dart

This file was deleted.

0 comments on commit c2c2fb5

Please sign in to comment.