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

Idea: Set BackGround Colors :) - Support for dark theme #263

Open
Josefpa opened this issue Sep 6, 2023 · 2 comments · May be fixed by #431
Open

Idea: Set BackGround Colors :) - Support for dark theme #263

Josefpa opened this issue Sep 6, 2023 · 2 comments · May be fixed by #431
Assignees
Labels
enhancement New feature or request priority:1 Bug/Enhancement with highest priority.

Comments

@Josefpa
Copy link

Josefpa commented Sep 6, 2023

Ex: a Dark Calendar and a White Calendar and Setting all the text values

Basically a Dark and White Mode

@alex-dokienko
Copy link

voting +1, would be cool to support dark theme

@PRBaraiya PRBaraiya changed the title Idea: Set BackGround Colors :) Idea: Set BackGround Colors :) - Support for dark theme Nov 1, 2023
@2zqa
Copy link

2zqa commented Nov 4, 2023

I use the following code for my own project to implement support for the dark theme by using Theme colors. Maybe this can be used for inspiration in the actual implementation. Note that with material2 (useMaterial2: false in ThemeData, also the default value) the outlineVariant is always white, but with material3 enabled it correctly turns to gray in dark mode. Perhaps a better theme color field can be found.

Example implementation (click me)

Edited from: example/lib/widgets/month_view_widget.dart

class MonthViewWidget extends StatelessWidget {
  final GlobalKey<MonthViewState>? state;
  final double? width;

  const MonthViewWidget({
    Key? key,
    this.state,
    this.width,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final cls = Theme.of(context).colorScheme;
    return MonthView<Event>(
      key: state,
      width: width,
      borderColor: cls.outlineVariant,
      headerBuilder: (date) => MonthPageHeader(
        date: date,
        backgroundColor: cls.primaryContainer,
        iconColor: cls.onPrimaryContainer,
      ),
      weekDayBuilder: (dayIndex) => WeekDayTile(
        dayIndex: dayIndex,
        backgroundColor: cls.surface,
        // WeekDayTile doesn't have a borderColor parameter
      ),
      cellBuilder: (date, events, isToday, isInMonth) => FilledCell(
        date: date,
        events: events,
        shouldHighlight: isToday,
        titleColor: isInMonth ? cls.onSurface : cls.onSurfaceVariant,
        backgroundColor: isInMonth ? cls.surface : cls.surfaceVariant,
      ),
    );
  }
}

@ParthBaraiya ParthBaraiya added enhancement New feature or request priority:1 Bug/Enhancement with highest priority. labels Jun 5, 2024
@shubham-jitiya-simform shubham-jitiya-simform linked a pull request Dec 24, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:1 Bug/Enhancement with highest priority.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants