vatom_wallet_sdk 0.0.34 copy "vatom_wallet_sdk: ^0.0.34" to clipboard
vatom_wallet_sdk: ^0.0.34 copied to clipboard

Vatom Wallet SDK for flutter.

example/vatom_wallet_sdk_example.dart

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

main() {
  WidgetsFlutterBinding.ensureInitialized();

  final VatomWallet wallet = VatomWallet(
    accessToken:
        "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imw0Mjd4WnJxNjJlR0xhS0hhc0d0bkkyZ1JZVjF3c0VUUm0weDlDcEZiOWsifQ.eyJ1cm46dmF0b21pbmM6Z3Vlc3QiOmZhbHNlLCJ1cm46dmF0b21pbmM6cmVnaW9uIjoidXMtZWFzdDQuZ2NwIiwianRpIjoiQ044NUxycE9fNzVnTzNVS2xYRnV2Iiwic3ViIjoiMWxueWw4ZSIsImlhdCI6MTcyMDQ1MjA2MiwiZXhwIjoxNzIwNDU1NjYyLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIG9mZmxpbmVfYWNjZXNzIiwiaXNzIjoiaHR0cHM6Ly9pZC52YXRvbS5jb20iLCJhdWQiOiI5NEpIa2RqOGpGODNqZkZGMkxJOFE0In0.hIsjMWFRVYWtXP7Q7rqBwwAm1rpX1U4HraTfO9IiJb_8XGQZZhQawBLR8jzLDp2UYA12-dKCXleJl0sDhqa2FJ8_oYejx_fqFEnEh9BNmHuRSFVDZOc7A3ban6-rIYQqw2brPb5AMrHal0EKvw9wwGWkKDumUEV91P_RC-AcYfSgWfWwFUNqV8eGVpC4a7aQX-qC16WUtSv4ui4DpUfsilj2p7HtBn3TKfeXuIsS_SqCc02xEwht-6uC5bNiM-cg18Lmb35nKBL3gMZR_nNOLdLfW6DTLPp8Jt4H-6xZJpvTvpDCqMCIX1rLHL4RVUCwZqc4rhNDyXwaHiULgld6ZA",
    initialRoute: "map",
    config: VatomConfigFeatures(
      hideTokenActions: true,
      disableArPickup: true,
      disableNewTokenToast: true,
      hideDrawer: false,
      hideNavigation: false,
      language: "en",
      scanner: ScannerFeatures(enabled: false),
      pageConfig: PageConfig(
        features: PageFeatures(
          icon: PageFeaturesIcon(badges: false, editions: false, titles: false),
          footer: PageFeaturesFooter(enabled: true, icons: [
            PageFeaturesFooterIcon(id: "map", src: "", title: "Map"),
          ]),
        ),
      ),
    ),
  );

  void linkTo(String path) async {
    wallet.linkTo(path).catchError(
          (error) => print('Error: $error'),
        );
  }

  runApp(
    MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Column(
            children: [
              Expanded(
                child: wallet,
              ),
              Row(
                children: [
                  Padding(
                      padding: EdgeInsets.all(3),
                      child: ElevatedButton(
                        onPressed: () async {
                          var tabs = await wallet.getCurrentUser();
                          print(tabs?.toJson());
                        },
                        child: Text('getCurrentUser'),
                        style: ElevatedButton.styleFrom(
                          textStyle: const TextStyle(fontSize: 12),
                        ),
                      )),
                  Padding(
                    padding: EdgeInsets.all(3),
                    child: ElevatedButton(
                      onPressed: () {
                        linkTo("/map");
                      },
                      child: Text('map'),
                      style: ElevatedButton.styleFrom(
                        textStyle: const TextStyle(fontSize: 12),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.all(3),
                    child: ElevatedButton(
                      onPressed: () {
                        linkTo("/token/a95a888a-041d-49bc-ab1f-96be9faf2ac1");
                      },
                      child: Text('token'),
                      style: ElevatedButton.styleFrom(
                        textStyle: const TextStyle(fontSize: 12),
                      ),
                    ),
                  ),
                  Padding(
                      padding: EdgeInsets.all(3),
                      child: ElevatedButton(
                        onPressed: () async {
                          await wallet.navigateToTab("Wallet");
                        },
                        child: const Text('wallet (deprecated)'),
                        //break text to avoid overflow
                        style: ElevatedButton.styleFrom(
                          textStyle: const TextStyle(fontSize: 12),
                        ),
                      )),
                ],
              ),
            ],
          ),
        ),
      ),
    ),
  );
}