main #2

Closed
ryleedavis wants to merge 8 commits from alexvasl/drifter_app:main into main
14 changed files with 373 additions and 41 deletions
Showing only changes of commit 6921e30ecd - Show all commits

View File

@ -1,5 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:drifter/pages/create_account_screen/create_account_screen.dart';
import 'package:drifter/pages/home_screen/home_screen_widget.dart';
import 'package:drifter/pages/login_screen/login_screen.dart'; import 'package:drifter/pages/login_screen/login_screen.dart';
import 'package:drifter/pages/main_screen/main_screen_widget.dart'; 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';
@ -22,6 +24,8 @@ class MyApp extends StatelessWidget {
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
appBarTheme: const AppBarTheme(backgroundColor: AppColors.background), appBarTheme: const AppBarTheme(backgroundColor: AppColors.background),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(foregroundColor: AppColors.background)),
bottomNavigationBarTheme: const BottomNavigationBarThemeData( bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: AppColors.background, backgroundColor: AppColors.background,
selectedItemColor: AppColors.mainAccent, selectedItemColor: AppColors.mainAccent,
@ -29,11 +33,13 @@ class MyApp extends StatelessWidget {
), ),
), ),
routes: { routes: {
'/': (context) => const WelcomeScreen() '/': (context) => const Splash()
// Splash() // Splash()
, ,
'/login': (context) => const LoginScreen(), '/login': (context) => const LoginScreen(),
'/terms': (context) => const TermsOfServiceScreen(), '/terms': (context) => const TermsOfServiceScreen(),
'/createAccount': (context) => const CreateAccountScreen(),
'/MainScreen': (context) => const MainScreenWidget(),
}, },
); );
} }

24
lib/models/models.dart Normal file
View File

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:nostr_tools/nostr_tools.dart';
class Keys {
static String privateKey = '';
static String publicKey = '';
static String nsecKey = '';
static String npubKey = '';
static bool keysExist = false;
}
class Relay {
static final relay = RelayApi(relayUrl: 'wss://relay.damus.io');
}
final keyController = TextEditingController();
final formKey = GlobalKey<FormFieldState>();
final userNameController = TextEditingController();
final nameController = TextEditingController();
final descriptionController = TextEditingController();
class UserData {
static bool isLogin = true;
}

View File

@ -0,0 +1,164 @@
import 'package:dart_nostr/dart_nostr.dart';
import 'package:drifter/models/models.dart';
import 'package:drifter/pages/home_screen/widgets/message_text_button_widget.dart';
import 'package:drifter/pages/profile_screen/profile_screen.dart';
import 'package:drifter/pages/profile_screen/widgets/keys_option_modal_bottom_sheet.dart';
import 'package:drifter/pages/profile_screen/widgets/message_snack_bar.dart';
import 'package:drifter/pages/profile_screen/widgets/ok_button_widget.dart';
import 'package:drifter/widgets/btn_continue.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:drifter/utilities/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_svg/svg.dart';
import 'package:nostr_tools/nostr_tools.dart';
import 'package:sliding_switch/sliding_switch.dart';
import 'package:toggle_switch/toggle_switch.dart';
class CreateAccountScreen extends StatefulWidget {
const CreateAccountScreen({super.key});
@override
State<CreateAccountScreen> createState() => CreateAccountScreenState();
}
class CreateAccountScreenState extends State<CreateAccountScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: AppColors.topNavIconBack,
),
onPressed: () => Navigator.of(context).pop(),
),
actions: <Widget>[
TextButton(
onPressed: () {},
child: Text('Skip'),
)
],
elevation: 0,
backgroundColor: AppColors.mainBackground,
),
backgroundColor: AppColors.mainBackground,
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const Text(
'Create an account',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
),
const SizedBox(height: 13),
const Text(
'You can change this information later in your Profile.',
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400),
),
const SizedBox(height: 24),
TextField(
decoration: InputDecoration(
filled: true,
fillColor: AppColors.textFieldDefaultBg,
labelText: 'Username',
labelStyle: TextStyle(color: AppColors.textFieldDefaultText),
prefixIcon: const Icon(Icons.alternate_email),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(
width: 0,
style: BorderStyle.none,
),
),
iconColor: AppColors.textFieldDefaultIconTrail),
controller: userNameController,
),
const SizedBox(height: 8),
TextField(
decoration: InputDecoration(
filled: true,
fillColor: AppColors.textFieldDefaultBg,
labelText: 'Name (optional)',
labelStyle: TextStyle(color: AppColors.textFieldDefaultText),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(
width: 0,
style: BorderStyle.none,
),
),
iconColor: AppColors.textFieldDefaultIconTrail),
controller: nameController,
),
const SizedBox(height: 8),
SizedBox(
height: 112,
child: TextField(
minLines: 3,
maxLines: 5,
decoration: InputDecoration(
filled: true,
fillColor: AppColors.textFieldDefaultBg,
labelText: 'Description (optional)',
alignLabelWithHint: true,
labelStyle:
TextStyle(color: AppColors.textFieldDefaultText),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(
width: 0,
style: BorderStyle.none,
),
),
iconColor: AppColors.textFieldDefaultIconTrail),
controller: descriptionController,
),
),
Expanded(child: SizedBox()),
SizedBox(
width: double.infinity,
height: 56,
child: ElevatedButton(
onPressed: () {
Navigator.pushNamedAndRemoveUntil(
context, '/MainScreen', (_) => false);
},
child: Text(
'Continue',
style: TextStyle(fontSize: 16),
),
style: ButtonStyle(
shape: MaterialStatePropertyAll(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100))),
backgroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDefaultBg),
foregroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDefaultText)),
)),
],
),
),
);
}
}
abstract class Note {
static final note = Text.rich(
TextSpan(
style: TextStyle(
height: 1.6,
fontSize: 10,
fontWeight: FontWeight.w400,
),
children: <TextSpan>[
TextSpan(
style: TextStyle(color: AppColors.noteText),
text:
"Your private key starts with “nsec” or “hex” and gives your full access to your account. That means, if you log in using your private key, you will be able to make posts and send and receive private messages.\n\n"
"Your public key starts with “npub” and gives your view-only access to account. If you log in using your public key, you wont be able to make posts or access private messages, but you will be able to view your feed. Go to “View only” tab to log in via your public key.")
]),
);
}

View File

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:drifter/domain_models/domain_models.dart'; import 'package:drifter/domain_models/domain_models.dart';
import 'package:drifter/models/keys.dart'; import 'package:drifter/models/models.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:drifter/pages/home_screen/widgets/message_ok_button_widget.dart'; import 'package:drifter/pages/home_screen/widgets/message_ok_button_widget.dart';
import 'package:drifter/pages/home_screen/widgets/message_text_button_widget.dart'; import 'package:drifter/pages/home_screen/widgets/message_text_button_widget.dart';
@ -235,18 +235,10 @@ class DomainCard extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<String>? imageLinks = extractImage(domain.content); final List<String>? imageLinks = extractImage(domain.content);
return Container( return Container(
margin: const EdgeInsets.all(8), margin: const EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.mainLightBlue, color: Colors.grey,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: const Offset(0, 3),
),
],
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -1,12 +1,12 @@
import 'package:dart_nostr/dart_nostr.dart'; import 'package:dart_nostr/dart_nostr.dart';
import 'package:drifter/models/keys.dart'; import 'package:drifter/models/models.dart';
import 'package:drifter/pages/home_screen/widgets/message_text_button_widget.dart'; import 'package:drifter/pages/home_screen/widgets/message_text_button_widget.dart';
import 'package:drifter/pages/profile_screen/profile_screen.dart'; import 'package:drifter/pages/profile_screen/profile_screen.dart';
import 'package:drifter/pages/profile_screen/widgets/keys_option_modal_bottom_sheet.dart'; import 'package:drifter/pages/profile_screen/widgets/keys_option_modal_bottom_sheet.dart';
import 'package:drifter/pages/profile_screen/widgets/message_snack_bar.dart'; import 'package:drifter/pages/profile_screen/widgets/message_snack_bar.dart';
import 'package:drifter/pages/profile_screen/widgets/ok_button_widget.dart'; import 'package:drifter/pages/profile_screen/widgets/ok_button_widget.dart';
import 'package:drifter/pages/terms_of_service/button_continue.dart'; import 'package:drifter/widgets/btn_continue.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:drifter/utilities/assets.dart'; import 'package:drifter/utilities/assets.dart';
@ -27,6 +27,7 @@ class LoginScreen extends StatefulWidget {
class LoginScreenState extends State<LoginScreen> { class LoginScreenState extends State<LoginScreen> {
final keyGenerator = KeyApi(); final keyGenerator = KeyApi();
final nip19 = Nip19(); final nip19 = Nip19();
final indexToggle = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,6 +40,12 @@ class LoginScreenState extends State<LoginScreen> {
), ),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
actions: <Widget>[
TextButton(
onPressed: () {},
child: Text('Skip'),
)
],
elevation: 0, elevation: 0,
backgroundColor: AppColors.mainBackground, backgroundColor: AppColors.mainBackground,
), ),
@ -70,7 +77,9 @@ class LoginScreenState extends State<LoginScreen> {
customTextStyles: [ customTextStyles: [
TextStyle(fontSize: 14, fontWeight: FontWeight.w600) TextStyle(fontSize: 14, fontWeight: FontWeight.w600)
], ],
onToggle: (index) {}, onToggle: (indexToggle) {
print(indexToggle);
},
), ),
SizedBox( SizedBox(
height: 56, height: 56,

View File

@ -31,28 +31,28 @@ class _MainScreenWidgetState extends State<MainScreenWidget> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackground, backgroundColor: AppColors.mainBackground,
appBar: AppBar( appBar: AppBar(
title: Row( leading: IconButton(
// mainAxisAlignment: MainAxisAlignment.center, icon: Icon(Icons.settings),
children: [ color: AppColors.topNavIconPtimary,
SvgPicture.asset( onPressed: () {},
Assets.svg.drifterIcon, ),
height: 30, actions: <Widget>[
width: 30, IconButton(
alignment: Alignment.centerLeft, icon: Icon(Icons.rss_feed),
), color: AppColors.topNavIconPtimary,
const SizedBox( onPressed: () {},
width: 125, ),
), ],
const Text( title: const Text(
"Drifter", "Drifter",
style: TextStyle( style: TextStyle(
color: AppColors.mainAccent, color: AppColors.topNavText,
), ),
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
),
],
), ),
centerTitle: true, centerTitle: true,
backgroundColor: AppColors.mainBackground,
elevation: 0,
), ),
body: IndexedStack( body: IndexedStack(
index: _selectedTap, index: _selectedTap,
@ -64,6 +64,9 @@ class _MainScreenWidgetState extends State<MainScreenWidget> {
], ],
), ),
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
backgroundColor: AppColors.bottomNavBackground,
selectedItemColor: AppColors.bottomNavIconActive,
unselectedItemColor: AppColors.bottomNavIconDefault,
currentIndex: _selectedTap, currentIndex: _selectedTap,
items: const [ items: const [
BottomNavigationBarItem( BottomNavigationBarItem(

View File

@ -1,5 +1,5 @@
import 'package:dart_nostr/dart_nostr.dart'; import 'package:dart_nostr/dart_nostr.dart';
import 'package:drifter/models/keys.dart'; import 'package:drifter/models/models.dart';
import 'package:drifter/pages/profile_screen/widgets/delete_keys_dialog.dart'; import 'package:drifter/pages/profile_screen/widgets/delete_keys_dialog.dart';
import 'package:drifter/main.dart'; import 'package:drifter/main.dart';
import 'package:drifter/pages/profile_screen/widgets/key_exist_dialog.dart'; import 'package:drifter/pages/profile_screen/widgets/key_exist_dialog.dart';

View File

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:drifter/pages/main_screen/main_screen_widget.dart'; import 'package:drifter/pages/main_screen/main_screen_widget.dart';
import 'package:drifter/pages/welcome_screen/welcome_screen.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -18,7 +19,7 @@ class _SplashState extends State<Splash> {
super.initState(); super.initState();
Future.delayed(const Duration(seconds: 3), () { Future.delayed(const Duration(seconds: 3), () {
Navigator.pushReplacement(context, Navigator.pushReplacement(context,
MaterialPageRoute(builder: (context) => const MainScreenWidget())); MaterialPageRoute(builder: (context) => const WelcomeScreen()));
}); });
} }

View File

@ -0,0 +1,55 @@
import 'package:drifter/models/models.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart';
class DisabledElevatedButton extends StatelessWidget {
const DisabledElevatedButton({
super.key,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: null,
child: Text(
'Continue',
style: TextStyle(fontSize: 16),
),
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(100))),
backgroundColor:
const MaterialStatePropertyAll(AppColors.buttonPrimaryDisabledBg),
foregroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDisabledText)),
);
}
}
class ActiveElevatedButton extends StatelessWidget {
const ActiveElevatedButton({
super.key,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
UserData.isLogin
? Navigator.pushNamed(context, '/login')
: Navigator.pushNamed(context, '/createAccount');
},
child: Text(
'Continue',
style: TextStyle(fontSize: 16),
),
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(100))),
backgroundColor:
const MaterialStatePropertyAll(AppColors.buttonPrimaryDefaultBg),
foregroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDefaultText)),
);
}
}

