inuba_flutter_sdk 1.1.1
inuba_flutter_sdk: ^1.1.1 copied to clipboard
iNuba App SDK for Flutter - Integration library for Flutter mobile applications
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:inuba_flutter_sdk/inuba_flutter_sdk.dart';
/// Entry point of the application
void main() {
runApp(const MyApp());
}
/// Main application widget that sets up the MaterialApp
class MyApp extends StatelessWidget {
/// Creates a [MyApp] widget
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iNuba SDK Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
home: const INubaSDKExampleScreen(),
);
}
}
/// Example screen that demonstrates the usage of the iNuba SDK widget
class INubaSDKExampleScreen extends StatelessWidget {
/// Creates an [INubaSDKExampleScreen] widget
const INubaSDKExampleScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('iNuba SDK Example'),
),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home_rounded),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings_rounded),
label: 'Settings',
),
BottomNavigationBarItem(
icon: Icon(Icons.info_rounded),
label: 'About',
),
],
),
body: INubaSDK(
// Required parameters
clientToken: 'your_client_token',
userToken: 'your_user_token',
// Optional: White label configuration
whitelabel: Whitelabel.iNuba, // or Whitelabel.custom('YourBrand')
// Optional: Environment
environment: Environment.develop, // or Environment.production
// Optional: Platform identification
platform: Platform.android, // or Platform.ios
// Optional: Display mode
displayMode: DisplayMode.inlineView, // or DisplayMode.fullScreen
// Optional: Language
language: Language.en, // or Language.es or Language.userChoice
// Optional: Unit measurement
unitMeasurement: UnitMeasurement.metric, // or UnitMeasurement.imperial or UnitMeasurement.userChoice
// Optional: Handle file downloads from WebView
onDownload: (url, filename, downloadAndShare) {
// Implement your download logic here
// Example: Use flutter_downloader or flutter_file_downloader packages
},
// Optional: Handle SDK close events
onClose: (reason) {
/// Implement your close logic here
///
/// Only the webview calls this callback when displayMode is DisplayMode.fullScreen
/// and the user closes the webview by clicking the close button.
///
/// Example: Navigator.of(context).pop();
},
),
);
}
}