-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
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
Listener when tapping the background (e.g. for creating an event) #18
Comments
Yes, I'm definitely open to contributions and haven't started implementing this feature yet. Just fork the project and open a PR when you're done or a draft PR when you have something to discuss. You don't have to update the changelog or version as I do that directly when releasing. Maybe showcase it in the example project by showing a snackbar when the listener fires. I, unfortunately, don't have any documentation about the architecture of timetable yet (which will soon change a lot due to #17), so feel free to ask if you have any questions. There will probably be an additional parameter in the |
I added the typedef to the Timetable. I see the point to pass that listener down to Would we use the eventBuilder for that? EG (for simple events). Expanded(
child: TimetableContent<E>(
controller: controller,
eventBuilder: eventBuilder, <-- pass it as parameter or such?
),
), Could you maybe shortly elaborate on the difference between |
An easy way to pass the listener to the widgets that need it ( Expanded(
child: TimetableContent<E>(
controller: controller,
eventBuilder: eventBuilder,
onCreateEvent: onCreateEvent,
),
), That results in an additional parameter in a few intermediate widgets, but due to the large refactoring coming soon, we don't really need a more elegant way (like an
For the header and all-day events, the listener would get passed down through
|
Currently making progress. Taps are received in DateEvents and give back the actual date. How ever I'm currently only getting back the current date (no time). If I understand your comment correctly we need to pass down that listener even more towards the events to get the actual selected timeframe? I think that would be pretty helpful. Also I'm a bit confused since we defined |
Looks good so far! To get the time, we probably need to read the y-offset of the tap and calculate it manually. To get the offset, register The I'm not quite sure what you mean by your last question — we already have access to the respective |
Ah! No worries. Thanks for your explanation. What caused confusion for me was the part with I think we almost made it for the child: DatePageView(
controller: widget.controller,
builder: (_, date) {
return LayoutBuilder(
builder: (context, constraints) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTapUp: (details) {
final cell = details.localPosition.dy / (((constraints.heightConstraints() / 24).maxHeight).floor());
final time = DateTime(date.year, date.monthOfYear, date.dayOfYear, cell.toInt());
final startTime = LocalDateTime.dateTime(time);
print(startTime);
// widget.onCreateEvent(startTime, false);
},
child: StreamedDateEvents<E>(
date: date,
controller: widget.controller,
eventBuilder: widget.eventBuilder,
));});
},
), This is the way I'm currently creating the start time of the tapped event. There is still a flaw because it is currently 1 hour off. Gonna checkout tomorrow why that is. Do you see any flaws or improvements we could do to calculate the tapped starting time (variable naming aside for now)? Thanks for your awesome help so far. My attempt was too calculate the height dimensions of each cell from 00:00 - 23:00 and then determine based on the tap position which cell was selected. But currently it results in inconsistencies so that i have two different timeframes in one cell. The offset of 1 hour apparently origins by a flawed calculation of the tapped cell position. I also tried to EDIT: Sorry for the spam I think I figured it out and find the problem. TLDR: I think it's working now using. How ever the +1 offset still bothers me somehow: final cell = details.localPosition.dy / ((constraints.maxHeight / 24).round());
final time = DateTime(date.year, date.monthOfYear, date.dayOfYear, cell.toInt() + 1);
final startTime = LocalDateTime.dateTime(time);
print(startTime); |
Hello there,
any ideas on when this will be live?
Are you open for foreign contributions?
I could not find a contribution guide but I'd be happy to start working on this one since I could need it for a personal project.
Just wanted to check in whether you are basically open for foreign contributions etc. and what a foreign contributor should consider?
Would be a pity if I start working on this one and it's nearly done on your side or you don't want anyone to contribute to this project.
The text was updated successfully, but these errors were encountered: