Skip to content

Commit

Permalink
Flutter Usage Example Added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhi13man committed May 13, 2021
1 parent 24d7977 commit dd90e36
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ For more information about the API view [Nordigen's Account Information API docu

[![nordigen_integration version](https://img.shields.io/pub/v/nordigen_integration.svg)](https://pub.dev/packages/nordigen_integration)

## Dependencies

[http](https://pub.dev/packages/http) is used for making API calls to the Nordigen Server Endpoints with proper response and error handling.

----

## Usage Steps

1. Go through the [Nordigen's Account Information API documentation](https://nordigen.com/en/account_information_documenation/integration/quickstart_guide/).
Expand Down Expand Up @@ -156,7 +150,13 @@ For more information about the API view [Nordigen's Account Information API docu

----

### Getting Started
### Dependencies

[http](https://pub.dev/packages/http) is used for making API calls to the Nordigen Server Endpoints with proper response and error handling.

----

#### Getting Started

This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
Expand Down
83 changes: 83 additions & 0 deletions example/nordigen_integration_widget_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

import 'package:nordigen_integration/nordigen_integration.dart';

void main() {
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Basic Widget Example')),
body: BankPickerWidget(),
),
),
);
}

/// Opens Redirect URL based on whatever bank is chosen
class BankPickerWidget extends StatelessWidget {
const BankPickerWidget({
Key key,
EdgeInsets listItemPadding,
EdgeInsets margin,
double height,
double width,
}) : _listItemPadding = listItemPadding ?? const EdgeInsets.all(2),
_margin = margin ?? const EdgeInsets.all(10),
_width = width,
_height = height,
super(key: key);

final EdgeInsets _listItemPadding;

final EdgeInsets _margin;

final double _height, _width;

@override
Widget build(BuildContext context) {
final NordigenAccountInfoAPI apiInterface = NordigenAccountInfoAPI(
accessToken: 'YOUR_TOKEN',
);
return Container(
margin: _margin,
height: _height,
width: _width,
child: Expanded(
child: FutureBuilder(
future: apiInterface.getBanksForCountry(countryCode: 'gb'),
builder: (context, snapshot) {
if (!snapshot.hasData)
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Loading banks...'),
SizedBox(height: 50),
CircularProgressIndicator(),
],
);
List<ASPSP> banks = snapshot.data;
return ListView.builder(
itemBuilder: (context, index) => ListTile(
contentPadding: _listItemPadding,
onTap: () async => launch(
await apiInterface.fetchRedirectLinkForRequisition(
requisition: await apiInterface.createRequisition(
endUserID: 'exampleEndUser',
redirect: 'http://www.yourwebpage.com/',
reference: 'exampleReference13110',
),
aspsp: banks[index],
),
),
title: Text('${banks[index].name}'),
leading: Text('${banks[index].id}'),
subtitle: Text('${banks[index].bic}'),
),
);
},
),
),
);
}
}
Empty file removed lib/nordigen_bank_picker.dart
Empty file.
63 changes: 62 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
Expand All @@ -74,6 +79,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -102,6 +114,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -156,6 +175,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
url_launcher:
dependency: "direct dev"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.3"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
vector_math:
dependency: transitive
description:
Expand All @@ -165,4 +226,4 @@ packages:
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
flutter: ">=1.22.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
url_launcher:

flutter:

Expand Down

0 comments on commit dd90e36

Please sign in to comment.