Skip to content

Commit

Permalink
login rework
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiidb committed Mar 24, 2023
1 parent a086081 commit faa3927
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 56 deletions.
2 changes: 2 additions & 0 deletions lib/views/auth/login.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nygma/views/index_or_login.dart';

import '../../components/buttons/gradient_button.dart';
import '../../components/labeled_text_form_field.dart';
Expand Down Expand Up @@ -42,6 +43,7 @@ class LoginPage extends StatelessWidget {
onPressed: () {
authController.loginNsec(
authController.privkeyController.text);
Get.offAll(IndexOrLogin());
},
text: "continue".tr,
),
Expand Down
121 changes: 65 additions & 56 deletions lib/views/login_choice.dart
Original file line number Diff line number Diff line change
@@ -1,81 +1,90 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nygma/app_theme.dart';
import 'package:nygma/views/auth/login.dart';
import 'package:nygma/views/index_page.dart';
import 'package:nygma/views/recover_page.dart';

import '../components/buttons/gradient_button.dart';
import '../constants/colors.dart';
import '../controllers/auth_controller.dart';
import 'index_or_login.dart';

class LoginChoicePage extends StatelessWidget {
const LoginChoicePage({Key? key}) : super(key: key);
final AuthController authController = Get.put(AuthController());
LoginChoicePage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Row(children: [
ClipRRect(
borderRadius: BorderRadius.circular(25),
child: Image.asset(
'images/icon.png',
height: 50,
return GetX<AuthController>(builder: (controller) {
if (controller.pubkey.value != "") {
return IndexPage();
}
return Scaffold(
appBar: AppBar(
title: Row(children: [
ClipRRect(
borderRadius: BorderRadius.circular(25),
child: Image.asset(
'images/icon.png',
height: 50,
),
),
),
const SizedBox(
width: 10,
),
const Text(
"Nygma",
style: TextStyle(fontSize: 20),
)
]),
actions: []),
body: DecoratedBox(
decoration: const BoxDecoration(gradient: kBgGradient),
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
height: 60,
child: GradientButton(
onPressed: () {
Get.offAll(IndexOrLogin());
},
child: const Text(
'Login',
style: TextStyle(
fontSize: 24,
const SizedBox(
width: 10,
),
const Text(
"Nygma",
style: TextStyle(fontSize: 20),
)
]),
actions: []),
body: DecoratedBox(
decoration: const BoxDecoration(gradient: kBgGradient),
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
height: 60,
child: GradientButton(
onPressed: () {
Get.to(LoginPage());
},
child: const Text(
'Login',
style: TextStyle(
fontSize: 24,
),
),
),
),
),
const SizedBox(height: 20),
SizedBox(
width: double.infinity,
height: 60,
child: GradientButton(
onPressed: () {
Get.to(RecoverPage());
},
child: const Text(
'Recover',
style: TextStyle(
fontSize: 24,
color: Colors.white,
const SizedBox(height: 20),
SizedBox(
width: double.infinity,
height: 60,
child: GradientButton(
onPressed: () {
Get.to(RecoverPage());
},
child: const Text(
'Recover',
style: TextStyle(
fontSize: 24,
color: Colors.white,
),
),
),
),
),
],
],
),
),
),
),
),
);
);
});
}
}

0 comments on commit faa3927

Please sign in to comment.