Skip to content
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

Layout issue on landscape Tablet #237

Closed
Paroca72 opened this issue Jun 27, 2023 · 1 comment · Fixed by #249
Closed

Layout issue on landscape Tablet #237

Paroca72 opened this issue Jun 27, 2023 · 1 comment · Fixed by #249
Labels
bug Something isn't working

Comments

@Paroca72
Copy link

Paroca72 commented Jun 27, 2023

Hello,

On smartphone, locked in portrait, all good.
On tablet, locked in landscape, WeekView and DayView, wrong the layout.

Screenshot_20230627_230654
Screenshot_20230627_230724

Following my code to create the views.

        HeaderStyle headerStyle = const HeaderStyle(
          decoration: BoxDecoration(color: Themes.plannerHeaderBackgroundColor),
          headerTextStyle: TextStyle(fontWeight: FontWeight.bold),
        );

        // Create the views
        final List<Widget> views = [
          DayView(
            headerStyle: headerStyle,
            timeLineWidth: 60,
            dateStringBuilder: (date, {secondaryDate}) => date.toDisplay(),
            timeStringBuilder: (date, {secondaryDate}) =>
                date.toTime().toDisplay(),
            onDateTap: (date) => _createAppointment(context, date),
            onEventTap: (events, date) {
              AppointmentModel? appointment =
                  events.last.event as AppointmentModel?;
              _createAppointment(context, date, appointment?.id);
            },
          ),
          WeekView(
            headerStyle: headerStyle,
            timeLineWidth: 60,
            headerStringBuilder: (date, {secondaryDate}) =>
                "${date.toDisplay()} ${"Common.To".tr().toLowerCase()} ${secondaryDate!.toDisplay()}",
            timeLineStringBuilder: (date, {secondaryDate}) =>
                date.toTime().toDisplay(),
            onDateTap: (date) => _createAppointment(context, date),
            onEventTap: (events, date) {
              AppointmentModel? appointment =
                  events.last.event as AppointmentModel?;
              _createAppointment(context, date, appointment?.id);
            },
          ),
          MonthView(
            headerStyle: headerStyle,
            headerStringBuilder: (date, {secondaryDate}) =>
                "${date.monthName()} ${date.year}",
            onCellTap: (_, date) => _createAppointment(context, date),
            onEventTap: (event, date) {
              AppointmentModel? appointment = event.event as AppointmentModel?;
              _createAppointment(context, date, appointment?.id);
            },
          ),
        ];

Very thanks for your help
Sam

@jaiminrana05 jaiminrana05 added the bug Something isn't working label Aug 3, 2023
@PRBaraiya PRBaraiya added the priority:2 Bug/Enhancement with priority level 2. label Aug 8, 2023
@PRBaraiya
Copy link
Collaborator

Hi @Paroca72 , For this you need to provide the width in WeekView. We will try to remove the width dependency in the near future but till then please provide width if you are not displaying the calendar view in full-screen width.

You can use LayoutBuilder to get the width of parent widget and pass it to week view.

@PRBaraiya PRBaraiya linked a pull request Aug 8, 2023 that will close this issue
7 tasks
PRBaraiya added a commit that referenced this issue Aug 8, 2023
…_and_week_view_layout_issue

fix: 🐛Fixed week-view & day-view layout issue in landscape mode #237.
@PRBaraiya PRBaraiya removed the priority:2 Bug/Enhancement with priority level 2. label Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants