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

WeekDayTile causes RenderFlex-Overflow #42

Closed
philitell opened this issue Feb 23, 2022 · 4 comments · Fixed by #51
Closed

WeekDayTile causes RenderFlex-Overflow #42

philitell opened this issue Feb 23, 2022 · 4 comments · Fixed by #51
Labels
bug Something isn't working

Comments

@philitell
Copy link

I am using calendar_view (monthView) in a flutter web-project. Resizing the calendar_view works alright, except for the week-day-row.

When we reduce the screensize the weekDay-tiles are not resized (they keep the width with which they were initialized once), which creates a Renderflex-Overflow on the right side.

Bildschirmfoto vom 2022-02-23 14-27-56

@PRBaraiya
Copy link
Collaborator

Hello @philitell , If possible, Please provide an code example.

@philitell
Copy link
Author

This is the code i use inside the body of my Page-Scaffold:

CalendarControllerProvider<CalendarGarbageEntry>(
    controller: _eventController,
    child: LayoutBuilder(builder: (context, constraints) {
        final double maxWidth = constraints.maxWidth;
        return MonthView(
        controller: _eventController,
        minMonth: DateTime(2022),
        maxMonth: DateTime(DateTime.now().year + 2, 12, 31),
        cellAspectRatio: 1.5,
        weekDayBuilder: (index) => CapWeekDayTile(
            dayIndex: index,
        ),
        width: maxWidth,
        );
    }),
    ),

This is the Source-code of the weekDayBuilder i use in order to get german week titles:

import 'package:flutter/material.dart';

class CapWeekDayTile extends StatelessWidget {
  static final List<String> weekTitles = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];

  final int dayIndex;
  final Color backgroundColor;
  final bool displayBorder;
  final TextStyle? textStyle;

  const CapWeekDayTile({
    Key? key,
    required this.dayIndex,
    this.backgroundColor = Colors.white,
    this.displayBorder = true,
    this.textStyle,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      margin: EdgeInsets.zero,
      padding: const EdgeInsets.symmetric(vertical: 10.0),
      decoration: BoxDecoration(
        color: backgroundColor,
        border: Border.all(
          color: const Color(0xffdddddd),
          width: displayBorder ? 0.5 : 0,
        ),
      ),
      child: Text(
        weekTitles[dayIndex],
        style: textStyle ??
            const TextStyle(
              fontSize: 17,
              color: Colors.black,
            ),
      ),
    );
  }
}

@PRBaraiya PRBaraiya added the bug Something isn't working label Mar 7, 2022
PRBaraiya pushed a commit that referenced this issue Mar 7, 2022
- Wrap all the children of Row with expanded. in MonthView _weekBuilder.
PRBaraiya pushed a commit that referenced this issue Mar 7, 2022
- Wrap all the children of Row with expanded. in MonthView _weekBuilder.
@ParthBaraiya ParthBaraiya linked a pull request Mar 14, 2022 that will close this issue
@awatson32
Copy link

Is there a scheduled release for this update any time soon?

@keanallen
Copy link

Any update on this? The error also occurs in desktop even in MonthView

PRBaraiya pushed a commit that referenced this issue May 16, 2022
- Wrap all the children of Row with expanded. in MonthView _weekBuilder.
vatsaltanna pushed a commit that referenced this issue May 28, 2022
- Wrap all the children of Row with expanded. in MonthView _weekBuilder.
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
Development

Successfully merging a pull request may close this issue.

4 participants