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/router/routeGenerator.dart';
|
||||
import 'package:patient_manager/theme/mihTheme.dart';
|
||||
import 'package:no_screenshot/no_screenshot.dart';
|
||||
|
||||
class MzanziInnovationHub extends StatefulWidget {
|
||||
const MzanziInnovationHub({
|
||||
@@ -19,6 +20,12 @@ class MzanziInnovationHub extends StatefulWidget {
|
||||
class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
||||
late ThemeMode _themeMode;
|
||||
late MyTheme theme;
|
||||
final _noScreenshot = NoScreenshot.instance;
|
||||
|
||||
void disableScreenshot() async {
|
||||
bool result = await _noScreenshot.screenshotOff();
|
||||
debugPrint('Screenshot Off: $result');
|
||||
}
|
||||
|
||||
Color getPrimany() {
|
||||
return theme.primaryColor();
|
||||
@@ -47,10 +54,17 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
||||
});
|
||||
}
|
||||
|
||||
void setPlatformSpecificPlugins() {
|
||||
if (theme.getPlateform() == "Android" || theme.getPlateform() == "IOS") {
|
||||
disableScreenshot();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_themeMode = ThemeMode.dark;
|
||||
theme = MyTheme();
|
||||
setPlatformSpecificPlugins();
|
||||
theme.mode = "Dark";
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ class _SignInState extends State<SignIn> {
|
||||
const SizedBox(height: 10),
|
||||
//Heading
|
||||
Text(
|
||||
'Sign In Now',
|
||||
'Sign In (${MzanziInnovationHub.of(context)!.theme.getPlateform()})',
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
class MyTheme {
|
||||
late int _mainColor;
|
||||
@@ -9,7 +10,7 @@ class MyTheme {
|
||||
late String mode;
|
||||
late String screenType;
|
||||
late AssetImage loading;
|
||||
|
||||
bool kIsWeb = const bool.fromEnvironment('dart.library.js_util');
|
||||
// Options:-
|
||||
// f3f9d2 = Cream
|
||||
// f0f0c9 = cream2
|
||||
@@ -28,6 +29,19 @@ class MyTheme {
|
||||
//_mesColor = 0xffc8c8c8d9;
|
||||
}
|
||||
|
||||
String getPlateform() {
|
||||
if (kIsWeb) {
|
||||
return "Web";
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
return "Android";
|
||||
} else if (Platform.isIOS) {
|
||||
return "IOS";
|
||||
} else {
|
||||
return "Other";
|
||||
}
|
||||
}
|
||||
|
||||
ThemeData getData() {
|
||||
return ThemeData(
|
||||
fontFamily: 'Segoe UI',
|
||||
|
||||
Reference in New Issue
Block a user