Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7d90761
rewrite existing feature scope to flutter webview, remove native sdk …
mateusz-ramp Jul 29, 2026
aed8065
convert to flutter package, drop redundant mobile shells
mateusz-ramp Jul 29, 2026
6ca62dc
fix webview permissions and example
mateusz-ramp Jul 29, 2026
c57351f
fix host api loading
mateusz-ramp Jul 29, 2026
105ecf0
drop local notifications from demo app
mateusz-ramp Jul 29, 2026
203b0d5
pass through any js events
mateusz-ramp Jul 29, 2026
cc588f9
move presentation responsibility to sdk integrator, sdk provides view…
mateusz-ramp Jul 29, 2026
a0e687e
show example toasts on top of widget
mateusz-ramp Jul 29, 2026
2841f4e
fix js message parsing
mateusz-ramp Jul 29, 2026
9ad3a31
drop cococapods
mateusz-ramp Jul 29, 2026
10d96e0
update dependencies
mateusz-ramp Jul 29, 2026
10b505b
use forked webview to properly handle external links
mateusz-ramp Jul 29, 2026
a690728
recreate the project
mateusz-ramp Jul 29, 2026
bb48828
squash noop page
mateusz-ramp Jul 29, 2026
a8ab661
extract events
mateusz-ramp Jul 29, 2026
cef13e0
separate webview
mateusz-ramp Jul 29, 2026
fa7d9d7
update events
mateusz-ramp Jul 29, 2026
8f1cc9a
extract models
mateusz-ramp Jul 29, 2026
d816d0e
unify posting methods
mateusz-ramp Jul 29, 2026
c0aa6dd
add widget close request event
mateusz-ramp Jul 29, 2026
c5cf5e9
fix android file picker
mateusz-ramp Jul 29, 2026
fcd4ec7
open non-http/s urls externally
mateusz-ramp Jul 29, 2026
e4e9634
ensure controller
mateusz-ramp Jul 29, 2026
049c02f
make Configuration an url builder
mateusz-ramp Jul 29, 2026
73c816e
add debug prints
mateusz-ramp Jul 29, 2026
1aed444
fix webview packaging
mateusz-ramp Jul 29, 2026
fe44358
queue events
mateusz-ramp Jul 29, 2026
9d2f700
rename files
mateusz-ramp Jul 29, 2026
b2b3ed4
extract webview tools
mateusz-ramp Jul 29, 2026
03e4b3c
store example deplocks
mateusz-ramp Jul 29, 2026
920ccf7
fix empty schemes
mateusz-ramp Jul 29, 2026
c397365
remove verbose logging
mateusz-ramp Jul 29, 2026
ab0ba37
streamline widget creation
mateusz-ramp Jul 29, 2026
06285ec
flatten webview indent
mateusz-ramp Jul 29, 2026
cbccd34
reformat
mateusz-ramp Jul 29, 2026
5b299dd
Ignore example/lib/secrets.dart so local API keys stay untracked.
mateusz-ramp Jul 29, 2026
9e5fa2d
remove unused test files
mateusz-ramp Jul 29, 2026
f9f061c
update dependencies
mateusz-ramp Jul 29, 2026
aad7556
adapt params to existing widget options
mateusz-ramp Jul 29, 2026
280bc56
add enums for payment methods and flows
mateusz-ramp Jul 29, 2026
d923f1e
sanitize widget url
mateusz-ramp Jul 29, 2026
efcd804
clean up
mateusz-ramp Jul 29, 2026
bcb3eef
add makefile, fix analyze issues
mateusz-ramp Jul 29, 2026
44bfb09
add more tests
mateusz-ramp Jul 29, 2026
4af1cd6
restore changelog
mateusz-ramp Jul 29, 2026
a3d13be
add migration guide
mateusz-ramp Aug 3, 2026
78e2f1b
add make command for running ios sim
mateusz-ramp Aug 3, 2026
4e1aa13
add separate widget for signed url in example app
mateusz-ramp Aug 3, 2026
32ae23b
add missing version event
mateusz-ramp Aug 3, 2026
356a9b6
make send crypto protocol version a constant
mateusz-ramp Aug 3, 2026
2eb2713
improve make commands
mateusz-ramp Aug 3, 2026
51edf4b
update docs
mateusz-ramp Aug 3, 2026
7ac7a65
improve ios sim select in ios example app
mateusz-ramp Aug 4, 2026
7a4b48b
add theme support in example app
mateusz-ramp Aug 4, 2026
9148798
drop partner name/logo from configuration
mateusz-ramp Aug 4, 2026
63b6f36
remove finalUrl param
mateusz-ramp Aug 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ migrate_working_dir/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
# The example app lockfile (example/pubspec.lock) is kept for reproducible demos.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
build/
25 changes: 1 addition & 24 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,4 @@ version:
revision: "46787ee49c1fd80ab603f0702733edab54653aef"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 46787ee49c1fd80ab603f0702733edab54653aef
base_revision: 46787ee49c1fd80ab603f0702733edab54653aef
- platform: android
create_revision: 46787ee49c1fd80ab603f0702733edab54653aef
base_revision: 46787ee49c1fd80ab603f0702733edab54653aef
- platform: ios
create_revision: 46787ee49c1fd80ab603f0702733edab54653aef
base_revision: 46787ee49c1fd80ab603f0702733edab54653aef

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
project_type: package
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 5.0.0

* Rewrite the SDK to load the Ramp widget in a Flutter WebView instead of the
native iOS/Android Ramp SDKs. Published as a Dart Flutter package (no
Android/iOS plugin shells).
* Breaking: host owns presentation (`ramp.view`); use sealed `WidgetEvent` /
`HostEvent` instead of the old callbacks; `Configuration` is immutable and
uses widget-2 params. See [MIGRATION.md](MIGRATION.md).
* Default base URL is now `https://app.rampnetwork.com`.
* Raise minimums: Flutter 3.44 / Dart 3.12, Android API 24, iOS 13.
* Off-widget / `target=_blank` navigations open in the system browser; Android
file inputs use `file_picker` / `image_picker`.

## 4.0.1

* Updated package documentation
Expand All @@ -10,7 +23,7 @@

## 3.0.0

* Regenerated plugin to fix platform specific dependencies
* Regenerated plugin to fix platform specific dependencies

## 2.0.2

Expand Down
114 changes: 114 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Migrating from 4.x to 5.x

Version 5.0.0 replaces the native iOS/Android Ramp SDKs with a Flutter WebView
that loads the Ramp widget. The package is a Dart Flutter package (no Android
or iOS plugin shells).

## Platform requirements

| | 4.x | 5.x |
| --- | --- | --- |
| Flutter / Dart | Flutter `>=3.3.0` / Dart `>=3.2.3 <4.0.0` | Flutter 3.44+ / Dart 3.12+ |
| Android | `minSdkVersion` 21 | `minSdkVersion` 24+ |
| iOS | deployment target 11.0 | deployment target 13+ |

Declare `android.permission.CAMERA`, `NSCameraUsageDescription`, and photo
library usage descriptions for identity verification and document upload.

## Presentation

**4.x:** the SDK presented its own UI (`showRamp` / similar).

**5.x:** create `RampFlutter(Configuration)` or `RampFlutter.signed(url)`,
embed `ramp.view` in your own route / sheet / dialog, and call `dispose` when
dismissed.

```dart
final ramp = RampFlutter(Configuration(/* ... */))
..onWidgetEvent = (event) { /* ... */ };

await showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
builder: (_) => SizedBox(
height: MediaQuery.sizeOf(context).height * 0.92,
child: ramp.view,
),
);

ramp.dispose();
```

## Events

**4.x:** separate callbacks (`onOnrampPurchaseCreated`, `onSendCryptoRequested`,
`onOfframpSaleCreated`, `onRampClosed`, …).

**5.x:** one `onWidgetEvent` handler with sealed `WidgetEvent` subtypes, and
`postHostEvent` with sealed `HostEvent` subtypes (`SendCryptoResult`,
`RequestCryptoAccountResult`). Host events are queued until the widget page
has finished loading.

```dart
ramp.onWidgetEvent = (event) {
switch (event) {
case AppVersion():
break;
case PurchaseCreated(:final payload):
break;
case OfframpSaleCreated(:final payload):
break;
case SendCryptoRequested(:final payload):
ramp.postHostEvent(SendCryptoResult.txHash(txHash));
case RequestCryptoAccount(:final payload):
ramp.postHostEvent(
RequestCryptoAccountResult.account(address: userAddress, type: payload.type),
);
case WidgetClose():
Navigator.of(context).pop();
case WidgetCloseRequest():
break;
case WidgetConfigDone():
case WidgetConfigFailed():
break;
}
};
```

## Configuration

`Configuration` is an immutable helper used only for the config-built entry
point. It builds widget URLs with widget-2 params and always appends
`sdkType` / `sdkVersion`.

### Param mapping

| 4.x (removed) | 5.x |
| --- | --- |
| `defaultAsset` / `fiatCurrency` / `fiatValue` / `swapAsset` / `offrampAsset` / `swapAmount` | `inAsset` / `outAsset` / `inAssetValue` / `outAssetValue` / `enabledCryptoAssets` |
| `enabledFlows` / `defaultFlow` as strings | `TransactionFlow` enum |
| — | `paymentMethodType` (`PaymentMethodType` enum) |
| `hostLogoUrl`, `hostAppName`, `containerNode`, `deepLinkScheme`, `variant` | removed — partner name and logo are set by Ramp Network on the integration (`PARTNER_NAME` / `PARTNER_LOGO_URL`) |
| `finalUrl` | removed — hosted-mode redirect only; not used by the Flutter WebView SDK |

Default base URL is `https://app.rampnetwork.com`.

Both `Configuration.buildWidgetUrl()` and `RampFlutter.signed` require an
`https` Ramp Network host (`*.ramp.network`, `*.rampnetwork.com`,
`*.ramp-network.org`).

## Signed URLs

