Added: When the app is in the background, hided te contents of the app (#387)
<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description Added: Hide the contents of the app, when is it in the background - Both android and ios In android, it shows a blank white/black background, when in background In iOS, it shows the launch icon, when in background  Android Physical Device  Android stimulator Also, compared the bitwarden apps in android, the flow is same iOS Device: Need to verify @ua741 @vishnukvmd Could you run on iOS devices and verify it? Closes #47 ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] 🖼️ New icon - [x] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore
This commit is contained in:
parent
1606b74b40
commit
1a654fe748
3 changed files with 26 additions and 0 deletions
|
@ -24,6 +24,7 @@ import "package:flutter/material.dart";
|
|||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:privacy_screen/privacy_screen.dart';
|
||||
|
||||
final _logger = Logger("main");
|
||||
|
||||
|
@ -31,6 +32,22 @@ void main() async {
|
|||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final savedThemeMode = await AdaptiveTheme.getThemeMode();
|
||||
await _runInForeground(savedThemeMode);
|
||||
await PrivacyScreen.instance.enable(
|
||||
iosOptions: const PrivacyIosOptions(
|
||||
enablePrivacy: true,
|
||||
privacyImageName: "LaunchImage",
|
||||
lockTrigger: IosLockTrigger.didEnterBackground,
|
||||
),
|
||||
androidOptions: const PrivacyAndroidOptions(
|
||||
enableSecure: true,
|
||||
),
|
||||
backgroundColor: savedThemeMode == AdaptiveThemeMode.dark
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
blurEffect: savedThemeMode == AdaptiveThemeMode.dark
|
||||
? PrivacyBlurEffect.dark
|
||||
: PrivacyBlurEffect.extraLight,
|
||||
);
|
||||
FlutterDisplayMode.setHighRefreshRate();
|
||||
}
|
||||
|
||||
|
|
|
@ -1047,6 +1047,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
privacy_screen:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: privacy_screen
|
||||
sha256: b80297d2726d96e8a8341149e81a415302755f02d3af7c05c820d9e191bbfbee
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.6"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -67,6 +67,7 @@ dependencies:
|
|||
path_provider: ^2.0.11
|
||||
pinput: ^1.2.2
|
||||
pointycastle: ^3.7.3
|
||||
privacy_screen: ^0.0.6
|
||||
protobuf: ^3.0.0
|
||||
qr_code_scanner: ^1.0.1
|
||||
qr_flutter: 4.0.0
|
||||
|
|
Loading…
Add table
Reference in a new issue