From f501c3213dfb5c4f7976062b35986ef24a233bfb Mon Sep 17 00:00:00 2001 From: AmSn6 Date: Thu, 23 Sep 2021 13:02:50 +0530 Subject: [PATCH] forked by AmSn6. replaced deprecated text theme --- lib/date_range_picker.dart | 32 +++++++++++++++++--------------- pubspec.lock | 10 +++++----- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/date_range_picker.dart b/lib/date_range_picker.dart index 01cc7bb..da7c16d 100644 --- a/lib/date_range_picker.dart +++ b/lib/date_range_picker.dart @@ -8,6 +8,8 @@ library date_range_picker; // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// forked by AmSn6. replaced deprecated text theme on 23-09-2021 + import 'dart:async'; import 'dart:math' as math; @@ -93,9 +95,9 @@ class _DatePickerHeader extends StatelessWidget { break; } final TextStyle dayStyle = - headerTextTheme.display1!.copyWith(color: dayColor, height: 1.4); + headerTextTheme.headline4!.copyWith(color: dayColor, height: 1.4); final TextStyle yearStyle = - headerTextTheme.subhead!.copyWith(color: yearColor, height: 1.4); + headerTextTheme.subtitle1!.copyWith(color: yearColor, height: 1.4); Color? backgroundColor; switch (themeData.brightness) { @@ -452,7 +454,7 @@ class DayPicker extends StatelessWidget { (selectableDayPredicate != null && !selectableDayPredicate!(dayToBuild)); BoxDecoration? decoration; - TextStyle? itemStyle = themeData.textTheme.body1; + TextStyle? itemStyle = themeData.textTheme.bodyText2; final bool isSelectedFirstDay = selectedFirstDate.year == year && selectedFirstDate.month == month && selectedFirstDate.day == day; @@ -467,39 +469,39 @@ class DayPicker extends StatelessWidget { : null; if (isSelectedFirstDay && (isSelectedLastDay == null || isSelectedLastDay)) { - itemStyle = themeData.accentTextTheme.body2; + itemStyle = themeData.textTheme.bodyText1; decoration = new BoxDecoration( - color: themeData.accentColor, shape: BoxShape.circle); + color: themeData.primaryColor, shape: BoxShape.circle); } else if (isSelectedFirstDay) { // The selected day gets a circle background highlight, and a contrasting text color. - itemStyle = themeData.accentTextTheme.body2; + itemStyle = themeData.textTheme.bodyText1; decoration = new BoxDecoration( - color: themeData.accentColor, + color: themeData.primaryColor, borderRadius: BorderRadius.only( topLeft: new Radius.circular(50.0), bottomLeft: new Radius.circular(50.0), )); } else if (isSelectedLastDay != null && isSelectedLastDay) { - itemStyle = themeData.accentTextTheme.body2; + itemStyle = themeData.textTheme.bodyText1; decoration = new BoxDecoration( - color: themeData.accentColor, + color: themeData.primaryColor, borderRadius: BorderRadius.only( topRight: new Radius.circular(50.0), bottomRight: new Radius.circular(50.0), )); } else if (isInRange != null && isInRange) { decoration = new BoxDecoration( - color: themeData.accentColor.withOpacity(0.1), + color: themeData.primaryColor.withOpacity(0.1), shape: BoxShape.rectangle); } else if (disabled) { - itemStyle = themeData.textTheme.body1! + itemStyle = themeData.textTheme.bodyText2! .copyWith(color: themeData.disabledColor); } else if (currentDate.year == year && currentDate.month == month && currentDate.day == day) { // The current day gets a different text color. itemStyle = - themeData.textTheme.body2!.copyWith(color: themeData.accentColor); + themeData.textTheme.bodyText1!.copyWith(color: themeData.primaryColor); } Widget dayWidget = new Container( @@ -561,7 +563,7 @@ class DayPicker extends StatelessWidget { child: new ExcludeSemantics( child: new Text( localizations.formatMonthYear(displayedMonth), - style: themeData.textTheme.subhead, + style: themeData.textTheme.subtitle1, ), ), ), @@ -941,7 +943,7 @@ class _YearPickerState extends State { Widget build(BuildContext context) { assert(debugCheckHasMaterial(context)); final ThemeData themeData = Theme.of(context); - final TextStyle? style = themeData.textTheme.body1; + final TextStyle? style = themeData.textTheme.bodyText2; return new ListView.builder( controller: scrollController, itemExtent: _itemExtent, @@ -952,7 +954,7 @@ class _YearPickerState extends State { (widget.selectedLastDate != null && year == widget.selectedLastDate!.year); final TextStyle? itemStyle = isSelected - ? themeData.textTheme.headline! + ? themeData.textTheme.headline5! .copyWith(color: themeData.accentColor) : style; return new InkWell( diff --git a/pubspec.lock b/pubspec.lock index 49a0ce6..8077d23 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.8.1" boolean_selector: dependency: transitive description: @@ -28,7 +28,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -73,7 +73,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: @@ -92,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -127,7 +127,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.4.2" typed_data: dependency: transitive description: