Skip to content

Instantly share code, notes, and snippets.

@fpatelm
Created September 9, 2023 09:30
Show Gist options
  • Save fpatelm/4a5654570063dd7e510b54c5b55fdc6c to your computer and use it in GitHub Desktop.
Save fpatelm/4a5654570063dd7e510b54c5b55fdc6c to your computer and use it in GitHub Desktop.
edit_number_screen
class EditNumber extends StatefulWidget {
const EditNumber({Key? key}) : super(key: key);
@override
_EditNumberState createState() => _EditNumberState();
}
class _EditNumberState extends State<EditNumber> {
var _enterPhoneNumber = TextEditingController();
Map<String, dynamic> data = {"name": "Portugal", "code": "+351"};
Map<String, dynamic>? dataResult;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text("Edit Number"),
previousPageTitle: "Back",
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Logo(width: 80.0, height: 80.0, radius: 30.0),
Text("Verification • one step",
style: TextStyle(
color: Color(0xFF08C187).withOpacity(0.7), fontSize: 30))
],
),
Text("Enter your phone number",
style: TextStyle(
color: CupertinoColors.systemGrey.withOpacity(0.7),
fontSize: 30)),
CupertinoListTile(
onTap: () async {
dataResult = await Navigator.push(context,
CupertinoPageRoute(builder: (context) => SelectCountry()));
setState(() {
if (dataResult != null) data = dataResult!;
});
},
title:
Text(data['name'], style: TextStyle(color: Color(0xFF08C187))),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
children: [
Text(data['code'],
style: TextStyle(
fontSize: 25, color: CupertinoColors.secondaryLabel)),
Expanded(
child: CupertinoTextField(
placeholder: "Enter your phone number",
controller: _enterPhoneNumber,
keyboardType: TextInputType.number,
style: TextStyle(
fontSize: 25, color: CupertinoColors.secondaryLabel),
),
)
],
),
),
Text("You will receive an activation code in short time",
style:
TextStyle(color: CupertinoColors.systemGrey, fontSize: 15)),
Padding(
padding: const EdgeInsets.symmetric(vertical: 40),
child: CupertinoButton.filled(
child: Text("Request code"),
onPressed: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => VerifyNumber(
number: data['code']! + _enterPhoneNumber.text,
)));
}),
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment