Guest User

Untitled

a guest
Sep 7th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.64 KB | None | 0 0
  1. class MyHomePage extends StatefulWidget {
  2. @override
  3. _MyHomePageState createState() => new _MyHomePageState();
  4. }
  5.  
  6. class _MyHomePageState extends State<MyHomePage> {
  7. bool _twoFactorAuth = false;
  8.  
  9. final TextEditingController _userName = new TextEditingController();
  10. final TextEditingController _email = new TextEditingController();
  11. final TextEditingController _password = new TextEditingController();
  12. final _scaffoldKey = new GlobalKey<ScaffoldState>();
  13. VoidCallback _showPersBottomSheetCallBack;
  14. bool _obscureText = true;
  15.  
  16. @override
  17. void initState() {
  18. super.initState();
  19. _showPersBottomSheetCallBack = _showBottomSheet;
  20. }
  21.  
  22. void _showBottomSheet() {
  23. setState(() {
  24. _showPersBottomSheetCallBack = null;
  25. });
  26.  
  27. _scaffoldKey.currentState
  28. .showBottomSheet((context) {
  29. return new Container(
  30. decoration: new BoxDecoration(
  31. color: Colors.grey,
  32. shape: BoxShape.rectangle,
  33. borderRadius: BorderRadius.only(
  34. topRight: Radius.circular(16.0),
  35. topLeft: Radius.circular(16.0))),
  36. padding: new EdgeInsets.only(top: 0.5),
  37. child: new Container(
  38. padding: new EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 0.0),
  39. decoration: new BoxDecoration(
  40. color: Colors.white,
  41. shape: BoxShape.rectangle,
  42. borderRadius: BorderRadius.only(
  43. topRight: Radius.circular(16.0),
  44. topLeft: Radius.circular(16.0))),
  45. child: new SingleChildScrollView(
  46. child: new Column(
  47. mainAxisSize: MainAxisSize.min,
  48. children: <Widget>[
  49. new Row(
  50. mainAxisAlignment: MainAxisAlignment.start,
  51. children: <Widget>[
  52. new CircleAvatar(
  53. backgroundColor: Colors.brown.shade800,
  54. child: new Text('MM'),
  55. radius: 30.0,
  56. ),
  57. new Expanded(
  58. child: new Container(
  59. padding: new EdgeInsets.only(right: 54.0),
  60. child: new Text(
  61. "Mendy Marcus",
  62. textAlign: TextAlign.center,
  63. style: new TextStyle(
  64. fontWeight: FontWeight.w300,
  65. fontSize: 20.0),
  66. )))
  67. ],
  68. ),
  69. new Container(
  70. margin: new EdgeInsets.only(top: 8.0),
  71. child: new Form(
  72. child: new Column(
  73. children: <Widget>[
  74. new Container(
  75. margin: new EdgeInsets.only(bottom: 8.0),
  76. child: new TextFormField(
  77. controller: _userName,
  78. keyboardType: TextInputType.text,
  79. decoration: new InputDecoration(
  80. border: InputBorder.none,
  81. filled: true,
  82. labelText: "Username",
  83. icon: new Icon(Icons.person_pin)),
  84. ),
  85. ),
  86. new Container(
  87. margin: new EdgeInsets.only(bottom: 8.0),
  88. child: new TextFormField(
  89. controller: _email,
  90. keyboardType: TextInputType.emailAddress,
  91. decoration: new InputDecoration(
  92. border: InputBorder.none,
  93. filled: true,
  94. labelText: "E-mail",
  95. icon: new Icon(Icons.email)),
  96. ),
  97. ),
  98. new Container(
  99. margin: new EdgeInsets.only(bottom: 8.0),
  100. child: new TextFormField(
  101. controller: _password,
  102. obscureText: _obscureText,
  103. keyboardType: TextInputType.text,
  104. decoration: new InputDecoration(
  105. suffixIcon: new GestureDetector(
  106. onTap: () {
  107. setState(() {
  108. _obscureText = !_obscureText;
  109. });
  110. },
  111. child: new Icon(_obscureText
  112. ? Icons.visibility
  113. : Icons.visibility_off),
  114. ),
  115. border: InputBorder.none,
  116. filled: true,
  117. labelText: "Password",
  118. icon: new Icon(Icons.lock)),
  119. ),
  120. ),
  121. ],
  122. ),
  123. )),
  124. new SwitchListTile(
  125. value: _twoFactorAuth,
  126. onChanged: (bool newValue) {
  127. setState(() {
  128. _twoFactorAuth = newValue;
  129. });
  130. },
  131. title: new Text("Two-Factor Authentication"),
  132. ),
  133. new Divider(
  134. height: 16.0,
  135. color: Colors.redAccent,
  136. indent: 0.0,
  137. ),
  138. new Center(
  139. child: new MaterialButton(
  140. onPressed: () => {},
  141. padding: new EdgeInsets.all(8.0),
  142. child: new Column(
  143. // Replace with a Row for horizontal icon + text
  144. children: <Widget>[
  145. new Icon(Icons.delete),
  146. new Text("Delete Account")
  147. ],
  148. ),
  149. ))
  150. ],
  151. ))));
  152. })
  153. .closed
  154. .whenComplete(() {
  155. if (mounted) {
  156. setState(() {
  157. _showPersBottomSheetCallBack = _showBottomSheet;
  158. });
  159. }
  160. });
  161. }
  162.  
  163. @override
  164. Widget build(BuildContext context) {
  165. return new SafeArea(
  166. child: new Scaffold(
  167. key: _scaffoldKey,
  168. body: new Padding(
  169. padding: const EdgeInsets.all(20.0),
  170. child: new Center(
  171. child: new Column(
  172. mainAxisAlignment: MainAxisAlignment.center,
  173. children: <Widget>[
  174. new RaisedButton(
  175. onPressed: _showPersBottomSheetCallBack,
  176. child: new Text("Account"),
  177. ),
  178. ],
  179. )),
  180. ),
  181. ));
  182. }
  183. }
Add Comment
Please, Sign In to add comment