finik_sdk 0.1.0 copy "finik_sdk: ^0.1.0" to clipboard
finik_sdk: ^0.1.0 copied to clipboard

This Flutter package allows your application to integrate Finik application features.

example/lib/main.dart

import 'package:finik_sdk/finik_sdk.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

void main() async {
  await FinikSdk.initialize(
    apiKey: '<YOUR_API_KEY>',
  );

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Finik DEMO',
      home: FinikProvider(
        languageCode: 'en',
        onBackPressed: () => _yourCustomDialog('onBackPressed'),
        onSuccess: () => _yourCustomDialog('onSuccess'),
        onFail: (String message) => _yourCustomDialog(message),
        // finikWidget: GetItemWidget(accountId: 'YOUR_ACCOUNT_ID',),
        widget: const CreateItemHandlerWidget(
          accountId: 'YOUR_ITEM_ID',
          nameEn: 'YOUR_NAME_EN',
        ),
      ),
    );
  }
}

void _yourCustomDialog(String message) {
  Fluttertoast.showToast(
      msg: message,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      timeInSecForIosWeb: 1,
      backgroundColor: Colors.red,
      textColor: Colors.white,
      fontSize: 16.0);
}