mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-16 03:58:09 +00:00
feat: disconnect wallet
This commit is contained in:
@ -83,9 +83,9 @@ class ProfilePage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
BasicButton.text(
|
||||
t.button.edit_profile,
|
||||
t.button.settings,
|
||||
onTap: (context) {
|
||||
context.push("/settings/profile");
|
||||
context.push("/settings");
|
||||
},
|
||||
),
|
||||
],
|
||||
|
25
lib/pages/settings.dart
Normal file
25
lib/pages/settings.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:zap_stream_flutter/widgets/button.dart';
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
const SettingsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Text("Settings", style: TextStyle(fontSize: 24)),
|
||||
BasicButton.text(
|
||||
"Edit Profile",
|
||||
onTap: (context) => context.push("/settings/profile"),
|
||||
),
|
||||
BasicButton.text(
|
||||
"Wallet Settings",
|
||||
onTap: (context) => context.push("/settings/wallet"),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pubkey = ndk.accounts.getPublicKey();
|
||||
if (pubkey == null) return Text(t.profile.edit.error.logged_out);
|
||||
if (pubkey == null) return Text(t.settings.profile.error.logged_out);
|
||||
|
||||
return FutureBuilder(
|
||||
future: ndk.metadata.loadMetadata(pubkey),
|
||||
@ -52,7 +52,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _name,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: t.profile.edit.display_name,
|
||||
labelText: t.settings.profile.display_name,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -61,7 +61,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _about,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: t.profile.edit.about,
|
||||
labelText: t.settings.profile.about,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -70,7 +70,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _nip5,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: t.profile.edit.nip05,
|
||||
labelText: t.settings.profile.nip05,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -79,7 +79,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _lud16,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: t.profile.edit.lud16,
|
||||
labelText: t.settings.profile.lud16,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
|
@ -26,7 +26,7 @@ class _Inner extends State<SettingsWalletPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pubkey = ndk.accounts.getPublicKey();
|
||||
if (pubkey == null) return Text(t.wallet.error.logged_out);
|
||||
if (pubkey == null) return Text(t.settings.wallet.error.logged_out);
|
||||
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: loginData,
|
||||
@ -37,7 +37,7 @@ class _Inner extends State<SettingsWalletPage> {
|
||||
children: [
|
||||
TextField(
|
||||
controller: _uri,
|
||||
decoration: InputDecoration(labelText: t.wallet.connect_wallet),
|
||||
decoration: InputDecoration(labelText: t.settings.wallet.connect_wallet),
|
||||
),
|
||||
BasicButton.text(
|
||||
t.button.connect,
|
||||
@ -69,8 +69,23 @@ class _Inner extends State<SettingsWalletPage> {
|
||||
Text(_error!, style: TextStyle(color: WARNING)),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return BasicButton.text(
|
||||
t.settings.wallet.disconnect_wallet,
|
||||
onTap: (context) {
|
||||
loginData.value = LoginAccount(
|
||||
type: loginData.value!.type,
|
||||
pubkey: loginData.value!.pubkey,
|
||||
privateKey: loginData.value!.privateKey,
|
||||
signerRelays: loginData.value!.signerRelays,
|
||||
wallet: null,
|
||||
);
|
||||
if (context.mounted) {
|
||||
context.pop();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user