diff --git a/lib/main.dart b/lib/main.dart index f081039..4e83a28 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,7 @@ 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/main_screen/main_screen_widget.dart'; import 'package:drifter/pages/splash_screen/splash_screen.dart'; @@ -22,6 +24,8 @@ class MyApp extends StatelessWidget { title: 'Flutter Demo', theme: ThemeData( appBarTheme: const AppBarTheme(backgroundColor: AppColors.background), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom(foregroundColor: AppColors.background)), bottomNavigationBarTheme: const BottomNavigationBarThemeData( backgroundColor: AppColors.background, selectedItemColor: AppColors.mainAccent, @@ -29,11 +33,13 @@ class MyApp extends StatelessWidget { ), ), routes: { - '/': (context) => const WelcomeScreen() + '/': (context) => const Splash() // Splash() , '/login': (context) => const LoginScreen(), '/terms': (context) => const TermsOfServiceScreen(), + '/createAccount': (context) => const CreateAccountScreen(), + '/MainScreen': (context) => const MainScreenWidget(), }, ); } diff --git a/lib/models/models.dart b/lib/models/models.dart new file mode 100644 index 0000000..bda3f8b --- /dev/null +++ b/lib/models/models.dart @@ -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(); +final userNameController = TextEditingController(); +final nameController = TextEditingController(); +final descriptionController = TextEditingController(); + +class UserData { + static bool isLogin = true; +} diff --git a/lib/pages/create_account_screen/create_account_screen.dart b/lib/pages/create_account_screen/create_account_screen.dart new file mode 100644 index 0000000..c745baf --- /dev/null +++ b/lib/pages/create_account_screen/create_account_screen.dart @@ -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 createState() => CreateAccountScreenState(); +} + +class CreateAccountScreenState extends State { + @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: [ + 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( + 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 won’t 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.") + ]), + ); +} diff --git a/lib/pages/home_screen/home_screen_widget.dart b/lib/pages/home_screen/home_screen_widget.dart index e9e7a31..6524249 100644 --- a/lib/pages/home_screen/home_screen_widget.dart +++ b/lib/pages/home_screen/home_screen_widget.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:flutter/material.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/pages/home_screen/widgets/message_ok_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) { final List? imageLinks = extractImage(domain.content); return Container( - margin: const EdgeInsets.all(8), + margin: const EdgeInsets.all(4), decoration: BoxDecoration( - color: AppColors.mainLightBlue, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 2, - blurRadius: 5, - offset: const Offset(0, 3), - ), - ], + color: Colors.grey, + borderRadius: BorderRadius.circular(8), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/login_screen/login_screen.dart b/lib/pages/login_screen/login_screen.dart index 47a6133..11fe95c 100644 --- a/lib/pages/login_screen/login_screen.dart +++ b/lib/pages/login_screen/login_screen.dart @@ -1,12 +1,12 @@ 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/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/pages/terms_of_service/button_continue.dart'; +import 'package:drifter/widgets/btn_continue.dart'; import 'package:drifter/theme/app_colors.dart'; import 'package:drifter/utilities/assets.dart'; @@ -27,6 +27,7 @@ class LoginScreen extends StatefulWidget { class LoginScreenState extends State { final keyGenerator = KeyApi(); final nip19 = Nip19(); + final indexToggle = 0; @override Widget build(BuildContext context) { @@ -39,6 +40,12 @@ class LoginScreenState extends State { ), onPressed: () => Navigator.of(context).pop(), ), + actions: [ + TextButton( + onPressed: () {}, + child: Text('Skip'), + ) + ], elevation: 0, backgroundColor: AppColors.mainBackground, ), @@ -70,7 +77,9 @@ class LoginScreenState extends State { customTextStyles: [ TextStyle(fontSize: 14, fontWeight: FontWeight.w600) ], - onToggle: (index) {}, + onToggle: (indexToggle) { + print(indexToggle); + }, ), SizedBox( height: 56, diff --git a/lib/pages/main_screen/main_screen_widget.dart b/lib/pages/main_screen/main_screen_widget.dart index d7ebc7f..0d43224 100644 --- a/lib/pages/main_screen/main_screen_widget.dart +++ b/lib/pages/main_screen/main_screen_widget.dart @@ -31,28 +31,28 @@ class _MainScreenWidgetState extends State { return Scaffold( backgroundColor: AppColors.mainBackground, appBar: AppBar( - title: Row( - // mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset( - Assets.svg.drifterIcon, - height: 30, - width: 30, - alignment: Alignment.centerLeft, - ), - const SizedBox( - width: 125, - ), - const Text( - "Drifter", - style: TextStyle( - color: AppColors.mainAccent, - ), - // textAlign: TextAlign.center, - ), - ], + leading: IconButton( + icon: Icon(Icons.settings), + color: AppColors.topNavIconPtimary, + onPressed: () {}, + ), + actions: [ + IconButton( + icon: Icon(Icons.rss_feed), + color: AppColors.topNavIconPtimary, + onPressed: () {}, + ), + ], + title: const Text( + "Drifter", + style: TextStyle( + color: AppColors.topNavText, + ), + // textAlign: TextAlign.center, ), centerTitle: true, + backgroundColor: AppColors.mainBackground, + elevation: 0, ), body: IndexedStack( index: _selectedTap, @@ -64,6 +64,9 @@ class _MainScreenWidgetState extends State { ], ), bottomNavigationBar: BottomNavigationBar( + backgroundColor: AppColors.bottomNavBackground, + selectedItemColor: AppColors.bottomNavIconActive, + unselectedItemColor: AppColors.bottomNavIconDefault, currentIndex: _selectedTap, items: const [ BottomNavigationBarItem( diff --git a/lib/pages/profile_screen/profile_screen.dart b/lib/pages/profile_screen/profile_screen.dart index eaf1743..4d656f7 100644 --- a/lib/pages/profile_screen/profile_screen.dart +++ b/lib/pages/profile_screen/profile_screen.dart @@ -1,5 +1,5 @@ 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/main.dart'; import 'package:drifter/pages/profile_screen/widgets/key_exist_dialog.dart'; diff --git a/lib/pages/splash_screen/splash_screen.dart b/lib/pages/splash_screen/splash_screen.dart index 1e7a69f..f05810e 100644 --- a/lib/pages/splash_screen/splash_screen.dart +++ b/lib/pages/splash_screen/splash_screen.dart @@ -1,6 +1,7 @@ import 'dart:io'; 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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -18,7 +19,7 @@ class _SplashState extends State { super.initState(); Future.delayed(const Duration(seconds: 3), () { Navigator.pushReplacement(context, - MaterialPageRoute(builder: (context) => const MainScreenWidget())); + MaterialPageRoute(builder: (context) => const WelcomeScreen())); }); } diff --git a/lib/pages/terms_of_service/btn_continue_terms_of_service.dart b/lib/pages/terms_of_service/btn_continue_terms_of_service.dart new file mode 100644 index 0000000..d878e1c --- /dev/null +++ b/lib/pages/terms_of_service/btn_continue_terms_of_service.dart @@ -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)), + ); + } +} diff --git a/lib/pages/terms_of_service/terms_of_service.dart b/lib/pages/terms_of_service/terms_of_service.dart index 9488246..1843f4a 100644 --- a/lib/pages/terms_of_service/terms_of_service.dart +++ b/lib/pages/terms_of_service/terms_of_service.dart @@ -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/theme/app_colors.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/welcome_screen/welcome_screen.dart b/lib/pages/welcome_screen/welcome_screen.dart index 86d5c8c..95affb3 100644 --- a/lib/pages/welcome_screen/welcome_screen.dart +++ b/lib/pages/welcome_screen/welcome_screen.dart @@ -1,3 +1,4 @@ +import 'package:drifter/models/models.dart'; import 'package:drifter/theme/app_colors.dart'; import 'package:flutter/material.dart'; @@ -23,6 +24,7 @@ class WelcomeScreen extends StatelessWidget { width: double.infinity, child: ElevatedButton( onPressed: () { + UserData.isLogin = true; Navigator.pushNamed(context, '/terms'); }, child: Text( @@ -44,7 +46,10 @@ class WelcomeScreen extends StatelessWidget { height: 56, width: double.infinity, child: OutlinedButton( - onPressed: () {}, + onPressed: () { + UserData.isLogin = false; + Navigator.pushNamed(context, '/terms'); + }, child: Text( 'Create an account', style: TextStyle(fontSize: 16), diff --git a/lib/theme/app_colors.dart b/lib/theme/app_colors.dart index c0141ef..a727e69 100644 --- a/lib/theme/app_colors.dart +++ b/lib/theme/app_colors.dart @@ -19,6 +19,13 @@ abstract class AppColors { static const topNavIconBack = Color(0xFF4A40EC); 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 static const checkboxCheckedIcon = Color(0xFFFFFFFF); static const checkboxCheckedBg = Color(0xFF4A40EC); @@ -51,4 +58,18 @@ abstract class AppColors { static const mainDarkBlue = Color.fromRGBO(3, 37, 65, 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); } diff --git a/lib/widgets/btn_continue.dart b/lib/widgets/btn_continue.dart new file mode 100644 index 0000000..1bda815 --- /dev/null +++ b/lib/widgets/btn_continue.dart @@ -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)), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 9911b8c..c79fc99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - - assets/images/logo/welcome.png + - assets/images/logo/ # - images/a_dot_ham.jpeg