fix: calendar ui adjustments (#2398)

This commit is contained in:
Richard Shiue 2023-05-01 11:26:57 +08:00 committed by GitHub
parent 77d58a81fd
commit df4a5ca059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 32 deletions

View File

@ -54,11 +54,9 @@ class CalendarDayCard extends StatelessWidget {
if (cards.isNotEmpty) { if (cards.isNotEmpty) {
multipleCards = Flexible( multipleCards = Flexible(
child: ListView.separated( child: ListView.separated(
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) => cards[index],
return cards[index];
},
itemCount: cards.length, itemCount: cards.length,
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 8.0),
separatorBuilder: (BuildContext context, int index) => separatorBuilder: (BuildContext context, int index) =>
VSpace(GridSize.typeOptionSeparatorHeight), VSpace(GridSize.typeOptionSeparatorHeight),
), ),
@ -86,11 +84,11 @@ class CalendarDayCard extends StatelessWidget {
return Container( return Container(
color: backgroundColor, color: backgroundColor,
child: MouseRegion( child: MouseRegion(
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.basic,
onEnter: (p) => notifyEnter(context, true), onEnter: (p) => notifyEnter(context, true),
onExit: (p) => notifyEnter(context, false), onExit: (p) => notifyEnter(context, false),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0), padding: const EdgeInsets.only(top: 8.0),
child: child, child: child,
), ),
), ),
@ -188,18 +186,21 @@ class CalendarDayCard extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () => _showRowDetailPage(event, context), onTap: () => _showRowDetailPage(event, context),
child: Container( child: MouseRegion(
padding: const EdgeInsets.symmetric(horizontal: 2), cursor: SystemMouseCursors.click,
decoration: BoxDecoration( child: Container(
border: Border.fromBorderSide( padding: const EdgeInsets.symmetric(horizontal: 2),
BorderSide( decoration: BoxDecoration(
color: Theme.of(context).dividerColor, border: Border.fromBorderSide(
width: 1.5, BorderSide(
color: Theme.of(context).dividerColor,
width: 1.5,
),
), ),
borderRadius: Corners.s6Border,
), ),
borderRadius: Corners.s6Border, child: card,
), ),
child: card,
), ),
); );
}).toList(); }).toList();
@ -305,27 +306,36 @@ class _DayBadge extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color dayTextColor = Theme.of(context).colorScheme.onBackground; Color dayTextColor = Theme.of(context).colorScheme.onBackground;
String dayString = date.day == 1 String monthString =
? DateFormat('MMM d', context.locale.toLanguageTag()).format(date) DateFormat("MMM ", context.locale.toLanguageTag()).format(date);
: date.day.toString(); String dayString = date.day.toString();
if (isToday) {
dayTextColor = Theme.of(context).colorScheme.onPrimary;
}
if (!isInMonth) { if (!isInMonth) {
dayTextColor = Theme.of(context).disabledColor; dayTextColor = Theme.of(context).disabledColor;
} }
if (isToday) {
dayTextColor = Theme.of(context).colorScheme.onPrimary;
}
return Container( return Row(
decoration: BoxDecoration( children: [
color: isToday ? Theme.of(context).colorScheme.primary : null, if (date.day == 1) FlowyText.medium(monthString),
borderRadius: Corners.s6Border, Container(
), decoration: BoxDecoration(
padding: GridSize.typeOptionContentInsets, color: isToday ? Theme.of(context).colorScheme.primary : null,
child: FlowyText.medium( borderRadius: Corners.s6Border,
dayString, ),
color: dayTextColor, width: isToday ? 26 : null,
), height: isToday ? 26 : null,
padding: GridSize.typeOptionContentInsets,
child: Center(
child: FlowyText.medium(
dayString,
color: dayTextColor,
),
),
),
],
); );
} }
} }

View File

@ -57,7 +57,8 @@ class _RowDetailPageState extends State<RowDetailPage> {
// - header and cover image // - header and cover image
// - lower rich text area // - lower rich text area
IntrinsicHeight(child: _responsiveRowInfo()), IntrinsicHeight(child: _responsiveRowInfo()),
const Divider(height: 1.0) const Divider(height: 1.0),
const SizedBox(height: 10),
], ],
), ),
), ),