update carton from packages
This commit is contained in:
@@ -7,7 +7,9 @@ import 'local_text.dart';
|
||||
class DialogInput extends StatefulWidget {
|
||||
final String value;
|
||||
final String label;
|
||||
const DialogInput({Key key, this.label, this.value}) : super(key: key);
|
||||
final bool isQty;
|
||||
const DialogInput({Key key, this.label, this.value, this.isQty = false})
|
||||
: super(key: key);
|
||||
@override
|
||||
_DialogInputState createState() => _DialogInputState();
|
||||
}
|
||||
@@ -15,6 +17,7 @@ class DialogInput extends StatefulWidget {
|
||||
class _DialogInputState extends State<DialogInput> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
TextEditingController _controller = new TextEditingController();
|
||||
final _focusNode = FocusNode();
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
@@ -23,6 +26,12 @@ class _DialogInputState extends State<DialogInput> {
|
||||
super.initState();
|
||||
if (widget.value != null) {
|
||||
_controller.text = widget.value;
|
||||
_focusNode.addListener(() {
|
||||
if (_focusNode.hasFocus) {
|
||||
_controller.selection = TextSelection(
|
||||
baseOffset: 0, extentOffset: _controller.text.length);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +50,8 @@ class _DialogInputState extends State<DialogInput> {
|
||||
key: _formKey,
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
focusNode: widget.isQty ? _focusNode : FocusNode(),
|
||||
autofocus: true,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: new InputDecoration(
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
|
||||
Reference in New Issue
Block a user