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

Change calendar and timer default color #25

Closed
gdet opened this issue Feb 19, 2022 · 2 comments
Closed

Change calendar and timer default color #25

gdet opened this issue Feb 19, 2022 · 2 comments

Comments

@gdet
Copy link

gdet commented Feb 19, 2022

Hello! Is it possible when you press the field and the calendar pops up to change the default color of the calendar? Currently it is blue. The same goes for time selection.
Thank you

@GaspardMerten
Copy link
Owner

GaspardMerten commented Mar 7, 2022

Hello,

For that, you should use the Theme widget of the Material widgets library.

https://www.raywenderlich.com/16628777-theming-a-flutter-app-getting-started

Could you confirm that you could resolve your issue using that approach?

Allowing you to customize the colour using the widgets in my package would be against the way Flutter theming works...

@Wizely99
Copy link

Wizely99 commented Jun 19, 2023

THIS IS HOW I'VE DONE IT

              data: Theme.of(context).copyWith(
                colorScheme: const ColorScheme.light(
                  primary: Colors.black12,
                  onPrimary: primaryColor, // <-- SEE HERE
                  //onSurface: Colors.black, // <-- SEE HERE
                ),
                textButtonTheme: TextButtonThemeData(
                  style: TextButton.styleFrom(
                    foregroundColor: Colors.red, // button text color
                  ),
                ),
              ),
              child: DateTimeFormField(
                mode: DateTimeFieldPickerMode.date,
                decoration: const InputDecoration(
                  hintStyle: TextStyle(color: Colors.black45),
                  errorStyle: TextStyle(color: Colors.redAccent),
                  border: OutlineInputBorder(),
                  prefixIcon: Icon(Icons.event_note),
                  labelText: 'Due date',
                  prefixIconColor: primaryColor,
                ),
                firstDate: DateTime.now(),
                lastDate: DateTime.now().add(
                  const Duration(days: 700),
                ),
                initialDate: _selectedDate,
                autovalidateMode: AutovalidateMode.always,
                validator: (DateTime? e) =>
                    (e?.day ?? 0) == 1 ? 'Please not the first day' : null,
                onDateSelected: (DateTime value) {
                  setState(() {
                    _selectedDate = value;
                  });
                },
              ),
            ),```
_Hope it helps someone out there_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants