summaryrefslogtreecommitdiffstats
path: root/lib/data/data_providers/app_provider.dart
blob: ad3dd228a02d0af76dc3d34eb723b2761fdd4150 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import 'package:flutter_ics_homescreen/data/data_providers/hybrid_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/signal_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/time_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/units_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/audio_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/users_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/radio_notifier.dart';
import 'package:flutter_ics_homescreen/data/data_providers/val_client.dart';
import 'package:flutter_ics_homescreen/data/data_providers/app_launcher.dart';
import 'package:flutter_ics_homescreen/data/data_providers/radio_client.dart';
import 'package:flutter_ics_homescreen/export.dart';

import '../models/users.dart';
import 'vehicle_notifier.dart';

enum AppState {
  home,
  dashboard,
  hvac,
  apps,
  media,
  settings,
  splash,
  dateTime,
  bluetooth,
  wifi,
  wired,
  audioSettings,
  profiles,
  newProfile,
  units,
  versionInfo,
  weather,
  distanceUnit,
  tempUnit,
  clock,
  date,
  time,
  year
}

final appProvider = StateProvider<AppState>((ref) => AppState.splash);

final valClientProvider = Provider((ref) {
  KuksaConfig config = ref.watch(appConfigProvider).kuksaConfig;
  return ValClient(config: config, ref: ref);
});

final appLauncherProvider = Provider((ref) {
  return AppLauncher(ref: ref);
});

final appLauncherListProvider =
    NotifierProvider<AppLauncherList, List<AppLauncherInfo>>(
        AppLauncherList.new);

final radioClientProvider = Provider((ref) {
  RadioConfig config = ref.watch(appConfigProvider).radioConfig;
  return RadioClient(config: config, ref: ref);
});

final vehicleProvider =
    NotifierProvider<VehicleNotifier, Vehicle>(VehicleNotifier.new);

final signalsProvider = StateNotifierProvider<SignalNotifier, Signals>((ref) {
  return SignalNotifier(const Signals.initial());
});

final unitStateProvider = StateNotifierProvider<UnitsNotifier, Units>((ref) {
  return UnitsNotifier(const Units.initial());
});

final audioStateProvider =
    NotifierProvider<AudioStateNotifier, AudioState>(AudioStateNotifier.new);

final radioStateProvider =
    NotifierProvider<RadioStateNotifier, RadioState>(RadioStateNotifier.new);

final usersProvider = StateNotifierProvider<UsersNotifier, Users>((ref) {
  return UsersNotifier(Users.initial());
});

final hybridStateProvider =
    StateNotifierProvider<HybridNotifier, Hybrid>((ref) {
  return HybridNotifier(const Hybrid.initial());
});

final currentTimeProvider =
    StateNotifierProvider<CurrentTimeNotifier, DateTime>((ref) {
  return CurrentTimeNotifier();
});