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 29df82b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ More details at [kilvish.in](https://kilvish.in)
- Due to sharing related changes, android & iOS specific code is written which had broken the web or MacOS builds.
- `flutter build apk --debug && flutter install --debug` will build & install apk in an already running emulator
- To run an Android emulator, install Android Studio & launch an emulator with the AVD manager
- To make it easier to launch emulator every time, add `/path/to/sdk/emulator` to PATH variable & run command `emulator -avd <name of emulator>`
- you can find SDK path from Android Studio -> Settings -> Appearance & Behavior -> Android SDK
- To give a short name to the emulator, launch AVD manager from Android Studio, click on the pencil/edit button of the emulator & give it a short name that you can pass to the emulator command above.

## Firebase Setup

Expand Down
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: "OTP will be sent on this number",
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:
"In future, you can receive OTP either on email or on phone",
buttonLabel: sendOtpSuccess
? (isOtpButtonEnabled ? "Re-requet OTP" : "Please wait ..")
: "Get OTP",
hint: "[email protected]",
hint: "[email protected]",
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 29df82b

Please sign in to comment.