1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// SPDX-License-Identifier: Apache-2.0
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_hvac/vehicle-signals/vss_provider.dart';
import 'package:flutter_hvac/vehicle-signals/vss_signal_providers.dart';
import 'package:flutter_hvac/vehicle-signals/vss_path.dart';
import 'package:numberpicker/numberpicker.dart';
import '../size.dart';
class RightClimateScrollWidget extends ConsumerWidget {
RightClimateScrollWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
final int _selectedTemp = ref.watch(RightClimateTempProvider);
return SizedBox(
width: SizeConfig.screenWidth * 0.25,
height: SizeConfig.screenHeight * 0.30,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 2,
),
borderRadius: BorderRadius.circular(12),
),
child: NumberPicker(
minValue: 16,
maxValue: 33,
itemHeight: 100,
itemCount: 5,
value: _selectedTemp,
textMapper: (value) {
return value.toString() + '°';
},
onChanged: (value) {
ref.read(RightClimateTempProvider.notifier).update(value);
var vss = ref.read(vssClientProvider);
if (vss != null) {
vss.setInt32(VSSPath.vehicleFrontRightTemp, value);
vss.setInt32(VSSPath.vehicleRearRightTemp, value);
}
},
selectedTextStyle: TextStyle(
color: Colors.lightBlueAccent,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.fontsize * 4,
),
textStyle: TextStyle(
color: Colors.white54,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.fontsize * 4,
))));
}
}
|