We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug A clear and concise description of what the bug is.
When changing the value of a DatePicker by scrolling the date, an exception is thrown when setState() is called in onChanged.
DatePicker
setState()
onChanged
Workaround until fixed: Wrap setState() inside a Future.delayed():
Future.delayed()
onChanged: (value) { Future.delayed(const Duration(milliseconds: 500), () { setState(() { selected = value; }); }); },
To Reproduce Steps to reproduce the behavior:
fluent_ui: git: https://github.com/bdlukaa/fluent_ui.git
main.dart
import 'package:fluent_ui/fluent_ui.dart'; void main() async { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return FluentApp( title: 'Bug issue', home: NavigationView( pane: NavigationPane( selected: 0, displayMode: PaneDisplayMode.compact, items: [ PaneItem( icon: const Icon(FluentIcons.home), title: const Text('Home'), body: Container( alignment: Alignment.center, child: const DateWidget(), ), ), ], ), ), ); } } class DateWidget extends StatefulWidget { const DateWidget({super.key}); @override State<DateWidget> createState() => DateWidgetState(); } class DateWidgetState extends State<DateWidget> { DateTime selected = DateTime.now(); @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return DatePicker( selected: selected, fieldOrder: const [ DatePickerField.year, DatePickerField.month, DatePickerField.day, ], onChanged: (value) { setState(() { selected = value; }); }, ); } }
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
We are calling onChanged before popping the picker. I believe changing this order fixes this issue.
Sorry, something went wrong.
I see the same issue.
No branches or pull requests
Describe the bug
A clear and concise description of what the bug is.
When changing the value of a
DatePicker
by scrolling the date, an exception is thrown whensetState()
is called inonChanged
.Workaround until fixed:
Wrap
setState()
inside aFuture.delayed()
:To Reproduce
Steps to reproduce the behavior:
main.dart
as follows:Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: