summaryrefslogtreecommitdiffstats
path: root/lib/provider.dart
blob: 228672f74847f1580967e7836681486ffb269b3f (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
92
93
94
95
// SPDX-License-Identifier: Apache-2.0

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:latlong2/latlong.dart';

import 'kuksa/class.dart';


final currlnglatProvider = StateNotifierProvider<currentLngLat,LatLng>(
      (ref)=> currentLngLat(),
);

class currentLngLat extends StateNotifier<LatLng>{
  currentLngLat() : super(
    LatLng(31.706964,76.933138),
  );
  Future<void> update(value) async{

    state = value;
  }

}

final destinationlnglatProvider = StateNotifierProvider<distiLngLat,LatLng>(
      (ref)=> distiLngLat(),
);

class distiLngLat extends StateNotifier<LatLng>{
  distiLngLat() : super(
    LatLng(0,0),
  );
  Future<void> update(value) async{
    state = value;
  }

}

final CurrentAdressProvider = StateNotifierProvider<currentAdress,String>(
      (ref)=> currentAdress(),
);

class currentAdress extends StateNotifier<String>{
  currentAdress() : super(
      ''
  );
  Future<void> update(value)async{
    state = value;
  }
}

final DestinationAdressProvider = StateNotifierProvider<destiAdress,String>(
      (ref)=> destiAdress(),
);

class destiAdress extends StateNotifier<String>{
  destiAdress() : super(
      ''
  );
  Future<void> update(value)async{
    state = value;
  }
}

final polylineprovider = StateNotifierProvider<PolyLine,List<LatLng>>((ref) => PolyLine());

class PolyLine extends StateNotifier<List<LatLng>> {

  PolyLine() : super([]);
  void update(List<LatLng> list) {
    state = list;
  }
}

final Infoprovider = StateNotifierProvider<Info,info>((ref) => Info());

class Info extends StateNotifier<info> {

  Info() : super(initial);
  static final info initial = info(Duration: 0, Distance: 0, instruction: '');

  void update({
  num? Duration,
    num? Distance,
    String? instruction,

      }){
    state = state.copywith(
      Duration: Duration,
      Distance: Distance,
      instruction: instruction,
    );


      }
}