encustody 0.0.2-beta copy "encustody: ^0.0.2-beta" to clipboard
encustody: ^0.0.2-beta copied to clipboard

unlisted

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();
  runApp(const MyApp());
}

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> {
  bool status = false;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    var config = EncodeConfig(
      client: 'Servicio-custodia',
      secret: '89a6d801-9032-4723-adc4-ce2f0fad90b7',
    );

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            SignSingleFileButtonWidget(
              config: config,
              onSuccess: (SignedDocument signedDocument) {
                status = true;
                print('user success $signedDocument');
                setState(() {});
              },
              onFailure: (failure) {
                status = false;
                print('user failure $failure');
                setState(() {});
              },
            ),
            if (status)
              const Center(
                child: Text(
                  'Documento firmado con exito',
                  style: TextStyle(color: Colors.green),
                ),
              )
          ],
        ),
      ),
    );
  }
}
0
likes
0
pub points
12%
popularity

Publisher

unverified uploader

Encustody signature service

License

unknown (LICENSE)

Dependencies

bloc, cryptography, dartz, file_picker, flutter, flutter_bloc, get_it, http, meta, path_provider, pointycastle

More

Packages that depend on encustody