fs_anti_theft_flutter 1.0.5+1 copy "fs_anti_theft_flutter: ^1.0.5+1" to clipboard
fs_anti_theft_flutter: ^1.0.5+1 copied to clipboard

unlisted

Package do antitheft.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fs_anti_theft_flutter/fs_anti_theft_flutter.dart';


void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _methodChanelName = 'fs_anti_theft_sdk';
  bool isProd = true;
  static const MethodChannel _channel = MethodChannel(_methodChanelName);
  static const _alarm = "locationPermission";

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(builder: (context) {
        return Scaffold(
          appBar: AppBar(
            title: const Text('FS Anti Theft Plugin'),
          ),
          body: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Column(
              children: [
                button(
                  text: "FS Anti Theft SDK",
                  onPressedCheck: () async {
                    var check = await FsAntiTheftPlugin.startLoginToSDK(
                      arguments: {
                        "BASE_URL": isProd ? "https://prod.protecaopix.com.br" : "https://backend.protecaopix.com.br",
                        "APPLICATION_ID": isProd ? "ayGMxEcU7hA5E7uZshPcSM" : "1VXRFMSa6cqUNrBbEdKktQ",
                        "ANTI_THEFT_API_KEY": "381bb4ee-7ef9-48c9-92be-d9ff05a9364d",
                        "VERSION_NAME": "",
                        "EMAIL": "devansh.mathur@unthinkable.co",
                        "MOBILE": "5511958781603",
                        "IMEI": "EXAMPLE_IMEI",
                        "ANDROID_PACKAGE_NAME": "br.com.fs.fs_anti_theft_flutter_example"
                      },
                    );
                    showSnackBar(context: context, message: 'FS Anti Theft SDK $check');
                  },
                ),
                button(
                  text: 'All',
                  onPressedReq: () async {
                    FsAntiTheftPlugin.requestAllPermission();
                  },
                  onPressedCheck: () async {
                    var result = await FsAntiTheftPlugin.checkAllPermission();
                    showSnackBar(context: context, message: 'All $result',duration: const Duration(seconds: 5));
                  },
                ),
                button(
                  text: 'Location',
                  onPressedReq: () async {
                    FsAntiTheftPlugin.requestPermission(
                        permissionName: EnumPermissionsName.location);
                  },
                  onPressedCheck: () async {
                    var result = await FsAntiTheftPlugin.checkPermission(
                        permissionName: EnumPermissionsName.location);
                    showSnackBar(context: context, message: 'Location $result');
                  },
                ),
                button(
                  text: 'Camera',
                  onPressedReq: () async {
                    FsAntiTheftPlugin.requestPermission(
                        permissionName: EnumPermissionsName.camera);
                  },
                  onPressedCheck: () async {
                    var result = await FsAntiTheftPlugin.checkPermission(
                        permissionName: EnumPermissionsName.camera);
                    showSnackBar(context: context, message: 'Camera $result');
                  },
                ),

                button(
                  text: 'Notification',
                  onPressedReq: () async {
                    FsAntiTheftPlugin.requestPermission(
                        permissionName: EnumPermissionsName.notification);
                  },
                  onPressedCheck: () async {
                    var result = await FsAntiTheftPlugin.checkPermission(
                        permissionName: EnumPermissionsName.notification);
                    showSnackBar(context: context, message: 'Notification $result');
                  },
                ),

                if(Platform.isAndroid)
                  button(
                    text: 'Overlay',
                    onPressedReq: () async {
                      FsAntiTheftPlugin.requestPermission(
                          permissionName: EnumPermissionsName.screenOverlay);
                    },
                    onPressedCheck: () async {
                      var result = await FsAntiTheftPlugin.checkPermission(
                          permissionName: EnumPermissionsName.screenOverlay);
                      showSnackBar(context: context, message: 'Overlay $result');
                    },
                  ),
                if(Platform.isAndroid)
                  button(
                    text: 'Admin',
                    onPressedReq: () async {
                      FsAntiTheftPlugin.requestPermission(
                          permissionName: EnumPermissionsName.adminAccess);
                    },
                    onPressedCheck: () async {
                      var result = await FsAntiTheftPlugin.checkPermission(
                          permissionName: EnumPermissionsName.adminAccess);
                      showSnackBar(context: context, message: 'Admin $result');
                    },
                  ),
                if(Platform.isAndroid)
                  buttonMethod(
                      text: 'Alarm On',
                      text2: 'Alarm Off',
                      onPressed1: () async {
                      var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.alarmOn);
                      showSnackBar(context: context, message: 'Alarm $result');
                    },
                      onPressed2: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.alarmOff);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      boolean: true
                  ),
                if(Platform.isAndroid)
                  buttonMethod(
                      text: 'Camera',
                      text2: 'Location',
                      onPressed1: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.camera);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      onPressed2: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.location);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      boolean: true
                  ),
                if(Platform.isAndroid)
                  buttonMethod(
                      text: 'Remote Loking',
                      text2: 'Remote Unloking',
                      onPressed1: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.remoteLoking);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      onPressed2: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.remoteUnloking);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      boolean: true
                  ),
                if(Platform.isAndroid)
                  buttonMethod(
                      text: 'Remote LockWithout Override',
                      text2: 'Remote Wipe',
                      onPressed1: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.remoteLockWithoutOverride);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      onPressed2: () async {
                        var result = await FsAntiTheftPlugin.methodChannel(arguments: {}, permissionName: EnumPermissionsName.remoteWipe);
                        showSnackBar(context: context, message: 'Alarm $result');
                      },
                      boolean: true
                  ),
              ],
            ),
          ),
        );
      }),
    );
  }

  Widget buttonMethod({
    required String text,
    String? text2,
    Function()? onPressed1,
    Function()? onPressed2,
    bool boolean = false
  }) {
    return Padding(
      padding: const EdgeInsets.only(bottom: 8.0),
      child: Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            if (onPressed1 != null)
              ElevatedButton(
                onPressed: onPressed1,
                child: Text('$text'),
              ),
            if (onPressed2 != null && text2 != null)
              ElevatedButton(
                onPressed: onPressed2,
                child: Text('$text2'),
              ),
          ],
        ),
      ),
    );
  }

  Widget button({
    required String text,
    Function()? onPressedReq,
    Function()? onPressedCheck,
    bool boolean = false
  }) {
    return Padding(
      padding: const EdgeInsets.only(bottom: 8.0),
      child: Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            if (onPressedCheck != null)
              ElevatedButton(
                onPressed: onPressedCheck,
                child: Text('$text check'),
              ),
            if (onPressedReq != null)
              ElevatedButton(
                onPressed: onPressedReq,
                child: Text('$text request'),
              ),
          ],
        ),
      ),
    );
  }

  void showSnackBar({
    required BuildContext context,
    required String message,
    Duration? duration,
  }) {
    print(message);
    ScaffoldMessenger.of(context)
        .clearSnackBars(); //clear any snack bars in queue and show current one
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        backgroundColor: Colors.blue,
        duration: duration ?? const Duration(seconds: 3),
        content: Text(
          message,
          style: const TextStyle(
            fontSize: 16,
            color: Colors.white,
          ),
        ),
      ),
    );
  }
}
0
likes
0
pub points
51%
popularity

Publisher

unverified uploader

Package do antitheft.

License

unknown (license)

Dependencies

flutter, permission_handler

More

Packages that depend on fs_anti_theft_flutter