import 'package:flutter/material.dart';
import 'package:umessage/contstrains/app_colors.dart';
import 'package:umessage/http_api_client.dart';
import 'package:umessage/locator.dart';
import 'package:umessage/widgets/navbar/navbar_tablet_desktop.dart';
class AuthView extends StatefulWidget {
AuthView({Key key}) : super(key: key);
@override
_AuthViewState createState() => _AuthViewState();
}
class _AuthViewState extends State<AuthView> {
TextEditingController _emailController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
bool rememberMe = false;
ApiClient apiClient = ApiClient.getInstance();
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: EdgeInsets.only(top: 150, left: 60, right: 60),
child: Column(
children: <Widget>[
Text(
'Авторизация',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 28, color: textColor),
),
SizedBox(
height: 40,
),
_input(Icon(Icons.mail), 'Email', _emailController, false, 15),
SizedBox(
height: 15,
),
_input(Icon(Icons.lock), 'Password', _passwordController, true, 15),
SizedBox(
height: 5,
),
Container(
padding: EdgeInsets.only(left: 20, right: 20),
width: 460,
child: Theme(
data: ThemeData(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
hoverColor: Colors.transparent),
child: CheckboxListTile(
title: Text(
'Запомнить меня',
style: TextStyle(color: textColor),
),
value: rememberMe,
onChanged: (bool value) {
setState(() {
rememberMe = value;
});
},
))),
SizedBox(
height: 5,
),
_button('Войти', auth, 15),
SizedBox(
height: 15,
),
Container(
width: 460,
child: Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Пройдите ',
style: TextStyle(color: Colors.white, fontSize: 12),
),
Text(
'регистрацию, ',
style: TextStyle(color: linkColor, fontSize: 12),
),
Text(
'если вы этого еще не сделали',
style: TextStyle(color: Colors.white, fontSize: 12),
),
],
)),
),
],
),
));
}
Widget _input(Icon icon, String hint, TextEditingController controller,
bool obscure, double borderRadius) {
return Container(
width: 460,
height: 50,
padding: EdgeInsets.only(left: 20, right: 20),
child: TextField(
controller: controller,
obscureText: obscure,
style: TextStyle(fontSize: 16, color: Colors.white),
decoration: InputDecoration(
border: OutlineInputBorder(),
isDense: true, // Added this
contentPadding: EdgeInsets.all(8), //
hintStyle: TextStyle(
fontWeight: FontWeight.bold, fontSize: 16, color: Colors.white),
hintText: hint,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: Colors.white, width: 2)),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: Colors.white54, width: 1)),
prefixIcon: Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: IconTheme(
data: IconThemeData(color: Colors.white),
child: icon,
),
)),
),
);
}
Widget _button(String label, void func(), double borderRadius) {
return Container(
width: 460,
padding: EdgeInsets.only(left: 20, right: 20),
child: RaisedButton(
onPressed: () {
apiClient
.authorization(_emailController.text, _passwordController.text)
.then((value) {
func();
});
},
highlightColor: Theme.of(context).primaryColor,
color: buttonPrimaryColor,
child: Text('Войти',
style: TextStyle(
fontWeight: FontWeight.bold,
color: textButtonColor,
fontSize: 16)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius)),
));
}
void auth() {
var state = navBar<NavBarDesktop>().navBarSate;
setState(() {
state.update();
});
}
}
class AuthorizationView extends StatelessWidget {
const AuthorizationView({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {}
}
import 'package:flutter/material.dart';
import 'package:umessage/http_api_client.dart';
import 'package:umessage/routing/route_names.dart';
import 'navbar_item.dart';
import 'navbar_logo.dart';
class NavBarDesktop extends StatefulWidget {
GlobalKey<_NavBarDesktopState> navBarDesktop =
GlobalKey<_NavBarDesktopState>();
String login = 'None';
_NavBarDesktopState navBarSate = new _NavBarDesktopState();
NavBarDesktop({Key key}) : super(key: key);
@override
_NavBarDesktopState createState() => navBarSate;
}
class _NavBarDesktopState extends State<NavBarDesktop> {
String username = '';
String loginButtonTitle = 'Войти';
@override
void initState() {
super.initState();
}
void update() {
setState(() {
if (ApiClient.username.length > 0) loginButtonTitle = ApiClient.username;
});
}
@override
Widget build(BuildContext context) {
return Container(
height: 60,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
NavBarIcon(),
SizedBox(width: 30),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
NavBarItem('Главная', HomeRoute),
SizedBox(width: 30),
NavBarItem('О нас', AboutRoute),
SizedBox(width: 30),
NavBarItem(loginButtonTitle, AuthRoute),
SizedBox(width: 30),
Text(widget.login),
],
)
],
),
);
}
}
GetIt navBar = GetIt.instance;
navBar.registerLazySingleton(() => NavBarDesktop());
# Packet 1240
peer1_4: !!binary |
sNuUobz22eVZ+svI+RMp8ohoG2HhrG5d9nY6upE51GfgD00jpQWwZ9F6Fwn1GD/h2/hnb35C8QqY
9AD2jLTV4kkSm1zuv1MxLktz1qvNdKG4Zyk6Jws7qhAYSnGJNkU2GsUP11bcmZCwlnX18xCWTcjr
sbX4hIgaxgcXkTG9M/tdJUrMTcFoEZ1lJnKCSYCBKQYVPCRMk337CbZMKIXM7UxUHg0voFf9NgGo
Fx0QWBG2AK/e9vS4sUkWAZ+h2+Y8FKEMbgnGlSY1f5z3ZFJtI0R7x+AF9xYJZ4dOhSUcIH1mEFgP
JCJ6XYiep3HCRLhqNDmtnQOewmLaaqM59RtT1RDiNgRK1C4lfHi+kUP1IBSNxc2Qgv0dA8og/2JB
gFWFfGkhlK6UtXUJp+Z+uzRgy9viNT7dpDutUIam5mAtMvzshePTyWiZrybMIP4RKWPtRT5uDL38
ENSFopnABbg1GHim2O8i5BEsaihDShlpCCYkO/Zo1kRygZ1OBSNrfEq0+Jda1rA2q0QhlG3w+QLU
zf6BqfBWE7eeg8vZnEgNQkROkS8wFRpeKbvU7xENnLGmszt3iBpyzUbMgtm7C2OFMi8PT2b4FD4f
53Bo6mcSTS7f+5U4PkLPzHwNzqR1REqGjCs2y2aQwOgPxyidEDB5G9wPIFDD6BvFLCBJdPsk5LZW
B4UYRvlrtMm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