Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds Reset Password Screen #269

Merged
merged 10 commits into from
Jan 16, 2024
1 change: 1 addition & 0 deletions lib/data/core/router/registry/paths.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ class AppPathsRegistry {
static const String weekMenu = 'weekMenu';
static const String leavesAndRebate = 'leavesAndRebate';
static const String feedback = 'feedback';
static const String resetPassword = 'resetPassword';
}
4 changes: 4 additions & 0 deletions lib/data/core/router/registry/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class AppRoutesRegistry {
path: AppPathsRegistry.feedback,
page: FeedbackRoute.page,
),
CustomRoute(
path: AppPathsRegistry.resetPassword,
page: ResetPasswordRoute.page,
),
],
),
];
Expand Down
68 changes: 68 additions & 0 deletions lib/presentation/components/app_formfield.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/presentation/components/app_textfield.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppFormField extends StatelessWidget {
const AppFormField({
super.key,
required this.hintText,
this.controller,
this.onChanged,
this.obscureText,
this.suffix,
this.border,
required this.title,
this.maxLength,
this.maxLines,
this.titleStyle,
}) : assert(
obscureText == null || suffix != null,
'Suffix should be provided if obscureText is provided',
),
assert(
controller != null || onChanged != null,
'Either controller or onChanged should be provided',
);

final String hintText;
final TextEditingController? controller;
final Function(String)? onChanged;
final bool? obscureText;
final Widget? suffix;
final InputBorder? border;
final String title;
final int? maxLength;
final int? maxLines;
final TextStyle? titleStyle;

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: titleStyle ??
GoogleFonts.notoSans(
fontSize: 18.toAutoScaledFont,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: title == "Description" ? 0 : 20.toAutoScaledHeight,
),
AppTextField(
controller: controller,
onChanged: onChanged,
obscureText: obscureText,
hintText: hintText,
suffix: suffix,
border: border,
maxLength: maxLength,
maxLines: maxLines,
),
],
);
}
}
61 changes: 61 additions & 0 deletions lib/presentation/components/app_textfield.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppTextField extends StatelessWidget {
const AppTextField({
super.key,
required this.hintText,
this.controller,
this.onChanged,
this.obscureText,
this.suffix,
this.border,
this.maxLength,
this.maxLines,
}) : assert(
obscureText == null || suffix != null,
'Suffix should be provided if obscureText is provided',
),
assert(
controller != null || onChanged != null,
'Either controller or onChanged should be provided',
);

final String hintText;
final TextEditingController? controller;
final Function(String)? onChanged;
final bool? obscureText;
final Widget? suffix;
final InputBorder? border;
final int? maxLength;
final int? maxLines;

@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
onChanged: onChanged,
obscureText: obscureText ?? false,
decoration: InputDecoration(
hintText: hintText,
hintStyle: GoogleFonts.lato(
fontSize: 12.toAutoScaledFont,
color: const Color(0xFF111111),
fontWeight: FontWeight.w600,
),
border: border ??
OutlineInputBorder(
borderSide: BorderSide(
color: const Color(0xFF111111).withOpacity(0.25)),
borderRadius: BorderRadius.circular(5),
),
contentPadding: EdgeInsets.symmetric(
horizontal: 20.toAutoScaledWidth,
vertical: 15.toAutoScaledHeight),
suffixIcon: suffix),
maxLength: maxLength,
maxLines: maxLines ?? 1,
);
}
}
22 changes: 10 additions & 12 deletions lib/presentation/feedback/feedback_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:appetizer/app_theme.dart';
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
import 'package:appetizer/domain/repositories/feedback_repository.dart';
import 'package:appetizer/presentation/components/app_formfield.dart';
import 'package:appetizer/presentation/components/black_button.dart';
import 'package:appetizer/presentation/feedback/bloc/feedback_page_bloc.dart';
import 'package:appetizer/presentation/feedback/components/FeedbackTile/feedback_tile.dart';
Expand Down Expand Up @@ -72,29 +73,26 @@ class FeedbackScreen extends StatelessWidget {
fontWeight: FontWeight.w400,
),
),
Text(
'Description',
style: TextStyle(
AppFormField(
hintText: "",
title: "Description",
controller: textController,
titleStyle: TextStyle(
color: Colors.black.withOpacity(0.5400000214576721),
fontSize: 12.toAutoScaledFont,
fontFamily: 'Open Sans',
fontWeight: FontWeight.w400,
),
),
TextField(
controller: textController,
onChanged: (value) => context
.read<FeedbackPageBloc>()
.add(FeedbackPageDescriptionChangedEvent(
description: value)),
maxLength: 200,
maxLines: 5,
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0.5.toAutoScaledWidth,
color: const Color.fromARGB(37, 0, 0, 0),
),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0.5.toAutoScaledWidth,
color: const Color.fromARGB(37, 0, 0, 0),
),
),
),
Expand Down
Loading