Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
1 change: 1 addition & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ packages:
- packages/rust_verifier/rust_builder
- packages/nip07_event_signer
- packages/sembast_cache_manager
- packages/ndk_flutter

scripts:
analyze:
Expand Down
31 changes: 31 additions & 0 deletions packages/ndk_flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins-dependencies
/build/
/coverage/
10 changes: 10 additions & 0 deletions packages/ndk_flutter/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "20f82749394e68bcfbbeee96bad384abaae09c13"
channel: "stable"

project_type: package
3 changes: 3 additions & 0 deletions packages/ndk_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions packages/ndk_flutter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
62 changes: 62 additions & 0 deletions packages/ndk_flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
This package helps you to easily produce Nostr apps by providing generics Widgets and functions.

## Features

- Nostr widgets
- Login persistence

## Getting started

### Add dependencies

```bash
flutter pub add ndk
flutter pub add ndk_flutter
```

### Add internationalization

Follow the [Official documentation](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization)

```dart
import 'package:ndk_flutter/l10n/app_localizations.dart' as ndk_flutter;

MaterialApp(
localizationsDelegates: [
ndk_flutter.AppLocalizations.delegate, // add this line
],
);
```

## Usage

By default, the logged user is used for user widgets, you can overwrite it by providing a pubkey as parameter.

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

// available widgets
NBanner(ndk);
NPicture(ndk);
NName(ndk);
NUserProfile(ndk);
NLogin(ndk);
NSwitchAccount(ndk);

final ndkFlutter = NdkFlutter(ndk: ndk)

// call this to connect user from local storage
ndkFlutter.restoreAccountsState();

// call this every time the auth state change
ndkFlutter.saveAccountsState();
```

## TODO

- [ ] NUserProfile optionnal show nsec and copy
- [ ] NUserProfile show the letter in the Picture and make it as big as possible

## Need more Widgets

Open an Issue
4 changes: 4 additions & 0 deletions packages/ndk_flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
117 changes: 117 additions & 0 deletions packages/ndk_flutter/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"@@locale": "en",
"createAccount": "Create your account",
"@createAccount": {
"description": "Button text for creating a new account"
},
"newHere": "Are you new here?",
"@newHere": {
"description": "Question asking if the user is new to the platform"
},
"nostrAddress": "Nostr Address",
"@nostrAddress": {
"description": "Label for nostr address input field"
},
"publicKey": "Public Key",
"@publicKey": {
"description": "Label for public key input field"
},
"privateKey": "Private Key (insecure)",
"@privateKey": {
"description": "Label for private key input field"
},
"browserExtension": "Browser extension",
"@browserExtension": {
"description": "Label for browser extension login section"
},
"connect": "Connect",
"@connect": {
"description": "Button text to connect with browser extension"
},
"install": "Install",
"@install": {
"description": "Button text to install browser extension"
},
"logout": "Logout",
"@logout": {
"description": "Button text to logout from the application"
},
"nostrAddressHint": "[email protected]",
"@nostrAddressHint": {
"description": "Placeholder text for nostr address input field"
},
"invalidAddress": "Invalid Address",
"@invalidAddress": {
"description": "Error message for invalid nostr address"
},
"unableToConnect": "Unable to connect",
"@unableToConnect": {
"description": "Error message when unable to connect to nostr address"
},
"publicKeyHint": "npub1...",
"@publicKeyHint": {
"description": "Placeholder text for public key input field"
},
"privateKeyHint": "nsec1...",
"@privateKeyHint": {
"description": "Placeholder text for private key input field"
},
"newToNostr": "New to Nostr?",
"@newToNostr": {
"description": "Question asking if the user is new to Nostr"
},
"getStarted": "Get Started",
"@getStarted": {
"description": "Button text to get started with Nostr"
},
"bunker": "Bunker",
"@bunker": {
"description": "Label for bunker login section"
},
"bunkerAuthentication": "Bunker Authentication",
"@bunkerAuthentication": {
"description": "Title for bunker authentication toast"
},
"tapToOpen": "Tap to open: {url}",
"@tapToOpen": {
"description": "Description for bunker authentication toast",
"placeholders": {
"url": {
"type": "String",
"example": "https://example.com/auth"
}
}
},
"showNostrConnectQrcode": "Show nostr connect qrcode",
"@showNostrConnectQrcode": {
"description": "Button text to show nostr connect QR code"
},
"loginWithAmber": "Login with amber",
"@loginWithAmber": {
"description": "Button text to login with Amber"
},
"nostrConnectUrl": "Nostr connect URL",
"@nostrConnectUrl": {
"description": "Title for nostr connect URL dialog"
},
"copy": "Copy",
"@copy": {
"description": "Button text to copy to clipboard"
},
"addAccount": "Add account",
"@addAccount": {
"description": "Button text to add a new account"
},
"readOnly": "Read-only",
"@readOnly": {
"description": "Label for read-only account type"
},
"nsec": "Nsec",
"@nsec": {
"description": "Label for nsec (private key) account type"
},
"extension": "Extension",
"@extension": {
"description": "Label for browser extension account type"
}
}
30 changes: 30 additions & 0 deletions packages/ndk_flutter/lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@@locale": "es",
"createAccount": "Crear tu cuenta",
"newHere": "¿Eres nuevo aquí?",
"nostrAddress": "Dirección Nostr",
"publicKey": "Clave pública",
"privateKey": "Clave privada (inseguro)",
"browserExtension": "Extensión del navegador",
"connect": "Conectar",
"install": "Instalar",
"logout": "Cerrar sesión",
"nostrAddressHint": "[email protected]",
"invalidAddress": "Dirección inválida",
"unableToConnect": "No se puede conectar",
"publicKeyHint": "npub1...",
"privateKeyHint": "nsec1...",
"newToNostr": "¿Nuevo en Nostr?",
"getStarted": "Comenzar",
"bunker": "Bunker",
"bunkerAuthentication": "Autenticación Bunker",
"tapToOpen": "Toca para abrir: {url}",
"showNostrConnectQrcode": "Mostrar código QR de nostr connect",
"loginWithAmber": "Iniciar sesión con Amber",
"nostrConnectUrl": "URL de conexión Nostr",
"copy": "Copiar",
"addAccount": "Añadir cuenta",
"readOnly": "Solo lectura",
"nsec": "Nsec",
"extension": "Extensión"
}
30 changes: 30 additions & 0 deletions packages/ndk_flutter/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@@locale": "fr",
"createAccount": "Créer votre compte",
"newHere": "Êtes-vous nouveau ici?",
"nostrAddress": "Adresse Nostr",
"publicKey": "Clé publique",
"privateKey": "Clé privée (non sécurisé)",
"browserExtension": "Extension de navigateur",
"connect": "Se connecter",
"install": "Installer",
"logout": "Se déconnecter",
"nostrAddressHint": "[email protected]",
"invalidAddress": "Adresse invalide",
"unableToConnect": "Impossible de se connecter",
"publicKeyHint": "npub1...",
"privateKeyHint": "nsec1...",
"newToNostr": "Nouveau sur Nostr?",
"getStarted": "Commencer",
"bunker": "Bunker",
"bunkerAuthentication": "Authentification Bunker",
"tapToOpen": "Appuyez pour ouvrir: {url}",
"showNostrConnectQrcode": "Afficher le code QR nostr connect",
"loginWithAmber": "Se connecter avec Amber",
"nostrConnectUrl": "URL de connexion Nostr",
"copy": "Copier",
"addAccount": "Ajouter un compte",
"readOnly": "Lecture seule",
"nsec": "Nsec",
"extension": "Extension"
}
30 changes: 30 additions & 0 deletions packages/ndk_flutter/lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"@@locale": "ja",
"createAccount": "アカウントを作成",
"newHere": "初めてですか?",
"nostrAddress": "Nostrアドレス",
"publicKey": "公開鍵",
"privateKey": "秘密鍵(安全ではありません)",
"browserExtension": "ブラウザ拡張機能",
"connect": "接続",
"install": "インストール",
"logout": "ログアウト",
"nostrAddressHint": "[email protected]",
"invalidAddress": "無効なアドレス",
"unableToConnect": "接続できません",
"publicKeyHint": "npub1...",
"privateKeyHint": "nsec1...",
"newToNostr": "Nostrは初めてですか?",
"getStarted": "始める",
"bunker": "バンカー",
"bunkerAuthentication": "バンカー認証",
"tapToOpen": "タップして開く:{url}",
"showNostrConnectQrcode": "nostr connect QRコードを表示",
"loginWithAmber": "Amberでログイン",
"nostrConnectUrl": "Nostr接続URL",
"copy": "コピー",
"addAccount": "アカウントを追加",
"readOnly": "読み取り専用",
"nsec": "Nsec",
"extension": "拡張機能"
}
Loading