Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class TextareaExample extends StatelessWidget {
- final _formKey = GlobalKey<FormState>();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('Textarea Sample'),
- ),
- body: Form(
- key: _formKey,
- child: Padding(
- padding: const EdgeInsets.all(2.0),
- child: Column(
- children: <Widget>[
- TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return 'Nama wajib diisi';
- }
- return null;
- },
- keyboardType: TextInputType.multiline,
- maxLines: 3,
- // focusNode: _nameFocus,
- decoration: const InputDecoration(
- icon: Icon(Icons.location_city),
- // labelText: 'Alamat *',
- hintText: 'Masukan alamat Anda',
- ),
- ),
- ],
- ),
- ),
- ),
- 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