Comments (9)
flutter > 1.5.4-hotfix.2
from datetime_picker_formfield.
Can confirm this occurs in Flutter version 1.7.8+hotfix3
from datetime_picker_formfield.
I have been doing some digging about & testing... It looks like the code is listening to changes on both the focus node and text controller so there are multiple entries to the function that opens the date picker. Here is the referenced code:
@override
void initState() {
super.initState();
widget.focusNode.addListener(inputChanged);
widget.controller.addListener(inputChanged);
}
@override
void dispose() {
widget.controller.removeListener(inputChanged);
widget.focusNode.removeListener(inputChanged);
super.dispose();
}
void inputChanged() {
final bool requiresInput = widget.controller.text.isEmpty &&
_previousValue.isEmpty &&
widget.focusNode.hasFocus;
if (requiresInput) {
getDateTimeInput(context, widget.initialDate, widget.initialTime)
.then(_setValue);
} else if (widget.resetIcon != null &&
widget.controller.text.isEmpty == showResetIcon) {
setState(() => showResetIcon = !showResetIcon);
// widget.focusNode.unfocus();
}
_previousValue = widget.controller.text;
if (!widget.focusNode.hasFocus) {
setValue(_toDate(_previousValue, widget.format));
} else if (!requiresInput && !widget.editable) {
var date = _toDate(_previousValue, widget.format);
getDateTimeInput(context, date ?? widget.initialDate,
_toTime(date) ?? widget.initialTime)
.then(_setValue);
}
}
What is more interesting... If I waited before clicking on the datetime picker (by click I mean a fairly quick mouse down + mouse up) but after waiting ~3 seconds after closing the datepicker before starting again I could get it to replicate.
HOWEVER - this was only replicatable AFTER I had set a value AND AFTER I hit the reset icon (although this does throw an exception) :
I/flutter (15494): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter (15494): The following assertion was thrown while handling a gesture:
I/flutter (15494): invalid text selection: TextSelection(baseOffset: 10, extentOffset: 10, affinity:
I/flutter (15494): TextAffinity.upstream, isDirectional: false)
I/flutter (15494):
I/flutter (15494): When the exception was thrown, this was the stack:
I/flutter (15494): #0 TextEditingController.selection=
package:flutter/…/widgets/editable_text.dart:169
I/flutter (15494): #1 EditableTextState._handleSelectionChanged
package:flutter/…/widgets/editable_text.dart:1216
I/flutter (15494): #2 RenderEditable._handlePotentialSelectionChange
package:flutter/…/rendering/editable.dart:369
I/flutter (15494): #3 RenderEditable.selectPositionAt
package:flutter/…/rendering/editable.dart:1416
I/flutter (15494): #4 RenderEditable.selectPosition
package:flutter/…/rendering/editable.dart:1388
I/flutter (15494): #5 _TextFieldState._handleSingleTapUp
package:flutter/…/material/text_field.dart:770
I/flutter (15494): #6 _TextSelectionGestureDetectorState._handleTapUp
package:flutter/…/widgets/text_selection.dart:944
I/flutter (15494): #7 TapGestureRecognizer._checkUp.<anonymous closure>
package:flutter/…/gestures/tap.dart:363
I/flutter (15494): #8 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:182
I/flutter (15494): #9 TapGestureRecognizer._checkUp
package:flutter/…/gestures/tap.dart:363
I/flutter (15494): #10 TapGestureRecognizer.acceptGesture
package:flutter/…/gestures/tap.dart:312
I/flutter (15494): #11 _TransparentTapGestureRecognizer.rejectGesture
package:flutter/…/widgets/text_selection.dart:1146
I/flutter (15494): #12 GestureArenaManager.sweep
package:flutter/…/gestures/arena.dart:159
I/flutter (15494): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent
package:flutter/…/gestures/binding.dart:222
I/flutter (15494): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent
package:flutter/…/gestures/binding.dart:198
I/flutter (15494): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent
package:flutter/…/gestures/binding.dart:156
I/flutter (15494): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue
package:flutter/…/gestures/binding.dart:102
I/flutter (15494): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket
package:flutter/…/gestures/binding.dart:86
I/flutter (15494): #21 _invoke1 (dart:ui/hooks.dart:250:10)
I/flutter (15494): #22 _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5)
I/flutter (15494): (elided 3 frames from package dart:async)
I/flutter (15494):
I/flutter (15494): Handler: "onTapUp"
I/flutter (15494): Recognizer:
I/flutter (15494): _TransparentTapGestureRecognizer#1273d
I/flutter (15494): ════════════════════════════════════════════════════════════════════════════════════════════════════
Perhaps it is related to the exception? The widget may likely be in some broken state?
from datetime_picker_formfield.
from datetime_picker_formfield.
from datetime_picker_formfield.
from datetime_picker_formfield.
This should be fixed in v0.3.0.
from datetime_picker_formfield.
Ok. When?
from datetime_picker_formfield.
from datetime_picker_formfield.
Related Issues (20)
- Change color
- No reset option
- Empty DateTimeField cant be clicked
- Warning: Operand of null-aware operation
- Context lost for FocusNode HOT 4
- How to set value with WidgetTester?
- Arabic locale time issue HOT 2
- How to hide the clear button? HOT 2
- BasicDateTimeField allowing user to select time before initialTime.
- onChanged runs when you click the field
- Error TextField
- Flutter application crashing on build on iOS.
- Error: No named parameter with the name 'autovalidate'. HOT 3
- Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null HOT 4
- Set datepicker value while clicked on a radio button HOT 1
- Flutter android app crashing building error
- Not changing 24hr to 12hr.
- 🐛 Bug on Windows version - time returned is out by one hour
- Is it really discontinued? Which fork is the best maintained? HOT 1
- Error: Undefined name 'maxLengthEnforcement' while executing the main.dart file for flutter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datetime_picker_formfield.