encustody 1.0.2 copy "encustody: ^1.0.2" to clipboard
encustody: ^1.0.2 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();

  var url =
      "https://auth-test.encustody.com.ar/auth/realms/ENCODE/protocol/openid-connect/token";

  var config = EncustodyConfig(
    client: 'Servicio-custodia',
    secret: '89a6d801-9032-4723-adc4-ce2f0fad90b7',
    hostApi: 'https://localhost:7151',
    hostLogin: url,
  );

  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(),
          ],
        ),
      ),
    );
  }
}