finik_sdk 0.1.4 finik_sdk: ^0.1.4 copied to clipboard
This Flutter package allows your application to integrate Finik application features.
import 'package:finik_sdk/finik_sdk.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
void main() async {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Finik DEMO',
home: FinikProvider(
apiKey: 'YOUR_API_KEY',
languageCode: 'en',
useHiveForGraphQLCache: false,
onBackPressed: () => _customDialog('onBackPressed'),
/// on development in ScannerWidget
onSuccess: () => _customDialog('onSuccess'),
/// on development in ScannerWidget
onFail: (String message) => _customDialog(message),
/// widget: GetItemHandlerWidget/CreateItemHandlerWidget
/// widget: const GetItemHandlerWidget(
/// itemId: 'YOUR_ITEM_ID',
/// ),
widget: const CreateItemHandlerWidget(
accountId: 'YOUR_ACCOUNT_ID',
nameEn: 'YOUR_NAME_EN',
requiredFields: [
RequiredField(
fieldId: 'YOU_FIELD_ID_FOR_REQUIRED_FIELD',
/// optional value
value: 'YOUR_VALUE',
),
],
),
),
);
}
}
void _customDialog(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0);
}