mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 13:13:44 +02:00
fix: revert calendar UI changes from bad rebase
This commit is contained in:
parent
67842ed2f5
commit
5931b4c29a
1 changed files with 24 additions and 9 deletions
|
@ -115,6 +115,8 @@ class _CalendarDay extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
|
var textTheme = theme.textTheme;
|
||||||
|
var colorScheme = theme.colorScheme;
|
||||||
var availabilityScope = AvailabilityScope.of(context);
|
var availabilityScope = AvailabilityScope.of(context);
|
||||||
var options = availabilityScope.options;
|
var options = availabilityScope.options;
|
||||||
var colors = options.colors;
|
var colors = options.colors;
|
||||||
|
@ -125,29 +127,42 @@ class _CalendarDay extends StatelessWidget {
|
||||||
Color? textColor;
|
Color? textColor;
|
||||||
TextStyle? textStyle;
|
TextStyle? textStyle;
|
||||||
if (day.outsideMonth) {
|
if (day.outsideMonth) {
|
||||||
textColor = colors.outsideMonthTextColor ?? theme.colorScheme.onSurface;
|
textColor = colors.outsideMonthTextColor ?? colorScheme.onSurface;
|
||||||
textStyle = theme.textTheme.bodyMedium?.copyWith(color: textColor);
|
textStyle = textTheme.bodyMedium?.copyWith(color: textColor);
|
||||||
} else if (day.hasAvailability) {
|
} else if (day.hasAvailability) {
|
||||||
textColor = dayColor;
|
textColor = dayColor;
|
||||||
textStyle = theme.textTheme.titleMedium?.copyWith(color: textColor);
|
textStyle = textTheme.titleMedium?.copyWith(color: textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var decoration = day.outsideMonth
|
||||||
|
? null
|
||||||
|
: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: textColor ?? Colors.transparent,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => onDayTap(day.date),
|
onTap: () => onDayTap(day.date),
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: dayColor,
|
|
||||||
borderRadius: options.borderRadius,
|
borderRadius: options.borderRadius,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: day.isSelected && !day.outsideMonth
|
color: day.isSelected ? theme.dividerColor : Colors.transparent,
|
||||||
? theme.colorScheme.primary
|
width: 1.5,
|
||||||
: Colors.transparent,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(day.date.day.toString(), style: textStyle),
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
decoration: decoration,
|
||||||
|
child: Text(day.date.day.toString(), style: textStyle),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (day.templateDeviation) ...[
|
if (day.templateDeviation) ...[
|
||||||
Positioned(
|
Positioned(
|
||||||
|
@ -236,7 +251,7 @@ List<CalendarDay> _generateCalendarDays(
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
var day = isNextMonth
|
var day = isNextMonth
|
||||||
? DateTime(startDay.year, startDay.month, startDay.day + i + 1)
|
? DateTime(startDay.year, startDay.month, startDay.day + i + 1)
|
||||||
: DateTime(startDay.year, startDay.month, startDay.day - count - 1);
|
: DateTime(startDay.year, startDay.month, startDay.day - count + i);
|
||||||
var isSelected = selectedRange != null &&
|
var isSelected = selectedRange != null &&
|
||||||
!day.isBefore(selectedRange.start) &&
|
!day.isBefore(selectedRange.start) &&
|
||||||
!day.isAfter(selectedRange.end);
|
!day.isAfter(selectedRange.end);
|
||||||
|
|
Loading…
Reference in a new issue