zeba_books_offline_gatekeeper 0.0.1
zeba_books_offline_gatekeeper: ^0.0.1 copied to clipboard
Security and integrity suite for offline educational and proctoring apps providing lifecycle monitoring, screen protection, focus lock detection, encrypted storage, and offline enforcement.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:zeba_books_offline_gatekeeper/zeba_books_offline_gatekeeper.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final session = GatekeeperSession();
String status = "Waiting...";
@override
void initState() {
super.initState();
session.onViolation = (msg) {
setState(() {
status = "⚠️ $msg";
});
};
}
void startSession() async {
await session.start();
setState(() {
status = "✅ Session Started";
});
}
void stopSession() {
session.stop();
setState(() {
status = "🛑 Session Stopped";
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text("Gatekeeper Test")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(status, style: const TextStyle(fontSize: 18)),
const SizedBox(height: 30),
ElevatedButton(
onPressed: startSession,
child: const Text("Start Secure Session"),
),
ElevatedButton(
onPressed: stopSession,
child: const Text("Stop Session"),
),
],
),
),
),
);
}
}