Finish user log in to endi's account + rename some files and class
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FooterLogWidget extends StatelessWidget {
|
||||
final TextStyle style = TextStyle(fontFamily: 'Varela Round', fontSize: 20.0);
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
_enDIUrl(),
|
||||
SizedBox(height: 5),
|
||||
_astrolabeUrl()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _enDIUrl() {
|
||||
return InkWell(
|
||||
onTap: _launchLinkEnDI,
|
||||
child: Text(
|
||||
"En collaboration avec enDI",
|
||||
style: style.copyWith(
|
||||
color: Colors.black,
|
||||
fontSize: 15.0,
|
||||
decoration: TextDecoration.underline),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _astrolabeUrl() {
|
||||
return InkWell(
|
||||
onTap: _launchLinkAstrolabe,
|
||||
child: Text(
|
||||
"Développé par Astrolabe",
|
||||
style: style.copyWith(
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
decoration: TextDecoration.underline),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _launchLinkEnDI() async {
|
||||
const urlEndi = "https://endi.coop";
|
||||
|
||||
if (await canLaunch(urlEndi)) {
|
||||
await launch(urlEndi);
|
||||
} else {
|
||||
//TODO : error message
|
||||
}
|
||||
}
|
||||
|
||||
void _launchLinkAstrolabe() async {
|
||||
const url = "https://astrolabe.coop";
|
||||
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
} else {
|
||||
//TODO : error message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:astronote_app/providers/sign_in.dart';
|
||||
|
||||
class FormLogWidget extends StatefulWidget {
|
||||
@override
|
||||
_FormLogWidgetState createState() => _FormLogWidgetState();
|
||||
}
|
||||
|
||||
class _FormLogWidgetState extends State<FormLogWidget> {
|
||||
TextStyle style = TextStyle(fontFamily: 'Varela Round', fontSize: 20.0);
|
||||
|
||||
bool _obscurePassword = true;
|
||||
final GlobalKey<FormState> _formKey = GlobalKey();
|
||||
bool _isLoading = false;
|
||||
|
||||
TextEditingController urlController = new TextEditingController();
|
||||
TextEditingController emailController = new TextEditingController();
|
||||
TextEditingController passwordController = new TextEditingController();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
_urlFormField(),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
_emailFormField(),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
_passwordFormField(),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.07),
|
||||
_logButton()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _urlFormField() {
|
||||
return TextFormField(
|
||||
controller: urlController,
|
||||
style: style,
|
||||
keyboardType: TextInputType.url,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
|
||||
labelText: "Lien enDI",
|
||||
suffixIcon: Icon(Icons.link,color: Colors.indigo[900]),
|
||||
border:
|
||||
OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _emailFormField() {
|
||||
return TextFormField(
|
||||
controller: emailController,
|
||||
style: style,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
|
||||
labelText: "E-mail",
|
||||
suffixIcon: Icon(Icons.mail,color: Colors.indigo[900]),
|
||||
border:
|
||||
OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _passwordFormField() {
|
||||
return TextFormField(
|
||||
controller: passwordController,
|
||||
style: style,
|
||||
obscureText: _obscurePassword,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
|
||||
labelText: "Mot de passe",
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscurePassword ? Icons.visibility : Icons.visibility_off,color: Colors.indigo[900]),
|
||||
onPressed: () {
|
||||
setState(() => _obscurePassword = !_obscurePassword);
|
||||
}),
|
||||
border:
|
||||
OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _logButton() {
|
||||
return Material(
|
||||
elevation: 3.0,
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
color: Colors.indigo[900],
|
||||
child: MaterialButton(
|
||||
// minWidth: MediaQuery.of(context).size.width,
|
||||
padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
SignIn().login(urlController.text, emailController.text, passwordController.text);
|
||||
},
|
||||
child: Text("Connexion",
|
||||
textAlign: TextAlign.center,
|
||||
style: style.copyWith(
|
||||
color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HeaderLogWidget extends StatelessWidget {
|
||||
final TextStyle style = TextStyle(fontFamily: 'Varela Round', fontSize: 20.0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.09),
|
||||
child: Column(
|
||||
children: <Widget>[_astrolabeLogo(), SizedBox(height: 5.0), _appTitle(context)],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _astrolabeLogo() {
|
||||
return Image.asset(
|
||||
"assets/astrolabe_logo.jpg",
|
||||
);
|
||||
}
|
||||
|
||||
Widget _appTitle(BuildContext context) {
|
||||
return Text("AstroNotes",
|
||||
style:
|
||||
style.copyWith(color: Colors.black, fontSize: 40));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user