Conversation
| - `dayOfWeek`: An `int` between one and seven ([`DateTime.monday`](https://api.flutter.dev/flutter/dart-core/DateTime/monday-constant.html) through [`DateTime.sunday`](https://api.flutter.dev/flutter/dart-core/DateTime/sunday-constant.html)). | ||
|
|
||
| Timetable currently offers localizations for Chinese, English, French, German, Hungarian, Italian, Japanese, Portuguese, and Spanish. | ||
| Timetable currently offers localizations for Czech, Chinese, English, French, German, Hungarian, Italian, Japanese, Portuguese, and Spanish. |
There was a problem hiding this comment.
| Timetable currently offers localizations for Czech, Chinese, English, French, German, Hungarian, Italian, Japanese, Portuguese, and Spanish. | |
| Timetable currently offers localizations for Chinese, Czech, English, French, German, Hungarian, Italian, Japanese, Portuguese, and Spanish. |
| /// Supported [Locale.languageCode]s: | ||
| /// | ||
| /// * `cs` – Czech | ||
| /// * `de` – German |
There was a problem hiding this comment.
| /// * `de` – German |
| case 'cs': | ||
| return const TimetableLocalizationCs(); |
There was a problem hiding this comment.
Please move this case above 'de' to keep them ordered alphabetically as well
| class TimetableLocalizationCs extends TimetableLocalizations { | ||
| const TimetableLocalizationCs(); | ||
|
|
||
| @override | ||
| List<String> weekLabels(Week week) { | ||
| return [ | ||
| weekOfYear(week), | ||
| 'Týden ${week.weekOfYear}', | ||
| 'T ${week.weekOfYear}', | ||
| '${week.weekOfYear}', | ||
| ]; | ||
| } | ||
|
|
||
| @override | ||
| String weekOfYear(Week week) => | ||
| 'Týden ${week.weekOfYear}, ${week.weekBasedYear}'; | ||
| } |
There was a problem hiding this comment.
Please move this class above TimetableLocalizationDe to keep them ordered alphabetically
| if (mounted) { | ||
| final adjustedOffset = _pointerToWidgetTopCenter(_lastOffset!); | ||
| final geometry = _findGeometry(context, adjustedOffset); | ||
| widget.onDragCanceled?.call(geometry.key, _wasMoved); | ||
| _resetState(); | ||
| } else { | ||
| widget.onDragCanceled?.call(null, _wasMoved); | ||
| _resetState(); | ||
| } |
There was a problem hiding this comment.
What problem were you seeing with the previous code?
With the new code, if this widget is created as PartDayDraggableEvent.forGeometryKeys(…), the call to onDragCanceled will throw an exception since it ensures that the geometry key is not null
There was a problem hiding this comment.
Thank you for taking the time to review the code. I apologize for the confusion caused by the incorrect order. I have not realized that the letter "Ch" is specific to my language, Czech.
I have implemented the drag-and-drop functionality in my app, using the example app as a guide. However, there have been instances where the PartDayDraggableEvent becomes unmounted, and the onDragCanceled function crashes due to the unmounted state at _pointerToWidgetTopCenter(_lastOffset!). As a result, the logic to remove the event overlay is not executed.
To address this issue, I have made a change that ensures the onDragCanceled function is called even after the widget is mounted, which removes the overlay in my app.
But I see that it conflicts with other functionality. What do you think I should do?
There was a problem hiding this comment.
A stacktrace:
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
at State.context(framework.dart:954)
at _PartDayDraggableEventState._findRenderBox(multi_date_content.dart:274)
at _PartDayDraggableEventState._pointerToWidgetTopCenter(multi_date_content.dart:334)
at _PartDayDraggableEventState._onDragCanceled(multi_date_content.dart:327)
at AsyncValueX.maybeWhen.<fn>(common.dart:624)
at _DraggableState._startDrag.<fn>(drag_target.dart:525)
at _DragAvatar.finishDrag(drag_target.dart:897)
at _DragAvatar.end(drag_target.dart:801)
at MultiDragPointerState._up(multidrag.dart:158)
at MultiDragGestureRecognizer._handleEvent(multidrag.dart:266)
at PointerRouter._dispatch(pointer_router.dart:98)
at PointerRouter._dispatchEventToRoutes.<fn>(pointer_router.dart:143)
at _LinkedHashMapMixin.forEach(dart:collection)
at PointerRouter._dispatchEventToRoutes(pointer_router.dart:141)
at PointerRouter.route(pointer_router.dart:127)
at GestureBinding.handleEvent(binding.dart:460)
at GestureBinding.dispatchEvent(binding.dart:440)
at RendererBinding.dispatchEvent(binding.dart:336)
at GestureBinding._handlePointerEventImmediately(binding.dart:395)
at GestureBinding.handlePointerEvent(binding.dart:357)
at GestureBinding._flushPointerEventQueue(binding.dart:314)
at GestureBinding._handlePointerDataPacket(binding.dart:295)```
There was a problem hiding this comment.
No worries, that's an interesting property of the Czech alphabet!
Okay, I see the problem. Maybe we should just drop the geometry key parameter of the onDragCanceled callback? I don't know where it would be useful… That would also mean that the three different typedefs for onDragCanceled could be merged into just one taking a bool wasMoved.
Alternatively, we could save the geometry key from the last onDragUpdate, but that doesn't work if the pointer didn't move or the corresponding geometry got disposed of already. Hence, I lean towards the first option
There was a problem hiding this comment.
Thanks :)!
If you think the argument is not helpful, I agree with the first option as it is cleaner.
There was a problem hiding this comment.
Would you like me to do it? Or should I create a new pull request with correctly added Czech locales and leave this to you?
I am currently not dependent upon this change as I use the fork.
There was a problem hiding this comment.
Sorry for the delay! I'll leave that up to you – go ahead if you want to, otherwise, I'll implement that change before the next release :)
No description provided.