forked from eatvio/eatvio_app
feat(profile): fix pickers
This commit is contained in:
@@ -21,20 +21,11 @@ class WeightChartWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
late final weightKiloController;
|
||||
late final weightGramsController;
|
||||
late FixedExtentScrollController weightKiloController;
|
||||
late FixedExtentScrollController weightGramsController;
|
||||
late int weightKilo;
|
||||
late int weightGrams;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
weightKiloController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[0]) - 20);
|
||||
weightGramsController = FixedExtentScrollController(initialItem: int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]));
|
||||
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
|
||||
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
@@ -48,19 +39,19 @@ class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
'${widget.chartPoints.last.weight.toStringAsFixed(1)} кг',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 48,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
widget.chartPoints.last.weight > widget.chartPoints[widget.chartPoints.length - 2].weight
|
||||
? Icon(
|
||||
Icons.arrow_drop_up,
|
||||
size: 48,
|
||||
size: 40,
|
||||
color: Colors.grey.withOpacity(0.4),
|
||||
)
|
||||
: Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 48,
|
||||
size: 40,
|
||||
color: Colors.grey.withOpacity(0.4),
|
||||
),
|
||||
],
|
||||
@@ -113,6 +104,10 @@ class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
FloatingActionButton.small(
|
||||
heroTag: 'addWeight',
|
||||
onPressed: () {
|
||||
weightKilo = int.parse(widget.chartPoints.last.weight.toString().split('.')[0]);
|
||||
weightGrams = int.parse(widget.chartPoints.last.weight.toString().split('.')[1][0]);
|
||||
weightKiloController = FixedExtentScrollController(initialItem: weightKilo - 20);
|
||||
weightGramsController = FixedExtentScrollController(initialItem: weightGrams);
|
||||
showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
@@ -133,7 +128,7 @@ class _WeightChartWidgetState extends State<WeightChartWidget> {
|
||||
weightKilo = value + 20;
|
||||
},
|
||||
children: [
|
||||
for (int i = 20; i < 301; i++) Text('$i'),
|
||||
for (int i = 20; i < 300; i++) Text('$i'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user