import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class HomeLog extends StatefulWidget { @override _HomeLogState createState() => _HomeLogState(); } class _HomeLogState extends State { TextStyle style = TextStyle(fontFamily: 'Varela Round', fontSize: 20.0); final GlobalKey _globalKey = GlobalKey(); @override Widget build(BuildContext context) { return Scaffold( key: _globalKey, body: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height, color: Colors.white, child: Padding( padding: EdgeInsets.all(50), child: Column( children: [ SizedBox(height: 40), _logoApp(), _titleApp(), SizedBox(height: 90), _emailField(), SizedBox(height: 30), _passwordField(), SizedBox(height: 50), _logButton(), SizedBox(height: 70), _enDIUrl(), SizedBox(height: 10), _astrolabeUrl() ], ), ), ), ), ); } Widget _logoApp() { return SizedBox( height: 100.0, child: Image.asset( "assets/astrolabe_logo.jpg", ), ); } Widget _titleApp() { return Text( "AstroNotes", style: style.copyWith(color: Colors.black, fontSize: 40), ); } Widget _emailField() { return TextField( style: style, keyboardType: TextInputType.emailAddress, decoration: InputDecoration( contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), labelText: "E-mail", border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))), ); } Widget _passwordField() { return TextField( style: style, obscureText: true, decoration: InputDecoration( contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), labelText: "Mot de passe", border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0))), ); } Widget _logButton() { return Material( elevation: 5.0, borderRadius: BorderRadius.circular(30.0), color: Color(0xFF4A148C), child: MaterialButton( // minWidth: MediaQuery.of(context).size.width, padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), onPressed: () {}, child: Text("Connexion", textAlign: TextAlign.center, style: style.copyWith( color: Colors.white, fontWeight: FontWeight.bold)), )); } void _launchLinkEnDI() async { const url = "https://endi.coop"; if (await canLaunch(url)) { await launch(url); } else { final snack = SnackBar( content: Text("Impossible de lancer le lien"), duration: Duration(seconds: 4), backgroundColor: Colors.red[300], ); _globalKey.currentState.showSnackBar(snack); } } void _launchLinkAstrolabe() async { const url = "https://astrolabe.coop"; if (await canLaunch(url)) { await launch(url); } else { final snack = SnackBar( content: Text("Impossible de lancer le lien"), duration: Duration(seconds: 4), backgroundColor: Colors.red[300], ); _globalKey.currentState.showSnackBar(snack); } } Widget _enDIUrl() { return InkWell( onTap: _launchLinkEnDI, child: Text( "En collaboration avec enDI", style: style.copyWith( color: Colors.black, fontSize: 15, 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), ), ); } }