kit_2fa 0.1.0 copy "kit_2fa: ^0.1.0" to clipboard
kit_2fa: ^0.1.0 copied to clipboard

This package allows you to implement 2fa in any project quickly and easily.

example/main.dart

import 'package:flutter/material.dart';
import 'package:kit_2fa/kit_2fa.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: Scaffold(body: MyHome()));
  }
}

class MyHome extends StatelessWidget {
  const MyHome({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Padding(
          padding: const EdgeInsets.all(25),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              SizedBox(
                  width: double.infinity,
                  height: 56,
                  child: ElevatedButton(
                    onPressed: () => Kit2FA().activate(
                      context: context,
                      appName: "Matrix Desktop",
                      info: "ADMIN 12050",
                    ),
                    child: const Text('Activate 2FA'),
                  )),
              const SizedBox(height: 30),
              SizedBox(
                  width: double.infinity,
                  height: 56,
                  child: ElevatedButton(
                    onPressed: () => Kit2FA()
                        .verify(context: context, page: const Success()),
                    style: ButtonStyle(
                      backgroundColor:
                          MaterialStateProperty.all<Color>(Colors.green),
                    ),
                    child: const Text('Login with 2FA'),
                  ))
            ],
          )),
    );
  }
}

class Success extends StatelessWidget {
  const Success({super.key});

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(child: Text("user logged In Successfully!")),
    );
  }
}
1
likes
100
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

This package allows you to implement 2fa in any project quickly and easily.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, otp, pinput, plugin_platform_interface, qr_flutter, shared_preferences

More

Packages that depend on kit_2fa