Compare commits

...

7 Commits

10 changed files with 298 additions and 232 deletions

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.3652 3.12516H13.4359C12.9626 1.79313 11.7021 0.833496 10.209 0.833496C8.71582 0.833496 7.4554 1.79313 6.98275 3.12516H5.05273C4.10384 3.12516 3.33398 3.8943 3.33398 4.84391V17.4481C3.33398 18.397 4.10384 19.1668 5.05273 19.1668H15.3652C16.3141 19.1668 17.084 18.3977 17.084 17.4481V4.84391C17.084 3.8943 16.3141 3.12516 15.3652 3.12516ZM10.209 3.12516C10.8417 3.12516 11.3548 3.63828 11.3548 4.271C11.3548 4.90371 10.8417 5.41683 10.209 5.41683C9.57627 5.41683 9.06315 4.90478 9.06315 4.271C9.06315 3.63828 9.5752 3.12516 10.209 3.12516ZM6.87565 8.75016C6.87565 8.52004 7.0622 8.3335 7.29232 8.3335H13.1257C13.3558 8.3335 13.5423 8.52004 13.5423 8.75016V9.16683C13.5423 9.39695 13.3558 9.5835 13.1257 9.5835H7.29232C7.0622 9.5835 6.87565 9.39695 6.87565 9.16683V8.75016ZM6.87565 12.0835C6.87565 11.8534 7.0622 11.6668 7.29232 11.6668H13.1257C13.3558 11.6668 13.5423 11.8534 13.5423 12.0835V12.5002C13.5423 12.7303 13.3558 12.9168 13.1257 12.9168H7.29232C7.0622 12.9168 6.87565 12.7303 6.87565 12.5002V12.0835ZM6.87565 15.4168C6.87565 15.1867 7.0622 15.0002 7.29232 15.0002H13.1257C13.3558 15.0002 13.5423 15.1867 13.5423 15.4168V15.8335C13.5423 16.0636 13.3558 16.2502 13.1257 16.2502H7.29232C7.0622 16.2502 6.87565 16.0636 6.87565 15.8335V15.4168Z" fill="#A9ACAC"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,10 +1,7 @@
import 'dart:io';
import 'package:drifter/pages/main_screen/main_screen_widget.dart';
import 'package:drifter/pages/splash_screen/splash_screen.dart'; import 'package:drifter/pages/splash_screen/splash_screen.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
void main() { void main() {
runApp(const MyApp()); runApp(const MyApp());
@ -15,7 +12,8 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return KeyboardDismisser(
child: MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
appBarTheme: const AppBarTheme(backgroundColor: AppColors.background), appBarTheme: const AppBarTheme(backgroundColor: AppColors.background),
@ -26,6 +24,7 @@ class MyApp extends StatelessWidget {
), ),
), ),
home: const Splash(), home: const Splash(),
),
); );
} }
} }

View File

