|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | + |
| 3 | +import '../palette.dart'; |
| 4 | + |
| 5 | +class HeightWidget extends StatelessWidget { |
| 6 | + const HeightWidget({ |
| 7 | + super.key, |
| 8 | + required this.height, |
| 9 | + required this.onHeightChanged, |
| 10 | + }); |
| 11 | + |
| 12 | + final int height; |
| 13 | + final Function(double) onHeightChanged; |
| 14 | + |
| 15 | + @override |
| 16 | + Widget build(BuildContext context) { |
| 17 | + return Container( |
| 18 | + height: (MediaQuery.of(context).size.width - 48) / 2, |
| 19 | + width: double.infinity, |
| 20 | + decoration: BoxDecoration( |
| 21 | + borderRadius: BorderRadius.circular(5), |
| 22 | + color: Palette.cardBackgroundInactive, |
| 23 | + ), |
| 24 | + child: Column( |
| 25 | + mainAxisAlignment: MainAxisAlignment.center, |
| 26 | + children: [ |
| 27 | + const Text( |
| 28 | + 'HEIGHT', |
| 29 | + style: TextStyle( |
| 30 | + fontSize: 23, |
| 31 | + fontWeight: FontWeight.w600, |
| 32 | + color: Palette.textInactive, |
| 33 | + ), |
| 34 | + ), |
| 35 | + Row( |
| 36 | + mainAxisAlignment: MainAxisAlignment.center, |
| 37 | + crossAxisAlignment: CrossAxisAlignment.baseline, |
| 38 | + textBaseline: TextBaseline.alphabetic, |
| 39 | + children: [ |
| 40 | + Text( |
| 41 | + height.round().toString(), |
| 42 | + style: const TextStyle( |
| 43 | + fontSize: 50, |
| 44 | + fontWeight: FontWeight.w800, |
| 45 | + color: Palette.textActive, |
| 46 | + ), |
| 47 | + ), |
| 48 | + const Text( |
| 49 | + 'cm', |
| 50 | + style: TextStyle( |
| 51 | + fontSize: 30, |
| 52 | + color: Palette.textInactive, |
| 53 | + ), |
| 54 | + ), |
| 55 | + ], |
| 56 | + ), |
| 57 | + Padding( |
| 58 | + padding: const EdgeInsets.symmetric( |
| 59 | + horizontal: 24.0, |
| 60 | + ), |
| 61 | + child: SliderTheme( |
| 62 | + data: SliderTheme.of(context).copyWith( |
| 63 | + trackHeight: 1.0, |
| 64 | + thumbShape: const RoundSliderThumbShape( |
| 65 | + enabledThumbRadius: 15, |
| 66 | + ), |
| 67 | + ), |
| 68 | + child: Slider( |
| 69 | + value: height.toDouble(), |
| 70 | + min: 150.0, |
| 71 | + max: 210.0, |
| 72 | + activeColor: Palette.textActive, |
| 73 | + inactiveColor: Palette.textInactive, |
| 74 | + thumbColor: Palette.action, |
| 75 | + onChanged: onHeightChanged, |
| 76 | + ), |
| 77 | + ), |
| 78 | + ), |
| 79 | + ], |
| 80 | + ), |
| 81 | + ); |
| 82 | + } |
| 83 | +} |
0 commit comments