Compare commits

..

No commits in common. "dac68c0b86a112cad705f5aaa77afc1e10cb3028" and "05dc4bdd948788a102890e29ed636570fd2498f9" have entirely different histories.

10 changed files with 233 additions and 299 deletions

View File

@ -1,3 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,7 +1,10 @@
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/theme/app_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
void main() {
runApp(const MyApp());
@ -12,19 +15,17 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return KeyboardDismisser(
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
appBarTheme: const AppBarTheme(backgroundColor: AppColors.background),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: AppColors.background,
selectedItemColor: AppColors.mainAccent,
unselectedItemColor: Colors.grey,
),
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
appBarTheme: const AppBarTheme(backgroundColor: AppColors.background),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: AppColors.background,
selectedItemColor: AppColors.mainAccent,
unselectedItemColor: Colors.grey,
),
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(
context: context,
builder: ((context) {
@ -145,127 +145,32 @@ class ProfileScreenState extends State<ProfileScreen> {
privateKeyInput.text = Keys.nsecKey;
publicKeyInput.text = Keys.npubKey;
return Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(
height: 60,
),
UserInfo(),
const SizedBox(
height: 40,
),
Row(
return ListView(
children: [
const SizedBox(
height: 60,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: UserInfo(),
),
const SizedBox(
height: 40,
),
FormKeys(),
SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
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
? ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(AppColors.background),
),
backgroundColor: MaterialStateProperty.all(
AppColors.mainDarkBlue)),
onPressed: () {
_keysExistDialog(
keysExistDialog(
Nostr.instance.keysService
.encodePublicKeyToNpub(Keys.publicKey),
Nostr.instance.keysService
@ -278,9 +183,8 @@ class ProfileScreenState extends State<ProfileScreen> {
)
: ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(AppColors.background),
),
backgroundColor:
MaterialStateProperty.all(AppColors.background)),
onPressed: () {
final currentContext = context;
generateNewKeys().then(
@ -298,13 +202,86 @@ class ProfileScreenState extends State<ProfileScreen> {
},
);
},
child: const Text(
child: Text(
"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,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:drifter/theme/app_colors.dart';
import 'ok_button_widget.dart';
@ -15,60 +16,70 @@ class DeleteKeysDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Dialog(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(12),
// ),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Container(
constraints: BoxConstraints(
maxWidth: 700,
maxHeight: 190,
),
constraints: const BoxConstraints(maxWidth: 600),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Delete Keys",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black87,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.symmetric(vertical: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.redAccent,
),
child: const Center(
child: Text(
'Delete Keys!',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
const SizedBox(height: 16),
Text(
"Are you sure you want to delete your keys?",
// textAlign: TextAlign.c,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.end,
),
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
OkButton(
onPressed: onNoPressed,
label: "No",
Text(
'Do you want to delete your keys?',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
const SizedBox(
width: 8,
),
OkButton(
onPressed: onYesPressed,
label: "Yes",
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: onNoPressed,
child: Text(
'On',
style: TextStyle(color: AppColors.mainDarkBlue),
),
),
OkButton(
onPressed: onYesPressed,
label: 'YES',
),
],
),
],
)
],
),
),
)
],
),
),
);

View File

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

View File

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

View File

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

View File

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

View File

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