Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(LOON-667): Webview loading indicator, package update #268

Merged
merged 2 commits into from
May 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(LOON-667): Webview loading indicator, package update
MartinMacek committed May 16, 2022
commit a95cd012cbbdc7c3171c7538ff85485d957e3b99
27 changes: 26 additions & 1 deletion lib/ui/screens/about_health/about_health.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_svg/svg.dart';
import 'package:loono/constants.dart';
import 'package:loono/helpers/map_variables.dart';
import 'package:loono/services/webview_service.dart';
import 'package:loono/ui/widgets/feedback/feedback_button.dart';
@@ -18,6 +19,8 @@ class AboutHealthScreen extends StatelessWidget {

final _showBackArrow = ValueNotifier<bool>(false);

final _loadingProgress = ValueNotifier<int>(0);

@override
Widget build(BuildContext context) {
return SafeArea(
@@ -33,6 +36,9 @@ class AboutHealthScreen extends StatelessWidget {
onUpdateVisitedHistory: (webViewController, uri, androidIsReload) async {
_showBackArrow.value = uri != initialUri;
},
onProgressChanged: (webViewController, progress) {
_loadingProgress.value = progress;
},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
@@ -87,7 +93,26 @@ class AboutHealthScreen extends StatelessWidget {
padding: EdgeInsets.only(top: 8.0, right: 18),
child: FeedbackButton(),
),
)
),
ValueListenableBuilder<int>(
valueListenable: _loadingProgress,
builder: (context, value, _) {
if (value == 0 || value == 100) {
return const SizedBox.shrink();
}
return Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: double.infinity,
child: LinearProgressIndicator(
value: value / 100,
backgroundColor: LoonoColors.beigeLight,
valueColor: const AlwaysStoppedAnimation<Color>(LoonoColors.primary),
),
),
);
},
),
],
),
);
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
@@ -607,7 +607,7 @@ packages:
name: flutter_inappwebview
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.2"
version: "5.4.3+7"
flutter_keyboard_visibility:
dependency: transitive
description:
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: loono
description: We show prevention matters.
publish_to: "none"
version: 0.1.3+4
version: 0.3.9+0

environment:
sdk: ">=2.12.0 <3.0.0"
@@ -44,7 +44,7 @@ dependencies:
flutter_cache_manager: ^3.1.3
flutter_config: ^2.0.0
flutter_dotenv: ^5.0.0
flutter_inappwebview: ^5.4.2
flutter_inappwebview: ^5.4.3+7
flutter_localizations:
sdk: flutter
flutter_native_splash: ^2.0.5