Bladeren bron

fix: some UI issues (#3403)

Richard Shiue 1 jaar geleden
bovenliggende
commit
f6f80b48c9

+ 23 - 0
frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_event_card.dart

@@ -167,6 +167,29 @@ class EventCard extends StatelessWidget {
       );
     });
 
+    renderHook.addTimestampCellHook((cellData, cardData, _) {
+      return Align(
+        alignment: Alignment.centerLeft,
+        child: Padding(
+          padding: const EdgeInsets.symmetric(vertical: 2),
+          child: Row(
+            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+            children: [
+              Flexible(
+                flex: 3,
+                child: FlowyText.regular(
+                  cellData.dateTime,
+                  fontSize: 10,
+                  color: Theme.of(context).hintColor,
+                  overflow: TextOverflow.ellipsis,
+                ),
+              ),
+            ],
+          ),
+        ),
+      );
+    });
+
     renderHook.addSelectOptionHook((selectedOptions, cardData, _) {
       if (selectedOptions.isEmpty) {
         return const SizedBox.shrink();

+ 2 - 2
frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/create_filter_list.dart

@@ -114,7 +114,7 @@ class _GridCreateFilterListState extends State<GridCreateFilterList> {
 class _FilterTextFieldDelegate extends SliverPersistentHeaderDelegate {
   _FilterTextFieldDelegate();
 
-  double fixHeight = 46;
+  double fixHeight = 36;
 
   @override
   Widget build(
@@ -123,7 +123,7 @@ class _FilterTextFieldDelegate extends SliverPersistentHeaderDelegate {
     bool overlapsContent,
   ) {
     return Container(
-      padding: const EdgeInsets.only(top: 4),
+      padding: const EdgeInsets.only(bottom: 4),
       height: fixHeight,
       child: FlowyTextField(
         hintText: LocaleKeys.grid_settings_filterBy.tr(),

+ 0 - 1
frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/filter/filter_menu.dart

@@ -105,7 +105,6 @@ class _AddFilterButtonState extends State<AddFilterButton> {
     return AppFlowyPopover(
       controller: popoverController,
       constraints: BoxConstraints.loose(const Size(200, 300)),
-      margin: const EdgeInsets.all(6),
       triggerActions: PopoverTriggerFlags.none,
       child: child,
       popupBuilder: (BuildContext context) {

+ 2 - 2
frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/sort/create_sort_list.dart

@@ -114,7 +114,7 @@ class _GridCreateSortListState extends State<GridCreateSortList> {
 class _SortTextFieldDelegate extends SliverPersistentHeaderDelegate {
   _SortTextFieldDelegate();
 
-  double fixHeight = 46;
+  double fixHeight = 36;
 
   @override
   Widget build(
@@ -123,7 +123,7 @@ class _SortTextFieldDelegate extends SliverPersistentHeaderDelegate {
     bool overlapsContent,
   ) {
     return Container(
-      padding: const EdgeInsets.only(top: 4),
+      padding: const EdgeInsets.only(bottom: 4),
       height: fixHeight,
       child: FlowyTextField(
         hintText: LocaleKeys.grid_settings_sortBy.tr(),

+ 11 - 0
frontend/appflowy_flutter/lib/plugins/database_view/widgets/card/cells/card_cell.dart

@@ -4,6 +4,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/date_entities.pb.dart'
 import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
 import 'package:appflowy_backend/protobuf/flowy-database2/select_option.pb.dart';
 import 'package:appflowy_backend/log.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/timestamp_entities.pb.dart';
 import 'package:flutter/material.dart';
 
 typedef CellRenderHook<C, CustomCardData> = Widget? Function(
@@ -50,6 +51,16 @@ class RowCardRenderHook<CustomCardData> {
     renderHook[FieldType.DateTime] = _typeSafeHook<DateCellDataPB>(hook);
   }
 
+  /// Add a render hook for [FieldType.LastEditedTime] and [FieldType.CreatedTime]
+  void addTimestampCellHook(
+    CellRenderHook<TimestampCellDataPB, CustomCardData?> hook,
+  ) {
+    renderHook[FieldType.LastEditedTime] =
+        _typeSafeHook<TimestampCellDataPB>(hook);
+    renderHook[FieldType.CreatedTime] =
+        _typeSafeHook<TimestampCellDataPB>(hook);
+  }
+
   CellRenderHook<dynamic, CustomCardData> _typeSafeHook<C>(
     CellRenderHook<C, CustomCardData?> hook,
   ) {