wildanfuady

Untitled

Nov 13th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:sekolahku/project/ListSiswa.dart';
  3.  
  4. class Login extends StatefulWidget {
  5.  
  6. @override
  7. LoginState createState() => new LoginState();
  8. }
  9.  
  10. class LoginState extends State<Login> {
  11.  
  12. bool _secureText = true;
  13. showHide() {
  14. setState(() {
  15. _secureText = !_secureText;
  16. });
  17. }
  18.  
  19.  
  20. // variabel member class
  21. final _email = TextEditingController();
  22. final _password = TextEditingController();
  23.  
  24.  
  25. @override
  26. Widget build(BuildContext context) {
  27. return Scaffold(
  28. body: Center(
  29. child: ListView(
  30. shrinkWrap: true,
  31. padding: EdgeInsets.only(left: 24.0, right: 24.0),
  32. children: <Widget>[
  33. Padding(
  34. padding: EdgeInsets.only(top: 25.0),
  35. ),
  36. Hero(
  37. tag: 'hero',
  38. child: CircleAvatar(
  39. backgroundColor: Colors.transparent,
  40. radius: 48.0,
  41. child: Image.asset('images/logo.png'),
  42. ),
  43. ),
  44. SizedBox(height: 24.0),
  45. Center(
  46. child: Column(
  47. children: <Widget>[
  48. Text(
  49. "SEKOLAHKU",
  50. style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.grey),
  51. ),
  52. ],
  53. ),
  54. ),
  55. SizedBox(height: 24.0),
  56. TextFormField(
  57. controller: _email,
  58. keyboardType: TextInputType.text,
  59. autofocus: false,
  60. decoration: InputDecoration(
  61. hintText: 'email',
  62. filled: true,
  63. contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
  64. border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
  65. suffixIcon: Icon(Icons.person),
  66. ),
  67. ),
  68. // spasi
  69. SizedBox(height: 8.0),
  70. TextFormField(
  71. autofocus: false,
  72. obscureText: _secureText,
  73. controller: _password,
  74. keyboardType: TextInputType.text,
  75. decoration: InputDecoration(
  76. hintText: 'Password',
  77. filled: true,
  78. contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
  79. border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
  80. suffixIcon: IconButton(
  81. onPressed: showHide,
  82. icon: Icon(_secureText
  83. ? Icons.visibility_off
  84. : Icons.visibility),
  85. ),
  86. ),
  87. ),
  88. // spasi
  89. SizedBox(height: 24.0),
  90. // tombol
  91. Padding(
  92. padding: EdgeInsets.symmetric(vertical: 16.0),
  93. child: Material(
  94. borderRadius: BorderRadius.circular(30.0),
  95. shadowColor: Colors.lightBlueAccent.shade100,
  96. elevation: 5.0,
  97. child: MaterialButton(
  98. minWidth: 200.0,
  99. height: 42.0,
  100. onPressed: () {
  101. Navigator.of(context).pushReplacement(
  102. new MaterialPageRoute(
  103. builder: (BuildContext context) => ListSiswa()
  104. ),
  105. );
  106. },
  107. color: Colors.lightBlueAccent,
  108. child: Text('Log In', style: TextStyle(color: Colors.white, fontSize: 20.0)),
  109. ),
  110. ),
  111. ),
  112. ],
  113. )
  114. )
  115. );
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment