mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Login: Try actually logging in with gotrue
This commit is contained in:
@ -33,9 +33,12 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:gotrue/gotrue.dart';
|
||||
|
||||
import 'package:gitjournal/widgets/scroll_view_without_animation.dart';
|
||||
|
||||
//import 'Widget/bezierContainer.dart';
|
||||
const _localDevServer = 'http://192.168.1.130:9999/';
|
||||
// const _prodServer = 'https://api.gitjournal.io/auth/';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
LoginPage({Key key, this.title}) : super(key: key);
|
||||
@ -47,56 +50,18 @@ class LoginPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LoginPageState extends State<LoginPage> {
|
||||
Widget _backButton() {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: const Icon(Icons.keyboard_arrow_left, color: Colors.black),
|
||||
),
|
||||
const Text(
|
||||
'Back',
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
var goTrue = GoTrue(_localDevServer);
|
||||
|
||||
Widget _entryField(String title, {bool isPassword = false}) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
TextField(
|
||||
obscureText: isPassword,
|
||||
decoration: const InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Color(0xfff3f3f4),
|
||||
filled: true,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
Future<void> _loginAction() async {
|
||||
var t = await goTrue.login('handa.vish@gmail.com', 'blah');
|
||||
print("Got Token: $t");
|
||||
|
||||
var user = await goTrue.user(t.accessToken);
|
||||
print("Got usre: $user");
|
||||
}
|
||||
|
||||
Widget _submitButton() {
|
||||
return Container(
|
||||
var c = Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
alignment: Alignment.center,
|
||||
@ -120,6 +85,13 @@ class _LoginPageState extends State<LoginPage> {
|
||||
style: TextStyle(fontSize: 20, color: Colors.white),
|
||||
),
|
||||
);
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
_loginAction();
|
||||
},
|
||||
child: c,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _divider() {
|
||||
|
16
pubspec.lock
16
pubspec.lock
@ -199,6 +199,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.2+4"
|
||||
dio:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.10"
|
||||
dots_indicator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -476,6 +483,15 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
gotrue:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "5fea2573f075cd307e8cf0c323487b4685f28a87"
|
||||
url: "https://github.com/GitJournal/gotrue-dart.git"
|
||||
source: git
|
||||
version: "1.0.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -67,6 +67,9 @@ dependencies:
|
||||
email_validator: ^1.0.6
|
||||
icloud_documents_path:
|
||||
git: https://github.com/GitJournal/icloud_documents_path.git
|
||||
gotrue:
|
||||
#path: /Users/vishesh/src/gitjournal/gotrue-dart/
|
||||
git: https://github.com/GitJournal/gotrue-dart.git
|
||||
|
||||
dev_dependencies:
|
||||
flutter_launcher_icons: "^0.7.2"
|
||||
|
Reference in New Issue
Block a user