aiprise_flutter_sdk 1.2.3 copy "aiprise_flutter_sdk: ^1.2.3" to clipboard
aiprise_flutter_sdk: ^1.2.3 copied to clipboard

Identity verification made simple

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:aiprise_flutter_sdk/aiprise_flutter_sdk.dart';

// 1 - Material Button Example
class MaterialExample extends StatelessWidget {
  const MaterialExample({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
          useMaterial3: true,
        ),
        home: Scaffold(
          appBar: AppBar(
            title: const Text('Material Example'),
            backgroundColor: Colors.blue,
            foregroundColor: Colors.white,
          ),
          body: const Center(
              child: AiPriseMaterialButton(
                  mode: AiPriseEnvironment.sandbox,
                  templateID: "TEMPLATE_ID_HERE")),
        ));
  }
}

// 2 - Cupertino Button Example
class CupertinoExample extends StatelessWidget {
  const CupertinoExample({super.key});

  @override
  Widget build(BuildContext context) {
    return const CupertinoApp(
      theme: CupertinoThemeData(primaryColor: CupertinoColors.activeBlue),
      home: CupertinoPageScaffold(
          navigationBar: CupertinoNavigationBar(
            middle: Text('Cupertino Example'),
          ),
          child: Center(
              child: AiPriseCupertinoButton(
                  mode: AiPriseEnvironment.sandbox,
                  templateID: "TEMPLATE_ID_HERE"))),
    );
  }
}

// 3 - Splits the screen into 2 and shows both examples
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const SizedBox.expand(
      child: Column(
        children: [
          Expanded(child: MaterialExample()),
          Divider(
            height: 1,
          ),
          Expanded(
            child: CupertinoExample(),
          ),
        ],
      ),
    );
  }
}

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