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:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:gotrue/gotrue.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/widgets/scroll_view_without_animation.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 {
|
class LoginPage extends StatefulWidget {
|
||||||
LoginPage({Key key, this.title}) : super(key: key);
|
LoginPage({Key key, this.title}) : super(key: key);
|
||||||
@ -47,56 +50,18 @@ class LoginPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _LoginPageState extends State<LoginPage> {
|
class _LoginPageState extends State<LoginPage> {
|
||||||
Widget _backButton() {
|
var goTrue = GoTrue(_localDevServer);
|
||||||
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),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _entryField(String title, {bool isPassword = false}) {
|
Future<void> _loginAction() async {
|
||||||
return Container(
|
var t = await goTrue.login('handa.vish@gmail.com', 'blah');
|
||||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
print("Got Token: $t");
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
var user = await goTrue.user(t.accessToken);
|
||||||
children: <Widget>[
|
print("Got usre: $user");
|
||||||
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,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _submitButton() {
|
Widget _submitButton() {
|
||||||
return Container(
|
var c = Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@ -120,6 +85,13 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
style: TextStyle(fontSize: 20, color: Colors.white),
|
style: TextStyle(fontSize: 20, color: Colors.white),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_loginAction();
|
||||||
|
},
|
||||||
|
child: c,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _divider() {
|
Widget _divider() {
|
||||||
|
16
pubspec.lock
16
pubspec.lock
@ -199,6 +199,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.2+4"
|
version: "0.4.2+4"
|
||||||
|
dio:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dio
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.10"
|
||||||
dots_indicator:
|
dots_indicator:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -476,6 +483,15 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
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:
|
html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -67,6 +67,9 @@ dependencies:
|
|||||||
email_validator: ^1.0.6
|
email_validator: ^1.0.6
|
||||||
icloud_documents_path:
|
icloud_documents_path:
|
||||||
git: https://github.com/GitJournal/icloud_documents_path.git
|
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:
|
dev_dependencies:
|
||||||
flutter_launcher_icons: "^0.7.2"
|
flutter_launcher_icons: "^0.7.2"
|
||||||
|
Reference in New Issue
Block a user