update carton from packages

This commit is contained in:
2021-01-08 17:13:51 +06:30
parent f0662ff1d0
commit 32b8c5ae93
17 changed files with 321 additions and 371 deletions

View File

@@ -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(