add platform check & block screenshot if Android or IOS
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:patient_manager/env/env.dart';
|
import 'package:patient_manager/env/env.dart';
|
||||||
import 'package:patient_manager/router/routeGenerator.dart';
|
import 'package:patient_manager/router/routeGenerator.dart';
|
||||||
import 'package:patient_manager/theme/mihTheme.dart';
|
import 'package:patient_manager/theme/mihTheme.dart';
|
||||||
|
import 'package:no_screenshot/no_screenshot.dart';
|
||||||
|
|
||||||
class MzanziInnovationHub extends StatefulWidget {
|
class MzanziInnovationHub extends StatefulWidget {
|
||||||
const MzanziInnovationHub({
|
const MzanziInnovationHub({
|
||||||
@@ -19,6 +20,12 @@ class MzanziInnovationHub extends StatefulWidget {
|
|||||||
class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
||||||
late ThemeMode _themeMode;
|
late ThemeMode _themeMode;
|
||||||
late MyTheme theme;
|
late MyTheme theme;
|
||||||
|
final _noScreenshot = NoScreenshot.instance;
|
||||||
|
|
||||||
|
void disableScreenshot() async {
|
||||||
|
bool result = await _noScreenshot.screenshotOff();
|
||||||
|
debugPrint('Screenshot Off: $result');
|
||||||
|
}
|
||||||
|
|
||||||
Color getPrimany() {
|
Color getPrimany() {
|
||||||
return theme.primaryColor();
|
return theme.primaryColor();
|
||||||
@@ -47,10 +54,17 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPlatformSpecificPlugins() {
|
||||||
|
if (theme.getPlateform() == "Android" || theme.getPlateform() == "IOS") {
|
||||||
|
disableScreenshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_themeMode = ThemeMode.dark;
|
_themeMode = ThemeMode.dark;
|
||||||
theme = MyTheme();
|
theme = MyTheme();
|
||||||
|
setPlatformSpecificPlugins();
|
||||||
theme.mode = "Dark";
|
theme.mode = "Dark";
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ class _SignInState extends State<SignIn> {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
//Heading
|
//Heading
|
||||||
Text(
|
Text(
|
||||||
'Sign In Now',
|
'Sign In (${MzanziInnovationHub.of(context)!.theme.getPlateform()})',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'dart:io' show Platform;
|
||||||
|
|
||||||
class MyTheme {
|
class MyTheme {
|
||||||
late int _mainColor;
|
late int _mainColor;
|
||||||
@@ -9,7 +10,7 @@ class MyTheme {
|
|||||||
late String mode;
|
late String mode;
|
||||||
late String screenType;
|
late String screenType;
|
||||||
late AssetImage loading;
|
late AssetImage loading;
|
||||||
|
bool kIsWeb = const bool.fromEnvironment('dart.library.js_util');
|
||||||
// Options:-
|
// Options:-
|
||||||
// f3f9d2 = Cream
|
// f3f9d2 = Cream
|
||||||
// f0f0c9 = cream2
|
// f0f0c9 = cream2
|
||||||
@@ -28,6 +29,19 @@ class MyTheme {
|
|||||||
//_mesColor = 0xffc8c8c8d9;
|
//_mesColor = 0xffc8c8c8d9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getPlateform() {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return "Web";
|
||||||
|
}
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
return "Android";
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
return "IOS";
|
||||||
|
} else {
|
||||||
|
return "Other";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ThemeData getData() {
|
ThemeData getData() {
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
fontFamily: 'Segoe UI',
|
fontFamily: 'Segoe UI',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import Foundation
|
|||||||
import app_links
|
import app_links
|
||||||
import device_info_plus
|
import device_info_plus
|
||||||
import google_sign_in_ios
|
import google_sign_in_ios
|
||||||
|
import no_screenshot
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
import sign_in_with_apple
|
import sign_in_with_apple
|
||||||
@@ -18,6 +19,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
|
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||||
|
NoScreenshotPlugin.register(with: registry.registrar(forPlugin: "NoScreenshotPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
|
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
|
||||||
|
|||||||
@@ -688,6 +688,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.27"
|
version: "0.0.27"
|
||||||
|
no_screenshot:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: no_screenshot
|
||||||
|
sha256: ec3d86d7ee89a09c3a3939c1003012536ba4b3fcb4f8cbd23d87ada595c99258
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.1"
|
||||||
package_config:
|
package_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ dependencies:
|
|||||||
gif: ^2.3.0
|
gif: ^2.3.0
|
||||||
intl: ^0.19.0
|
intl: ^0.19.0
|
||||||
flutter_native_splash: ^2.4.1
|
flutter_native_splash: ^2.4.1
|
||||||
|
no_screenshot: ^0.3.1
|
||||||
#google_maps_flutter_web: ^0.5.10
|
#google_maps_flutter_web: ^0.5.10
|
||||||
url_strategy: ^0.3.0
|
url_strategy: ^0.3.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user