Skip to content

Commit

Permalink
Updated to support the latest version of Flutter.
Browse files Browse the repository at this point in the history
- Fixed linting issues
- Added a call to onDayTapped when the depdendencies change for DayBasedChangeablePicker. This allows for changing between day and week pickers using an external toggle and the DatePeriod will be automatically updated instead of requiring user action.

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
  • Loading branch information
hanskokx committed Apr 30, 2024
1 parent c69f1fb commit 3e7b7c7
Show file tree
Hide file tree
Showing 24 changed files with 242 additions and 166 deletions.
11 changes: 3 additions & 8 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ linter:
prefer_iterable_whereType: true
prefer_function_declarations_over_variables: true
unnecessary_lambdas: true
prefer_equal_for_default_values: true
avoid_init_to_null: true
unnecessary_getters_setters: true
unnecessary_getters: true
prefer_expression_function_bodies: true
unnecessary_this: true
unnecessary_const: true
Expand All @@ -51,11 +49,10 @@ linter:
prefer_final_fields: true
use_setters_to_change_properties: true
avoid_setters_without_getters: true
avoid_returning_null: true
avoid_returning_this: true
type_annotate_public_apis: true
prefer_typing_uninitialized_variables: true
# omit_local_variable_types: true
# omit_local_variable_types: true
avoid_types_on_closure_parameters: true
avoid_return_types_on_setters: true
prefer_generic_function_type_aliases: true
Expand All @@ -66,11 +63,9 @@ linter:
avoid_equals_and_hash_code_on_mutable_classes: true
avoid_null_checks_in_equality_operators: true


# PEDANTIC
# (duplicated rules are removed)
always_declare_return_types: true
always_require_non_null_named_parameters: true
annotate_overrides: true
avoid_empty_else: true
avoid_shadowing_type_parameters: true
Expand All @@ -83,12 +78,12 @@ linter:
prefer_contains: true
prefer_for_elements_to_map_fromIterable: true
prefer_if_null_operators: true
# prefer_single_quotes: true
# prefer_single_quotes: true
prefer_spread_collections: true
recursive_getters: true
type_init_formals: true
unawaited_futures: true
unnecessary_new: true
unnecessary_null_in_if_null_operators: true
unrelated_type_equality_checks: true
valid_regexps: true
valid_regexps: true
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/day_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _DayPickerPageState extends State<DayPickerPage> {
dp.DatePickerRangeStyles styles = dp.DatePickerRangeStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor,
Expand Down Expand Up @@ -88,7 +88,7 @@ class _DayPickerPageState extends State<DayPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/days_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _DaysPickerPageState extends State<DaysPickerPage> {
dp.DatePickerRangeStyles styles = dp.DatePickerRangeStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor, shape: BoxShape.circle));
Expand Down Expand Up @@ -86,7 +86,7 @@ class _DaysPickerPageState extends State<DaysPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/month_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _MonthPickerPageState extends State<MonthPickerPage> {
dp.DatePickerStyles styles = dp.DatePickerStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor, shape: BoxShape.circle));
Expand Down Expand Up @@ -60,7 +60,7 @@ class _MonthPickerPageState extends State<MonthPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/months_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _MonthsPickerPageState extends State<MonthsPickerPage> {
dp.DatePickerStyles styles = dp.DatePickerStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor, shape: BoxShape.circle));
Expand Down Expand Up @@ -60,7 +60,7 @@ class _MonthsPickerPageState extends State<MonthsPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/date_pickers_widgets/range_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class _RangePickerPageState extends State<RangePickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
_stylesBlock(),
_selectedBlock()
Expand Down
2 changes: 1 addition & 1 deletion example/lib/date_pickers_widgets/range_picker_styled.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _RangePickerPageStyledState extends State<RangePickerPageStyled> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
_selectedBlock()
],
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/week_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class _WeekPickerPageState extends State<WeekPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
_stylesBlock(),
_selectedBlock()
Expand Down Expand Up @@ -222,7 +222,7 @@ class _WeekPickerPageState extends State<WeekPickerPage> {
borderRadius: BorderRadius.all(Radius.circular(3.0)));

TextStyle? whiteText =
Theme.of(context).textTheme.bodyText2?.copyWith(color: Colors.white);
Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.white);

return isEventDate
? EventDecoration(boxDecoration: roundedBorder, textStyle: whiteText)
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/year_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _YearPickerPageState extends State<YearPickerPage> {
dp.DatePickerStyles styles = dp.DatePickerStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor, shape: BoxShape.circle));
Expand Down Expand Up @@ -60,7 +60,7 @@ class _YearPickerPageState extends State<YearPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/date_pickers_widgets/years_picker_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _YearsPickerPageState extends State<YearsPickerPage> {
dp.DatePickerStyles styles = dp.DatePickerStyles(
selectedDateStyle: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.copyWith(color: selectedDateStyleColor),
selectedSingleDateDecoration: BoxDecoration(
color: selectedSingleDateDecorationColor, shape: BoxShape.circle));
Expand Down Expand Up @@ -60,7 +60,7 @@ class _YearsPickerPageState extends State<YearsPickerPage> {
children: <Widget>[
Text(
"Selected date styles",
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
data: Theme.of(context).copyWith(
canvasColor: Colors.blueGrey,
textTheme: Theme.of(context).textTheme.copyWith(
caption: TextStyle(color: Colors.white.withOpacity(0.5)))),
bodySmall: TextStyle(color: Colors.white.withOpacity(0.5)))),
child: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
items: [
Expand Down
Loading

0 comments on commit 3e7b7c7

Please sign in to comment.