From 3dc7441a2b310ca1ecd6ec9914664b615c88e9a3 Mon Sep 17 00:00:00 2001 From: SimonSchwierzeck Date: Wed, 13 Nov 2019 18:35:45 +0100 Subject: [PATCH] added attributes and methods to rerive inputs from textfields. #131 --- lib/screens/newbox_screen.dart | 51 +++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/lib/screens/newbox_screen.dart b/lib/screens/newbox_screen.dart index 6f1e2a07..82eb9c88 100644 --- a/lib/screens/newbox_screen.dart +++ b/lib/screens/newbox_screen.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; @@ -39,11 +38,14 @@ class NewBoxData extends StatefulWidget { } class _NewBoxDataState extends State { - String id; - String oldId; - DateTime hangDate; - String material; - + String _id; + String _oldId; + String _foreignId; + DateTime _hangDate; + String _regionId; + String _regionName; + String _owner; + String _comment; String _dropDownMaterial; double _slideHoleSize = 1; @@ -71,6 +73,11 @@ class _NewBoxDataState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(10), child: TextFormField( + onChanged: (String value) { + setState(() { + _id = value; + }); + }, textAlign: TextAlign.left, decoration: InputDecoration( labelText: "ID - optional", @@ -85,6 +92,11 @@ class _NewBoxDataState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(10), child: TextFormField( + onChanged: (String value) { + setState(() { + _oldId = value; + }); + }, textAlign: TextAlign.left, decoration: InputDecoration( labelText: "old ID - optional", @@ -99,6 +111,11 @@ class _NewBoxDataState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(10), child: TextFormField( + onChanged: (String value) { + setState(() { + _foreignId = value; + }); + }, textAlign: TextAlign.left, decoration: InputDecoration( labelText: "foreign ID - optional", @@ -132,7 +149,7 @@ class _NewBoxDataState extends State { initialDate: DateTime.now(), editable: false, onChanged: (dt) { - setState(() => hangDate = dt); + setState(() => _hangDate = dt); }, ), ))), @@ -178,6 +195,11 @@ class _NewBoxDataState extends State { ), subtitle: Column(children: [ TextFormField( + onChanged: (String value) { + setState(() { + _regionId = value; + }); + }, maxLines: 1, textAlign: TextAlign.left, decoration: InputDecoration( @@ -187,6 +209,11 @@ class _NewBoxDataState extends State { ), ), TextFormField( + onChanged: (String value) { + setState(() { + _regionName = value; + }); + }, maxLines: 1, textAlign: TextAlign.left, decoration: InputDecoration( @@ -258,6 +285,11 @@ class _NewBoxDataState extends State { ], ), subtitle: TextFormField( + onChanged: (String value) { + setState(() { + _owner = value; + }); + }, maxLines: 1, textAlign: TextAlign.left, decoration: InputDecoration( @@ -279,6 +311,11 @@ class _NewBoxDataState extends State { ], ), subtitle: TextFormField( + onChanged: (String value) { + setState(() { + _comment = value; + }); + }, maxLines: 3, textAlign: TextAlign.left, ),