aboutsummaryrefslogtreecommitdiffstats
path: root/lib/presentation/screens/dashboard/widgets/hybrid_mode.dart
blob: 01fb9817f0b92bce8686b2b9bd02df6f4697d7f9 (plain)
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
import 'package:flutter_ics_homescreen/export.dart';

class HybridModel extends ConsumerStatefulWidget {
  const HybridModel({super.key});

  @override
  HybridModelState createState() => HybridModelState();
}

class HybridModelState extends ConsumerState<HybridModel> {

  @override
  Widget build(BuildContext context) {
    bool randomHybridAnimation = ref.watch(appConfigProvider).randomHybridAnimation;
    if (!randomHybridAnimation) {
      ref.listen<Vehicle>(vehicleProvider, (Vehicle? previous, Vehicle next) {
        ref.watch(hybridStateProvider.notifier).updateHybridState(
            next.speed,
            next.engineSpeed,
            false); //TODO get brake value and improve state logic
      });
    }
    
    return const SizedBox(
      width: 500,
      height: 500,
      child: Stack(
        children: [
          HybridBackground(),
          TopArrow(),
          LeftArrow(),
          RightArrow(),
          BatteryHybrid(),
        ],
      ),
    );
  }
}