Use `RampFlutter.signed(url)` for server-signed widget URLs (loaded verbatim).
Do not put a signed URL in `Configuration.url` — `buildWidgetUrl()` rejects
bases that already include a `signature` query parameter.

## Public API surface

Import only `package:ramp_flutter/ramp_flutter.dart`. Implementation lives under
`lib/src/`.

## Further reading

See [README.md](README.md) for host setup and usage examples, and the
[Flutter SDK docs](https://docs.ramp.network/mobile/flutter-sdk/).
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.PHONY: get format analyze test ios
.DEFAULT_GOAL := test

get:
flutter pub get

format:
dart format lib test example/lib

analyze:
dart analyze

test: get format analyze
flutter test

build: get
cd example && flutter build ios --debug --no-codesign
cd example && flutter build apk --debug

ios:
@id=$$(flutter devices --device-connection attached | grep SimRuntime.iOS \
| head -n1 | cut -d'•' -f2 | xargs); \
[ -n "$$id" ] || (echo "No iOS device found" && exit 1); \
cd example && flutter run -d $$id
104 changes: 102 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,107 @@
# Ramp Network Flutter

Official Flutter wrapper for Ramp Network
Official Flutter package for Ramp Network. \
Loads the Ramp widget in a Flutter
WebView on iOS and Android.

## Getting Started

For installation & usage follow [Ramp Network Flutter documentation](https://docs.ramp.network/mobile/flutter-sdk/)
Add the dependency:

```yaml
dependencies:
ramp_flutter: ^5.0.0
```

Upgrading from 4.x? See [MIGRATION.md](MIGRATION.md).

### Host setup

- **Android:** `minSdkVersion` 24+. Declare `android.permission.CAMERA` for
identity verification camera capture.
- **iOS:** deployment target 13+. Add `NSCameraUsageDescription` and photo
library usage descriptions for identity verification and document upload.
- Requires Flutter 3.44+ / Dart 3.12+.

### Usage

The SDK provides the Ramp WebView; your app owns presentation (route, bottom
sheet, dialog, etc.) and must call `dispose` when it is dismissed.

**Configuration** (SDK builds the widget URL, including `sdkType` / `sdkVersion`):

```dart
import 'package:ramp_flutter/ramp_flutter.dart';

final ramp = RampFlutter(
Configuration(
hostApiKey: 'YOUR_API_KEY',
enabledFlows: [TransactionFlow.ONRAMP, TransactionFlow.OFFRAMP],
outAsset: 'BTC_BTC',
),
)
..onWidgetEvent = (event) {
switch (event) {
case AppVersion():
break;
case PurchaseCreated(:final payload):
break;
case OfframpSaleCreated(:final payload):
break;
case SendCryptoRequested(:final payload):
ramp.postHostEvent(SendCryptoResult.txHash(txHash));
case RequestCryptoAccount(:final payload):
ramp.postHostEvent(
RequestCryptoAccountResult.account(address: userAddress, type: payload.type),
);
case WidgetClose():
Navigator.of(context).pop();
case WidgetCloseRequest():
break;
case WidgetConfigDone():
case WidgetConfigFailed():
break;
}
};

await showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
builder: (_) => SizedBox(
height: MediaQuery.sizeOf(context).height * 0.92,
child: ramp.view,
),
);

ramp.dispose();
```

**Server-signed URL** (loaded verbatim — do not put this in `Configuration.url`):

```dart
final ramp = RampFlutter.signed(signedWidgetUrlFromYourBackend)
..onWidgetEvent = (event) { /* same switch as above */ };
```

Generate the signed URL on your backend (`hostApiKey`, `timestamp`, `signature`).
Keep signing keys out of the app.

Partner **name** and **logo** are not SDK configuration fields. Ask Ramp
Network to set host features `PARTNER_NAME` / `PARTNER_LOGO_URL` for your
integration (for example via integrations@rampnetwork.com).

For more configuration parameters see
[Ramp Network Flutter documentation](https://docs.ramp.network/mobile/flutter-sdk/).

### Notes

- Off-widget navigations (other https hosts, custom schemes, `intent:`) and
`target=_blank` / `window.open` open in the system browser via
`NavigationDelegate` and a forked `webview_flutter`
([mateusz-ramp/flutter_packages](https://github.com/mateusz-ramp/flutter_packages/tree/webview-target-blank)
/ commit `a37d157`), declared as a direct dependency of this package so hosts
pick it up transitively (no host `dependency_overrides` required unless
another package pins pub.dev `webview_flutter`).
- Android WebView `<input type="file">` uses `file_picker` (and the camera via
`image_picker` for capture). Host apps must declare camera / photo library
usage (see Getting Started). iOS WKWebView handles file inputs natively.
4 changes: 2 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
formatter:
page_width: 120
9 changes: 0 additions & 9 deletions android/.gitignore

This file was deleted.

55 changes: 0 additions & 55 deletions android/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

3 changes: 0 additions & 3 deletions android/src/main/AndroidManifest.xml

This file was deleted.

Loading
Loading