plumcheck_flutter_sdk 0.0.5 copy "plumcheck_flutter_sdk: ^0.0.5" to clipboard
plumcheck_flutter_sdk: ^0.0.5 copied to clipboard

Plumcheck SDK Flutter project.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'components/auth_widget.dart';
import 'components/idv_widget.dart';
import 'components/health_data_widget.dart';
import './state/app_shared_state.dart';

void main() {
  runApp(
    AppStateContainer(
      child: const MyApp(),
    ),
  );
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    final sharedState = AppStateInherited.of(context);
    final isAuthDone = sharedState.isSdkInitialized;
    return MaterialApp(
      title: 'Plumcheck Flutter SDK Demo App',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: DefaultTabController( 
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            title: const Text("PlumСheck Flutter SDK Demo"),
            bottom: const TabBar(
              tabs: [
                Tab(icon: Icon(Icons.person), text: 'Auth'), 
                Tab(icon: Icon(Icons.security), text: 'IDV'),
                Tab(icon: Icon(Icons.health_and_safety), text: 'Health Check'),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              const AuthWidget(),
              IgnorePointer(
                ignoring: !isAuthDone,
                child: Opacity(
                  opacity: !isAuthDone ? 0.5 : 1.0, 
                  child: const IDVWidget()
                ),
              ),        
              IgnorePointer(
                ignoring: !isAuthDone,
                child: Opacity(
                  opacity: !isAuthDone ? 0.5 : 1.0, 
                  child: const HealthDataWidget()
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}