165 lines
6.4 KiB
Dart
165 lines
6.4 KiB
Dart
|
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 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.")
|
|||
|
]),
|
|||
|
);
|
|||
|
}
|