encustody 1.0.4 copy "encustody: ^1.0.4" to clipboard
encustody: ^1.0.4 copied to clipboard

PlatformAndroidiOS
unlisted

This is an sdk to sign documents using the Encustody signature service.

example/lib/main.dart

import 'dart:io';

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

class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext? context) {
    return super.createHttpClient(context)
      ..badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;
  }
}

void main() {
  HttpOverrides.global = MyHttpOverrides();

  var config = EncustodyConfig(
    client: '',
    secret: '',
    hostApi: '',
    hostLogin: '',
  );

  final encustody = EncustodyContext(config: config, child: const MyApp());

  runApp(encustody);
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            EncustodySignButtonWidget(),
          ],
        ),
      ),
    );
  }
}