arcana_auth_flutter 0.0.3 copy "arcana_auth_flutter: ^0.0.3" to clipboard
arcana_auth_flutter: ^0.0.3 copied to clipboard

Arcana Auth flutter SDK

example/lib/main.dart

import 'dart:math';

import 'package:arcana_auth_flutter/common.dart';
import 'package:arcana_sdk_example/strings.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:arcana_auth_flutter/arcana_sdk.dart';

void main() {
  runApp(MaterialApp(home: const MyApp()));
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _arcanaSdkPlugin = ArcanaSdk();
  TextEditingController heightController=TextEditingController();
  TextEditingController widthController=TextEditingController();
  String logs='';
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    setState(() {
      logs='';
    });
    _arcanaSdkPlugin.initWeb(
          config : ArcanaConfig.dev,
          fullScreen : false,
          height: 400,
          width:400,
          alignment : Alignment.bottomCenter,
          context: context,
          isPasswordLessLogin: false,
          email: "",
          clientId: "xar_dev_2cbfe3fc82840d8f4191935e1811b0c2e33619f8",
          onError: (error){
            logs=error;
            setState(() {

            });
          },
          onLoginSuccess : (){
            logs=login_success;
            setState(() {

            });
          },
          onLoginFailed : (){
            logs=logout_success;
            setState(() {

            });
          },
          onLog :(String value){
            logs=value;
            setState(() {

            });
          },
      );

  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            Row(
              children: [
                ElevatedButton(onPressed: (){
                  _arcanaSdkPlugin.showArcanaView();
                  logs='';
                  setState(() {

                  });
                }, child: Text(show)),
                SizedBox(width: 20,),
                Text(logs)
              ],
            ),
            Row(
              children: [
                ElevatedButton(onPressed: (){
                  _arcanaSdkPlugin.hideArcanaView();
                }, child: Text(hide)),
                ElevatedButton(onPressed: (){
                  _arcanaSdkPlugin.clearCache();
                }, child: Text('destroy')),
              ],
            ),
            Row(
              children: [
                Expanded(
                  child: ElevatedButton(onPressed: () async {
                    _arcanaSdkPlugin.sendRequest(1234,onSendRequestResponse:(response){
                      logs=response;
                      setState(() {

                      });
                    });
                  }, child: Text('sendRequest')),
                )   ,
                Expanded(
                  child: ElevatedButton(onPressed: (){
                    _arcanaSdkPlugin.getUserInfo(1234,onUserInfoResponse:(response){
                      logs=response;
                      setState(() {

                      });
                    });
                  }, child: Text('getUserInfo')),
                )  ,
                Expanded(
                  child: ElevatedButton(onPressed: (){
                    _arcanaSdkPlugin.sendTransaction('3635', '0xE28F01Cf69f27Ee17e552bFDFB7ff301ca07e780', '0xE28F01Cf69f27Ee17e552bFDFB7ff301ca07e780', '0x0de0b6b3a7640000',onTransactionResponse:(String response){
                      logs=response;
                      setState(() {

                      });
                    });
                  }, child: Text('sendTransaction')),
                ),
                Expanded(
                  child: ElevatedButton(onPressed: (){
                    _arcanaSdkPlugin.getAccount(12311,getAccountResponse: (response){
                      logs=response;
                      setState(() {

                      });
                    });
                  }, child: Text('getAccount')),
                ),
                Expanded(
                  child: ElevatedButton(onPressed: (){
                    _arcanaSdkPlugin.logOut(onLogoutResponse:(response){

                    });
                  }, child: Text('logout')),
                ),
              ],
            ),
            Row(
              children: [
                Expanded(child: TextField(
                  controller: heightController,
                )),
                Expanded(child: TextField(
                  controller: widthController,
                )),
                ElevatedButton(onPressed: (){
                  _arcanaSdkPlugin.resize(false,double.parse(heightController.text),double.parse(widthController.text));
                }, child: Text(resize)),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Arcana Auth flutter SDK

License

unknown (license)

Dependencies

flutter, plugin_platform_interface, webview_flutter

More

Packages that depend on arcana_auth_flutter