vatom_wallet_sdk 0.0.51 copy "vatom_wallet_sdk: ^0.0.51" to clipboard
vatom_wallet_sdk: ^0.0.51 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: "...accessToken",
    refreshToken: "...refreshToken",
    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: () async {
                          await wallet.navigateToTab("Wallet");
                        },
                        child: const Text('wallet (deprecated)'),
                        //break text to avoid overflow
                        style: ElevatedButton.styleFrom(
                          textStyle: const TextStyle(fontSize: 12),
                        ),
                      )),
                ],
              ),
            ],
          ),
        ),
      ),
    ),
  );
}