Skip to content

Commit 16885b1

Browse files
authored
Merge pull request #269 from mdgspace/casper/reset_password
feat: adds Reset Password Screen
2 parents ccdfb81 + a8abb67 commit 16885b1

13 files changed

Lines changed: 554 additions & 131 deletions

File tree

lib/data/core/router/registry/paths.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ class AppPathsRegistry {
1616
static const String weekMenu = 'weekMenu';
1717
static const String leavesAndRebate = 'leavesAndRebate';
1818
static const String feedback = 'feedback';
19+
static const String resetPassword = 'resetPassword';
1920
}

lib/data/core/router/registry/routes.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class AppRoutesRegistry {
5555
path: AppPathsRegistry.feedback,
5656
page: FeedbackRoute.page,
5757
),
58+
CustomRoute(
59+
path: AppPathsRegistry.resetPassword,
60+
page: ResetPasswordRoute.page,
61+
),
5862
],
5963
),
6064
];
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
2+
import 'package:appetizer/presentation/components/app_textfield.dart';
3+
import 'package:flutter/material.dart';
4+
import 'package:google_fonts/google_fonts.dart';
5+
6+
class AppFormField extends StatelessWidget {
7+
const AppFormField({
8+
super.key,
9+
required this.hintText,
10+
this.controller,
11+
this.onChanged,
12+
this.obscureText,
13+
this.suffix,
14+
this.border,
15+
required this.title,
16+
this.maxLength,
17+
this.maxLines,
18+
this.titleStyle,
19+
}) : assert(
20+
obscureText == null || suffix != null,
21+
'Suffix should be provided if obscureText is provided',
22+
),
23+
assert(
24+
controller != null || onChanged != null,
25+
'Either controller or onChanged should be provided',
26+
);
27+
28+
final String hintText;
29+
final TextEditingController? controller;
30+
final Function(String)? onChanged;
31+
final bool? obscureText;
32+
final Widget? suffix;
33+
final InputBorder? border;
34+
final String title;
35+
final int? maxLength;
36+
final int? maxLines;
37+
final TextStyle? titleStyle;
38+
39+
@override
40+
Widget build(BuildContext context) {
41+
return Column(
42+
crossAxisAlignment: CrossAxisAlignment.start,
43+
children: [
44+
Text(
45+
title,
46+
style: titleStyle ??
47+
GoogleFonts.notoSans(
48+
fontSize: 18.toAutoScaledFont,
49+
fontWeight: FontWeight.w600,
50+
),
51+
),
52+
SizedBox(
53+
height: title == "Description" ? 0 : 20.toAutoScaledHeight,
54+
),
55+
AppTextField(
56+
controller: controller,
57+
onChanged: onChanged,
58+
obscureText: obscureText,
59+
hintText: hintText,
60+
suffix: suffix,
61+
border: border,
62+
maxLength: maxLength,
63+
maxLines: maxLines,
64+
),
65+
],
66+
);
67+
}
68+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:google_fonts/google_fonts.dart';
4+
5+
class AppTextField extends StatelessWidget {
6+
const AppTextField({
7+
super.key,
8+
required this.hintText,
9+
this.controller,
10+
this.onChanged,
11+
this.obscureText,
12+
this.suffix,
13+
this.border,
14+
this.maxLength,
15+
this.maxLines,
16+
}) : assert(
17+
obscureText == null || suffix != null,
18+
'Suffix should be provided if obscureText is provided',
19+
),
20+
assert(
21+
controller != null || onChanged != null,
22+
'Either controller or onChanged should be provided',
23+
);
24+
25+
final String hintText;
26+
final TextEditingController? controller;
27+
final Function(String)? onChanged;
28+
final bool? obscureText;
29+
final Widget? suffix;
30+
final InputBorder? border;
31+
final int? maxLength;
32+
final int? maxLines;
33+
34+
@override
35+
Widget build(BuildContext context) {
36+
return TextField(
37+
controller: controller,
38+
onChanged: onChanged,
39+
obscureText: obscureText ?? false,
40+
decoration: InputDecoration(
41+
hintText: hintText,
42+
hintStyle: GoogleFonts.lato(
43+
fontSize: 12.toAutoScaledFont,
44+
color: const Color(0xFF111111),
45+
fontWeight: FontWeight.w600,
46+
),
47+
border: border ??
48+
OutlineInputBorder(
49+
borderSide: BorderSide(
50+
color: const Color(0xFF111111).withOpacity(0.25)),
51+
borderRadius: BorderRadius.circular(5),
52+
),
53+
contentPadding: EdgeInsets.symmetric(
54+
horizontal: 20.toAutoScaledWidth,
55+
vertical: 15.toAutoScaledHeight),
56+
suffixIcon: suffix),
57+
maxLength: maxLength,
58+
maxLines: maxLines ?? 1,
59+
);
60+
}
61+
}

lib/presentation/feedback/feedback_view.dart

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:appetizer/app_theme.dart';
22
import 'package:appetizer/data/core/theme/dimensional/dimensional.dart';
33
import 'package:appetizer/domain/repositories/feedback_repository.dart';
4+
import 'package:appetizer/presentation/components/app_formfield.dart';
45
import 'package:appetizer/presentation/components/black_button.dart';
56
import 'package:appetizer/presentation/feedback/bloc/feedback_page_bloc.dart';
67
import 'package:appetizer/presentation/feedback/components/FeedbackTile/feedback_tile.dart';
@@ -72,29 +73,26 @@ class FeedbackScreen extends StatelessWidget {
7273
fontWeight: FontWeight.w400,
7374
),
7475
),
75-
Text(
76-
'Description',
77-
style: TextStyle(
76+
AppFormField(
77+
hintText: "",
78+
title: "Description",
79+
controller: textController,
80+
titleStyle: TextStyle(
7881
color: Colors.black.withOpacity(0.5400000214576721),
7982
fontSize: 12.toAutoScaledFont,
8083
fontFamily: 'Open Sans',
8184
fontWeight: FontWeight.w400,
8285
),
83-
),
84-
TextField(
85-
controller: textController,
8686
onChanged: (value) => context
8787
.read<FeedbackPageBloc>()
8888
.add(FeedbackPageDescriptionChangedEvent(
8989
description: value)),
9090
maxLength: 200,
9191
maxLines: 5,
92-
decoration: InputDecoration(
93-
border: OutlineInputBorder(
94-
borderSide: BorderSide(
95-
width: 0.5.toAutoScaledWidth,
96-
color: const Color.fromARGB(37, 0, 0, 0),
97-
),
92+
border: OutlineInputBorder(
93+
borderSide: BorderSide(
94+
width: 0.5.toAutoScaledWidth,
95+
color: const Color.fromARGB(37, 0, 0, 0),
9896
),
9997
),
10098
),

0 commit comments

Comments
 (0)