View File

@ -1,4 +1,4 @@
import 'package:drifter/pages/terms_of_service/button_continue.dart'; import 'package:drifter/pages/terms_of_service/btn_continue_terms_of_service.dart';
import 'package:drifter/pages/terms_of_service/terms_of_service_text.dart'; import 'package:drifter/pages/terms_of_service/terms_of_service_text.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

View File

@ -1,3 +1,4 @@
import 'package:drifter/models/models.dart';
import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -23,6 +24,7 @@ class WelcomeScreen extends StatelessWidget {
width: double.infinity, width: double.infinity,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
UserData.isLogin = true;
Navigator.pushNamed(context, '/terms'); Navigator.pushNamed(context, '/terms');
}, },
child: Text( child: Text(
@ -44,7 +46,10 @@ class WelcomeScreen extends StatelessWidget {
height: 56, height: 56,
width: double.infinity, width: double.infinity,
child: OutlinedButton( child: OutlinedButton(
onPressed: () {}, onPressed: () {
UserData.isLogin = false;
Navigator.pushNamed(context, '/terms');
},
child: Text( child: Text(
'Create an account', 'Create an account',
style: TextStyle(fontSize: 16), style: TextStyle(fontSize: 16),

View File

@ -19,6 +19,13 @@ abstract class AppColors {
static const topNavIconBack = Color(0xFF4A40EC); static const topNavIconBack = Color(0xFF4A40EC);
static const topNavIconBg = Color(0xFFE3E0F9); static const topNavIconBg = Color(0xFFE3E0F9);
// BottomNav
static const bottomNavIconDefault = Color(0xFF787680);
static const bottomNavIconActive = Color(0xFF4A40EC);
static const bottomNavBackground = Color(0xFFFFFFFF);
static const bottomNavShadow = Color(0xFFF2EFFF);
// Checkbox // Checkbox
static const checkboxCheckedIcon = Color(0xFFFFFFFF); static const checkboxCheckedIcon = Color(0xFFFFFFFF);
static const checkboxCheckedBg = Color(0xFF4A40EC); static const checkboxCheckedBg = Color(0xFF4A40EC);
@ -51,4 +58,18 @@ abstract class AppColors {
static const mainDarkBlue = Color.fromRGBO(3, 37, 65, 1); static const mainDarkBlue = Color.fromRGBO(3, 37, 65, 1);
static const mainLightBlue = Color.fromRGBO(48, 86, 117, 1); static const mainLightBlue = Color.fromRGBO(48, 86, 117, 1);
// Post
static const postFullName = Color(0xFF302F38);
static const postUserName = Color(0xFFC8C5D0);
static const postBg = Color(0xFFF9F8FF);
static const postTime = Color(0xFFC8C5D0);
static const postMoreIcon = Color(0xFF323232);
static const postBodyText = Color(0xFF000000);
static const postBodyLink = Color(0xFF3A00E5);
static const postActionNumber = Color(0xFFC8C5D0);
static const postActionIconDefault = Color(0xFFC8C5D0);
static const postActionIconPressed = Color(0xFFFE82B1);
static const postBookmark = Color(0xFF8482FF);
} }

View File

@ -0,0 +1,52 @@
import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart';
class DisabledElevatedButton extends StatelessWidget {
const DisabledElevatedButton({
super.key,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: null,
child: Text(
'Continue',
style: TextStyle(fontSize: 16),
),
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(100))),
backgroundColor:
const MaterialStatePropertyAll(AppColors.buttonPrimaryDisabledBg),
foregroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDisabledText)),
);
}
}
class ActiveElevatedButton extends StatelessWidget {
const ActiveElevatedButton({
super.key,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
Navigator.pushNamed(context, '/login');
},
child: Text(
'Continue',
style: TextStyle(fontSize: 16),
),
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(100))),
backgroundColor:
const MaterialStatePropertyAll(AppColors.buttonPrimaryDefaultBg),
foregroundColor: const MaterialStatePropertyAll(
AppColors.buttonPrimaryDefaultText)),
);
}
}

View File

@ -64,7 +64,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- assets/images/logo/welcome.png - assets/images/logo/
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg