File tree Expand file tree Collapse file tree 6 files changed +66
-14
lines changed Expand file tree Collapse file tree 6 files changed +66
-14
lines changed Original file line number Diff line number Diff line change 1
1
# Flutter Core
2
2
3
- Projelerinizde kullanabileceğiniz çekirdek katman. [ Update: 02.07 .2022 ]
3
+ Projelerinizde kullanabileceğiniz çekirdek katman. [ Update: 27.08 .2022 ]
4
4
5
5
#
6
6
@@ -44,6 +44,7 @@ NOT: Gerekli kütüphaneler yüklü değilse hata alabilirsiniz.
44
44
- Map Service
45
45
- google_maps_flutter
46
46
- geolocator
47
+ - geocoding
47
48
- Other
48
49
- path_provider
49
50
- awesome_notifications
Original file line number Diff line number Diff line change
1
+ // ignore_for_file: empty_catches
2
+
3
+ import 'dart:io' ;
4
+
1
5
import 'package:hive_flutter/hive_flutter.dart' ;
6
+ import 'package:path_provider/path_provider.dart' ;
2
7
3
8
final cacheService = CacheService ();
4
9
5
10
class CacheService {
6
11
late Box box;
12
+ final String cacheName = "project_name_cache" ;
7
13
8
14
Future init () async {
9
- await Hive .initFlutter ();
10
- box = await Hive .openBox ('cache' );
15
+ final dir = await getDir ();
16
+ await Hive .initFlutter (dir.path);
17
+ box = await openBox (dir);
18
+ }
19
+
20
+ Future <Box > openBox (Directory dir) async {
21
+ return await Hive .openBox (cacheName, path: dir.path);
22
+ }
23
+
24
+ Future deleteBox () async {
25
+ try {
26
+ final dir = await getDir ();
27
+ await Hive .deleteBoxFromDisk (cacheName);
28
+ box = await openBox (dir);
29
+ } catch (e) {}
30
+ }
31
+
32
+ Future <Directory > getDir () async {
33
+ final appDocumentDirectory = await getApplicationDocumentsDirectory ();
34
+ return Directory ('${appDocumentDirectory .path }/database' );
11
35
}
12
36
}
Original file line number Diff line number Diff line change 1
1
// Documents and Integration
2
2
// *https://pub.dev/packages/geolocator
3
+ // https://pub.dev/packages/geocoding
3
4
4
5
import 'package:geolocator/geolocator.dart' ;
6
+ import 'package:geocoding/geocoding.dart' ;
5
7
6
8
final locationService = LocationService ();
7
9
@@ -31,4 +33,30 @@ class LocationService {
31
33
return null ;
32
34
}
33
35
}
36
+
37
+ Future <List <Placemark >?> getAddressFromLatLng (
38
+ double ? lat, double ? lng) async {
39
+ if (lat == null || lng == null ) {
40
+ return null ;
41
+ }
42
+
43
+ try {
44
+ var placeMarkList = await placemarkFromCoordinates (lat, lng);
45
+ return placeMarkList;
46
+ } catch (e) {
47
+ return null ;
48
+ }
49
+ }
50
+
51
+ Future <List <Location >?> getLatLngFromAddress (String ? address) async {
52
+ if (address == null ) {
53
+ return null ;
54
+ }
55
+ try {
56
+ var locationList = await locationFromAddress (address);
57
+ return locationList;
58
+ } catch (e) {
59
+ return null ;
60
+ }
61
+ }
34
62
}
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class AudioService {
81
81
required String path,
82
82
Function ()? finishCallback,
83
83
Function ()? playCallback,
84
- double ? pitch,
84
+ // double? pitch,
85
85
}) async {
86
86
this .path = path;
87
87
@@ -94,7 +94,7 @@ class AudioService {
94
94
break ;
95
95
}
96
96
final _duration = await player.load ();
97
- await player.setPitch (pitch ?? 1 );
97
+ // await player.setPitch(pitch ?? 1);
98
98
player.play ();
99
99
playCallback? .call ();
100
100
player.positionStream.listen ((event) {
@@ -109,16 +109,16 @@ class AudioService {
109
109
Future <void > stopAudio () async {
110
110
await player.stop ();
111
111
player.seek (Duration .zero);
112
- await player.setPitch (1 );
112
+ // await player.setPitch(1);
113
113
}
114
114
115
115
Future <void > pauseAudio () async {
116
116
await player.pause ();
117
- await player.setPitch (1 );
117
+ // await player.setPitch(1);
118
118
}
119
119
120
120
Future <void > resumeAudio ({Function ()? callback, double ? pitch}) async {
121
- await player.setPitch (pitch ?? 1 );
121
+ // await player.setPitch(pitch ?? 1);
122
122
player.play ();
123
123
}
124
124
Original file line number Diff line number Diff line change 5
5
// android/app/build.gradle
6
6
// minSdkVersion 20
7
7
// android/build.gradle
8
- // ext.kotlin_version = '1.5.10'
8
+ // ext.kotlin_version = '1.5.10' // update last version
9
9
// classpath 'com.android.tools.build:gradle:4.2.0'
10
10
// android/gradle/wrapper/gradle-wrapper.properties
11
11
// distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ import 'package:flutter/material.dart';
2
2
3
3
import '../../../main.dart' ;
4
4
5
+ final screenSizeNotifier = ValueNotifier (Size .infinite);
6
+
5
7
mixin ContextMixin {
6
8
BuildContext get currentContext => navigatorKey.currentContext! ;
7
- MediaQueryData get mediaQuery => MediaQuery .of (currentContext);
8
9
ThemeData get theme => Theme .of (currentContext);
9
10
10
- double dynamicWidth (double value) =>
11
- MediaQuery .of (currentContext).size.width * value;
12
- double dynamicHeight (double value) =>
13
- MediaQuery .of (currentContext).size.height * value;
11
+ double dynamicWidth (double value) => screenSizeNotifier.value.width * value;
12
+ double dynamicHeight (double value) => screenSizeNotifier.value.height * value;
14
13
}
You can’t perform that action at this time.
0 commit comments