GaspardMerten / date_field

Flutter DateField and DateFormField
Other
45 stars 32 forks source link

Calendar hard to see in Darkmode on iOS #34

Closed jclement closed 2 years ago

jclement commented 2 years ago

I'm not sure if I'm doing something wrong here, but I've got an app using DateTimeFormField (3.0.1) on iOS. The app is dark mode-only and when you click into the date field it looks like it's adding a grey overlay over the entire screen (including the date picker) which makes the date picker very faint and difficult to read. I don't see this same thing on light mode.

toodark

Here is what I'm currently setting for my Theme:

import 'package:flutter/material.dart';

final ThemeData darkTheme = _buildDarkTheme();

ThemeData _buildDarkTheme() {
  final ThemeData base = ThemeData.dark();
  return base.copyWith(
    colorScheme: base.colorScheme.copyWith(
      primary: const Color.fromARGB(255, 40, 203, 162),
      onPrimary: const Color.fromARGB(255, 40, 101, 85),
      secondary: Colors.amber,
      error: Colors.red,
    ),
  );
}
class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Barreleye',
      theme: barreleyeDarkTheme,
      darkTheme: barreleyeDarkTheme,
      themeMode: ThemeMode.dark,
      home: const OperationList(),
    );
  }
}

And my invocation of the DateTimeFormField.

    fields.add(DateTimeFormField(
      decoration: const InputDecoration(
        //border: OutlineInputBorder(),
        suffixIcon: Icon(Icons.event_note),
        labelText: 'Ticket Date',
      ),
      initialValue: _date,
      enabled: _enableEditing,
      mode: DateTimeFieldPickerMode.dateAndTime,
      autovalidateMode: AutovalidateMode.always,
      validator: (DateTime? value) {
        if (value != null &&
            (widget.op.start.isAfter(value) || widget.op.end.isBefore(value))) {
          return "Ticket falls outside of operation range";
        }
        return null;
      },
      onDateSelected: (DateTime value) {
        _date = value;
      },
    ));
GaspardMerten commented 2 years ago

Could you try changing the value of:

´CupertinoTheme.textTheme.dateTimePickerTextStyle´

Does it help?

jclement commented 2 years ago

That worked. Thank you so much! TIL