From 7b0d15aeded43ab6cea7eb86b2660b7d30c5a0a3 Mon Sep 17 00:00:00 2001 From: bossanyit Date: Sat, 15 May 2021 19:45:08 +0200 Subject: [PATCH] WT 1.1.17+2 error fix utf8 in names, thick pointer --- ios/Runner.xcodeproj/project.pbxproj | 6 ++-- lib/service/api.dart | 47 +++++++++++++++------------- lib/view/customer_modify_page.dart | 8 +++++ lib/widgets/image_button.dart | 4 +-- pubspec.yaml | 2 +- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index c57d9bd..340629d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -531,7 +531,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -566,7 +566,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/service/api.dart b/lib/service/api.dart index 2ca44a7..db84eca 100644 --- a/lib/service/api.dart +++ b/lib/service/api.dart @@ -42,27 +42,32 @@ class APIClient with Common, Logging { Future post(String endPoint, String body) async { final url = Cache().getBaseUrl() + endPoint; trace(" ------------ http/post body $body - url: $url "); - String authToken = Cache().getAuthToken(); - if (authToken.length == 0) { - var responseJson = await this.authenticateUser(Cache.username, Cache.password); - authToken = responseJson['token']; - Cache().authToken = authToken; - } - var uri = Uri.parse(url); - HttpClient client = new HttpClient(); - client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true); - final HttpClientRequest request = await client.postUrl(uri); - request.headers.set('Content-Type', 'application/json'); - request.headers.set('Authorization', 'Bearer $authToken'); - request.contentLength = body.length; - request.write(body); - HttpClientResponse result = await request.close(); - trace(" ------------post response code: " + result.statusCode.toString()); - if (result.statusCode == 200) { - return await result.transform(utf8.decoder).join(); - } else if (result.statusCode == 404) { - throw NotFoundException(message: "Not Found"); - } else { + try { + String authToken = Cache().getAuthToken(); + if (authToken.length == 0) { + var responseJson = await this.authenticateUser(Cache.username, Cache.password); + authToken = responseJson['token']; + Cache().authToken = authToken; + } + var uri = Uri.parse(url); + HttpClient client = new HttpClient(); + client.badCertificateCallback = ((X509Certificate cert, String host, int port) => true); + final HttpClientRequest request = await client.postUrl(uri); + request.headers.contentType = new ContentType("application", "json", charset: "utf-8"); + request.headers.set('Authorization', 'Bearer $authToken'); + //request.contentLength = body.length; + request.write(body); + HttpClientResponse result = await request.close(); + trace(" ------------post response code: " + result.statusCode.toString()); + if (result.statusCode == 200) { + return await result.transform(utf8.decoder).join(); + } else if (result.statusCode == 404) { + throw NotFoundException(message: "Not Found"); + } else { + throw Exception("Network Error, please try again later"); + } + } on Exception catch (e) { + print("Post Exception: $e"); throw Exception("Network Error, please try again later"); } } diff --git a/lib/view/customer_modify_page.dart b/lib/view/customer_modify_page.dart index 6580001..7d472da 100644 --- a/lib/view/customer_modify_page.dart +++ b/lib/view/customer_modify_page.dart @@ -241,6 +241,8 @@ class CustomerModifyPage extends StatelessWidget with Trans { ), LinearShapePointer( value: customerBloc.year!.toDouble(), + height: 35, + width: 15, onValueChanged: (value) => { customerBloc.add(CustomerBirthYearChange(year: value.toInt())), }, @@ -295,9 +297,13 @@ class CustomerModifyPage extends StatelessWidget with Trans { )), )), NeedlePointer( + needleColor: Colors.blue[200], + knobStyle: KnobStyle(color: Colors.blue[800]), value: customerBloc.weight.toDouble(), enableAnimation: true, enableDragging: true, + needleStartWidth: 6, + needleEndWidth: 12, onValueChanged: (value) => {customerBloc.add(CustomerWeightChange(weight: value))}, ) ], @@ -359,6 +365,8 @@ class CustomerModifyPage extends StatelessWidget with Trans { ), ), LinearShapePointer( + height: 15, + width: 35, value: customerBloc.height, onValueChanged: (value) => { customerBloc.add(CustomerHeightChange(height: value.toInt())), diff --git a/lib/widgets/image_button.dart b/lib/widgets/image_button.dart index 613c8ed..a377a6a 100644 --- a/lib/widgets/image_button.dart +++ b/lib/widgets/image_button.dart @@ -110,10 +110,10 @@ class ImageButton extends StatelessWidget { )), isMarked == null || Cache().hasPurchased ? Offstage() - : Stack(alignment: Alignment.topCenter, children: [ + : Stack(alignment: Alignment.center, children: [ Positioned( top: 10, - left: (width / 2 - 30) / 2 - 75, + left: (width / 2 - 30) / 2 - 25, child: !isLocked! ? Offstage() : GestureDetector( diff --git a/pubspec.yaml b/pubspec.yaml index 8ba0ab1..665b8b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.1.17+79 +version: 1.1.17+80 environment: sdk: ">=2.12.0 <3.0.0"