feat: login page ui done
This commit is contained in:
15
lib/feature/auth/presentation/login_page/login_page.dart
Normal file
15
lib/feature/auth/presentation/login_page/login_page.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/login_page/widgets/login_body.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/w_back_button.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WLoginBody();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
155
lib/feature/auth/presentation/login_page/widgets/login_body.dart
Normal file
155
lib/feature/auth/presentation/login_page/widgets/login_body.dart
Normal file
@@ -0,0 +1,155 @@
|
||||
import 'package:food_delivery_client/feature/auth/presentation/login_page/widgets/welcome_text.dart';
|
||||
import 'package:food_delivery_client/feature/common/presentation/widgets/app_text_form_field.dart';
|
||||
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class WLoginBody extends StatefulWidget {
|
||||
const WLoginBody({super.key});
|
||||
|
||||
@override
|
||||
State<WLoginBody> createState() => _WLoginBodyState();
|
||||
}
|
||||
|
||||
class _WLoginBodyState extends State<WLoginBody> {
|
||||
late TextEditingController _phoneNumberController;
|
||||
late TextEditingController _passwordController;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_phoneNumberController = TextEditingController();
|
||||
_passwordController = TextEditingController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_phoneNumberController.dispose();
|
||||
_passwordController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
child: WLayout(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
SvgPicture.asset(AppIcons.icLogin),
|
||||
Positioned(
|
||||
child: Material(
|
||||
color: AppColors.cTransparent,
|
||||
child:
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
30.verticalSpace,
|
||||
WBackButton(),
|
||||
20.verticalSpace,
|
||||
WelcomeText(
|
||||
text: context.loc.welcome_to_volt(
|
||||
AppLocaleKeys.appName,
|
||||
),
|
||||
),
|
||||
8.verticalSpace,
|
||||
Text(
|
||||
context.loc.please_login,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cA7AEC1,
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
54.verticalSpace,
|
||||
Text(
|
||||
context.loc.email_or_phone,
|
||||
style: context.appThemeTextStyles.size16Medium,
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
controller: _phoneNumberController,
|
||||
hintText: context.loc.enter_email_or_phone,
|
||||
),
|
||||
20.verticalSpace,
|
||||
Text(
|
||||
context.loc.password,
|
||||
style: context.appThemeTextStyles.size16Medium,
|
||||
),
|
||||
10.verticalSpace,
|
||||
AppTextFormField(
|
||||
obscureText: true,
|
||||
controller: _passwordController,
|
||||
hintText: context.loc.enter_password,
|
||||
),
|
||||
10.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.centerRight,
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
child: Text(
|
||||
context.loc.forgot_password,
|
||||
style: AppTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cFF6F00,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
60.verticalSpace,
|
||||
AppButton(
|
||||
name: context.loc.login,
|
||||
onPressed: () {
|
||||
if (_formKey.currentState?.validate() ?? false) {}
|
||||
},
|
||||
),
|
||||
15.verticalSpace,
|
||||
Align(
|
||||
alignment: AlignmentGeometry.center,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: context.loc.dont_have_account,
|
||||
style: context.appThemeTextStyles.size14Regular,
|
||||
children: [
|
||||
WidgetSpan(
|
||||
baseline: TextBaseline.alphabetic,
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
style: ButtonStyle(
|
||||
shadowColor: WidgetStatePropertyAll(
|
||||
AppColors.cFF6F00.newWithOpacity(.2),
|
||||
),
|
||||
padding: WidgetStatePropertyAll(
|
||||
EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
context.loc.register,
|
||||
style: AppTextStyles.size14Bold
|
||||
.copyWith(color: AppColors.cFF6F00),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingOnly(
|
||||
left: 24,
|
||||
right: 24,
|
||||
top: context.mq.viewPadding.top,
|
||||
bottom: context.mq.viewPadding.bottom,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class WelcomeText extends StatelessWidget {
|
||||
final String text;
|
||||
|
||||
const WelcomeText({Key? key, required this.text}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final voltIndex = text.toLowerCase().indexOf(
|
||||
AppLocaleKeys.appName.toLowerCase(),
|
||||
);
|
||||
|
||||
if (voltIndex == -1) {
|
||||
return Text(
|
||||
text,
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
);
|
||||
}
|
||||
|
||||
final before = text.substring(0, voltIndex);
|
||||
final volt = text.substring(
|
||||
voltIndex,
|
||||
voltIndex + AppLocaleKeys.appName.length,
|
||||
);
|
||||
final after = text.substring(voltIndex + AppLocaleKeys.appName.length);
|
||||
|
||||
return Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(text: before, style: context.appThemeTextStyles.size24Bold),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.baseline,
|
||||
baseline: TextBaseline.alphabetic,
|
||||
child: ShaderMask(
|
||||
shaderCallback: (bounds) =>
|
||||
AppUtils.kGradient.createShader(bounds),
|
||||
child: Text(
|
||||
volt,
|
||||
style: context.appThemeTextStyles.size24Bold.copyWith(
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// "Volt" dan keyingi text
|
||||
TextSpan(text: after, style: context.appThemeTextStyles.size24Bold),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export 'presentation/widgets/widgets.dart';
|
||||
export 'presentation/blocs/language_bloc/language_bloc.dart';
|
||||
export 'data/models/success_model.dart';
|
||||
export 'data/models/success_model.dart';
|
||||
|
||||
@@ -57,10 +57,10 @@ class AppButton extends StatelessWidget {
|
||||
mainAxisAlignment:
|
||||
mainAxisAlignment ?? MainAxisAlignment.center,
|
||||
children: [
|
||||
leading?? AppUtils.kSizedBox,
|
||||
leading ?? AppUtils.kSizedBox,
|
||||
Text(
|
||||
name,
|
||||
style: AppTextStyles.size16Bold.copyWith(
|
||||
style: AppTextStyles.size14Bold.copyWith(
|
||||
color: AppColors.cFFFFFF,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -55,67 +55,92 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
enabled: true,
|
||||
//autofocus: true,
|
||||
maxLines: widget.maxLines ?? 1,
|
||||
minLines: widget.minLines ?? 1,
|
||||
onChanged: widget.onChanged,
|
||||
focusNode: widget.focusNode,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
keyboardType: widget.keyBoardType,
|
||||
style: widget.textStyle ?? AppTextStyles.size16Regular,
|
||||
onTap: widget.onTap,
|
||||
textAlign: widget.textAlign ?? TextAlign.start,
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
obscureText: widget.obscureText ? visibility : false,
|
||||
obscuringCharacter: "*",
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
decoration: InputDecoration(
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 4),
|
||||
color: AppColors.cA7AEC1.newWithOpacity(.15),
|
||||
blurRadius: 70,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: TextFormField(
|
||||
enabled: true,
|
||||
filled: true,
|
||||
|
||||
fillColor: widget.fillColor ?? AppColors.cEEEEEE,
|
||||
hintText: widget.hintText,
|
||||
hintStyle:
|
||||
widget.hintTextStyle ??
|
||||
AppTextStyles.size16Regular.copyWith(color: AppColors.c7F7F7F),
|
||||
suffixIcon: widget.obscureText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
visibility = !visibility;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
visibility ? Icons.visibility : Icons.visibility_off,
|
||||
color: AppColors.c000000,
|
||||
),
|
||||
)
|
||||
: widget.suffixIcon,
|
||||
prefixIconConstraints: BoxConstraints(minHeight: 24, minWidth: 0),
|
||||
prefixIcon: widget.prefixIcon?.paddingOnly(left: 10).paddingAll(3),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide.none,
|
||||
//autofocus: true,
|
||||
maxLines: widget.maxLines ?? 1,
|
||||
minLines: widget.minLines ?? 1,
|
||||
onChanged: widget.onChanged,
|
||||
focusNode: widget.focusNode,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
keyboardType: widget.keyBoardType,
|
||||
style: widget.textStyle ?? context.appThemeTextStyles.size14Regular,
|
||||
onTap: widget.onTap,
|
||||
textAlign: widget.textAlign ?? TextAlign.start,
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
obscureText: widget.obscureText ? visibility : false,
|
||||
obscuringCharacter: "*",
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
cursorColor: AppColors.cFF6F00,
|
||||
decoration: InputDecoration(
|
||||
enabled: true,
|
||||
filled: true,
|
||||
fillColor: context.appThemeColors.iconColor ?? AppColors.cEEEEEE,
|
||||
hintText: widget.hintText,
|
||||
hintStyle:
|
||||
widget.hintTextStyle ??
|
||||
context.appThemeTextStyles.size14Regular.copyWith(
|
||||
color: AppColors.cA7AEC1,
|
||||
),
|
||||
suffixIcon: widget.obscureText
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
visibility = !visibility;
|
||||
});
|
||||
},
|
||||
icon: SvgPicture.asset(
|
||||
visibility ? AppIcons.icVisibility : AppIcons.icVisibilityOff,
|
||||
color: AppColors.c000000,
|
||||
),
|
||||
)
|
||||
: widget.suffixIcon,
|
||||
prefixIconConstraints: BoxConstraints(minHeight: 24, minWidth: 0),
|
||||
prefixIcon: widget.prefixIcon?.paddingOnly(left: 10).paddingAll(3),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16, horizontal: 14),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius16,
|
||||
borderSide: BorderSide(
|
||||
color: context.appThemeColors.borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius16,
|
||||
borderSide: BorderSide(
|
||||
color: context.appThemeColors.borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius16,
|
||||
borderSide: BorderSide(
|
||||
color: context.appThemeColors.borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius16,
|
||||
borderSide: BorderSide(color: AppColors.cFF6F00, width: 1),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: widget.borderRadius ?? AppUtils.kBorderRadius40,
|
||||
borderSide: BorderSide(
|
||||
color: context.appThemeColors.borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
31
lib/feature/common/presentation/widgets/w_back_button.dart
Normal file
31
lib/feature/common/presentation/widgets/w_back_button.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
class WBackButton extends StatelessWidget {
|
||||
const WBackButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
borderRadius: AppUtils.kBorderRadius22,
|
||||
child: Ink(
|
||||
height: 44,
|
||||
width: 44,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius22,
|
||||
color: context.appThemeColors.iconColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.cA7AEC1.newWithOpacity(.3),
|
||||
offset: const Offset(0, 4),
|
||||
blurRadius: 80,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
context.appThemeIcons.icArrowLeft,
|
||||
).paddingAll(10),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,3 +5,4 @@ export 'w_stories_list_item.dart';
|
||||
export 'w_custom_modal_bottom_sheet.dart';
|
||||
export 'app_button.dart';
|
||||
export 'app_list_tile.dart';
|
||||
export 'w_back_button.dart';
|
||||
|
||||
@@ -73,9 +73,8 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
||||
onPressed: () {
|
||||
if (currentIndex < 1) {
|
||||
onPressed();
|
||||
}
|
||||
if (currentIndex == 1) {
|
||||
log("Navigate to login");
|
||||
} else {
|
||||
context.go(Routes.login);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -31,15 +31,11 @@ class SplashPage extends StatelessWidget {
|
||||
Center(child: SvgPicture.asset(AppIcons.icLogo)),
|
||||
ShaderMask(
|
||||
shaderCallback: (bounds) =>
|
||||
const LinearGradient(
|
||||
begin: AlignmentGeometry.bottomCenter,
|
||||
end: AlignmentGeometry.topCenter,
|
||||
colors: [AppColors.cFF6F00, AppColors.cFFAB40],
|
||||
).createShader(
|
||||
AppUtils.kGradient.createShader(
|
||||
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
|
||||
),
|
||||
child: Text(
|
||||
"Felix Eats",
|
||||
AppLocaleKeys.appName,
|
||||
style: context.appThemeTextStyles.size64Black,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user