Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:grouped_buttons/grouped_buttons.dart';
- class TextFieldExample extends StatelessWidget {
- final _formKey = GlobalKey<FormState>();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('Form Sample'),
- ),
- body: Form(
- key: _formKey,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- children: <Widget>[
- TextFormField(
- textInputAction: TextInputAction.next,
- // focusNode: _nameFocus,
- decoration: const InputDecoration(
- icon: Icon(Icons.person),
- labelText: 'Nama Siswa *',
- hintText: 'Masukan nama siswa',
- ),
- ),
- TextFormField(
- textInputAction: TextInputAction.next,
- // focusNode: _nameFocus,
- decoration: const InputDecoration(
- icon: Icon(Icons.phone),
- labelText: 'Telp *',
- hintText: 'Masukan no telp',
- ),
- ),
- TextFormField(
- textInputAction: TextInputAction.next,
- // focusNode: _nameFocus,
- decoration: const InputDecoration(
- icon: Icon(Icons.email),
- labelText: 'Email *',
- hintText: 'akun@emailanda.com',
- ),
- ),
- ],
- ),
- ),
- ),
- floatingActionButton: FloatingActionButton(
- child: Icon(Icons.save),
- onPressed: () {
- // Validate returns true if the form is valid, or false
- // otherwise.
- if (_formKey.currentState.validate()) {
- // If the form is valid, display a Snackbar.
- Scaffold.of(context)
- .showSnackBar(SnackBar(content: Text('Processing Data')));
- }
- },
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement