简体   繁体   中英

How to set border radius and remove Header bar to showDatePicker?

I'm using the showDatePicker() method to display a date picker in my flutter application. How do I set border radius and remove Header bar?

Here is my code:

showDatePicker(
  locale: Locale('ja'),
  context: context,
  initialDate: _dateTime,
  firstDate:
      DateTime(DateTime.now().year - 5),
  lastDate: DateTime(DateTime.now().year + 5),
  builder: (context, child) {
    return Theme(
      data: ThemeData.light().copyWith(
        primaryColor:
            helper.hexColor('#007AFF'),
        accentColor:
            helper.hexColor('#007AFF'),
        colorScheme: ColorScheme.light(
            primary:
                helper.hexColor('#007AFF')),
        buttonTheme: ButtonThemeData(
            textTheme: ButtonTextTheme
                .primary), // This will change to light theme.
      ),
      child: child,
    );
  },
);

You can set border radius in your ThemeData:

ThemeData(
      dialogTheme: const DialogTheme(
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(16)))),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM