Skip to content

Commit

Permalink
created support text for input fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish Sharma committed Feb 20, 2024
1 parent 8ade0dd commit 0dd81db
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 15 additions & 0 deletions lib/common_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ Widget renderLabel(
)));
}

Widget renderSupportLabel(
{required String text,
Color color = inactiveColor,
double fontSize = smallFontSize,
double topSpacing = 0}) {
return Container(
margin: EdgeInsets.only(top: topSpacing),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
text,
style: TextStyle(color: color, fontSize: fontSize),
)));
}

Widget renderHelperText({required String text}) {
return Container(
margin: const EdgeInsets.only(top: 5, bottom: 10),
Expand Down
11 changes: 9 additions & 2 deletions lib/signup_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class SignUpPageState extends State<SignUpPage> {
SignupForm(
stepNumber: "1",
fieldLabel: "Kilvish Id",
hint: "First time user ? Create a new kilvish id",
supportLabel: "First time user ? Get a new id",
hint: "crime-master-gogo",
isActive: _stepNumber == 1 && (!sendOtpSuccess),
isOperationAllowedButNotActive: _stepNumber > 1,
buttonClickHandler: () => allowFormSubmission(1),
Expand All @@ -166,6 +167,7 @@ class SignUpPageState extends State<SignUpPage> {
SignupForm(
stepNumber: "2",
fieldLabel: "Phone Number",
supportLabel: "Please ensure OTP can be recieved",
hint: "7019316063",
isActive: _stepNumber == 2 && (!sendOtpSuccess),
isOperationAllowedButNotActive: _stepNumber > 2,
Expand All @@ -177,10 +179,12 @@ class SignUpPageState extends State<SignUpPage> {
SignupForm(
stepNumber: "3",
fieldLabel: "Email Id",
supportLabel:
"For new user, different OTPs are sent on Email & Phone",
buttonLabel: sendOtpSuccess
? (isOtpButtonEnabled ? "Re-requet OTP" : "Please wait ..")
: "Get OTP",
hint: "admin@mail.com",
hint: "teja-finder@aaa.movie",
isActive: _stepNumber == 3 && (!sendOtpSuccess),
isOperationAllowedButNotActive: _stepNumber > 3,
buttonClickHandler: () {
Expand Down Expand Up @@ -369,6 +373,7 @@ String? genericFieldValidator(String? value) {
class SignupForm extends StatefulWidget {
final String stepNumber;
final String fieldLabel;
final String supportLabel;
final String? buttonLabel;
final String hint;
final bool isActive;
Expand All @@ -384,6 +389,7 @@ class SignupForm extends StatefulWidget {
const SignupForm({
required this.stepNumber,
required this.fieldLabel,
required this.supportLabel,
this.buttonLabel,
required this.hint,
required this.isActive,
Expand Down Expand Up @@ -416,6 +422,7 @@ class SignupFormState extends State<SignupForm> {
child: Column(
children: [
renderInputLabel(),
renderSupportLabel(text: widget.supportLabel),
renderTextField(),
Visibility(
visible: widget.buttonVisible,
Expand Down

0 comments on commit 0dd81db

Please sign in to comment.