diff --git a/android/app/build.gradle b/android/app/build.gradle index 19d22b13..759fa6a7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -41,7 +41,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cloud.diplomaticquarterapp" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt index bebd0101..ceecd65b 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/HMGUtils.kt @@ -68,12 +68,12 @@ class HMGUtils { } } - fun getGeoZonesFromPreference(context: Context):List{ + fun getGeoZonesFromPreference(context: Context): List { val pref = context.getSharedPreferences(PREFS_STORAGE, Context.MODE_PRIVATE) val json = pref.getString(PREF_KEY_HMG_ZONES,"[]") - val geoZones = GeoZoneModel().listFrom(json) - return geoZones + val geoZones = json?.let { GeoZoneModel().listFrom(it) } + return geoZones!! } } diff --git a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart index af2768a5..5b0a4568 100644 --- a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart +++ b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart @@ -168,20 +168,28 @@ class LineChartCurvedState extends State { double getMaxY() { double max = 0; widget.labResult.forEach((element) { + try{ double resultValueDouble = double.parse(element.resultValue); - if (resultValueDouble > max) max = resultValueDouble; + if (resultValueDouble > max) max = resultValueDouble;} + catch(e){ + print(e); + } }); return max.roundToDouble(); } double getMinY() { - double min = double.parse(widget.labResult[0].resultValue); + double min = 0; + try{ + min = double.parse(widget.labResult[0].resultValue); widget.labResult.forEach((element) { double resultValueDouble = double.parse(element.resultValue); if (resultValueDouble < min) min = resultValueDouble; - }); + });}catch(e){ + print(e); + } int value = min.toInt(); return value.toDouble(); @@ -190,8 +198,14 @@ class LineChartCurvedState extends State { List getData() { List spots = List(); for (int index = 0; index < widget.labResult.length; index++) { + try{ var resultValueDouble = double.parse(widget.labResult[index].resultValue); spots.add(FlSpot(index.toDouble(), resultValueDouble)); + }catch(e){ + print(e); + spots.add(FlSpot(index.toDouble(), 0.0)); + + } } final LineChartBarData lineChartBarData1 = LineChartBarData( diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 2e831963..3f45e3d0 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -76,18 +76,12 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { AppGlobal.context = context; - ProjectViewModel projectViewModel = Provider.of(context); - AppGlobal.context = context; - PreferredSizeWidget appBar; - - return Scaffold( backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, appBar: isShowAppBar? AppBarWidget( - appBarTitle, - appBarIcons, - isShowAppBar, + appBarTitle:appBarTitle, + appBarIcons:appBarIcons, isPharmacy: isPharmacy, isShowDecPage: isShowDecPage, image: image, @@ -95,22 +89,17 @@ class AppScaffold extends StatelessWidget { body: (!Provider.of(context, listen: false).isLogin && isShowDecPage) ? NotAutPage( - title: appBarTitle, + title: title ?? appBarTitle, description: description, infoList: infoList, imagesInfo: imagesInfo, ) : baseViewModel != null ? NetworkBaseView( - child: buildBodyWidget(), + child: body, baseViewModel: baseViewModel, ) - : buildBodyWidget(), - bottomSheet: bottomSheet, - //floatingActionButton: floatingActionButton ?? floatingActionButton, - // bottomNavigationBar: - // this.isBottomBar == true ? BottomBarSearch() : SizedBox() - // floatingActionButton: FloatingSearchButton(), + : body, ); } @@ -118,12 +107,6 @@ class AppScaffold extends StatelessWidget { return isLoading ? AppLoaderWidget() : Container(); } - buildBodyWidget() { - // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); - return Stack(children: [ - body, /*FloatingSearchButton()*/ - ]); - } } class AppBarWidget extends StatelessWidget with PreferredSizeWidget { @@ -132,13 +115,12 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { final String appBarTitle; final List appBarIcons; - final bool isShowAppBar; final bool isPharmacy; final bool isShowDecPage; final String image; - AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar, - {this.isPharmacy = true, this.isShowDecPage = true, this.image}); + AppBarWidget({this.appBarTitle, this.appBarIcons, + this.isPharmacy = true, this.isShowDecPage = true, this.image}); @override Widget build(BuildContext context) { @@ -147,8 +129,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { Widget buildAppBar(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return isShowAppBar - ? AppBar( + return AppBar( elevation: 0, backgroundColor: isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, @@ -194,10 +175,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { ), if (appBarIcons != null) ...appBarIcons ], - ) - : Container( - height: 0, - width: 0, + ); }