Advertisement
wildanfuady

Form Layout

Oct 13th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:grouped_buttons/grouped_buttons.dart';
  3.  
  4. class FormExample extends StatelessWidget {
  5.  
  6. final GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
  7.  
  8. @override
  9. Widget build(BuildContext context) {
  10. final Size screenSize = MediaQuery.of(context).size;
  11.  
  12. return new Scaffold(
  13. appBar: new AppBar(
  14. title: new Text('Form Example '),
  15. ),
  16. body: new Container(
  17. padding: new EdgeInsets.all(20.0),
  18. child: new Form(
  19. key: this._formKey,
  20. child: new ListView(
  21. children: <Widget>[
  22. new TextFormField(
  23. keyboardType: TextInputType.text, // Use email input type for emails.
  24. decoration: new InputDecoration(
  25. hintText: 'Enter your name',
  26. labelText: 'Name'
  27. )
  28. ),
  29. new TextFormField(
  30. keyboardType: TextInputType.phone, // Use email input type for emails.
  31. decoration: new InputDecoration(
  32. hintText: '0*** **** ****',
  33. labelText: 'Telp'
  34. )
  35. ),
  36. new TextFormField(
  37. keyboardType: TextInputType.emailAddress, // Use email input type for emails.
  38. decoration: new InputDecoration(
  39. hintText: 'email@example.com',
  40. labelText: 'E-mail'
  41. )
  42. ),
  43. new TextFormField(
  44. obscureText: true, // Use secure text for passwords.
  45. decoration: new InputDecoration(
  46. hintText: 'Enter your password',
  47. labelText: 'Password'
  48. )
  49. ),
  50. new TextFormField(
  51. obscureText: true, // Use secure text for passwords.
  52. decoration: new InputDecoration(
  53. hintText: 'Enter your age',
  54. labelText: 'Age'
  55. )
  56. ),
  57. new TextFormField(
  58. obscureText: true,
  59. keyboardType: TextInputType.multiline,
  60. maxLines: 3,
  61. decoration: new InputDecoration(
  62. hintText: 'Enter your address',
  63. labelText: 'Address'
  64. )
  65. ),
  66.  
  67. new Container(
  68. width: screenSize.width,
  69. child: new RaisedButton(
  70. child: new Text(
  71. 'Simpan',
  72. style: new TextStyle(
  73. color: Colors.white
  74. ),
  75. ),
  76. onPressed: () => null,
  77. color: Colors.blue,
  78. ),
  79. margin: new EdgeInsets.only(
  80. top: 20.0
  81. ),
  82. )
  83. ],
  84. ),
  85. )
  86. ),
  87. );
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement