This commit is contained in:
zypherift 2024-04-29 00:25:23 +02:00
parent bc61b61ae1
commit 78e6408962

View File

@ -15,6 +15,7 @@ import 'package:flutter/services.dart';
import 'login_screen.i18n.dart'; import 'login_screen.i18n.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_portal/flutter_portal.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
const LoginScreen({super.key, this.back = false}); const LoginScreen({super.key, this.back = false});
@ -83,298 +84,303 @@ class LoginScreenState extends State<LoginScreen> {
precacheImage(const AssetImage('assets/images/showcase3.png'), context); precacheImage(const AssetImage('assets/images/showcase3.png'), context);
precacheImage(const AssetImage('assets/images/showcase4.png'), context); precacheImage(const AssetImage('assets/images/showcase4.png'), context);
return Scaffold( return Portal(
body: Container( child: Scaffold(
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)), body: Container(
child: SingleChildScrollView( decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
physics: const ClampingScrollPhysics(), child: SingleChildScrollView(
controller: _scrollController, physics: const ClampingScrollPhysics(),
child: Container( controller: _scrollController,
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)), child: Container(
width: MediaQuery.of(context).size.width, decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width,
child: SafeArea( height: MediaQuery.of(context).size.height,
child: Column( child: SafeArea(
mainAxisAlignment: MainAxisAlignment.start, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ crossAxisAlignment: CrossAxisAlignment.start,
// app icon children: [
Padding( // app icon
padding: const EdgeInsets.only(left: 24, top: 20), Padding(
child: Row( padding: const EdgeInsets.only(left: 24, top: 20),
children: [ child: Row(
Image.asset( children: [
'assets/icons/ic_rounded.png', Image.asset(
width: 30.0, 'assets/icons/ic_rounded.png',
), width: 30.0,
const SizedBox(width: 8), ),
Text( const SizedBox(width: 8),
'reFilc', Text(
style: TextStyle( 'reFilc',
color: AppColors.of(context).loginPrimary, style: TextStyle(
fontSize: 18.0, color: AppColors.of(context).loginPrimary,
fontWeight: FontWeight.bold, fontSize: 18.0,
fontFamily: 'Montserrat'), fontWeight: FontWeight.bold,
), fontFamily: 'Montserrat'),
Material( ),
type: MaterialType.transparency, Material(
child: showBack type: MaterialType.transparency,
? BackButton( child: showBack
color: AppColors.of(context).loginPrimary) ? BackButton(
: const SizedBox(height: 48.0), color: AppColors.of(context).loginPrimary)
), : const SizedBox(height: 48.0),
], ),
)), ],
Column( )),
mainAxisAlignment: MainAxisAlignment.center, Column(
crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ crossAxisAlignment: CrossAxisAlignment.center,
const SizedBox(height: 21), children: [
CarouselSlider( const SizedBox(height: 21),
options: CarouselOptions( CarouselSlider(
height: MediaQuery.of(context).size.height, options: CarouselOptions(
viewportFraction: 1, height: MediaQuery.of(context).size.height,
autoPlay: true, viewportFraction: 1,
autoPlayInterval: const Duration(seconds: 6), autoPlay: true,
pauseAutoPlayOnTouch: true), autoPlayInterval: const Duration(seconds: 6),
items: [1, 2, 3, 4].map((i) { pauseAutoPlayOnTouch: true),
return Builder( items: [1, 2, 3, 4].map((i) {
builder: (BuildContext context) { return Builder(
return Column( builder: (BuildContext context) {
crossAxisAlignment: CrossAxisAlignment.start, return Column(
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ mainAxisAlignment: MainAxisAlignment.start,
Padding( children: [
padding: const EdgeInsets.only(left: 24), Padding(
child: Column( padding:
crossAxisAlignment: const EdgeInsets.only(left: 24),
CrossAxisAlignment.start, child: Column(
mainAxisAlignment: crossAxisAlignment:
MainAxisAlignment.start, CrossAxisAlignment.start,
children: [ mainAxisAlignment:
Text( MainAxisAlignment.start,
"welcome_title_$i".i18n, children: [
style: TextStyle( Text(
color: AppColors.of(context) "welcome_title_$i".i18n,
.loginPrimary, style: TextStyle(
fontSize: 19, color: AppColors.of(context)
fontFamily: 'Montserrat', .loginPrimary,
fontWeight: FontWeight.w700, fontSize: 19,
height: 1.3), fontFamily: 'Montserrat',
), fontWeight: FontWeight.w700,
const SizedBox(height: 14.375), //meth
Padding(
padding: const EdgeInsets.only(
right: 20),
child: Text(
"welcome_text_$i".i18n,
style: const TextStyle(
fontFamily: 'FigTree',
fontWeight: FontWeight.w500,
fontSize: 17,
height: 1.3), height: 1.3),
), ),
), const SizedBox(
], height: 14.375), //meth
)), Padding(
const SizedBox(height: 15.625), padding: const EdgeInsets.only(
Padding( right: 20),
padding: const EdgeInsets.only( child: Text(
left: 16, right: 16), "welcome_text_$i".i18n,
child: Image.asset( style: const TextStyle(
'assets/images/showcase$i.png', fit: BoxFit.fitWidth)), fontFamily: 'FigTree',
], fontWeight: FontWeight.w500,
); fontSize: 17,
}, height: 1.3),
); ),
}).toList(), ),
), ],
], )),
) const SizedBox(height: 15.625),
Padding(
padding: const EdgeInsets.only(
left: 16, right: 16),
child: Image.asset(
'assets/images/showcase$i.png',
fit: BoxFit.fitWidth)),
],
);
},
);
}).toList(),
),
],
)
//TODO: finish this fucking thing:)
// // inputs
// Padding(
// padding: const EdgeInsets.only(
// left: 22.0,
// right: 22.0,
// top: 0.0,
// ),
// child: AutofillGroup(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// // username
// Padding(
// padding: const EdgeInsets.only(bottom: 6.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(
// child: Text(
// "username".i18n,
// maxLines: 1,
// style: TextStyle(
// color: AppColors.of(context).loginPrimary,
// fontWeight: FontWeight.w500,
// fontSize: 12.0,
// ),
// ),
// ),
// Expanded(
// child: Text(
// "usernameHint".i18n,
// maxLines: 1,
// textAlign: TextAlign.right,
// style: TextStyle(
// color:
// AppColors.of(context).loginSecondary,
// fontWeight: FontWeight.w500,
// fontSize: 12.0,
// ),
// ),
// ),
// ],
// ),
// ),
// Padding(
// padding: const EdgeInsets.only(bottom: 12.0),
// child: LoginInput(
// style: LoginInputStyle.username,
// controller: usernameController,
// ),
// ),
// // inputs // // password
// Padding( // Padding(
// padding: const EdgeInsets.only( // padding: const EdgeInsets.only(bottom: 6.0),
// left: 22.0, // child: Row(
// right: 22.0, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// top: 0.0, // children: [
// ), // Expanded(
// child: AutofillGroup( // child: Text(
// child: Column( // "password".i18n,
// crossAxisAlignment: CrossAxisAlignment.start, // maxLines: 1,
// children: [ // style: TextStyle(
// // username // color: AppColors.of(context).loginPrimary,
// Padding( // fontWeight: FontWeight.w500,
// padding: const EdgeInsets.only(bottom: 6.0), // fontSize: 12.0,
// child: Row( // ),
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // ),
// children: [ // ),
// Expanded( // Expanded(
// child: Text( // child: Text(
// "username".i18n, // "passwordHint".i18n,
// maxLines: 1, // maxLines: 1,
// style: TextStyle( // textAlign: TextAlign.right,
// color: AppColors.of(context).loginPrimary, // style: TextStyle(
// fontWeight: FontWeight.w500, // color:
// fontSize: 12.0, // AppColors.of(context).loginSecondary,
// ), // fontWeight: FontWeight.w500,
// ), // fontSize: 12.0,
// ), // ),
// Expanded( // ),
// child: Text( // ),
// "usernameHint".i18n, // ],
// maxLines: 1, // ),
// textAlign: TextAlign.right, // ),
// style: TextStyle( // Padding(
// color: // padding: const EdgeInsets.only(bottom: 12.0),
// AppColors.of(context).loginSecondary, // child: LoginInput(
// fontWeight: FontWeight.w500, // style: LoginInputStyle.password,
// fontSize: 12.0, // controller: passwordController,
// ), // ),
// ), // ),
// ),
// ],
// ),
// ),
// Padding(
// padding: const EdgeInsets.only(bottom: 12.0),
// child: LoginInput(
// style: LoginInputStyle.username,
// controller: usernameController,
// ),
// ),
// // password // // school
// Padding( // Padding(
// padding: const EdgeInsets.only(bottom: 6.0), // padding: const EdgeInsets.only(bottom: 6.0),
// child: Row( // child: Text(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // "school".i18n,
// children: [ // maxLines: 1,
// Expanded( // style: TextStyle(
// child: Text( // color: AppColors.of(context).loginPrimary,
// "password".i18n, // fontWeight: FontWeight.w500,
// maxLines: 1, // fontSize: 12.0,
// style: TextStyle( // ),
// color: AppColors.of(context).loginPrimary, // ),
// fontWeight: FontWeight.w500, // ),
// fontSize: 12.0, // SchoolInput(
// ), // scroll: _scrollController,
// ), // controller: schoolController,
// ), // ),
// Expanded( // ],
// child: Text( // ),
// "passwordHint".i18n, // ),
// maxLines: 1, // ),
// textAlign: TextAlign.right,
// style: TextStyle(
// color:
// AppColors.of(context).loginSecondary,
// fontWeight: FontWeight.w500,
// fontSize: 12.0,
// ),
// ),
// ),
// ],
// ),
// ),
// Padding(
// padding: const EdgeInsets.only(bottom: 12.0),
// child: LoginInput(
// style: LoginInputStyle.password,
// controller: passwordController,
// ),
// ),
// // school // // login button
// Padding( // Padding(
// padding: const EdgeInsets.only(bottom: 6.0), // padding: const EdgeInsets.only(
// child: Text( // top: 35.0,
// "school".i18n, // left: 22.0,
// maxLines: 1, // right: 22.0,
// style: TextStyle( // ),
// color: AppColors.of(context).loginPrimary, // child: Visibility(
// fontWeight: FontWeight.w500, // visible: _loginState != LoginState.inProgress,
// fontSize: 12.0, // replacement: const Padding(
// ), // padding: EdgeInsets.symmetric(vertical: 6.0),
// ), // child: CircularProgressIndicator(
// ), // valueColor:
// SchoolInput( // AlwaysStoppedAnimation<Color>(Colors.white),
// scroll: _scrollController, // ),
// controller: schoolController, // ),
// ), // child: LoginButton(
// ], // child: Text("login".i18n,
// ), // maxLines: 1,
// ), // style: const TextStyle(
// ), // fontWeight: FontWeight.bold,
// fontSize: 20.0,
// )),
// onPressed: () => _loginAPI(context: context),
// ),
// ),
// ),
// // login button // // error messages
// Padding( // if (_loginState == LoginState.missingFields ||
// padding: const EdgeInsets.only( // _loginState == LoginState.invalidGrant ||
// top: 35.0, // _loginState == LoginState.failed)
// left: 22.0, // Padding(
// right: 22.0, // padding: const EdgeInsets.only(
// ), // top: 8.0, left: 12.0, right: 12.0),
// child: Visibility( // child: Text(
// visible: _loginState != LoginState.inProgress, // [
// replacement: const Padding( // "missing_fields",
// padding: EdgeInsets.symmetric(vertical: 6.0), // "invalid_grant",
// child: CircularProgressIndicator( // "error"
// valueColor: // ][_loginState.index]
// AlwaysStoppedAnimation<Color>(Colors.white), // .i18n,
// ), // style: const TextStyle(
// ), // color: Colors.red,
// child: LoginButton( // fontWeight: FontWeight.w500,
// child: Text("login".i18n, // ),
// maxLines: 1, // textAlign: TextAlign.center,
// style: const TextStyle( // ),
// fontWeight: FontWeight.bold, // ),
// fontSize: 20.0, // const SizedBox(height: 22.0),
// )),
// onPressed: () => _loginAPI(context: context),
// ),
// ),
// ),
// // error messages // // privacy policy
// if (_loginState == LoginState.missingFields || // GestureDetector(
// _loginState == LoginState.invalidGrant || // onTap: () => PrivacyView.show(context),
// _loginState == LoginState.failed) // child: Text(
// Padding( // 'privacy'.i18n,
// padding: const EdgeInsets.only( // style: TextStyle(
// top: 8.0, left: 12.0, right: 12.0), // color: AppColors.of(context).loginSecondary,
// child: Text( // fontWeight: FontWeight.w500,
// [ // fontSize: 14.0,
// "missing_fields", // ),
// "invalid_grant", // ),
// "error" // ),
// ][_loginState.index]
// .i18n,
// style: const TextStyle(
// color: Colors.red,
// fontWeight: FontWeight.w500,
// ),
// textAlign: TextAlign.center,
// ),
// ),
// const SizedBox(height: 22.0),
// // privacy policy // const Spacer(
// GestureDetector( // flex: 1,
// onTap: () => PrivacyView.show(context), // ),
// child: Text( ],
// 'privacy'.i18n, ),
// style: TextStyle(
// color: AppColors.of(context).loginSecondary,
// fontWeight: FontWeight.w500,
// fontSize: 14.0,
// ),
// ),
// ),
// const Spacer(
// flex: 1,
// ),
],
), ),
), ),
), ),