Advertisement
wildanfuady

Text Area Layout

Oct 13th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class TextareaExample extends StatelessWidget {
  4.  
  5. final _formKey = GlobalKey<FormState>();
  6. @override
  7. Widget build(BuildContext context) {
  8. return Scaffold(
  9. appBar: AppBar(
  10. title: Text('Textarea Sample'),
  11. ),
  12. body: Form(
  13. key: _formKey,
  14. child: Padding(
  15. padding: const EdgeInsets.all(2.0),
  16. child: Column(
  17. children: <Widget>[
  18. TextFormField(
  19. validator: (value) {
  20. if (value.isEmpty) {
  21. return 'Nama wajib diisi';
  22. }
  23. return null;
  24. },
  25. keyboardType: TextInputType.multiline,
  26. maxLines: 3,
  27. // focusNode: _nameFocus,
  28. decoration: const InputDecoration(
  29. icon: Icon(Icons.location_city),
  30. // labelText: 'Alamat *',
  31. hintText: 'Masukan alamat Anda',
  32. ),
  33. ),
  34. ],
  35. ),
  36. ),
  37. ),
  38. floatingActionButton: FloatingActionButton(
  39. child: Icon(Icons.save),
  40. onPressed: () {
  41. // Validate returns true if the form is valid, or false
  42. // otherwise.
  43. if (_formKey.currentState.validate()) {
  44. // If the form is valid, display a Snackbar.
  45. Scaffold.of(context)
  46. .showSnackBar(SnackBar(content: Text('Processing Data')));
  47. }
  48. },
  49. ),
  50. );
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement