-
Notifications
You must be signed in to change notification settings - Fork 5
make phone number field editable #804
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f475751
WIP: make phone number field editable
AlaaElattar 76c24ae
update dialog of adding phone number
AlaaElattar ae9e427
Merge branch 'development' of github.com:threefoldtech/threefold_conn…
AlaaElattar 3206893
check if phone is duplicate && add edit icon
AlaaElattar ef2dcf1
update re-virifaction msg && increase space
AlaaElattar ac40563
Merge branch 'development' of github.com:threefoldtech/threefold_conn…
AlaaElattar 4b3311a
handle validation msg && spaces
AlaaElattar 1a48766
Merge branch 'development' of github.com:threefoldtech/threefold_conn…
AlaaElattar 8ef82b2
Adjust the UI of phone widget dialog
AhmedHanafy725 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,15 +14,15 @@ import 'package:threebotlogin/services/shared_preference_service.dart'; | |
|
|
||
| import 'custom_dialog.dart'; | ||
|
|
||
| Future<void> addPhoneNumberDialog(context) async { | ||
| Future<void> addPhoneNumberDialog(context, {required bool newPhone}) async { | ||
| Response res = await getCountry(); | ||
| var countryCode = res.body.replaceAll('\n', ''); | ||
|
|
||
| await showDialog( | ||
| context: context, | ||
| barrierDismissible: false, | ||
| builder: (BuildContext context) => | ||
| PhoneAlertDialog(defaultCountryCode: countryCode), | ||
| PhoneAlertDialog(defaultCountryCode: countryCode, newPhone: newPhone), | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -48,8 +48,10 @@ phoneSendDialog(context) { | |
|
|
||
| class PhoneAlertDialog extends StatefulWidget { | ||
| final String defaultCountryCode; | ||
| final bool newPhone; | ||
|
|
||
| const PhoneAlertDialog({Key? key, required this.defaultCountryCode}) | ||
| const PhoneAlertDialog( | ||
| {Key? key, required this.defaultCountryCode, required this.newPhone}) | ||
| : super(key: key); | ||
|
|
||
| @override | ||
|
|
@@ -76,50 +78,79 @@ class PhoneAlertDialogState extends State<PhoneAlertDialog> { | |
| Widget build(BuildContext context) { | ||
| return CustomDialog( | ||
| image: Icons.phone, | ||
| title: 'Add phone number', | ||
| title: widget.newPhone | ||
| ? 'Add phone number' | ||
| : 'Change phone number', | ||
| widgetDescription: SizedBox( | ||
| height: 100, | ||
| child: Row( | ||
| children: <Widget>[ | ||
| Expanded( | ||
| child: Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: 16), | ||
| child: IntlPhoneField( | ||
| initialCountryCode: widget.defaultCountryCode, | ||
| decoration: const InputDecoration( | ||
| labelText: 'Phone Number', | ||
| border: OutlineInputBorder( | ||
| borderSide: BorderSide(), | ||
| height: widget.newPhone ? 100 : 180, | ||
| child: Column( | ||
| children: [ | ||
| if (!widget.newPhone) | ||
| Row( | ||
| children: <Widget>[ | ||
| Expanded( | ||
| child: Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: 16), | ||
| child: Text( | ||
| 'Changing your phone will require you to go through the phone verification process again.', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| style: Theme.of(context) | ||
| .textTheme | ||
| .bodyLarge! | ||
| .copyWith( | ||
| color: | ||
| Theme.of(context).colorScheme.onSurface), | ||
| ), | ||
| ), | ||
| ), | ||
| style: Theme.of(context).textTheme.bodyMedium!.copyWith( | ||
| color: Theme.of(context).colorScheme.onSurface), | ||
| dropdownTextStyle: Theme.of(context) | ||
| .textTheme | ||
| .bodyMedium! | ||
| .copyWith( | ||
| ], | ||
| ), | ||
| if (!widget.newPhone) | ||
| const SizedBox( | ||
| height: 20, | ||
| ), | ||
| Row( | ||
| children: <Widget>[ | ||
| Expanded( | ||
| child: Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: 16), | ||
| child: IntlPhoneField( | ||
| initialCountryCode: widget.defaultCountryCode, | ||
| decoration: const InputDecoration( | ||
| labelText: 'Phone Number', | ||
| border: OutlineInputBorder( | ||
| borderSide: BorderSide(), | ||
| ), | ||
| ), | ||
| style: Theme.of(context).textTheme.bodyMedium!.copyWith( | ||
| color: Theme.of(context).colorScheme.onSurface), | ||
| onChanged: (phone) { | ||
| PhoneNumber p = phone; | ||
| setState(() { | ||
| if (phone.number.length >= _country.minLength && | ||
| phone.number.length <= _country.maxLength) { | ||
| valid = true; | ||
| verificationPhoneNumber = p.completeNumber; | ||
| } else { | ||
| valid = false; | ||
| } | ||
| }); | ||
| }, | ||
| onCountryChanged: (country) { | ||
| if (_country != country) { | ||
| valid = false; | ||
| } | ||
| _country = country; | ||
| setState(() {}); | ||
| }, | ||
| dropdownTextStyle: Theme.of(context) | ||
| .textTheme | ||
| .bodyMedium! | ||
| .copyWith( | ||
| color: Theme.of(context).colorScheme.onSurface), | ||
| onChanged: (phone) { | ||
| PhoneNumber p = phone; | ||
| setState(() { | ||
| if (phone.number.length >= _country.minLength && | ||
| phone.number.length <= _country.maxLength) { | ||
| valid = true; | ||
| verificationPhoneNumber = p.completeNumber; | ||
| } else { | ||
| valid = false; | ||
| } | ||
| }); | ||
| }, | ||
| onCountryChanged: (country) { | ||
| if (_country != country) { | ||
| valid = false; | ||
| } | ||
| _country = country; | ||
| setState(() {}); | ||
| }, | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ], | ||
| ), | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Uh oh!
There was an error while loading. Please reload this page.