Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:sekolahku/project/ListSiswa.dart';
- class Login extends StatefulWidget {
- @override
- LoginState createState() => new LoginState();
- }
- class LoginState extends State<Login> {
- bool _secureText = true;
- showHide() {
- setState(() {
- _secureText = !_secureText;
- });
- }
- // variabel member class
- final _email = TextEditingController();
- final _password = TextEditingController();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(
- child: ListView(
- shrinkWrap: true,
- padding: EdgeInsets.only(left: 24.0, right: 24.0),
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(top: 25.0),
- ),
- Hero(
- tag: 'hero',
- child: CircleAvatar(
- backgroundColor: Colors.transparent,
- radius: 48.0,
- child: Image.asset('images/logo.png'),
- ),
- ),
- SizedBox(height: 24.0),
- Center(
- child: Column(
- children: <Widget>[
- Text(
- "SEKOLAHKU",
- style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.grey),
- ),
- ],
- ),
- ),
- SizedBox(height: 24.0),
- TextFormField(
- controller: _email,
- keyboardType: TextInputType.text,
- autofocus: false,
- decoration: InputDecoration(
- hintText: 'email',
- filled: true,
- contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
- suffixIcon: Icon(Icons.person),
- ),
- ),
- // spasi
- SizedBox(height: 8.0),
- TextFormField(
- autofocus: false,
- obscureText: _secureText,
- controller: _password,
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- hintText: 'Password',
- filled: true,
- contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
- suffixIcon: IconButton(
- onPressed: showHide,
- icon: Icon(_secureText
- ? Icons.visibility_off
- : Icons.visibility),
- ),
- ),
- ),
- // spasi
- SizedBox(height: 24.0),
- // tombol
- Padding(
- padding: EdgeInsets.symmetric(vertical: 16.0),
- child: Material(
- borderRadius: BorderRadius.circular(30.0),
- shadowColor: Colors.lightBlueAccent.shade100,
- elevation: 5.0,
- child: MaterialButton(
- minWidth: 200.0,
- height: 42.0,
- onPressed: () {
- Navigator.of(context).pushReplacement(
- new MaterialPageRoute(
- builder: (BuildContext context) => ListSiswa()
- ),
- );
- },
- color: Colors.lightBlueAccent,
- child: Text('Log In', style: TextStyle(color: Colors.white, fontSize: 20.0)),
- ),
- ),
- ),
- ],
- )
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment