Tie Picker
Tie picker 是一个极简主义的、有观点的自定义选择器和 DateTime 助手,支持主题颜色(目前仅支持浅色模式)和国际化。
使用 TiePicker
-
要支持国际化,请将以下内容添加到您的
MaterialApp
import 'package:tie_picker/tie_picker.dart';
MaterialApp(
locale: const Locale('en'),
/// Add the supported locales
supportedLocales: TiePickerLocalizations.supportedLocales,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
/// Add the localizations delegate
TiePickerLocalizations.delegate
],
);
日历
要使用日历,请在 Date 参数中传递实际的日期。需要使用本地化,并且需要为日期提供正确的格式。
您可以从以下模式之一设置选择器
enum CalendarMode {
day,
month,
year,
}
用法
date = await ModalPicker.datePicker(
context: context,
date: date,
mode: CalendarMode.day,
);

