commit
c9da66d38f
@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
|
|||||||
homepage: https://refilc.hu
|
homepage: https://refilc.hu
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
|
|
||||||
version: 4.2.2+222
|
version: 4.2.3+223
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
|
@ -5,7 +5,6 @@ import 'package:elegant_notification/elegant_notification.dart';
|
|||||||
import 'package:elegant_notification/resources/arrays.dart';
|
import 'package:elegant_notification/resources/arrays.dart';
|
||||||
import 'package:filcnaplo/api/client.dart';
|
import 'package:filcnaplo/api/client.dart';
|
||||||
import 'package:filcnaplo/api/login.dart';
|
import 'package:filcnaplo/api/login.dart';
|
||||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
|
||||||
import 'package:filcnaplo_mobile_ui/screens/login/login_button.dart';
|
import 'package:filcnaplo_mobile_ui/screens/login/login_button.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/screens/login/login_input.dart';
|
import 'package:filcnaplo_mobile_ui/screens/login/login_input.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/screens/login/school_input/school_input.dart';
|
import 'package:filcnaplo_mobile_ui/screens/login/school_input/school_input.dart';
|
||||||
@ -14,6 +13,17 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
||||||
import 'login_screen.i18n.dart';
|
import 'login_screen.i18n.dart';
|
||||||
|
|
||||||
|
const LinearGradient _backgroundGradient = LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Color.fromARGB(255, 0, 0, 0),
|
||||||
|
Color.fromARGB(255, 23, 77, 185),
|
||||||
|
Color.fromARGB(255, 7, 42, 112),
|
||||||
|
],
|
||||||
|
begin: Alignment(-0.8, -2),
|
||||||
|
end: Alignment(0.8, 1.0),
|
||||||
|
stops: [-1.0, 0.0, 1.0],
|
||||||
|
);
|
||||||
|
|
||||||
class LoginScreen extends StatefulWidget {
|
class LoginScreen extends StatefulWidget {
|
||||||
const LoginScreen({Key? key, this.back = false}) : super(key: key);
|
const LoginScreen({Key? key, this.back = false}) : super(key: key);
|
||||||
|
|
||||||
@ -70,14 +80,20 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Platform.isMacOS) Window.getTitlebarHeight().then((value) => setState(() => topInset = value));
|
if (Platform.isMacOS) {
|
||||||
|
Window.getTitlebarHeight()
|
||||||
|
.then((value) => setState(() => topInset = value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.of(context).filc,
|
body: Container(
|
||||||
body: SafeArea(
|
decoration: BoxDecoration(
|
||||||
|
gradient: _backgroundGradient,
|
||||||
|
),
|
||||||
|
child: SafeArea(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -91,20 +107,27 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
padding: const EdgeInsets.only(bottom: 24.0),
|
padding: const EdgeInsets.only(bottom: 24.0),
|
||||||
child: ClipRect(
|
child: ClipRect(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 12.0, right: 12.0, bottom: 32.0),
|
padding: const EdgeInsets.only(
|
||||||
|
left: 12.0, right: 12.0, bottom: 32.0),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 82.0,
|
width: 100.0,
|
||||||
height: 82.0,
|
height: 100.0,
|
||||||
// Png shadow *hack*
|
// Png shadow *hack*
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: Opacity(child: Image.asset("assets/icons/ic_splash.png", color: Colors.black), opacity: 0.3),
|
child: Opacity(
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/icons/ic_splash.png",
|
||||||
|
color: Colors.black),
|
||||||
|
opacity: 0.3),
|
||||||
),
|
),
|
||||||
BackdropFilter(
|
BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 6.0, sigmaY: 6.0),
|
filter: ImageFilter.blur(
|
||||||
child: Image.asset("assets/icons/ic_splash.png"),
|
sigmaX: 6.0, sigmaY: 6.0),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/icons/ic_splash.png"),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -124,7 +147,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 6.0),
|
padding: const EdgeInsets.only(bottom: 6.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -164,7 +188,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 6.0),
|
padding: const EdgeInsets.only(bottom: 6.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -242,19 +267,29 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
padding: EdgeInsets.symmetric(vertical: 6.0),
|
padding: EdgeInsets.symmetric(vertical: 6.0),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_loginState == LoginState.missingFields || _loginState == LoginState.invalidGrant || _loginState == LoginState.failed)
|
if (_loginState == LoginState.missingFields ||
|
||||||
|
_loginState == LoginState.invalidGrant ||
|
||||||
|
_loginState == LoginState.failed)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
["missing_fields", "invalid_grant", "error"][_loginState.index].i18n,
|
[
|
||||||
style: const TextStyle(color: Colors.red, fontWeight: FontWeight.w500),
|
"missing_fields",
|
||||||
|
"invalid_grant",
|
||||||
|
"error"
|
||||||
|
][_loginState.index]
|
||||||
|
.i18n,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.red,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -276,6 +311,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +319,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
String username = usernameController.text;
|
String username = usernameController.text;
|
||||||
String password = passwordController.text;
|
String password = passwordController.text;
|
||||||
|
|
||||||
if (username == "" || password == "" || schoolController.selectedSchool == null) {
|
if (username == "" ||
|
||||||
|
password == "" ||
|
||||||
|
schoolController.selectedSchool == null) {
|
||||||
return setState(() => _loginState = LoginState.missingFields);
|
return setState(() => _loginState = LoginState.missingFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +351,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
).show(context);
|
).show(context);
|
||||||
},
|
},
|
||||||
onSuccess: () {
|
onSuccess: () {
|
||||||
Navigator.of(context).pushNamedAndRemoveUntil("login_to_navigation", (_) => false);
|
Navigator.of(context)
|
||||||
|
.pushNamedAndRemoveUntil("login_to_navigation", (_) => false);
|
||||||
}).then((res) => setState(() => _loginState = res));
|
}).then((res) => setState(() => _loginState = res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user