@ -126,7 +126,7 @@ class ProfileScreenState extends State<ProfileScreen> {
}); });
} }
void keysExistDialog(String npubEncode, String nsecEncode) async { void _keysExistDialog(String npubEncode, String nsecEncode) async {
await showDialog( await showDialog(
context: context, context: context,
builder: ((context) { builder: ((context) {
@ -145,32 +145,127 @@ class ProfileScreenState extends State<ProfileScreen> {
privateKeyInput.text = Keys.nsecKey; privateKeyInput.text = Keys.nsecKey;
publicKeyInput.text = Keys.npubKey; publicKeyInput.text = Keys.npubKey;
return ListView( return Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
const SizedBox( const SizedBox(
height: 60, height: 60,
), ),
Padding( UserInfo(),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: UserInfo(),
),
const SizedBox( const SizedBox(
height: 40, height: 40,
), ),
FormKeys(), Row(
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Text(
"Public Key",
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
],
),
const SizedBox(height: 12),
publicKeyInput.text.isNotEmpty
? SelectableText(
publicKeyInput.text,
style: TextStyle(
fontSize: 16,
color: Colors.grey[800],
),
)
: Text(
"Public Key empty",
textAlign: TextAlign.left,
),
const SizedBox(
height: 12,
),
Row(
children: [
Text(
"Private Key",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
],
),
const SizedBox(height: 12),
privateKeyInput.text.isNotEmpty
? SelectableText(
privateKeyInput.text,
style: TextStyle(
fontSize: 16,
color: Colors.grey[800],
),
)
: Text(
"Private Key empty",
textAlign: TextAlign.left,
),
const SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Keys.keysExist
? Row(
children: [
ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.grey[500]),
),
onPressed: () {
showDialog(
context: context,
builder: (context) => DeleteKeysDialog(
onNoPressed: () {
Navigator.pop(context);
},
onYesPressed: () {
final currentContext = context;
_deleteKeysStorage().then(
(_) {
if (!Keys.keysExist) {
showFloatingFlushBar(
type: FlushBarType.warning,
message: "Keys deleted!",
context: context,
);
}
},
);
Navigator.pop(context);
},
),
);
},
child: Text(
"Delete",
),
),
],
)
: Container(),
Keys.keysExist Keys.keysExist
? ElevatedButton( ? ElevatedButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.all( backgroundColor:
AppColors.mainDarkBlue)), MaterialStateProperty.all(AppColors.background),
),
onPressed: () { onPressed: () {
keysExistDialog( _keysExistDialog(
Nostr.instance.keysService Nostr.instance.keysService
.encodePublicKeyToNpub(Keys.publicKey), .encodePublicKeyToNpub(Keys.publicKey),
Nostr.instance.keysService Nostr.instance.keysService
@ -184,7 +279,8 @@ class ProfileScreenState extends State<ProfileScreen> {
: ElevatedButton( : ElevatedButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor:
MaterialStateProperty.all(AppColors.background)), MaterialStateProperty.all(AppColors.background),
),
onPressed: () { onPressed: () {
final currentContext = context; final currentContext = context;
generateNewKeys().then( generateNewKeys().then(
@ -202,86 +298,13 @@ class ProfileScreenState extends State<ProfileScreen> {
}, },
); );
}, },
child: Text( child: const Text(
"Generate Keys", "Generate Keys",
), ),
), ),
Keys.keysExist
? Row(
children: [
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) => DeleteKeysDialog(
onNoPressed: () {
Navigator.pop(context);
},
onYesPressed: () {
final currentContext = context;
_deleteKeysStorage().then((_) {
if (!Keys.keysExist) {
showFloatingFlushBar(
type: FlushBarType.warning,
message: "Keys deleted!",
context: context,
);
}
});
Navigator.pop(context);
},
),
);
},
icon: const Icon(Icons.delete)),
],
)
: Container(),
], ],
), ),
)
], ],
);
}
Form FormKeys() {
return Form(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
TextFormField(
controller: privateKeyInput,
// _toHex ? widget.hexPriv : widget.nsecEncoded,
decoration: const InputDecoration(
labelText: 'Private Key',
border: OutlineInputBorder(),
),
maxLength: 64,
),
const SizedBox(
height: 20,
),
TextFormField(
controller: publicKeyInput,
// _toHex ? widget.hexPub : widget.npubEncoded,
decoration: const InputDecoration(
labelText: 'Public Key',
border: OutlineInputBorder(),
),
),
const SizedBox(
height: 40,
),
TextFormField(
decoration: const InputDecoration(
labelText: 'Relay',
border: OutlineInputBorder(),
),
),
],
),
), ),
); );
} }

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:drifter/theme/app_colors.dart';
import 'ok_button_widget.dart'; import 'ok_button_widget.dart';
@ -16,72 +15,62 @@ class DeleteKeysDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Dialog( return Dialog(
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), // borderRadius: BorderRadius.circular(12),
), // ),
child: Container( child: Container(
constraints: const BoxConstraints(maxWidth: 600), constraints: BoxConstraints(
maxWidth: 700,
maxHeight: 190,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white, color: Colors.white,
), ),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( const Text(
padding: const EdgeInsets.symmetric(vertical: 24), "Delete Keys",
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.redAccent,
),
child: const Center(
child: Text(
'Delete Keys!',
style: TextStyle( style: TextStyle(
fontSize: 28, fontSize: 28,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.black87,
), ),
), ),
), const SizedBox(height: 16),
),
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text( Text(
'Do you want to delete your keys?', "Are you sure you want to delete your keys?",
// textAlign: TextAlign.c,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.grey[700], color: Colors.grey[700],
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 12),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
TextButton( OkButton(
onPressed: onNoPressed, onPressed: onNoPressed,
child: Text( label: "No",
'On',
style: TextStyle(color: AppColors.mainDarkBlue),
), ),
const SizedBox(
width: 8,
), ),
OkButton( OkButton(
onPressed: onYesPressed, onPressed: onYesPressed,
label: 'YES', label: "Yes",
), ),
], ],
),
],
),
) )
], ],
), ),
), ),
),
); );
} }
} }

View File

@ -16,7 +16,7 @@ class DrifterDialog extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
@ -30,7 +30,7 @@ class DrifterDialog extends StatelessWidget {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Theme.of(context).extension<StackColors>()!.popupBG, color: Colors.white,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
20, 20,
), ),

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:drifter/theme/app_colors.dart';
import 'ok_button_widget.dart'; import 'ok_button_widget.dart';
@ -31,35 +30,34 @@ class _KeysExistDialogState extends State<KeysExistDialog> {
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
child: Container( child: Container(
constraints: const BoxConstraints(maxWidth: 600), constraints: BoxConstraints(
maxWidth: 700,
maxHeight: 340,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white, color: Colors.white,
), ),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Row(
padding: const EdgeInsets.symmetric(vertical: 24), mainAxisAlignment: MainAxisAlignment.center,
decoration: BoxDecoration( children: [
borderRadius: BorderRadius.circular(12), Text(
color: AppColors.mainDarkBlue, "Keys",
),
child: const Center(
child: Text(
'Keys',
style: TextStyle( style: TextStyle(
fontSize: 28, fontSize: 28,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.black,
),
), ),
), ),
],
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
Padding( Column(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
@ -96,33 +94,55 @@ class _KeysExistDialogState extends State<KeysExistDialog> {
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
Row( Padding(
mainAxisAlignment: MainAxisAlignment padding: const EdgeInsets.symmetric(horizontal: 10.0),
.spaceBetween, // Changed to space between to create space for icon buttons child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
IconButton( MaterialButton(
elevation: 3.0,
onPressed: () {
Navigator.of(context).pop();
},
color: Colors.grey[400],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
8.0,
),
),
child: Text(
"Cancel",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
_toHex
? OkButton(
onPressed: () { onPressed: () {
setState(() { setState(() {
_toHex = !_toHex; _toHex = !_toHex;
}); });
}, },
icon: const Icon(Icons.autorenew_outlined), label: "Encoded",
color: Colors.grey[700], )
), : OkButton(
OkButton(
onPressed: () { onPressed: () {
Navigator.pop(context); setState(() {
_toHex = !_toHex;
});
}, },
label: 'OK', label: "Hex",
), ),
], ],
),
) )
], ],
), ),
),
], ],
), ),
), ),
),
); );
} }
} }

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart';
class OkButton extends StatelessWidget { class OkButton extends StatelessWidget {
const OkButton({ const OkButton({
@ -16,7 +16,7 @@ class OkButton extends StatelessWidget {
return ElevatedButton( return ElevatedButton(
onPressed: onPressed, onPressed: onPressed,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: AppColors.mainDarkBlue, backgroundColor: AppColors.background,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),

View File

@ -1,4 +1,3 @@
import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class UserInfo extends StatelessWidget { class UserInfo extends StatelessWidget {
@ -8,7 +7,7 @@ class UserInfo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
child: Column( child: Column(
children: [ children: const [
AvatarWidget(), AvatarWidget(),
SizedBox( SizedBox(
height: 10, height: 10,
@ -25,13 +24,19 @@ class AvatarWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( // todo: create a slide up to choose avatar
decoration: BoxDecoration( return CircleAvatar(
border: Border.all(color: Colors.black), backgroundImage: NetworkImage('https://via.placeholder.com/150'),
borderRadius: BorderRadius.all(Radius.circular(75))), // backgroundColor: AppColors.mainAccent,
width: 150, radius: 40,
height: 150,
); );
// return Container(
// decoration: BoxDecoration(
// border: Border.all(color: Colors.black),
// borderRadius: BorderRadius.all(Radius.circular(75))),
// width: 150,
// height: 150,
// );
} }
} }
@ -75,20 +80,13 @@ class _UserNameWidgetState extends State<UserNameWidget> {
child: TextField( child: TextField(
controller: messageController, controller: messageController,
focusNode: messageFocusNode, focusNode: messageFocusNode,
textAlign: TextAlign.center,
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 14,
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Username', hintText: 'Username',
hintStyle: const TextStyle(fontSize: 14), hintStyle: const TextStyle(fontSize: 14),
suffixIcon: IconButton(
icon: const Icon(
Icons.send,
color: AppColors.mainDarkBlue,
size: 30,
),
onPressed: () {},
),
), ),
), ),
), ),

View File

@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
enum ButtonHeight {
xxs,
xs,
s,
m,
l,
xl,
xxl,
}
class CustomTextButtonBase extends StatelessWidget {
const CustomTextButtonBase({
Key? key,
this.width,
this.height,
this.textButton,
}) : super(key: key);
final double? width;
final double? height;
final TextButton? textButton;
@override
Widget build(BuildContext context) {
return SizedBox(
height: height,
width: width,
child: textButton,
);
}
}

View File

@ -34,6 +34,7 @@ dependencies:
nostr_tools: ^1.0.7 nostr_tools: ^1.0.7
flutter_secure_storage: ^8.0.0 flutter_secure_storage: ^8.0.0
flutter_svg: ^2.0.5 flutter_svg: ^2.0.5
keyboard_dismisser: ^3.0.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.