Skip to content

Commit

Permalink
Upgrade Flutter and dependencies version #117
Browse files Browse the repository at this point in the history
  • Loading branch information
up2code committed Jul 3, 2021
1 parent 10d5eed commit 3bce075
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 195 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class VocaDBApp extends StatelessWidget {
translations: AppTranslation(),
locale: Get.locale,
fallbackLocale: AppTranslation.fallbackLocale,
theme: Get.theme,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: ThemeMode.system,
navigatorObservers: <NavigatorObserver>[
Get.find<FirebaseAnalyticsObserver>()
],
Expand Down
4 changes: 2 additions & 2 deletions lib/src/controllers/release_event_search_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class ReleaseEventSearchController

final sort = 'Name'.obs;

final fromDate = Rx<DateTime>();
final fromDate = Rx<DateTime>(null);

final toDate = Rx<DateTime>();
final toDate = Rx<DateTime>(null);

final artists = <ArtistModel>[].obs;

Expand Down
16 changes: 7 additions & 9 deletions lib/src/services/http_service.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:cookie_jar/cookie_jar.dart';
import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:dio_http_cache/dio_http_cache.dart';
import 'package:get/get.dart' hide FormData;
import 'package:vocadb_app/constants.dart';
import 'package:vocadb_app/exceptions.dart';
Expand All @@ -18,19 +17,18 @@ class HttpService extends GetxService {

Future<HttpService> init() async {
_dio = Dio();
_dio.interceptors
.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
_dio.interceptors.add(CookieManager(
PersistCookieJar(dir: _appDirectory.cookiesDirectory.path)));
// _dio.interceptors
// .add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
_dio.interceptors.add(CookieManager(PersistCookieJar(
storage: FileStorage(_appDirectory.cookiesDirectory.path))));
return this;
}

Future<dynamic> get(String endpoint, Map<String, String> params) async {
params?.removeWhere((key, value) => value == null || value == '');
String url = Uri.https(authority, endpoint, params).toString();
print('GET $url | $params');
final response =
await _dio.get(url, options: buildCacheOptions(Duration(minutes: 5)));
final response = await _dio.get(url);

if (response.statusCode == 200) {
return response.data;
Expand All @@ -39,8 +37,8 @@ class HttpService extends GetxService {
throw HttpRequestErrorException();
}

Future<dynamic> post(String endpoint, Map<String, String> params) async {
params?.removeWhere((key, value) => value == null || value.isEmpty);
Future<dynamic> post(String endpoint, Map<String, dynamic> params) async {
params?.removeWhere((key, value) => value == null || value == '');
String url = Uri.https(authority, endpoint).toString();

print('POST $url | $params');
Expand Down
12 changes: 11 additions & 1 deletion lib/src/services/shared_preference_service.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:vocadb_app/config.dart';
Expand Down Expand Up @@ -34,21 +35,27 @@ class SharedPreferenceService extends GetxService {
}

void initUILang() {
print('initial shared_preference [uiLang]');
uiLang.val = box.read('uiLang');
AppTranslation().changeLocale(uiLang.val);
print('current locale ${Get.locale}');
}

updateUiLang(String value) {
print('Updating shared_preference [uiLang] = $value');
box.write('uiLang', value);
uiLang.val = value;
AppTranslation().changeLocale(value);
print('current locale ${Get.locale}');
}

void initContentLang() => contentLang(box.read('contentLang'));
void initContentLang() {
print('initial shared_preference [contentLang]');
contentLang(box.read('contentLang'));
}

updateContentLang(String value) {
print('updating shared_preference [contentLang] = $value');
box.write('contentLang', value);
contentLang(value);
Get.find<HomePageController>().fetchApi();
Expand All @@ -62,16 +69,19 @@ class SharedPreferenceService extends GetxService {
}

updateTheme(String value) {
print('updating shared_preference [theme] = $value');
box.write('theme', value);
theme(value);
Themes.changeTheme(value);
}

void initAutoPlay() {
print('init autoPlay');
autoPlay(box.read<bool>('autoPlay'));
}

updateAutoPlay(bool value) {
print('updating shared_preference [autoPlay] = $value');
box.write('autoPlay', value);
autoPlay(value);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/error_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ErrorUtils {
}

static String readDioError(DioError err) {
if (err.type == DioErrorType.DEFAULT) {
if (err.type == DioErrorType.other) {
return readDynamicError(err.error);
}

Expand Down
3 changes: 2 additions & 1 deletion lib/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Themes {
);

static void changeTheme(String value) {
Get.changeTheme((value == 'light') ? light : dark);
print('Get.changeTheme to $value');
Get.changeThemeMode((value == 'light') ? ThemeMode.light : ThemeMode.dark);
}
}
Loading

0 comments on commit 3bce075

Please sign in to comment.