testera_auth 1.0.1 copy "testera_auth: ^1.0.1" to clipboard
testera_auth: ^1.0.1 copied to clipboard

A Flutter plugin that provides a simple authentication layer using a code-based validation system.

TesteraAuth #

A Flutter plugin that provides a simple authentication layer for your app using a code-based validation system.

Features #

  • Code-based authentication (default code: 123456)
  • Configurable expiration duration
  • Persistent authentication state
  • Customizable UI
  • Built with GetX for state management

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
    testera_auth: ^1.0.0

Usage #

  1. Wrap your app with GetMaterialApp and use TesteraAuth as the home widget:
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:testera_auth/testera_auth.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'My App',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const TesteraAuth(
        child: HomeScreen(),
      ),
    );
  }
}
  1. Create your main screen that will be shown after successful authentication:
class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('My App'),
      ),
      body: const Center(
        child: Text('Welcome to the authenticated app!'),
      ),
    );
  }
}

Configuration #

The TesteraAuth widget accepts the following parameters:

  • child (required): The widget to display when authenticated
  • expirationDuration (optional): How long the authentication should remain valid (default: 7 days)
  • loadingWidget (optional): Custom widget to show during loading
  • errorWidget (optional): Custom widget to show when an error occurs

Authentication #

The plugin uses a simple code-based authentication system:

  • Default access code: 123456
  • Authentication state persists until expiration
  • Expiration duration is configurable (default: 7 days)

State Management #

The plugin uses GetX for state management. You can access the AuthController anywhere in your app:

final authController = Get.find<AuthController>();

Available observable states:

  • isLoading: Whether the authentication is in progress
  • isAuthenticated: Whether the user is authenticated
  • errorMessage: Any error message that occurred during authentication

Example #

Check out the example directory for a complete working example.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
0
points
6
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin that provides a simple authentication layer using a code-based validation system.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, get, http, shared_preferences

More

Packages that depend on testera_auth

Packages that implement testera_auth