Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

test(flutter_desktop): add grid integration tests (#6298)

Richard Shiue56cc7bb9725e
diff --git a/frontend/appflowy_flutter/assets/test/workspaces/database/v069.afdb b/frontend/appflowy_flutter/assets/test/workspaces/database/v069.afdb
new file mode 100644
index 0000000000..9c497cff5d
--- /dev/null
+++ b/frontend/appflowy_flutter/assets/test/workspaces/database/v069.afdb
@@ -0,0 +1,14 @@
+"{""id"":""RGmzka"",""name"":""Name"",""field_type"":0,""type_options"":{""0"":{""data"":""""}},""is_primary"":true}","{""id"":""oYoH-q"",""name"":""Time Slot"",""field_type"":2,""type_options"":{""0"":{""date_format"":3,""data"":"""",""time_format"":1,""timezone_id"":""""},""2"":{""date_format"":3,""time_format"":1,""timezone_id"":""""}},""is_primary"":false}","{""id"":""zVrp17"",""name"":""Amount"",""field_type"":1,""type_options"":{""1"":{""scale"":0,""format"":4,""name"":""Number"",""symbol"":""RUB""},""0"":{""data"":"""",""symbol"":""RUB"",""name"":""Number"",""format"":0,""scale"":0}},""is_primary"":false}","{""id"":""_p4EGt"",""name"":""Delta"",""field_type"":1,""type_options"":{""1"":{""name"":""Number"",""format"":36,""symbol"":""RUB"",""scale"":0},""0"":{""data"":"""",""symbol"":""RUB"",""name"":""Number"",""format"":0,""scale"":0}},""is_primary"":false}","{""id"":""Z909lc"",""name"":""Email"",""field_type"":6,""type_options"":{""6"":{""url"":"""",""content"":""""},""0"":{""data"":"""",""content"":"""",""url"":""""}},""is_primary"":false}","{""id"":""dBrSc7"",""name"":""Registration Complete"",""field_type"":5,""type_options"":{""5"":{}},""is_primary"":false}","{""id"":""VoigvK"",""name"":""Progress"",""field_type"":7,""type_options"":{""0"":{""data"":""""},""7"":{}},""is_primary"":false}","{""id"":""gbbQwh"",""name"":""Attachments"",""field_type"":14,""type_options"":{""0"":{""data"":"""",""content"":""{\""files\"":[]}""},""14"":{""content"":""{\""files\"":[]}""}},""is_primary"":false}","{""id"":""id3L0G"",""name"":""Priority"",""field_type"":3,""type_options"":{""3"":{""content"":""{\""options\"":[{\""id\"":\""cplL\"",\""name\"":\""VIP\"",\""color\"":\""Purple\""},{\""id\"":\""GSf_\"",\""name\"":\""High\"",\""color\"":\""Blue\""},{\""id\"":\""qnja\"",\""name\"":\""Medium\"",\""color\"":\""Green\""}],\""disable_color\"":false}""}},""is_primary"":false}","{""id"":""541SFC"",""name"":""Tags"",""field_type"":4,""type_options"":{""0"":{""data"":"""",""content"":""{\""options\"":[],\""disable_color\"":false}""},""4"":{""content"":""{\""options\"":[{\""id\"":\""1i4f\"",\""name\"":\""Education\"",\""color\"":\""Yellow\""},{\""id\"":\""yORP\"",\""name\"":\""Health\"",\""color\"":\""Orange\""},{\""id\"":\""SEUo\"",\""name\"":\""Hobby\"",\""color\"":\""LightPink\""},{\""id\"":\""uRAO\"",\""name\"":\""Family\"",\""color\"":\""Pink\""},{\""id\"":\""R9I7\"",\""name\"":\""Work\"",\""color\"":\""Purple\""}],\""disable_color\"":false}""}},""is_primary"":false}","{""id"":""lg0B7O"",""name"":""Last modified"",""field_type"":8,""type_options"":{""0"":{""time_format"":1,""field_type"":8,""date_format"":3,""data"":"""",""include_time"":true},""8"":{""date_format"":3,""field_type"":8,""time_format"":1,""include_time"":true}},""is_primary"":false}","{""id"":""5riGR7"",""name"":""Created at"",""field_type"":9,""type_options"":{""0"":{""field_type"":9,""include_time"":true,""date_format"":3,""time_format"":1,""data"":""""},""9"":{""include_time"":true,""field_type"":9,""date_format"":3,""time_format"":1}},""is_primary"":false}"
+"{""data"":""Olaf"",""created_at"":1726063289,""last_modified"":1726063289,""field_type"":0}","{""last_modified"":1726122374,""created_at"":1726110045,""reminder_id"":"""",""is_range"":true,""include_time"":true,""end_timestamp"":""1725415200"",""field_type"":2,""data"":""1725256800""}","{""field_type"":1,""data"":""55200"",""last_modified"":1726063592,""created_at"":1726063592}","{""last_modified"":1726062441,""created_at"":1726062441,""data"":""0.5"",""field_type"":1}","{""created_at"":1726063719,""last_modified"":1726063732,""data"":""[email protected]"",""field_type"":6}",,"{""field_type"":7,""last_modified"":1726064207,""data"":""{\""options\"":[{\""id\"":\""oqXQ\"",\""name\"":\""find elsa\"",\""color\"":\""Purple\""},{\""id\"":\""eQwp\"",\""name\"":\""find anna\"",\""color\"":\""Purple\""},{\""id\"":\""5-B3\"",\""name\"":\""play in the summertime\"",\""color\"":\""Purple\""},{\""id\"":\""UBFn\"",\""name\"":\""get a personal flurry\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""oqXQ\"",\""eQwp\"",\""UBFn\""]}"",""created_at"":1726064129}",,"{""created_at"":1726065208,""data"":""cplL"",""last_modified"":1726065282,""field_type"":3}","{""field_type"":4,""data"":""1i4f"",""last_modified"":1726105102,""created_at"":1726105102}","{""field_type"":8,""data"":""1726122374""}","{""data"":""1726060476"",""field_type"":9}"
+"{""field_type"":0,""last_modified"":1726063323,""data"":""Beatrice"",""created_at"":1726063323}",,"{""last_modified"":1726063638,""data"":""828600"",""created_at"":1726063607,""field_type"":1}","{""field_type"":1,""created_at"":1726062488,""data"":""-2.25"",""last_modified"":1726062488}","{""last_modified"":1726063790,""data"":""[email protected]"",""field_type"":6,""created_at"":1726063790}","{""created_at"":1726062718,""data"":""Yes"",""field_type"":5,""last_modified"":1726062724}","{""created_at"":1726064277,""data"":""{\""options\"":[{\""id\"":\""BDuH\"",\""name\"":\""get the leaf node\"",\""color\"":\""Purple\""},{\""id\"":\""GXAr\"",\""name\"":\""upgrade to b+\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[]}"",""field_type"":7,""last_modified"":1726064293}",,"{""data"":""GSf_"",""created_at"":1726065288,""last_modified"":1726065288,""field_type"":3}","{""created_at"":1726105110,""data"":""yORP,uRAO"",""last_modified"":1726105111,""field_type"":4}","{""data"":""1726105111"",""field_type"":8}","{""field_type"":9,""data"":""1726060476""}"
+"{""last_modified"":1726063355,""created_at"":1726063355,""field_type"":0,""data"":""Lancelot""}","{""data"":""1726468159"",""is_range"":true,""end_timestamp"":""1726727359"",""reminder_id"":"""",""include_time"":false,""field_type"":2,""created_at"":1726122403,""last_modified"":1726122559}","{""created_at"":1726063617,""last_modified"":1726063617,""data"":""22500"",""field_type"":1}","{""data"":""11.6"",""last_modified"":1726062504,""field_type"":1,""created_at"":1726062504}","{""field_type"":6,""data"":""[email protected]"",""last_modified"":1726063812,""created_at"":1726063812}","{""data"":""No"",""field_type"":5,""last_modified"":1726062724,""created_at"":1726062375}",,,"{""data"":""cplL"",""created_at"":1726065286,""last_modified"":1726065286,""field_type"":3}","{""last_modified"":1726105237,""data"":""SEUo"",""created_at"":1726105237,""field_type"":4}","{""field_type"":8,""data"":""1726122559""}","{""field_type"":9,""data"":""1726060476""}"
+"{""data"":""Scotty"",""last_modified"":1726063399,""created_at"":1726063399,""field_type"":0}","{""reminder_id"":"""",""last_modified"":1726122418,""include_time"":true,""data"":""1725868800"",""end_timestamp"":""1726646400"",""created_at"":1726122381,""field_type"":2,""is_range"":true}","{""created_at"":1726063650,""last_modified"":1726063650,""data"":""10900"",""field_type"":1}","{""data"":""0"",""created_at"":1726062581,""last_modified"":1726062581,""field_type"":1}","{""last_modified"":1726063835,""created_at"":1726063835,""field_type"":6,""data"":""[email protected]""}","{""data"":""Yes"",""field_type"":5,""created_at"":1726062718,""last_modified"":1726062718}","{""created_at"":1726064309,""data"":""{\""options\"":[{\""id\"":\""Cw0K\"",\""name\"":\""vocal warmup\"",\""color\"":\""Purple\""},{\""id\"":\""nYMo\"",\""name\"":\""mixed voice training\"",\""color\"":\""Purple\""},{\""id\"":\""i-OX\"",\""name\"":\""belting training\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""Cw0K\"",\""nYMo\"",\""i-OX\""]}"",""field_type"":7,""last_modified"":1726064325}","{""last_modified"":1726122911,""created_at"":1726122835,""data"":[""{\""id\"":\""746a741d-98f8-4cc6-b807-a82d2e78c221\"",\""name\"":\""googlelogo_color_272x92dp.png\"",\""url\"":\""https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png\"",\""upload_type\"":\""NetworkMedia\"",\""file_type\"":\""Image\""}"",""{\""id\"":\""cbbab3ee-32ab-4438-a909-3f69f935a8bd\"",\""name\"":\""tL_v571NdZ0.svg\"",\""url\"":\""https://static.xx.fbcdn.net/rsrc.php/y9/r/tL_v571NdZ0.svg\"",\""upload_type\"":\""NetworkMedia\"",\""file_type\"":\""Link\""}""],""field_type"":14}",,"{""data"":""SEUo,yORP"",""field_type"":4,""last_modified"":1726105123,""created_at"":1726105115}","{""data"":""1726122911"",""field_type"":8}","{""data"":""1726060539"",""field_type"":9}"
+"{""field_type"":0,""created_at"":1726063405,""last_modified"":1726063421,""data"":""""}",,,"{""last_modified"":1726062625,""field_type"":1,""data"":"""",""created_at"":1726062607}",,"{""data"":""No"",""last_modified"":1726062702,""created_at"":1726062393,""field_type"":5}",,,,,"{""data"":""1726063421"",""field_type"":8}","{""data"":""1726060539"",""field_type"":9}"
+"{""field_type"":0,""data"":""Thomas"",""last_modified"":1726063421,""created_at"":1726063421}","{""reminder_id"":"""",""field_type"":2,""data"":""1725627600"",""is_range"":false,""created_at"":1726122583,""last_modified"":1726122593,""end_timestamp"":"""",""include_time"":true}","{""last_modified"":1726063666,""field_type"":1,""data"":""465800"",""created_at"":1726063666}","{""last_modified"":1726062516,""field_type"":1,""created_at"":1726062516,""data"":""-0.03""}","{""field_type"":6,""last_modified"":1726063848,""created_at"":1726063848,""data"":""[email protected]""}","{""field_type"":5,""last_modified"":1726062725,""data"":""Yes"",""created_at"":1726062376}","{""created_at"":1726064344,""data"":""{\""options\"":[{\""id\"":\""D6X8\"",\""name\"":\""brainstorm\"",\""color\"":\""Purple\""},{\""id\"":\""XVN9\"",\""name\"":\""schedule\"",\""color\"":\""Purple\""},{\""id\"":\""nJx8\"",\""name\"":\""shoot\"",\""color\"":\""Purple\""},{\""id\"":\""7Mrm\"",\""name\"":\""edit\"",\""color\"":\""Purple\""},{\""id\"":\""o6vg\"",\""name\"":\""publish\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""D6X8\""]}"",""last_modified"":1726064379,""field_type"":7}",,"{""last_modified"":1726065298,""created_at"":1726065298,""field_type"":3,""data"":""GSf_""}","{""data"":""yORP,SEUo"",""field_type"":4,""last_modified"":1726105229,""created_at"":1726105229}","{""data"":""1726122593"",""field_type"":8}","{""field_type"":9,""data"":""1726060540""}"
+"{""data"":""Juan"",""last_modified"":1726063423,""created_at"":1726063423,""field_type"":0}","{""created_at"":1726122510,""reminder_id"":"""",""include_time"":false,""is_range"":true,""last_modified"":1726122515,""data"":""1725604115"",""end_timestamp"":""1725776915"",""field_type"":2}","{""field_type"":1,""created_at"":1726063677,""last_modified"":1726063677,""data"":""93100""}","{""field_type"":1,""data"":""4.86"",""created_at"":1726062597,""last_modified"":1726062597}",,"{""last_modified"":1726062377,""field_type"":5,""data"":""Yes"",""created_at"":1726062377}","{""last_modified"":1726064412,""field_type"":7,""data"":""{\""options\"":[{\""id\"":\""tTDq\"",\""name\"":\""complete onboarding\"",\""color\"":\""Purple\""},{\""id\"":\""E8Ds\"",\""name\"":\""contact support\"",\""color\"":\""Purple\""},{\""id\"":\""RoGN\"",\""name\"":\""get started\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""tTDq\"",\""E8Ds\""]}"",""created_at"":1726064396}",,"{""created_at"":1726065278,""field_type"":3,""data"":""qnja"",""last_modified"":1726065278}","{""data"":""R9I7,yORP,1i4f"",""field_type"":4,""created_at"":1726105126,""last_modified"":1726105127}","{""data"":""1726122515"",""field_type"":8}","{""data"":""1726060541"",""field_type"":9}"
+"{""data"":""Alex"",""created_at"":1726063432,""last_modified"":1726063432,""field_type"":0}","{""reminder_id"":"""",""data"":""1725292800"",""include_time"":true,""last_modified"":1726122448,""created_at"":1726122422,""is_range"":true,""end_timestamp"":""1725551940"",""field_type"":2}","{""field_type"":1,""last_modified"":1726063683,""created_at"":1726063683,""data"":""3560""}","{""created_at"":1726062561,""data"":""1.96"",""last_modified"":1726062561,""field_type"":1}","{""last_modified"":1726063952,""created_at"":1726063931,""data"":""[email protected]"",""field_type"":6}","{""last_modified"":1726062375,""field_type"":5,""created_at"":1726062375,""data"":""Yes""}","{""data"":""{\""options\"":[{\""id\"":\""qNyr\"",\""name\"":\""finish reading book\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[]}"",""created_at"":1726064616,""last_modified"":1726064616,""field_type"":7}",,"{""data"":""qnja"",""created_at"":1726065272,""last_modified"":1726065272,""field_type"":3}","{""created_at"":1726105180,""last_modified"":1726105180,""field_type"":4,""data"":""R9I7,1i4f""}","{""field_type"":8,""data"":""1726122448""}","{""field_type"":9,""data"":""1726060541""}"
+"{""last_modified"":1726063478,""created_at"":1726063436,""field_type"":0,""data"":""Alexander""}",,"{""field_type"":1,""last_modified"":1726063691,""created_at"":1726063691,""data"":""2073""}","{""field_type"":1,""data"":""0.5"",""last_modified"":1726062577,""created_at"":1726062577}","{""last_modified"":1726063991,""field_type"":6,""created_at"":1726063991,""data"":""[email protected]""}","{""field_type"":5,""last_modified"":1726062378,""created_at"":1726062377,""data"":""No""}",,,"{""created_at"":1726065291,""data"":""GSf_"",""last_modified"":1726065291,""field_type"":3}","{""last_modified"":1726105142,""created_at"":1726105133,""data"":""SEUo"",""field_type"":4}","{""field_type"":8,""data"":""1726105142""}","{""field_type"":9,""data"":""1726060542""}"
+"{""field_type"":0,""created_at"":1726063454,""last_modified"":1726063454,""data"":""George""}","{""created_at"":1726122467,""end_timestamp"":""1726468070"",""include_time"":false,""is_range"":true,""reminder_id"":"""",""field_type"":2,""data"":""1726295270"",""last_modified"":1726122470}",,,"{""field_type"":6,""data"":""[email protected]"",""last_modified"":1726064104,""created_at"":1726064016}","{""last_modified"":1726062376,""created_at"":1726062376,""field_type"":5,""data"":""Yes""}","{""data"":""{\""options\"":[{\""id\"":\""s_dQ\"",\""name\"":\""bug triage\"",\""color\"":\""Purple\""},{\""id\"":\""-Zfo\"",\""name\"":\""fix bugs\"",\""color\"":\""Purple\""},{\""id\"":\""wsDN\"",\""name\"":\""attend meetings\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""s_dQ\"",\""-Zfo\""]}"",""last_modified"":1726064468,""created_at"":1726064424,""field_type"":7}","{""data"":[""{\""id\"":\""8a77f84d-64e9-4e67-b902-fa23980459ec\"",\""name\"":\""BQdTmxpRI6f.png\"",\""url\"":\""https://static.cdninstagram.com/rsrc.php/v3/ym/r/BQdTmxpRI6f.png\"",\""upload_type\"":\""NetworkMedia\"",\""file_type\"":\""Image\""}""],""field_type"":14,""created_at"":1726122956,""last_modified"":1726122956}","{""field_type"":3,""data"":""qnja"",""created_at"":1726065313,""last_modified"":1726065313}","{""data"":""R9I7,yORP"",""field_type"":4,""last_modified"":1726105198,""created_at"":1726105187}","{""data"":""1726122956"",""field_type"":8}","{""data"":""1726060543"",""field_type"":9}"
+"{""field_type"":0,""last_modified"":1726063467,""data"":""Joanna"",""created_at"":1726063467}","{""include_time"":false,""end_timestamp"":""1727072893"",""is_range"":true,""last_modified"":1726122493,""created_at"":1726122483,""data"":""1726554493"",""field_type"":2,""reminder_id"":""""}","{""last_modified"":1726065463,""data"":""16470"",""field_type"":1,""created_at"":1726065463}","{""created_at"":1726062626,""field_type"":1,""last_modified"":1726062626,""data"":""-5.36""}","{""last_modified"":1726064069,""data"":""[email protected]"",""created_at"":1726064069,""field_type"":6}",,"{""field_type"":7,""created_at"":1726064444,""last_modified"":1726064460,""data"":""{\""options\"":[{\""id\"":\""ZxJz\"",\""name\"":\""post on Twitter\"",\""color\"":\""Purple\""},{\""id\"":\""upwi\"",\""name\"":\""watch Youtube videos\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""upwi\""]}""}",,"{""created_at"":1726065317,""last_modified"":1726065317,""field_type"":3,""data"":""qnja""}","{""field_type"":4,""last_modified"":1726105173,""data"":""uRAO,yORP"",""created_at"":1726105170}","{""data"":""1726122493"",""field_type"":8}","{""data"":""1726060545"",""field_type"":9}"
+"{""last_modified"":1726063457,""created_at"":1726063457,""data"":""George"",""field_type"":0}","{""include_time"":true,""reminder_id"":"""",""field_type"":2,""is_range"":true,""created_at"":1726122521,""end_timestamp"":""1725829200"",""data"":""1725822900"",""last_modified"":1726122535}","{""last_modified"":1726065493,""field_type"":1,""data"":""9500"",""created_at"":1726065493}","{""last_modified"":1726062680,""created_at"":1726062680,""field_type"":1,""data"":""1.7""}","{""data"":""[email protected]"",""field_type"":6,""last_modified"":1726064087,""created_at"":1726064036}",,"{""last_modified"":1726064513,""data"":""{\""options\"":[{\""id\"":\""zy0x\"",\""name\"":\""game vs celtics\"",\""color\"":\""Purple\""},{\""id\"":\""WJsv\"",\""name\"":\""training\"",\""color\"":\""Purple\""},{\""id\"":\""w-f8\"",\""name\"":\""game vs spurs\"",\""color\"":\""Purple\""},{\""id\"":\""p1VQ\"",\""name\"":\""game vs knicks\"",\""color\"":\""Purple\""},{\""id\"":\""VjUA\"",\""name\"":\""recovery\"",\""color\"":\""Purple\""},{\""id\"":\""sQ8X\"",\""name\"":\""don't get injured\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[]}"",""created_at"":1726064486,""field_type"":7}",,"{""field_type"":3,""last_modified"":1726065310,""data"":""qnja"",""created_at"":1726065310}","{""created_at"":1726105205,""field_type"":4,""last_modified"":1726105249,""data"":""R9I7,1i4f,yORP,SEUo""}","{""data"":""1726122535"",""field_type"":8}","{""field_type"":9,""data"":""1726060546""}"
+"{""data"":""Judy"",""created_at"":1726063475,""field_type"":0,""last_modified"":1726063487}","{""end_timestamp"":"""",""reminder_id"":"""",""data"":""1726640950"",""field_type"":2,""include_time"":false,""created_at"":1726122550,""last_modified"":1726122550,""is_range"":false}",,,"{""created_at"":1726063882,""field_type"":6,""last_modified"":1726064000,""data"":""[email protected]""}","{""last_modified"":1726062712,""field_type"":5,""data"":""Yes"",""created_at"":1726062712}","{""created_at"":1726064549,""field_type"":7,""data"":""{\""options\"":[{\""id\"":\""j8cC\"",\""name\"":\""finish training\"",\""color\"":\""Purple\""},{\""id\"":\""SmSk\"",\""name\"":\""brainwash\"",\""color\"":\""Purple\""},{\""id\"":\""mnf5\"",\""name\"":\""welcome to ba sing se\"",\""color\"":\""Purple\""},{\""id\"":\""hcrj\"",\""name\"":\""don't mess up\"",\""color\"":\""Purple\""}],\""selected_option_ids\"":[\""j8cC\"",\""SmSk\"",\""mnf5\"",\""hcrj\""]}"",""last_modified"":1726064591}",,,"{""field_type"":4,""last_modified"":1726105152,""created_at"":1726105152,""data"":""R9I7""}","{""field_type"":8,""data"":""1726122550""}","{""field_type"":9,""data"":""1726060549""}"
diff --git a/frontend/appflowy_flutter/integration_test/desktop/board/board_field_test.dart b/frontend/appflowy_flutter/integration_test/desktop/board/board_field_test.dart
index 387c35adf2..bdd0ecdb2c 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/board/board_field_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/board/board_field_test.dart
@@ -25,6 +25,7 @@ void main() {
name: fieldName,
layout: ViewLayoutPB.Board,
);
+ await tester.dismissRowDetailPage();
await tester.tapButton(card1);
await tester.changeFieldTypeOfFieldWithName(
fieldName,
diff --git a/frontend/appflowy_flutter/integration_test/desktop/board/board_hide_groups_test.dart b/frontend/appflowy_flutter/integration_test/desktop/board/board_hide_groups_test.dart
index b1f3d0fb45..a83372fcc6 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/board/board_hide_groups_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/board/board_hide_groups_test.dart
@@ -1,13 +1,14 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
+import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database/board/presentation/widgets/board_column_header.dart';
import 'package:appflowy/plugins/database/board/presentation/widgets/board_hidden_groups.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
-import '../../shared/database_test_op.dart';
import '../../shared/util.dart';
void main() {
@@ -77,47 +78,47 @@ void main() {
shownGroups = tester.widgetList(find.byType(BoardColumnHeader)).length;
expect(shownGroups, 4);
});
- });
-
- testWidgets('delete a group', (tester) async {
- await tester.initializeAppFlowy();
- await tester.tapAnonymousSignInButton();
- await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Board);
-
- expect(tester.widgetList(find.byType(BoardColumnHeader)).length, 4);
-
- // tap group option button for the first group. Delete shouldn't show up
- await tester.tapButton(
- find
- .descendant(
- of: find.byType(BoardColumnHeader),
- matching: find.byFlowySvg(FlowySvgs.details_horizontal_s),
- )
- .first,
- );
- expect(find.byFlowySvg(FlowySvgs.delete_s), findsNothing);
-
- // dismiss the popup
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pumpAndSettle();
- // tap group option button for the first group. Delete should show up
- await tester.tapButton(
- find
- .descendant(
- of: find.byType(BoardColumnHeader),
- matching: find.byFlowySvg(FlowySvgs.details_horizontal_s),
- )
- .at(1),
- );
- expect(find.byFlowySvg(FlowySvgs.delete_s), findsOneWidget);
+ testWidgets('delete a group', (tester) async {
+ await tester.initializeAppFlowy();
+ await tester.tapAnonymousSignInButton();
+ await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Board);
- // Tap the delete button and confirm
- await tester.tapButton(find.byFlowySvg(FlowySvgs.delete_s));
- await tester.tapDialogOkButton();
+ expect(tester.widgetList(find.byType(BoardColumnHeader)).length, 4);
+
+ // tap group option button for the first group. Delete shouldn't show up
+ await tester.tapButton(
+ find
+ .descendant(
+ of: find.byType(BoardColumnHeader),
+ matching: find.byFlowySvg(FlowySvgs.details_horizontal_s),
+ )
+ .first,
+ );
+ expect(find.byFlowySvg(FlowySvgs.delete_s), findsNothing);
+
+ // dismiss the popup
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
- // Expect number of groups to decrease by one
- expect(tester.widgetList(find.byType(BoardColumnHeader)).length, 3);
+ // tap group option button for the first group. Delete should show up
+ await tester.tapButton(
+ find
+ .descendant(
+ of: find.byType(BoardColumnHeader),
+ matching: find.byFlowySvg(FlowySvgs.details_horizontal_s),
+ )
+ .at(1),
+ );
+ expect(find.byFlowySvg(FlowySvgs.delete_s), findsOneWidget);
+
+ // Tap the delete button and confirm
+ await tester.tapButton(find.byFlowySvg(FlowySvgs.delete_s));
+ await tester.tapButtonWithName(LocaleKeys.space_delete.tr());
+
+ // Expect number of groups to decrease by one
+ expect(tester.widgetList(find.byType(BoardColumnHeader)).length, 3);
+ });
});
}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/board/board_test_runner.dart b/frontend/appflowy_flutter/integration_test/desktop/board/board_test_runner.dart
index a786367fff..75323a1c80 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/board/board_test_runner.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/board/board_test_runner.dart
@@ -3,6 +3,8 @@ import 'package:integration_test/integration_test.dart';
import 'board_add_row_test.dart' as board_add_row_test;
import 'board_group_test.dart' as board_group_test;
import 'board_row_test.dart' as board_row_test;
+import 'board_field_test.dart' as board_field_test;
+import 'board_hide_groups_test.dart' as board_hide_groups_test;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
@@ -11,4 +13,6 @@ void main() {
board_row_test.main();
board_add_row_test.main();
board_group_test.main();
+ board_field_test.main();
+ board_hide_groups_test.main();
}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_filter_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_filter_test.dart
index b6db3e1a62..8acc80a0dd 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_filter_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_filter_test.dart
@@ -11,7 +11,7 @@ void main() {
group('grid filter:', () {
testWidgets('add text filter', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a filter
await tester.tapDatabaseFilterButton();
@@ -19,68 +19,68 @@ void main() {
await tester.tapFilterButtonInGrid('Name');
// enter 'A' in the filter text field
- await tester.assertNumberOfRowsInGridPage(10);
+ tester.assertNumberOfRowsInGridPage(10);
await tester.enterTextInTextFilter('A');
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
// after remove the filter, the grid should show all rows
await tester.enterTextInTextFilter('');
- await tester.assertNumberOfRowsInGridPage(10);
+ tester.assertNumberOfRowsInGridPage(10);
await tester.enterTextInTextFilter('B');
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
// open the menu to delete the filter
await tester.tapDisclosureButtonInFinder(find.byType(TextFilterEditor));
await tester.tapDeleteFilterButtonInGrid();
- await tester.assertNumberOfRowsInGridPage(10);
+ tester.assertNumberOfRowsInGridPage(10);
await tester.pumpAndSettle();
});
testWidgets('add checkbox filter', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a filter
await tester.tapDatabaseFilterButton();
await tester.tapCreateFilterByFieldType(FieldType.Checkbox, 'Done');
- await tester.assertNumberOfRowsInGridPage(5);
+ tester.assertNumberOfRowsInGridPage(5);
await tester.tapFilterButtonInGrid('Done');
await tester.tapCheckboxFilterButtonInGrid();
await tester.tapUnCheckedButtonOnCheckboxFilter();
- await tester.assertNumberOfRowsInGridPage(5);
+ tester.assertNumberOfRowsInGridPage(5);
await tester
.tapDisclosureButtonInFinder(find.byType(CheckboxFilterEditor));
await tester.tapDeleteFilterButtonInGrid();
- await tester.assertNumberOfRowsInGridPage(10);
+ tester.assertNumberOfRowsInGridPage(10);
await tester.pumpAndSettle();
});
testWidgets('add checklist filter', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a filter
await tester.tapDatabaseFilterButton();
await tester.tapCreateFilterByFieldType(FieldType.Checklist, 'checklist');
// By default, the condition of checklist filter is 'uncompleted'
- await tester.assertNumberOfRowsInGridPage(9);
+ tester.assertNumberOfRowsInGridPage(9);
await tester.tapFilterButtonInGrid('checklist');
await tester.tapChecklistFilterButtonInGrid();
await tester.tapCompletedButtonOnChecklistFilter();
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
await tester.pumpAndSettle();
});
testWidgets('add single select filter', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a filter
await tester.tapDatabaseFilterButton();
@@ -90,27 +90,27 @@ void main() {
// select the option 's6'
await tester.tapOptionFilterWithName('s6');
- await tester.assertNumberOfRowsInGridPage(0);
+ tester.assertNumberOfRowsInGridPage(0);
// unselect the option 's6'
await tester.tapOptionFilterWithName('s6');
- await tester.assertNumberOfRowsInGridPage(10);
+ tester.assertNumberOfRowsInGridPage(10);
// select the option 's5'
await tester.tapOptionFilterWithName('s5');
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
// select the option 's4'
await tester.tapOptionFilterWithName('s4');
// The row with 's4' should be shown.
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
await tester.pumpAndSettle();
});
testWidgets('add multi select filter', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a filter
await tester.tapDatabaseFilterButton();
@@ -124,17 +124,17 @@ void main() {
// select the option 'm1'. Any option with 'm1' should be shown.
await tester.tapOptionFilterWithName('m1');
- await tester.assertNumberOfRowsInGridPage(5);
+ tester.assertNumberOfRowsInGridPage(5);
await tester.tapOptionFilterWithName('m1');
// select the option 'm2'. Any option with 'm2' should be shown.
await tester.tapOptionFilterWithName('m2');
- await tester.assertNumberOfRowsInGridPage(4);
+ tester.assertNumberOfRowsInGridPage(4);
await tester.tapOptionFilterWithName('m2');
// select the option 'm4'. Any option with 'm4' should be shown.
await tester.tapOptionFilterWithName('m4');
- await tester.assertNumberOfRowsInGridPage(1);
+ tester.assertNumberOfRowsInGridPage(1);
await tester.pumpAndSettle();
});
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
index 095d633b2d..a9b5d6612f 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
@@ -321,7 +321,7 @@ void main() {
await tester.tapRowDetailPageDeleteRowButton();
await tester.tapEscButton();
- await tester.assertNumberOfRowsInGridPage(2);
+ tester.assertNumberOfRowsInGridPage(2);
});
testWidgets('duplicate row', (tester) async {
@@ -338,7 +338,7 @@ void main() {
await tester.tapRowDetailPageDuplicateRowButton();
await tester.tapEscButton();
- await tester.assertNumberOfRowsInGridPage(4);
+ tester.assertNumberOfRowsInGridPage(4);
});
});
}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_test.dart
deleted file mode 100644
index 9865a47a6e..0000000000
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_test.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:integration_test/integration_test.dart';
-
-import '../../shared/database_test_op.dart';
-import '../../shared/util.dart';
-
-void main() {
- IntegrationTestWidgetsFlutterBinding.ensureInitialized();
-
- group('grid', () {
- testWidgets('create row of the grid', (tester) async {
- await tester.initializeAppFlowy();
- await tester.tapAnonymousSignInButton();
-
- await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
- await tester.tapCreateRowButtonInGrid();
-
- // 3 initial rows + 1 created
- await tester.assertNumberOfRowsInGridPage(4);
- await tester.pumpAndSettle();
- });
-
- testWidgets('create row from row menu of the grid', (tester) async {
- await tester.initializeAppFlowy();
- await tester.tapAnonymousSignInButton();
-
- await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
-
- await tester.hoverOnFirstRowOfGrid();
-
- await tester.tapCreateRowButtonInRowMenuOfGrid();
-
- // 3 initial rows + 1 created
- await tester.assertNumberOfRowsInGridPage(4);
- await tester.pumpAndSettle();
- });
-
- testWidgets('delete row of the grid', (tester) async {
- await tester.initializeAppFlowy();
- await tester.tapAnonymousSignInButton();
-
- await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
- await tester.hoverOnFirstRowOfGrid(() async {
- // Open the row menu and then click the delete
- await tester.tapRowMenuButtonInGrid();
- await tester.pumpAndSettle();
- await tester.tapDeleteOnRowMenu();
- await tester.pumpAndSettle();
-
- // 3 initial rows - 1 deleted
- await tester.assertNumberOfRowsInGridPage(2);
- });
- });
-
- testWidgets('check number of row indicator in the initial grid',
- (tester) async {
- await tester.initializeAppFlowy();
- await tester.tapAnonymousSignInButton();
-
- await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
-
- await tester.pumpAndSettle();
- });
- });
-}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_share_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_share_test.dart
index bd3adff7cc..a04948b35e 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_share_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_share_test.dart
@@ -9,7 +9,7 @@ void main() {
group('database', () {
testWidgets('import v0.2.0 database data', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// wait the database data is loaded
await tester.pumpAndSettle(const Duration(microseconds: 500));
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_sort_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_sort_test.dart
index e28072cebc..fcd71d1bc1 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_sort_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_sort_test.dart
@@ -9,7 +9,7 @@ void main() {
group('grid', () {
testWidgets('add text sort', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a sort
await tester.tapDatabaseSortButton();
await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
@@ -60,7 +60,7 @@ void main() {
// delete all sorts
await tester.tapSortMenuInSettingBar();
- await tester.tapAllSortButton();
+ await tester.tapDeleteAllSortsButton();
// check the text cell order
for (final (index, content) in <String>[
@@ -85,7 +85,7 @@ void main() {
});
testWidgets('add checkbox sort', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a sort
await tester.tapDatabaseSortButton();
await tester.tapCreateSortByFieldType(FieldType.Checkbox, 'Done');
@@ -135,7 +135,7 @@ void main() {
});
testWidgets('add number sort', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a sort
await tester.tapDatabaseSortButton();
await tester.tapCreateSortByFieldType(FieldType.Number, 'number');
@@ -187,7 +187,7 @@ void main() {
});
testWidgets('add checkbox and number sort', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a sort
await tester.tapDatabaseSortButton();
await tester.tapCreateSortByFieldType(FieldType.Checkbox, 'Done');
@@ -266,7 +266,7 @@ void main() {
});
testWidgets('reorder sort', (tester) async {
- await tester.openV020database();
+ await tester.openTestDatabase(v020GridFileName);
// create a sort
await tester.tapDatabaseSortButton();
await tester.tapCreateSortByFieldType(FieldType.Checkbox, 'Done');
diff --git a/frontend/appflowy_flutter/integration_test/desktop/grid/grid_create_row_test.dart b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_create_row_test.dart
new file mode 100644
index 0000000000..b8f2d9ca61
--- /dev/null
+++ b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_create_row_test.dart
@@ -0,0 +1,203 @@
+import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart';
+import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/shared_widget.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
+import 'package:collection/collection.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+
+import '../../shared/database_test_op.dart';
+import '../../shared/util.dart';
+import 'grid_test_extensions.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ group('grid create row test:', () {
+ testWidgets('from the bottom', (tester) async {
+ await tester.initializeAppFlowy();
+ await tester.tapAnonymousSignInButton();
+
+ await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
+
+ final expected = tester.getGridRows();
+
+ // create row
+ await tester.tapCreateRowButtonInGrid();
+
+ final actual = tester.getGridRows();
+ expect(actual.slice(0, 3), orderedEquals(expected));
+ expect(actual.length, equals(4));
+ tester.assertNumberOfRowsInGridPage(4);
+ });
+
+ testWidgets('from a row\'s menu', (tester) async {
+ await tester.initializeAppFlowy();
+ await tester.tapAnonymousSignInButton();
+
+ await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
+
+ final expected = tester.getGridRows();
+
+ // create row
+ await tester.hoverOnFirstRowOfGrid();
+ await tester.tapCreateRowButtonAfterHoveringOnGridRow();
+
+ final actual = tester.getGridRows();
+ expect([actual[0], actual[2], actual[3]], orderedEquals(expected));
+ expect(actual.length, equals(4));
+ tester.assertNumberOfRowsInGridPage(4);
+ });
+
+ testWidgets('with sort configured', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final unsorted = tester.getGridRows();
+
+ // add a sort
+ await tester.tapDatabaseSortButton();
+ await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ final sorted = [
+ unsorted[7],
+ unsorted[8],
+ unsorted[1],
+ unsorted[9],
+ unsorted[11],
+ unsorted[10],
+ unsorted[6],
+ unsorted[12],
+ unsorted[2],
+ unsorted[0],
+ unsorted[3],
+ unsorted[5],
+ unsorted[4],
+ ];
+
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+
+ // create row
+ await tester.hoverOnFirstRowOfGrid();
+ await tester.tapCreateRowButtonAfterHoveringOnGridRow();
+
+ // cancel
+ expect(find.byType(ConfirmPopup), findsOneWidget);
+ await tester.tapButtonWithName(LocaleKeys.button_cancel.tr());
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+
+ // try again, but confirm this time
+ await tester.hoverOnFirstRowOfGrid();
+ await tester.tapCreateRowButtonAfterHoveringOnGridRow();
+ expect(find.byType(ConfirmPopup), findsOneWidget);
+ await tester.tapButtonWithName(LocaleKeys.button_remove.tr());
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual.length, equals(14));
+ tester.assertNumberOfRowsInGridPage(14);
+ });
+
+ testWidgets('with filter configured', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // create a filter
+ await tester.tapDatabaseFilterButton();
+ await tester.tapCreateFilterByFieldType(
+ FieldType.Checkbox,
+ 'Registration Complete',
+ );
+
+ final filtered = [
+ original[1],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[9],
+ original[12],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(filtered));
+
+ // create row (one before and after the first row, and one at the bottom)
+ await tester.tapCreateRowButtonInGrid();
+ await tester.hoverOnFirstRowOfGrid();
+ await tester.tapCreateRowButtonAfterHoveringOnGridRow();
+ await tester.hoverOnFirstRowOfGrid(() async {
+ await tester.tapRowMenuButtonInGrid();
+ await tester.tapCreateRowAboveButtonInRowMenu();
+ });
+
+ actual = tester.getGridRows();
+ expect(actual.length, equals(10));
+ tester.assertNumberOfRowsInGridPage(10);
+ actual = [
+ actual[1],
+ actual[3],
+ actual[4],
+ actual[5],
+ actual[6],
+ actual[7],
+ actual[8],
+ ];
+ expect(actual, orderedEquals(filtered));
+
+ // delete the filter
+ await tester.tapFilterButtonInGrid('Registration Complete');
+ await tester
+ .tapDisclosureButtonInFinder(find.byType(CheckboxFilterEditor));
+ await tester.tapDeleteFilterButtonInGrid();
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual.length, equals(16));
+ tester.assertNumberOfRowsInGridPage(16);
+ actual = [
+ actual[0],
+ actual[2],
+ actual[4],
+ actual[5],
+ actual[6],
+ actual[7],
+ actual[8],
+ actual[9],
+ actual[10],
+ actual[11],
+ actual[12],
+ actual[13],
+ actual[14],
+ ];
+ expect(actual, orderedEquals(original));
+ });
+
+ // TODO(RS): move to somewhere else
+ testWidgets('delete row of the grid', (tester) async {
+ await tester.initializeAppFlowy();
+ await tester.tapAnonymousSignInButton();
+
+ await tester.createNewPageWithNameUnderParent(layout: ViewLayoutPB.Grid);
+ await tester.hoverOnFirstRowOfGrid(() async {
+ // Open the row menu and then click the delete
+ await tester.tapRowMenuButtonInGrid();
+ await tester.pumpAndSettle();
+ await tester.tapDeleteOnRowMenu();
+ await tester.pumpAndSettle();
+
+ // 3 initial rows - 1 deleted
+ tester.assertNumberOfRowsInGridPage(2);
+ });
+ });
+ });
+}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/grid/grid_filter_and_sort_test.dart b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_filter_and_sort_test.dart
new file mode 100644
index 0000000000..c9fed5b02e
--- /dev/null
+++ b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_filter_and_sort_test.dart
@@ -0,0 +1,120 @@
+import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+
+import '../../shared/database_test_op.dart';
+import 'grid_test_extensions.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ group('grid simultaneous sort and filter test:', () {
+ // testWidgets('delete filter with active sort', (tester) async {
+ // await tester.openTestDatabase(v069GridFileName);
+
+ // // get grid data
+ // final original = tester.getGridRows();
+
+ // // add a filter
+ // await tester.tapDatabaseFilterButton();
+ // await tester.tapCreateFilterByFieldType(
+ // FieldType.Checkbox,
+ // 'Registration Complete',
+ // );
+
+ // // add a sort
+ // await tester.tapDatabaseSortButton();
+ // await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ // final filteredAndSorted = [
+ // original[7],
+ // original[1],
+ // original[9],
+ // original[6],
+ // original[12],
+ // original[3],
+ // original[5],
+ // ];
+
+ // // verify grid data
+ // List actual = tester.getGridRows();
+ // expect(actual, orderedEquals(filteredAndSorted));
+
+ // // delete the filter
+ // await tester.tapFilterButtonInGrid('Registration Complete');
+ // await tester
+ // .tapDisclosureButtonInFinder(find.byType(CheckboxFilterEditor));
+ // await tester.tapDeleteFilterButtonInGrid();
+
+ // final sorted = [
+ // original[7],
+ // original[8],
+ // original[1],
+ // original[9],
+ // original[11],
+ // original[10],
+ // original[6],
+ // original[12],
+ // original[2],
+ // original[0],
+ // original[3],
+ // original[5],
+ // original[4],
+ // ];
+
+ // // verify grid data
+ // actual = tester.getGridRows();
+ // expect(actual, orderedEquals(sorted));
+ // });
+
+ testWidgets('delete sort with active fiilter', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // add a filter
+ await tester.tapDatabaseFilterButton();
+ await tester.tapCreateFilterByFieldType(
+ FieldType.Checkbox,
+ 'Registration Complete',
+ );
+
+ // add a sort
+ await tester.tapDatabaseSortButton();
+ await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ final filteredAndSorted = [
+ original[7],
+ original[1],
+ original[9],
+ original[6],
+ original[12],
+ original[3],
+ original[5],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(filteredAndSorted));
+
+ // delete the sort
+ await tester.tapSortMenuInSettingBar();
+ await tester.tapDeleteAllSortsButton();
+
+ final filtered = [
+ original[1],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[9],
+ original[12],
+ ];
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(filtered));
+ });
+ });
+}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reopen_test.dart b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reopen_test.dart
new file mode 100644
index 0000000000..a4363f7a83
--- /dev/null
+++ b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reopen_test.dart
@@ -0,0 +1,183 @@
+import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+
+import '../../shared/database_test_op.dart';
+import '../../shared/util.dart';
+import 'grid_test_extensions.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ group('grid reopen test:', () {
+ testWidgets('base case', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ final expected = tester.getGridRows();
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ final actual = tester.getGridRows();
+
+ expect(actual, orderedEquals(expected));
+ });
+
+ testWidgets('with sort configured', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final unsorted = tester.getGridRows();
+
+ // add a sort
+ await tester.tapDatabaseSortButton();
+ await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ final sorted = [
+ unsorted[7],
+ unsorted[8],
+ unsorted[1],
+ unsorted[9],
+ unsorted[11],
+ unsorted[10],
+ unsorted[6],
+ unsorted[12],
+ unsorted[2],
+ unsorted[0],
+ unsorted[3],
+ unsorted[5],
+ unsorted[4],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+
+ // delete sorts
+ // TODO(RS): Shouldn't the sort/filter list show automatically!?
+ await tester.tapDatabaseSortButton();
+ await tester.tapSortMenuInSettingBar();
+ await tester.tapDeleteAllSortsButton();
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(unsorted));
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(unsorted));
+ });
+
+ testWidgets('with filter configured', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final unfiltered = tester.getGridRows();
+
+ // add a filter
+ await tester.tapDatabaseFilterButton();
+ await tester.tapCreateFilterByFieldType(
+ FieldType.Checkbox,
+ 'Registration Complete',
+ );
+
+ final filtered = [
+ unfiltered[1],
+ unfiltered[3],
+ unfiltered[5],
+ unfiltered[6],
+ unfiltered[7],
+ unfiltered[9],
+ unfiltered[12],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(filtered));
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(filtered));
+
+ // delete the filter
+ // TODO(RS): Shouldn't the sort/filter list show automatically!?
+ await tester.tapDatabaseFilterButton();
+ await tester.tapFilterButtonInGrid('Registration Complete');
+ await tester
+ .tapDisclosureButtonInFinder(find.byType(CheckboxFilterEditor));
+ await tester.tapDeleteFilterButtonInGrid();
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(unfiltered));
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(unfiltered));
+ });
+
+ testWidgets('with both filter and sort configured', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // add a filter
+ await tester.tapDatabaseFilterButton();
+ await tester.tapCreateFilterByFieldType(
+ FieldType.Checkbox,
+ 'Registration Complete',
+ );
+
+ // add a sort
+ await tester.tapDatabaseSortButton();
+ await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ final filteredAndSorted = [
+ original[7],
+ original[1],
+ original[9],
+ original[6],
+ original[12],
+ original[3],
+ original[5],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(filteredAndSorted));
+
+ // go to another page and come back
+ await tester.openPage('Getting started');
+ await tester.openPage('v069', layout: ViewLayoutPB.Grid);
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(filteredAndSorted));
+ });
+ });
+}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reorder_row_test.dart b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reorder_row_test.dart
new file mode 100644
index 0000000000..40f7252a91
--- /dev/null
+++ b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_reorder_row_test.dart
@@ -0,0 +1,214 @@
+import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart';
+import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/shared_widget.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+
+import '../../shared/database_test_op.dart';
+import '../../shared/util.dart';
+import 'grid_test_extensions.dart';
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ group('grid reorder row test:', () {
+ testWidgets('base case', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // reorder row
+ await tester.reorderRow(original[4], original[1]);
+
+ // verify grid data
+ List reordered = [
+ original[0],
+ original[4],
+ original[1],
+ original[2],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[8],
+ original[9],
+ original[10],
+ original[11],
+ original[12],
+ ];
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(reordered));
+
+ // reorder row
+ await tester.reorderRow(reordered[1], reordered[3]);
+
+ // verify grid data
+ reordered = [
+ original[0],
+ original[1],
+ original[2],
+ original[4],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[8],
+ original[9],
+ original[10],
+ original[11],
+ original[12],
+ ];
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(reordered));
+
+ // reorder row
+ await tester.reorderRow(reordered[2], reordered[0]);
+
+ // verify grid data
+ reordered = [
+ original[2],
+ original[0],
+ original[1],
+ original[4],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[8],
+ original[9],
+ original[10],
+ original[11],
+ original[12],
+ ];
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(reordered));
+ });
+
+ testWidgets('with active sort', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // add a sort
+ await tester.tapDatabaseSortButton();
+ await tester.tapCreateSortByFieldType(FieldType.RichText, 'Name');
+
+ // verify grid data
+ final sorted = [
+ original[7],
+ original[8],
+ original[1],
+ original[9],
+ original[11],
+ original[10],
+ original[6],
+ original[12],
+ original[2],
+ original[0],
+ original[3],
+ original[5],
+ original[4],
+ ];
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+
+ // reorder row
+ await tester.reorderRow(original[4], original[1]);
+ expect(find.byType(ConfirmPopup), findsOneWidget);
+ await tester.tapButtonWithName(LocaleKeys.button_cancel.tr());
+
+ // verify grid data
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(sorted));
+ });
+
+ testWidgets('with active filter', (tester) async {
+ await tester.openTestDatabase(v069GridFileName);
+
+ // get grid data
+ final original = tester.getGridRows();
+
+ // add a filter
+ await tester.tapDatabaseFilterButton();
+ await tester.tapCreateFilterByFieldType(
+ FieldType.Checkbox,
+ 'Registration Complete',
+ );
+
+ final filtered = [
+ original[1],
+ original[3],
+ original[5],
+ original[6],
+ original[7],
+ original[9],
+ original[12],
+ ];
+
+ // verify grid data
+ List actual = tester.getGridRows();
+ expect(actual, orderedEquals(filtered));
+
+ // reorder row
+ await tester.reorderRow(filtered[3], filtered[1]);
+
+ // verify grid data
+ List reordered = [
+ original[1],
+ original[6],
+ original[3],
+ original[5],
+ original[7],
+ original[9],
+ original[12],
+ ];
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(reordered));
+
+ // reorder row
+ await tester.reorderRow(reordered[3], reordered[5]);
+
+ // verify grid data
+ reordered = [
+ original[1],
+ original[6],
+ original[3],
+ original[7],
+ original[9],
+ original[5],
+ original[12],
+ ];
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(reordered));
+
+ // delete the filter
+ await tester.tapFilterButtonInGrid('Registration Complete');
+ await tester
+ .tapDisclosureButtonInFinder(find.byType(CheckboxFilterEditor));
+ await tester.tapDeleteFilterButtonInGrid();
+
+ // verify grid data
+ final expected = [
+ original[0],
+ original[1],
+ original[2],
+ original[6],
+ original[3],
+ original[4],
+ original[7],
+ original[8],
+ original[9],
+ original[5],
+ original[10],
+ original[11],
+ original[12],
+ ];
+ actual = tester.getGridRows();
+ expect(actual, orderedEquals(expected));
+ });
+ });
+}
diff --git a/frontend/appflowy_flutter/integration_test/desktop/grid/grid_test_extensions.dart b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_test_extensions.dart
new file mode 100644
index 0000000000..c5a0b404e7
--- /dev/null
+++ b/frontend/appflowy_flutter/integration_test/desktop/grid/grid_test_extensions.dart
@@ -0,0 +1,13 @@
+import 'package:appflowy/plugins/database/application/row/row_service.dart';
+import 'package:appflowy/plugins/database/grid/presentation/grid_page.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+extension GridTestExtensions on WidgetTester {
+ List<RowId> getGridRows() {
+ final databaseController =
+ widget<GridPage>(find.byType(GridPage)).databaseController;
+ return [
+ ...databaseController.rowCache.rowInfos.map((e) => e.rowId),
+ ];
+ }
+}
diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart b/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart
index 56c9cfa53d..576cfc1e99 100644
--- a/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop_runner_2.dart
@@ -8,7 +8,6 @@ import 'desktop/database/database_field_test.dart' as database_field_test;
import 'desktop/database/database_filter_test.dart' as database_filter_test;
import 'desktop/database/database_media_test.dart' as database_media_test;
import 'desktop/database/database_row_page_test.dart' as database_row_page_test;
-import 'desktop/database/database_row_test.dart' as database_row_test;
import 'desktop/database/database_setting_test.dart' as database_setting_test;
import 'desktop/database/database_share_test.dart' as database_share_test;
import 'desktop/database/database_sort_test.dart' as database_sort_test;
@@ -30,7 +29,6 @@ Future<void> runIntegration2OnDesktop() async {
database_field_settings_test.main();
database_share_test.main();
database_row_page_test.main();
- database_row_test.main();
database_setting_test.main();
database_filter_test.main();
database_sort_test.main();
diff --git a/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart b/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart
index 284f6d4245..79c311e633 100644
--- a/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop_runner_3.dart
@@ -3,6 +3,12 @@ import 'package:integration_test/integration_test.dart';
import 'desktop/board/board_test_runner.dart' as board_test_runner;
import 'desktop/database/database_row_cover_test.dart'
as database_row_cover_test;
+import 'desktop/grid/grid_reopen_test.dart' as grid_reopen_test_runner;
+import 'desktop/grid/grid_create_row_test.dart' as grid_create_row_test_runner;
+import 'desktop/grid/grid_reorder_row_test.dart'
+ as grid_reorder_row_test_runner;
+import 'desktop/grid/grid_filter_and_sort_test.dart'
+ as grid_filter_and_sort_test_runner;
import 'desktop/settings/settings_runner.dart' as settings_test_runner;
import 'desktop/sidebar/sidebar_test_runner.dart' as sidebar_test_runner;
import 'desktop/uncategorized/emoji_shortcut_test.dart' as emoji_shortcut_test;
@@ -33,4 +39,8 @@ Future<void> runIntegration3OnDesktop() async {
board_test_runner.main();
tabs_test.main();
database_row_cover_test.main();
+ grid_reopen_test_runner.main();
+ grid_create_row_test_runner.main();
+ grid_reorder_row_test_runner.main();
+ grid_filter_and_sort_test_runner.main();
}
diff --git a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
index 18e7e3bfeb..ff4ec8e52d 100644
--- a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
+++ b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
@@ -96,8 +96,11 @@ import 'common_operations.dart';
import 'expectation.dart';
import 'mock/mock_file_picker.dart';
+const v020GridFileName = "v020.afdb";
+const v069GridFileName = "v069.afdb";
+
extension AppFlowyDatabaseTest on WidgetTester {
- Future<void> openV020database() async {
+ Future<void> openTestDatabase(String fileName) async {
final context = await initializeAppFlowy();
await tapAnonymousSignInButton();
@@ -107,29 +110,24 @@ extension AppFlowyDatabaseTest on WidgetTester {
await tapAddViewButton();
await tapImportButton();
- final testFileNames = ['v020.afdb'];
- final paths = <String>[];
- for (final fileName in testFileNames) {
- // Don't use the p.join to build the path that used in loadString. It
- // is not working on windows.
- final str = await rootBundle
- .loadString("assets/test/workspaces/database/$fileName");
-
- // Write the content to the file.
- final path = p.join(
- context.applicationDataDirectory,
- fileName,
- );
- paths.add(path);
- File(path).writeAsStringSync(str);
- }
+ // Don't use the p.join to build the path that used in loadString. It
+ // is not working on windows.
+ final str = await rootBundle
+ .loadString("assets/test/workspaces/database/$fileName");
+
+ // Write the content to the file.
+ final path = p.join(
+ context.applicationDataDirectory,
+ fileName,
+ );
+ final pageName = p.basenameWithoutExtension(path);
+ File(path).writeAsStringSync(str);
// mock get files
mockPickFilePaths(
- paths: paths,
+ paths: [path],
);
await tapDatabaseRawDataButton();
- await pumpAndSettle();
- await openPage('v020', layout: ViewLayoutPB.Grid);
+ await openPage(pageName, layout: ViewLayoutPB.Grid);
}
Future<void> hoverOnFirstRowOfGrid([Future<void> Function()? onHover]) async {
@@ -800,7 +798,7 @@ extension AppFlowyDatabaseTest on WidgetTester {
expect(finder, findsWidgets);
}
- Future<void> assertNumberOfRowsInGridPage(int num) async {
+ void assertNumberOfRowsInGridPage(int num) {
expect(
find.byType(GridRow, skipOffstage: false),
findsNWidgets(num),
@@ -885,21 +883,51 @@ extension AppFlowyDatabaseTest on WidgetTester {
await tapButton(find.byType(GridAddRowButton));
}
- Future<void> tapCreateRowButtonInRowMenuOfGrid() async {
+ Future<void> tapCreateRowButtonAfterHoveringOnGridRow() async {
await tapButton(find.byType(InsertRowButton));
}
Future<void> tapRowMenuButtonInGrid() async {
- expect(find.byType(RowMenuButton), findsOneWidget);
await tapButton(find.byType(RowMenuButton));
}
+ /// Should call [tapRowMenuButtonInGrid] first.
+ Future<void> tapCreateRowAboveButtonInRowMenu() async {
+ await tapButtonWithName(LocaleKeys.grid_row_insertRecordAbove.tr());
+ }
+
/// Should call [tapRowMenuButtonInGrid] first.
Future<void> tapDeleteOnRowMenu() async {
- expect(find.text(LocaleKeys.grid_row_delete.tr()), findsOneWidget);
await tapButtonWithName(LocaleKeys.grid_row_delete.tr());
}
+ Future<void> reorderRow(
+ String from,
+ String to,
+ ) async {
+ final fromRow = find.byWidgetPredicate(
+ (widget) => widget is GridRow && widget.rowId == from,
+ );
+ final toRow = find.byWidgetPredicate(
+ (widget) => widget is GridRow && widget.rowId == to,
+ );
+ await hoverOnWidget(
+ fromRow,
+ onHover: () async {
+ final dragElement = find.descendant(
+ of: fromRow,
+ matching: find.byType(ReorderableDragStartListener),
+ );
+ await timedDrag(
+ dragElement,
+ getCenter(toRow) - getCenter(fromRow),
+ const Duration(milliseconds: 200),
+ );
+ await pumpAndSettle();
+ },
+ );
+ }
+
Future<void> createField(
FieldType fieldType, {
String? name,
@@ -1028,7 +1056,7 @@ extension AppFlowyDatabaseTest on WidgetTester {
}
/// Must call [tapSortMenuInSettingBar] first.
- Future<void> tapAllSortButton() async {
+ Future<void> tapDeleteAllSortsButton() async {
await tapButton(find.byType(DeleteAllSortsButton));
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
index 2c671ebcc7..75c9d336ca 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
@@ -1,5 +1,6 @@
import 'dart:collection';
+import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
@@ -315,7 +316,7 @@ class RowChangesetNotifier extends ChangeNotifier {
}
}
-class RowInfo {
+class RowInfo extends Equatable {
RowInfo({
required this.fields,
required RowMetaPB rowMeta,
@@ -347,6 +348,9 @@ class RowInfo {
rowIconNotifier.dispose();
rowDocumentNotifier.dispose();
}
+
+ @override
+ List<Object> get props => [rowMeta];
}
typedef InsertedIndexs = List<InsertedIndex>;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
index e339d8f8f9..ed783f1b69 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
@@ -300,12 +300,14 @@ class _GridRowsState extends State<_GridRows> {
void _evaluateFloatingCalculations() {
WidgetsBinding.instance.addPostFrameCallback((_) {
- setState(() {
- // maxScrollExtent is 0.0 if scrolling is not possible
- showFloatingCalculations = widget
- .scrollController.verticalController.position.maxScrollExtent >
- 0;
- });
+ if (mounted) {
+ setState(() {
+ // maxScrollExtent is 0.0 if scrolling is not possible
+ showFloatingCalculations = widget.scrollController.verticalController
+ .position.maxScrollExtent >
+ 0;
+ });
+ }
});
}
@@ -388,6 +390,7 @@ class _GridRowsState extends State<_GridRows> {
),
description: LocaleKeys.grid_sort_removeSorting.tr(),
confirmLabel: LocaleKeys.button_remove.tr(),
+ closeOnAction: true,
onDelete: () {
SortBackendService(viewId: widget.viewId).deleteAllSorts();
moveRow();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/action.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/action.dart
index 966b9937b8..fae5c4ef5d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/action.dart
@@ -111,6 +111,7 @@ enum RowAction {
),
description: LocaleKeys.grid_sort_removeSorting.tr(),
confirmLabel: LocaleKeys.button_remove.tr(),
+ closeOnAction: true,
onDelete: () {
SortBackendService(viewId: viewId).deleteAllSorts();
RowBackendService.createRow(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
index 6c7e09d8ce..60b1e845ba 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
@@ -170,6 +170,7 @@ class InsertRowButton extends StatelessWidget {
),
description: LocaleKeys.grid_sort_removeSorting.tr(),
confirmLabel: LocaleKeys.button_remove.tr(),
+ closeOnAction: true,
onDelete: () {
SortBackendService(viewId: viewId).deleteAllSorts();
rowBloc.add(const RowEvent.createRow());
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
index 4ead716760..3465fd9b4f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
@@ -533,6 +533,7 @@ Future<void> showCancelAndDeleteDialog({
Widget Function(BuildContext)? builder,
VoidCallback? onDelete,
String? confirmLabel,
+ bool closeOnAction = false,
}) {
return showDialog(
context: context,
@@ -547,7 +548,7 @@ Future<void> showCancelAndDeleteDialog({
title: title,
description: description,
onConfirm: () => onDelete?.call(),
- closeOnAction: false,
+ closeOnAction: closeOnAction,
confirmLabel: confirmLabel,
confirmButtonColor: Theme.of(context).colorScheme.error,
child: builder?.call(context),
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index 8ffb17d26b..b86bee7baf 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -210,7 +210,7 @@ impl DatabaseViewEditor {
&self,
row_detail: &RowDetail,
index: u32,
- _is_move_row: bool,
+ is_move_row: bool,
_is_local_change: bool,
row_changes: &DashMap<String, RowsChangePB>,
) {
@@ -235,7 +235,11 @@ impl DatabaseViewEditor {
{
row_changes
.entry(self.view_id.clone())
- .or_default()
+ .or_insert_with(|| {
+ let mut change = RowsChangePB::new();
+ change.is_move_row = is_move_row;
+ change
+ })
.inserted_rows
.push(InsertedRowPB::new(RowMetaPB::from(row_detail)).with_index(index as i32));
};