Skip to content

Commit

Permalink
1. colon as splitter is not longer supported in dart >= 3.0.0, replace
Browse files Browse the repository at this point in the history
   with "="
2. replace DatePickerTheme with DateTimePickerTheme to resolve conflict
   with flutter package DatePickerTheme
  • Loading branch information
ebwood committed May 11, 2023
1 parent eb66486 commit cc9290f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 40 deletions.
13 changes: 5 additions & 8 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/liuyanbo/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/liuyanbo/Documents/GitHub/flutter_datetime_picker/example"
export "FLUTTER_TARGET=/Users/liuyanbo/Documents/GitHub/flutter_datetime_picker/example/lib/main.dart"
export "FLUTTER_ROOT=/Users/wombat/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/wombat/FlutterProjects/workstation/flutter_datetime_picker/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/liuyanbo/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=flutter.inspector.structuredErrors%3Dtrue"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class HomePage extends StatelessWidget {
showTitleActions: true,
minTime: DateTime(2018, 3, 5),
maxTime: DateTime(2019, 6, 7),
theme: DatePickerTheme(
theme: DateTimePickerTheme(
headerColor: Colors.orange,
backgroundColor: Colors.blue,
itemStyle: TextStyle(
Expand Down
51 changes: 25 additions & 26 deletions lib/flutter_datetime_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ library flutter_datetime_picker;
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_datetime_picker/src/datetime_picker_theme.dart';
import 'package:flutter_datetime_picker/src/date_model.dart';
import 'package:flutter_datetime_picker/src/i18n_model.dart';
Expand All @@ -22,15 +21,15 @@ class DatePicker {
///
static Future<DateTime?> showDatePicker(
BuildContext context, {
bool showTitleActions: true,
bool showTitleActions = true,
DateTime? minTime,
DateTime? maxTime,
DateChangedCallback? onChanged,
DateChangedCallback? onConfirm,
DateCancelledCallback? onCancel,
locale: LocaleType.en,
LocaleType locale = LocaleType.en,
DateTime? currentTime,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
}) async {
return await Navigator.push(
context,
Expand Down Expand Up @@ -58,14 +57,14 @@ class DatePicker {
///
static Future<DateTime?> showTimePicker(
BuildContext context, {
bool showTitleActions: true,
bool showSecondsColumn: true,
bool showTitleActions = true,
bool showSecondsColumn = true,
DateChangedCallback? onChanged,
DateChangedCallback? onConfirm,
DateCancelledCallback? onCancel,
locale: LocaleType.en,
LocaleType locale = LocaleType.en,
DateTime? currentTime,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
}) async {
return await Navigator.push(
context,
Expand All @@ -92,13 +91,13 @@ class DatePicker {
///
static Future<DateTime?> showTime12hPicker(
BuildContext context, {
bool showTitleActions: true,
bool showTitleActions = true,
DateChangedCallback? onChanged,
DateChangedCallback? onConfirm,
DateCancelledCallback? onCancel,
locale: LocaleType.en,
LocaleType locale = LocaleType.en,
DateTime? currentTime,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
}) async {
return await Navigator.push(
context,
Expand All @@ -124,15 +123,15 @@ class DatePicker {
///
static Future<DateTime?> showDateTimePicker(
BuildContext context, {
bool showTitleActions: true,
bool showTitleActions = true,
DateTime? minTime,
DateTime? maxTime,
DateChangedCallback? onChanged,
DateChangedCallback? onConfirm,
DateCancelledCallback? onCancel,
locale: LocaleType.en,
LocaleType locale = LocaleType.en,
DateTime? currentTime,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
}) async {
return await Navigator.push(
context,
Expand Down Expand Up @@ -160,13 +159,13 @@ class DatePicker {
///
static Future<DateTime?> showPicker(
BuildContext context, {
bool showTitleActions: true,
bool showTitleActions = true,
DateChangedCallback? onChanged,
DateChangedCallback? onConfirm,
DateCancelledCallback? onCancel,
locale: LocaleType.en,
LocaleType locale = LocaleType.en,
BasePickerModel? pickerModel,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
}) async {
return await Navigator.push(
context,
Expand All @@ -191,21 +190,21 @@ class _DatePickerRoute<T> extends PopupRoute<T> {
this.onChanged,
this.onConfirm,
this.onCancel,
DatePickerTheme? theme,
DateTimePickerTheme? theme,
this.barrierLabel,
this.locale,
RouteSettings? settings,
BasePickerModel? pickerModel,
}) : this.pickerModel = pickerModel ?? DatePickerModel(),
this.theme = theme ?? DatePickerTheme(),
this.theme = theme ?? DateTimePickerTheme(),
super(settings: settings);

final bool? showTitleActions;
final DateChangedCallback? onChanged;
final DateChangedCallback? onConfirm;
final DateCancelledCallback? onCancel;
final LocaleType? locale;
final DatePickerTheme theme;
final DateTimePickerTheme theme;
final BasePickerModel pickerModel;

@override
Expand Down Expand Up @@ -293,7 +292,7 @@ class _DatePickerState extends State<_DatePickerComponent> {

@override
Widget build(BuildContext context) {
DatePickerTheme theme = widget.route.theme;
DateTimePickerTheme theme = widget.route.theme;
return GestureDetector(
child: AnimatedBuilder(
animation: widget.route.animation!,
Expand Down Expand Up @@ -326,7 +325,7 @@ class _DatePickerState extends State<_DatePickerComponent> {
}
}

Widget _renderPickerView(DatePickerTheme theme) {
Widget _renderPickerView(DateTimePickerTheme theme) {
Widget itemView = _renderItemView(theme);
if (widget.route.showTitleActions == true) {
return Column(
Expand All @@ -341,7 +340,7 @@ class _DatePickerState extends State<_DatePickerComponent> {

Widget _renderColumnView(
ValueKey key,
DatePickerTheme theme,
DateTimePickerTheme theme,
StringAtIndexCallBack stringAtIndexCB,
ScrollController scrollController,
int layoutProportion,
Expand Down Expand Up @@ -396,7 +395,7 @@ class _DatePickerState extends State<_DatePickerComponent> {
);
}

Widget _renderItemView(DatePickerTheme theme) {
Widget _renderItemView(DateTimePickerTheme theme) {
return Container(
color: theme.backgroundColor,
child: Directionality(
Expand Down Expand Up @@ -471,7 +470,7 @@ class _DatePickerState extends State<_DatePickerComponent> {
}

// Title View
Widget _renderTitleActionsView(DatePickerTheme theme) {
Widget _renderTitleActionsView(DateTimePickerTheme theme) {
final done = _localeDone();
final cancel = _localeCancel();

Expand Down Expand Up @@ -543,7 +542,7 @@ class _BottomPickerLayout extends SingleChildLayoutDelegate {
final double progress;
final int? itemCount;
final bool? showTitleActions;
final DatePickerTheme theme;
final DateTimePickerTheme theme;
final double bottomPadding;

@override
Expand Down
4 changes: 3 additions & 1 deletion lib/src/date_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ class TimePickerModel extends CommonPickerModel {
bool showSecondsColumn;

TimePickerModel(
{DateTime? currentTime, LocaleType? locale, this.showSecondsColumn: true})
{DateTime? currentTime,
LocaleType? locale,
this.showSecondsColumn = true})
: super(locale: locale) {
this.currentTime = currentTime ?? DateTime.now();

Expand Down
4 changes: 2 additions & 2 deletions lib/src/datetime_picker_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';

// Migrate DiagnosticableMixin to Diagnosticable until
// https://github.com/flutter/flutter/pull/51495 makes it into stable (v1.15.21)
class DatePickerTheme with DiagnosticableTreeMixin {
class DateTimePickerTheme with DiagnosticableTreeMixin {
final TextStyle cancelStyle;
final TextStyle doneStyle;
final TextStyle itemStyle;
Expand All @@ -14,7 +14,7 @@ class DatePickerTheme with DiagnosticableTreeMixin {
final double titleHeight;
final double itemHeight;

const DatePickerTheme({
const DateTimePickerTheme({
this.cancelStyle = const TextStyle(color: Colors.black54, fontSize: 16),
this.doneStyle = const TextStyle(color: Colors.blue, fontSize: 16),
this.itemStyle = const TextStyle(color: Color(0xFF000046), fontSize: 18),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: flutter_datetime_picker
description: A date time picker for flutter, you can choose date / time / date&time in English Dutch and Chinese, and you can also custom your own picker content
version: 1.5.1
version: 1.5.2
homepage: https://github.com/Realank/flutter_datetime_picker

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
Expand Down

0 comments on commit cc9290f

Please sign in to comment.