diff --git a/lib/common/constants.dart b/lib/common/constants.dart index 3d1f8622..79745e3e 100644 --- a/lib/common/constants.dart +++ b/lib/common/constants.dart @@ -29,245 +29,245 @@ class Constants { static const urlPattern = r'https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]'; - static const goodsUrlPrefix = "https://gaoneng.bilibili.com/tetris"; + static get goodsUrlPrefix => "https://gaoneng.bilibili.com/tetris"; -// 超分辨率滤镜 - static const List mpvAnime4KShaders = [ - 'Anime4K_Clamp_Highlights.glsl', - 'Anime4K_Restore_CNN_VL.glsl', - 'Anime4K_Upscale_CNN_x2_VL.glsl', - 'Anime4K_AutoDownscalePre_x2.glsl', - 'Anime4K_AutoDownscalePre_x4.glsl', - 'Anime4K_Upscale_CNN_x2_M.glsl' - ]; + // 超分辨率滤镜 + static List get mpvAnime4KShaders => [ + 'Anime4K_Clamp_Highlights.glsl', + 'Anime4K_Restore_CNN_VL.glsl', + 'Anime4K_Upscale_CNN_x2_VL.glsl', + 'Anime4K_AutoDownscalePre_x2.glsl', + 'Anime4K_AutoDownscalePre_x4.glsl', + 'Anime4K_Upscale_CNN_x2_M.glsl' + ]; // 超分辨率滤镜 (轻量) - static const List mpvAnime4KShadersLite = [ - 'Anime4K_Clamp_Highlights.glsl', - 'Anime4K_Restore_CNN_M.glsl', - 'Anime4K_Restore_CNN_S.glsl', - 'Anime4K_Upscale_CNN_x2_M.glsl', - 'Anime4K_AutoDownscalePre_x2.glsl', - 'Anime4K_AutoDownscalePre_x4.glsl', - 'Anime4K_Upscale_CNN_x2_S.glsl' - ]; + static List get mpvAnime4KShadersLite => [ + 'Anime4K_Clamp_Highlights.glsl', + 'Anime4K_Restore_CNN_M.glsl', + 'Anime4K_Restore_CNN_S.glsl', + 'Anime4K_Upscale_CNN_x2_M.glsl', + 'Anime4K_AutoDownscalePre_x2.glsl', + 'Anime4K_AutoDownscalePre_x4.glsl', + 'Anime4K_Upscale_CNN_x2_S.glsl' + ]; //内容来自 https://passport.bilibili.com/web/generic/country/list - static const List> internationalDialingPrefix = [ - {"id": 1, "cname": "中国大陆", "country_id": "86"}, - {"id": 5, "cname": "中国香港特别行政区", "country_id": "852"}, - {"id": 2, "cname": "中国澳门特别行政区", "country_id": "853"}, - {"id": 3, "cname": "中国台湾", "country_id": "886"}, - {"id": 4, "cname": "美国", "country_id": "1"}, - {"id": 6, "cname": "比利时", "country_id": "32"}, - {"id": 7, "cname": "澳大利亚", "country_id": "61"}, - {"id": 8, "cname": "法国", "country_id": "33"}, - {"id": 9, "cname": "加拿大", "country_id": "1"}, - {"id": 10, "cname": "日本", "country_id": "81"}, - {"id": 11, "cname": "新加坡", "country_id": "65"}, - {"id": 12, "cname": "韩国", "country_id": "82"}, - {"id": 13, "cname": "马来西亚", "country_id": "60"}, - {"id": 14, "cname": "英国", "country_id": "44"}, - {"id": 15, "cname": "意大利", "country_id": "39"}, - {"id": 16, "cname": "德国", "country_id": "49"}, - {"id": 18, "cname": "俄罗斯", "country_id": "7"}, - {"id": 19, "cname": "新西兰", "country_id": "64"}, //common:1-19 - {"id": 153, "cname": "瓦利斯群岛和富图纳群岛", "country_id": "1681"}, - {"id": 152, "cname": "葡萄牙", "country_id": "351"}, - {"id": 151, "cname": "帕劳", "country_id": "680"}, - {"id": 150, "cname": "诺福克岛", "country_id": "672"}, - {"id": 149, "cname": "挪威", "country_id": "47"}, - {"id": 148, "cname": "纽埃岛", "country_id": "683"}, - {"id": 147, "cname": "尼日利亚", "country_id": "234"}, - {"id": 146, "cname": "尼日尔", "country_id": "227"}, - {"id": 145, "cname": "尼加拉瓜", "country_id": "505"}, - {"id": 144, "cname": "尼泊尔", "country_id": "977"}, - {"id": 143, "cname": "瑙鲁", "country_id": "674"}, - {"id": 154, "cname": "格鲁吉亚", "country_id": "995"}, - {"id": 155, "cname": "瑞典", "country_id": "46"}, - {"id": 165, "cname": "沙特阿拉伯", "country_id": "966"}, - {"id": 164, "cname": "桑给巴尔岛", "country_id": "259"}, - {"id": 163, "cname": "塞舌尔共和国", "country_id": "248"}, - {"id": 162, "cname": "塞浦路斯", "country_id": "357"}, - {"id": 161, "cname": "塞内加尔", "country_id": "221"}, - {"id": 160, "cname": "塞拉利昂", "country_id": "232"}, - {"id": 159, "cname": "萨摩亚,东部", "country_id": "684"}, - {"id": 158, "cname": "萨摩亚,西部", "country_id": "685"}, - {"id": 157, "cname": "萨尔瓦多", "country_id": "503"}, - {"id": 156, "cname": "瑞士", "country_id": "41"}, - {"id": 166, "cname": "圣多美和普林西比", "country_id": "239"}, - {"id": 142, "cname": "塞尔维亚", "country_id": "381"}, - {"id": 141, "cname": "南非", "country_id": "27"}, - {"id": 128, "cname": "毛里塔尼亚", "country_id": "222"}, - {"id": 127, "cname": "毛里求斯", "country_id": "230"}, - {"id": 126, "cname": "马歇尔岛", "country_id": "692"}, - {"id": 125, "cname": "马提尼克岛", "country_id": "596"}, - {"id": 124, "cname": "马其顿", "country_id": "389"}, - {"id": 123, "cname": "马里亚纳岛", "country_id": "1670"}, - {"id": 122, "cname": "马里", "country_id": "223"}, - {"id": 121, "cname": "马拉维", "country_id": "265"}, - {"id": 120, "cname": "马耳他", "country_id": "356"}, - {"id": 119, "cname": "马尔代夫", "country_id": "960"}, - {"id": 129, "cname": "蒙古", "country_id": "976"}, - {"id": 130, "cname": "蒙特塞拉特岛", "country_id": "1664"}, - {"id": 140, "cname": "纳米比亚", "country_id": "264"}, - {"id": 139, "cname": "墨西哥", "country_id": "52"}, - {"id": 138, "cname": "莫桑比克", "country_id": "258"}, - {"id": 137, "cname": "摩纳哥", "country_id": "377"}, - {"id": 136, "cname": "摩洛哥", "country_id": "212"}, - {"id": 135, "cname": "摩尔多瓦", "country_id": "373"}, - {"id": 134, "cname": "缅甸", "country_id": "95"}, - {"id": 133, "cname": "密克罗尼西亚", "country_id": "691"}, - {"id": 132, "cname": "秘鲁", "country_id": "51"}, - {"id": 131, "cname": "孟加拉国", "country_id": "880"}, - {"id": 118, "cname": "马达加斯加", "country_id": "261"}, - {"id": 167, "cname": "圣卢西亚", "country_id": "1784"}, - {"id": 216, "cname": "智利", "country_id": "56"}, - {"id": 203, "cname": "牙买加", "country_id": "1876"}, - {"id": 202, "cname": "叙利亚", "country_id": "963"}, - {"id": 201, "cname": "匈牙利", "country_id": "36"}, - {"id": 200, "cname": "科特迪瓦", "country_id": "225"}, - {"id": 199, "cname": "希腊", "country_id": "30"}, - {"id": 198, "cname": "西班牙", "country_id": "34"}, - {"id": 197, "cname": "乌兹别克斯坦", "country_id": "998"}, - {"id": 196, "cname": "乌拉圭", "country_id": "598"}, - {"id": 195, "cname": "乌克兰", "country_id": "380"}, - {"id": 194, "cname": "乌干达", "country_id": "256"}, - {"id": 204, "cname": "亚美尼亚", "country_id": "374"}, - {"id": 205, "cname": "也门", "country_id": "967"}, - {"id": 215, "cname": "直布罗陀", "country_id": "350"}, - {"id": 214, "cname": "乍得", "country_id": "235"}, - {"id": 213, "cname": "赞比亚", "country_id": "260"}, - {"id": 212, "cname": "越南", "country_id": "84"}, - {"id": 211, "cname": "约旦", "country_id": "962"}, - {"id": 210, "cname": "印尼", "country_id": "62"}, - {"id": 209, "cname": "印度", "country_id": "91"}, - {"id": 208, "cname": "以色列", "country_id": "972"}, - {"id": 207, "cname": "伊朗", "country_id": "98"}, - {"id": 206, "cname": "伊拉克", "country_id": "964"}, - {"id": 193, "cname": "文莱", "country_id": "673"}, - {"id": 192, "cname": "委内瑞拉", "country_id": "58"}, - {"id": 191, "cname": "维珍群岛(英属)", "country_id": "1284"}, - {"id": 178, "cname": "泰国", "country_id": "66"}, - {"id": 177, "cname": "索马里", "country_id": "252"}, - {"id": 176, "cname": "所罗门群岛", "country_id": "677"}, - {"id": 175, "cname": "苏里南", "country_id": "597"}, - {"id": 174, "cname": "苏丹", "country_id": "249"}, - {"id": 173, "cname": "斯威士兰", "country_id": "268"}, - {"id": 172, "cname": "斯洛文尼亚", "country_id": "386"}, - {"id": 171, "cname": "斯洛伐克", "country_id": "421"}, - {"id": 170, "cname": "斯里兰卡", "country_id": "94"}, - {"id": 169, "cname": "圣皮埃尔和密克隆群岛", "country_id": "508"}, - {"id": 179, "cname": "坦桑尼亚", "country_id": "255"}, - {"id": 180, "cname": "汤加", "country_id": "676"}, - {"id": 190, "cname": "维珍群岛(美属)", "country_id": "1340"}, - {"id": 189, "cname": "瓦努阿图", "country_id": "678"}, - {"id": 188, "cname": "托克劳岛", "country_id": "690"}, - {"id": 187, "cname": "土库曼斯坦", "country_id": "993"}, - {"id": 186, "cname": "土耳其", "country_id": "90"}, - {"id": 185, "cname": "图瓦卢", "country_id": "688"}, - {"id": 184, "cname": "突尼斯", "country_id": "216"}, - {"id": 183, "cname": "阿森松岛", "country_id": "247"}, - {"id": 182, "cname": "特立尼达和多巴哥", "country_id": "1868"}, - {"id": 181, "cname": "特克斯和凯科斯", "country_id": "1649"}, - {"id": 168, "cname": "圣马力诺", "country_id": "378"}, - {"id": 67, "cname": "法属圭亚那", "country_id": "594"}, - {"id": 54, "cname": "不丹", "country_id": "975"}, - {"id": 53, "cname": "博茨瓦纳", "country_id": "267"}, - {"id": 52, "cname": "伯利兹", "country_id": "501"}, - {"id": 51, "cname": "玻利维亚", "country_id": "591"}, - {"id": 50, "cname": "波兰", "country_id": "48"}, - {"id": 49, "cname": "波黑", "country_id": "387"}, - {"id": 48, "cname": "波多黎各", "country_id": "1787"}, - {"id": 47, "cname": "冰岛", "country_id": "354"}, - {"id": 46, "cname": "贝宁", "country_id": "229"}, - {"id": 45, "cname": "保加利亚", "country_id": "359"}, - {"id": 55, "cname": "布基纳法索", "country_id": "226"}, - {"id": 56, "cname": "布隆迪", "country_id": "257"}, - {"id": 66, "cname": "法属波利尼西亚", "country_id": "689"}, - {"id": 65, "cname": "法罗岛", "country_id": "298"}, - {"id": 64, "cname": "厄立特里亚", "country_id": "291"}, - {"id": 63, "cname": "厄瓜多尔", "country_id": "593"}, - {"id": 62, "cname": "多米尼加代表", "country_id": "1809"}, - {"id": 61, "cname": "多米尼加", "country_id": "1767"}, - {"id": 60, "cname": "多哥", "country_id": "228"}, - {"id": 59, "cname": "迪戈加西亚岛", "country_id": "246"}, - {"id": 58, "cname": "丹麦", "country_id": "45"}, - {"id": 57, "cname": "赤道几内亚", "country_id": "240"}, - {"id": 44, "cname": "百慕大群岛", "country_id": "1441"}, - {"id": 43, "cname": "白俄罗斯", "country_id": "375"}, - {"id": 42, "cname": "巴西", "country_id": "55"}, - {"id": 29, "cname": "爱尔兰", "country_id": "353"}, - {"id": 28, "cname": "埃塞俄比亚", "country_id": "251"}, - {"id": 27, "cname": "埃及", "country_id": "20"}, - {"id": 26, "cname": "阿塞拜疆", "country_id": "994"}, - {"id": 25, "cname": "阿曼", "country_id": "968"}, - {"id": 24, "cname": "阿联酋", "country_id": "971"}, - {"id": 23, "cname": "阿根廷", "country_id": "54"}, - {"id": 22, "cname": "阿富汗", "country_id": "93"}, - {"id": 21, "cname": "阿尔及利亚", "country_id": "213"}, - {"id": 20, "cname": "阿尔巴尼亚", "country_id": "355"}, - {"id": 30, "cname": "爱沙尼亚", "country_id": "372"}, - {"id": 31, "cname": "安道尔", "country_id": "376"}, - {"id": 41, "cname": "巴拿马", "country_id": "507"}, - {"id": 40, "cname": "巴林", "country_id": "973"}, - {"id": 39, "cname": "巴拉圭", "country_id": "595"}, - {"id": 38, "cname": "巴基斯坦", "country_id": "92"}, - {"id": 37, "cname": "巴哈马群岛", "country_id": "1242"}, - {"id": 36, "cname": "巴布亚新几内亚", "country_id": "675"}, - {"id": 35, "cname": "巴巴多斯", "country_id": "1246"}, - {"id": 34, "cname": "奥地利", "country_id": "43"}, - {"id": 33, "cname": "安提瓜岛和巴布达", "country_id": "1268"}, - {"id": 32, "cname": "安哥拉", "country_id": "244"}, - {"id": 68, "cname": "非洲中部", "country_id": "236"}, - {"id": 117, "cname": "罗马尼亚", "country_id": "40"}, - {"id": 104, "cname": "科威特", "country_id": "965"}, - {"id": 103, "cname": "科摩罗", "country_id": "269"}, - {"id": 102, "cname": "开曼群岛", "country_id": "1345"}, - {"id": 101, "cname": "卡塔尔", "country_id": "974"}, - {"id": 100, "cname": "喀麦隆", "country_id": "237"}, - {"id": 99, "cname": "聚会岛", "country_id": "262"}, - {"id": 98, "cname": "津巴布韦", "country_id": "263"}, - {"id": 97, "cname": "捷克", "country_id": "420"}, - {"id": 96, "cname": "柬埔寨", "country_id": "855"}, - {"id": 95, "cname": "加蓬", "country_id": "241"}, - {"id": 105, "cname": "克罗地亚", "country_id": "385"}, - {"id": 106, "cname": "肯尼亚", "country_id": "254"}, - {"id": 116, "cname": "卢旺达", "country_id": "250"}, - {"id": 115, "cname": "卢森堡", "country_id": "352"}, - {"id": 114, "cname": "利比亚", "country_id": "218"}, - {"id": 113, "cname": "利比里亚", "country_id": "231"}, - {"id": 112, "cname": "立陶宛", "country_id": "370"}, - {"id": 111, "cname": "黎巴嫩", "country_id": "961"}, - {"id": 110, "cname": "老挝", "country_id": "856"}, - {"id": 109, "cname": "莱索托", "country_id": "266"}, - {"id": 108, "cname": "拉脱维亚", "country_id": "371"}, - {"id": 107, "cname": "库克岛", "country_id": "682"}, - {"id": 94, "cname": "加纳", "country_id": "233"}, - {"id": 93, "cname": "几内亚比绍", "country_id": "245"}, - {"id": 92, "cname": "几内亚", "country_id": "224"}, - {"id": 79, "cname": "格林纳达", "country_id": "1473"}, - {"id": 78, "cname": "哥斯达黎加", "country_id": "506"}, - {"id": 77, "cname": "哥伦比亚", "country_id": "57"}, - {"id": 76, "cname": "刚果(金)", "country_id": "243"}, - {"id": 75, "cname": "刚果", "country_id": "242"}, - {"id": 74, "cname": "冈比亚", "country_id": "220"}, - {"id": 73, "cname": "福克兰岛", "country_id": "500"}, - {"id": 72, "cname": "佛得角", "country_id": "238"}, - {"id": 71, "cname": "芬兰", "country_id": "358"}, - {"id": 70, "cname": "斐济", "country_id": "679"}, - {"id": 80, "cname": "格陵兰岛", "country_id": "299"}, - {"id": 81, "cname": "古巴", "country_id": "53"}, - {"id": 91, "cname": "吉尔吉斯斯坦", "country_id": "996"}, - {"id": 90, "cname": "吉布提", "country_id": "253"}, - {"id": 89, "cname": "基里巴斯", "country_id": "686"}, - {"id": 88, "cname": "维克岛", "country_id": "1808"}, - {"id": 87, "cname": "洪都拉斯", "country_id": "504"}, - {"id": 86, "cname": "荷兰", "country_id": "31"}, - {"id": 85, "cname": "朝鲜", "country_id": "850"}, - {"id": 84, "cname": "海地", "country_id": "509"}, - {"id": 83, "cname": "关岛", "country_id": "1671"}, - {"id": 82, "cname": "瓜德罗普岛", "country_id": "590"}, - {"id": 69, "cname": "菲律宾", "country_id": "63"} - ]; + static List> get internationalDialingPrefix => [ + {"id": 1, "cname": "中国大陆", "country_id": "86"}, + {"id": 5, "cname": "中国香港特别行政区", "country_id": "852"}, + {"id": 2, "cname": "中国澳门特别行政区", "country_id": "853"}, + {"id": 3, "cname": "中国台湾", "country_id": "886"}, + {"id": 4, "cname": "美国", "country_id": "1"}, + {"id": 6, "cname": "比利时", "country_id": "32"}, + {"id": 7, "cname": "澳大利亚", "country_id": "61"}, + {"id": 8, "cname": "法国", "country_id": "33"}, + {"id": 9, "cname": "加拿大", "country_id": "1"}, + {"id": 10, "cname": "日本", "country_id": "81"}, + {"id": 11, "cname": "新加坡", "country_id": "65"}, + {"id": 12, "cname": "韩国", "country_id": "82"}, + {"id": 13, "cname": "马来西亚", "country_id": "60"}, + {"id": 14, "cname": "英国", "country_id": "44"}, + {"id": 15, "cname": "意大利", "country_id": "39"}, + {"id": 16, "cname": "德国", "country_id": "49"}, + {"id": 18, "cname": "俄罗斯", "country_id": "7"}, + {"id": 19, "cname": "新西兰", "country_id": "64"}, //common:1-19 + {"id": 153, "cname": "瓦利斯群岛和富图纳群岛", "country_id": "1681"}, + {"id": 152, "cname": "葡萄牙", "country_id": "351"}, + {"id": 151, "cname": "帕劳", "country_id": "680"}, + {"id": 150, "cname": "诺福克岛", "country_id": "672"}, + {"id": 149, "cname": "挪威", "country_id": "47"}, + {"id": 148, "cname": "纽埃岛", "country_id": "683"}, + {"id": 147, "cname": "尼日利亚", "country_id": "234"}, + {"id": 146, "cname": "尼日尔", "country_id": "227"}, + {"id": 145, "cname": "尼加拉瓜", "country_id": "505"}, + {"id": 144, "cname": "尼泊尔", "country_id": "977"}, + {"id": 143, "cname": "瑙鲁", "country_id": "674"}, + {"id": 154, "cname": "格鲁吉亚", "country_id": "995"}, + {"id": 155, "cname": "瑞典", "country_id": "46"}, + {"id": 165, "cname": "沙特阿拉伯", "country_id": "966"}, + {"id": 164, "cname": "桑给巴尔岛", "country_id": "259"}, + {"id": 163, "cname": "塞舌尔共和国", "country_id": "248"}, + {"id": 162, "cname": "塞浦路斯", "country_id": "357"}, + {"id": 161, "cname": "塞内加尔", "country_id": "221"}, + {"id": 160, "cname": "塞拉利昂", "country_id": "232"}, + {"id": 159, "cname": "萨摩亚,东部", "country_id": "684"}, + {"id": 158, "cname": "萨摩亚,西部", "country_id": "685"}, + {"id": 157, "cname": "萨尔瓦多", "country_id": "503"}, + {"id": 156, "cname": "瑞士", "country_id": "41"}, + {"id": 166, "cname": "圣多美和普林西比", "country_id": "239"}, + {"id": 142, "cname": "塞尔维亚", "country_id": "381"}, + {"id": 141, "cname": "南非", "country_id": "27"}, + {"id": 128, "cname": "毛里塔尼亚", "country_id": "222"}, + {"id": 127, "cname": "毛里求斯", "country_id": "230"}, + {"id": 126, "cname": "马歇尔岛", "country_id": "692"}, + {"id": 125, "cname": "马提尼克岛", "country_id": "596"}, + {"id": 124, "cname": "马其顿", "country_id": "389"}, + {"id": 123, "cname": "马里亚纳岛", "country_id": "1670"}, + {"id": 122, "cname": "马里", "country_id": "223"}, + {"id": 121, "cname": "马拉维", "country_id": "265"}, + {"id": 120, "cname": "马耳他", "country_id": "356"}, + {"id": 119, "cname": "马尔代夫", "country_id": "960"}, + {"id": 129, "cname": "蒙古", "country_id": "976"}, + {"id": 130, "cname": "蒙特塞拉特岛", "country_id": "1664"}, + {"id": 140, "cname": "纳米比亚", "country_id": "264"}, + {"id": 139, "cname": "墨西哥", "country_id": "52"}, + {"id": 138, "cname": "莫桑比克", "country_id": "258"}, + {"id": 137, "cname": "摩纳哥", "country_id": "377"}, + {"id": 136, "cname": "摩洛哥", "country_id": "212"}, + {"id": 135, "cname": "摩尔多瓦", "country_id": "373"}, + {"id": 134, "cname": "缅甸", "country_id": "95"}, + {"id": 133, "cname": "密克罗尼西亚", "country_id": "691"}, + {"id": 132, "cname": "秘鲁", "country_id": "51"}, + {"id": 131, "cname": "孟加拉国", "country_id": "880"}, + {"id": 118, "cname": "马达加斯加", "country_id": "261"}, + {"id": 167, "cname": "圣卢西亚", "country_id": "1784"}, + {"id": 216, "cname": "智利", "country_id": "56"}, + {"id": 203, "cname": "牙买加", "country_id": "1876"}, + {"id": 202, "cname": "叙利亚", "country_id": "963"}, + {"id": 201, "cname": "匈牙利", "country_id": "36"}, + {"id": 200, "cname": "科特迪瓦", "country_id": "225"}, + {"id": 199, "cname": "希腊", "country_id": "30"}, + {"id": 198, "cname": "西班牙", "country_id": "34"}, + {"id": 197, "cname": "乌兹别克斯坦", "country_id": "998"}, + {"id": 196, "cname": "乌拉圭", "country_id": "598"}, + {"id": 195, "cname": "乌克兰", "country_id": "380"}, + {"id": 194, "cname": "乌干达", "country_id": "256"}, + {"id": 204, "cname": "亚美尼亚", "country_id": "374"}, + {"id": 205, "cname": "也门", "country_id": "967"}, + {"id": 215, "cname": "直布罗陀", "country_id": "350"}, + {"id": 214, "cname": "乍得", "country_id": "235"}, + {"id": 213, "cname": "赞比亚", "country_id": "260"}, + {"id": 212, "cname": "越南", "country_id": "84"}, + {"id": 211, "cname": "约旦", "country_id": "962"}, + {"id": 210, "cname": "印尼", "country_id": "62"}, + {"id": 209, "cname": "印度", "country_id": "91"}, + {"id": 208, "cname": "以色列", "country_id": "972"}, + {"id": 207, "cname": "伊朗", "country_id": "98"}, + {"id": 206, "cname": "伊拉克", "country_id": "964"}, + {"id": 193, "cname": "文莱", "country_id": "673"}, + {"id": 192, "cname": "委内瑞拉", "country_id": "58"}, + {"id": 191, "cname": "维珍群岛(英属)", "country_id": "1284"}, + {"id": 178, "cname": "泰国", "country_id": "66"}, + {"id": 177, "cname": "索马里", "country_id": "252"}, + {"id": 176, "cname": "所罗门群岛", "country_id": "677"}, + {"id": 175, "cname": "苏里南", "country_id": "597"}, + {"id": 174, "cname": "苏丹", "country_id": "249"}, + {"id": 173, "cname": "斯威士兰", "country_id": "268"}, + {"id": 172, "cname": "斯洛文尼亚", "country_id": "386"}, + {"id": 171, "cname": "斯洛伐克", "country_id": "421"}, + {"id": 170, "cname": "斯里兰卡", "country_id": "94"}, + {"id": 169, "cname": "圣皮埃尔和密克隆群岛", "country_id": "508"}, + {"id": 179, "cname": "坦桑尼亚", "country_id": "255"}, + {"id": 180, "cname": "汤加", "country_id": "676"}, + {"id": 190, "cname": "维珍群岛(美属)", "country_id": "1340"}, + {"id": 189, "cname": "瓦努阿图", "country_id": "678"}, + {"id": 188, "cname": "托克劳岛", "country_id": "690"}, + {"id": 187, "cname": "土库曼斯坦", "country_id": "993"}, + {"id": 186, "cname": "土耳其", "country_id": "90"}, + {"id": 185, "cname": "图瓦卢", "country_id": "688"}, + {"id": 184, "cname": "突尼斯", "country_id": "216"}, + {"id": 183, "cname": "阿森松岛", "country_id": "247"}, + {"id": 182, "cname": "特立尼达和多巴哥", "country_id": "1868"}, + {"id": 181, "cname": "特克斯和凯科斯", "country_id": "1649"}, + {"id": 168, "cname": "圣马力诺", "country_id": "378"}, + {"id": 67, "cname": "法属圭亚那", "country_id": "594"}, + {"id": 54, "cname": "不丹", "country_id": "975"}, + {"id": 53, "cname": "博茨瓦纳", "country_id": "267"}, + {"id": 52, "cname": "伯利兹", "country_id": "501"}, + {"id": 51, "cname": "玻利维亚", "country_id": "591"}, + {"id": 50, "cname": "波兰", "country_id": "48"}, + {"id": 49, "cname": "波黑", "country_id": "387"}, + {"id": 48, "cname": "波多黎各", "country_id": "1787"}, + {"id": 47, "cname": "冰岛", "country_id": "354"}, + {"id": 46, "cname": "贝宁", "country_id": "229"}, + {"id": 45, "cname": "保加利亚", "country_id": "359"}, + {"id": 55, "cname": "布基纳法索", "country_id": "226"}, + {"id": 56, "cname": "布隆迪", "country_id": "257"}, + {"id": 66, "cname": "法属波利尼西亚", "country_id": "689"}, + {"id": 65, "cname": "法罗岛", "country_id": "298"}, + {"id": 64, "cname": "厄立特里亚", "country_id": "291"}, + {"id": 63, "cname": "厄瓜多尔", "country_id": "593"}, + {"id": 62, "cname": "多米尼加代表", "country_id": "1809"}, + {"id": 61, "cname": "多米尼加", "country_id": "1767"}, + {"id": 60, "cname": "多哥", "country_id": "228"}, + {"id": 59, "cname": "迪戈加西亚岛", "country_id": "246"}, + {"id": 58, "cname": "丹麦", "country_id": "45"}, + {"id": 57, "cname": "赤道几内亚", "country_id": "240"}, + {"id": 44, "cname": "百慕大群岛", "country_id": "1441"}, + {"id": 43, "cname": "白俄罗斯", "country_id": "375"}, + {"id": 42, "cname": "巴西", "country_id": "55"}, + {"id": 29, "cname": "爱尔兰", "country_id": "353"}, + {"id": 28, "cname": "埃塞俄比亚", "country_id": "251"}, + {"id": 27, "cname": "埃及", "country_id": "20"}, + {"id": 26, "cname": "阿塞拜疆", "country_id": "994"}, + {"id": 25, "cname": "阿曼", "country_id": "968"}, + {"id": 24, "cname": "阿联酋", "country_id": "971"}, + {"id": 23, "cname": "阿根廷", "country_id": "54"}, + {"id": 22, "cname": "阿富汗", "country_id": "93"}, + {"id": 21, "cname": "阿尔及利亚", "country_id": "213"}, + {"id": 20, "cname": "阿尔巴尼亚", "country_id": "355"}, + {"id": 30, "cname": "爱沙尼亚", "country_id": "372"}, + {"id": 31, "cname": "安道尔", "country_id": "376"}, + {"id": 41, "cname": "巴拿马", "country_id": "507"}, + {"id": 40, "cname": "巴林", "country_id": "973"}, + {"id": 39, "cname": "巴拉圭", "country_id": "595"}, + {"id": 38, "cname": "巴基斯坦", "country_id": "92"}, + {"id": 37, "cname": "巴哈马群岛", "country_id": "1242"}, + {"id": 36, "cname": "巴布亚新几内亚", "country_id": "675"}, + {"id": 35, "cname": "巴巴多斯", "country_id": "1246"}, + {"id": 34, "cname": "奥地利", "country_id": "43"}, + {"id": 33, "cname": "安提瓜岛和巴布达", "country_id": "1268"}, + {"id": 32, "cname": "安哥拉", "country_id": "244"}, + {"id": 68, "cname": "非洲中部", "country_id": "236"}, + {"id": 117, "cname": "罗马尼亚", "country_id": "40"}, + {"id": 104, "cname": "科威特", "country_id": "965"}, + {"id": 103, "cname": "科摩罗", "country_id": "269"}, + {"id": 102, "cname": "开曼群岛", "country_id": "1345"}, + {"id": 101, "cname": "卡塔尔", "country_id": "974"}, + {"id": 100, "cname": "喀麦隆", "country_id": "237"}, + {"id": 99, "cname": "聚会岛", "country_id": "262"}, + {"id": 98, "cname": "津巴布韦", "country_id": "263"}, + {"id": 97, "cname": "捷克", "country_id": "420"}, + {"id": 96, "cname": "柬埔寨", "country_id": "855"}, + {"id": 95, "cname": "加蓬", "country_id": "241"}, + {"id": 105, "cname": "克罗地亚", "country_id": "385"}, + {"id": 106, "cname": "肯尼亚", "country_id": "254"}, + {"id": 116, "cname": "卢旺达", "country_id": "250"}, + {"id": 115, "cname": "卢森堡", "country_id": "352"}, + {"id": 114, "cname": "利比亚", "country_id": "218"}, + {"id": 113, "cname": "利比里亚", "country_id": "231"}, + {"id": 112, "cname": "立陶宛", "country_id": "370"}, + {"id": 111, "cname": "黎巴嫩", "country_id": "961"}, + {"id": 110, "cname": "老挝", "country_id": "856"}, + {"id": 109, "cname": "莱索托", "country_id": "266"}, + {"id": 108, "cname": "拉脱维亚", "country_id": "371"}, + {"id": 107, "cname": "库克岛", "country_id": "682"}, + {"id": 94, "cname": "加纳", "country_id": "233"}, + {"id": 93, "cname": "几内亚比绍", "country_id": "245"}, + {"id": 92, "cname": "几内亚", "country_id": "224"}, + {"id": 79, "cname": "格林纳达", "country_id": "1473"}, + {"id": 78, "cname": "哥斯达黎加", "country_id": "506"}, + {"id": 77, "cname": "哥伦比亚", "country_id": "57"}, + {"id": 76, "cname": "刚果(金)", "country_id": "243"}, + {"id": 75, "cname": "刚果", "country_id": "242"}, + {"id": 74, "cname": "冈比亚", "country_id": "220"}, + {"id": 73, "cname": "福克兰岛", "country_id": "500"}, + {"id": 72, "cname": "佛得角", "country_id": "238"}, + {"id": 71, "cname": "芬兰", "country_id": "358"}, + {"id": 70, "cname": "斐济", "country_id": "679"}, + {"id": 80, "cname": "格陵兰岛", "country_id": "299"}, + {"id": 81, "cname": "古巴", "country_id": "53"}, + {"id": 91, "cname": "吉尔吉斯斯坦", "country_id": "996"}, + {"id": 90, "cname": "吉布提", "country_id": "253"}, + {"id": 89, "cname": "基里巴斯", "country_id": "686"}, + {"id": 88, "cname": "维克岛", "country_id": "1808"}, + {"id": 87, "cname": "洪都拉斯", "country_id": "504"}, + {"id": 86, "cname": "荷兰", "country_id": "31"}, + {"id": 85, "cname": "朝鲜", "country_id": "850"}, + {"id": 84, "cname": "海地", "country_id": "509"}, + {"id": 83, "cname": "关岛", "country_id": "1671"}, + {"id": 82, "cname": "瓜德罗普岛", "country_id": "590"}, + {"id": 69, "cname": "菲律宾", "country_id": "63"} + ]; } diff --git a/lib/http/dynamics.dart b/lib/http/dynamics.dart index c59d8299..f7a469f8 100644 --- a/lib/http/dynamics.dart +++ b/lib/http/dynamics.dart @@ -1,4 +1,5 @@ import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/utils/storage.dart'; import 'package:dio/dio.dart'; import '../models/dynamics/result.dart'; @@ -10,7 +11,6 @@ class DynamicsHttp { String? type, String? offset, int? mid, - required bool antiGoodsDyn, }) async { Map data = { 'type': type ?? 'all', @@ -26,7 +26,7 @@ class DynamicsHttp { if (res.data['code'] == 0) { try { DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']); - if (antiGoodsDyn) { + if (GStorage.antiGoodsDyn) { data.items?.removeWhere( (item) => item.orig?.modules?.moduleDynamic?.additional?.type == diff --git a/lib/http/member.dart b/lib/http/member.dart index 7fe70ded..004dc3a5 100644 --- a/lib/http/member.dart +++ b/lib/http/member.dart @@ -389,7 +389,6 @@ class MemberHttp { static Future memberDynamic({ String? offset, int? mid, - required bool antiGoodsDyn, }) async { String dmImgStr = Utils.base64EncodeRandomString(16, 64); String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128); @@ -410,7 +409,7 @@ class MemberHttp { var res = await Request().get(Api.memberDynamic, queryParameters: params); if (res.data['code'] == 0) { DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']); - if (antiGoodsDyn) { + if (GStorage.antiGoodsDyn) { data.items?.removeWhere((item) => item.orig?.modules?.moduleDynamic?.additional?.type == 'ADDITIONAL_TYPE_GOODS' || diff --git a/lib/http/user.dart b/lib/http/user.dart index 482e114c..b0f9b356 100644 --- a/lib/http/user.dart +++ b/lib/http/user.dart @@ -180,8 +180,10 @@ class UserHttp { }); } List list = []; - for (var i in res.data['data']['list']) { - list.add(HotVideoItemModel.fromJson(i)); + if (res.data['data']?['list'] != null) { + for (var i in res.data['data']['list']) { + list.add(HotVideoItemModel.fromJson(i)); + } } return LoadingState.success({ 'list': list, diff --git a/lib/pages/about/index.dart b/lib/pages/about/index.dart index 7a15d7f7..c6a7b385 100644 --- a/lib/pages/about/index.dart +++ b/lib/pages/about/index.dart @@ -27,11 +27,9 @@ class AboutPage extends StatefulWidget { class _AboutPageState extends State { final AboutController _aboutController = Get.put(AboutController()); - static const String _sourceCodeUrl = - 'https://github.com/bggRGjQaUbCoE/PiliPlus'; - static const String _originSourceCodeUrl = - 'https://github.com/guozhigq/pilipala'; - static const String _upstreamUrl = 'https://github.com/orz12/PiliPalaX'; + final String _sourceCodeUrl = 'https://github.com/bggRGjQaUbCoE/PiliPlus'; + final String _originSourceCodeUrl = 'https://github.com/guozhigq/pilipala'; + final String _upstreamUrl = 'https://github.com/orz12/PiliPalaX'; late int _pressCount = 0; diff --git a/lib/pages/bangumi/pgc_index/pgc_index_controller.dart b/lib/pages/bangumi/pgc_index/pgc_index_controller.dart index 45081d84..8cd704b3 100644 --- a/lib/pages/bangumi/pgc_index/pgc_index_controller.dart +++ b/lib/pages/bangumi/pgc_index/pgc_index_controller.dart @@ -2,6 +2,7 @@ import 'package:PiliPlus/http/bangumi.dart'; import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/bangumi/pgc_index/condition.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:get/get.dart' hide Condition; class PgcIndexController extends CommonController { @@ -55,13 +56,13 @@ class PgcIndexController extends CommonController { response.response['has_next'] == 0) { isEnd = true; } - if (response.response['list'] == null || - (response.response['list'] as List?)?.isEmpty == true) { + if (isEnd.not && (response.response['list'] as List?).isNullOrEmpty) { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - response.response['list'] - ?.insertAll(0, (loadingState.value as Success).response); + response.response['list'] ??= []; + response.response['list']! + .insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(response.response['list']); return true; diff --git a/lib/pages/blacklist/index.dart b/lib/pages/blacklist/index.dart index 9eb15018..c6176ecd 100644 --- a/lib/pages/blacklist/index.dart +++ b/lib/pages/blacklist/index.dart @@ -1,7 +1,9 @@ import 'package:PiliPlus/common/widgets/loading_widget.dart'; import 'package:PiliPlus/common/widgets/refresh_indicator.dart'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/user/black.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -24,9 +26,9 @@ class _BlackListPageState extends State { void dispose() { List list = _blackListController.loadingState.value is Success ? (_blackListController.loadingState.value as Success).response - : []; + : []; GStorage.setBlackMidsList( - list.isNotEmpty ? list.map((e) => e.mid!).toList() : []); + list.isNotEmpty ? list.map((e) => e.mid!).toList() : []); super.dispose(); } @@ -111,18 +113,20 @@ class BlackListController extends CommonController { @override bool customHandleResponse(Success response) { total.value = response.response.total; - if (response.response.list.isEmpty) { + if ((response.response.list as List?).isNullOrEmpty) { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - response.response.list - ?.insertAll(0, (loadingState.value as Success).response); + response.response.list ??= []; + response.response.list! + .insertAll(0, (loadingState.value as Success).response); } - if (response.response.list.length >= total.value) { + if (isEnd.not && response.response.list.length >= total.value) { isEnd = true; } - loadingState.value = LoadingState.success( - response.response.list.isNotEmpty ? response.response.list : []); + loadingState.value = LoadingState.success(response.response.list.isNotEmpty + ? response.response.list + : []); return true; } @@ -133,7 +137,7 @@ class BlackListController extends CommonController { list.removeWhere((e) => e.mid == mid); total.value = total.value - 1; loadingState.value = - LoadingState.success(list.isNotEmpty ? list : []); + LoadingState.success(list.isNotEmpty ? list : []); SmartDialog.showToast(result['msg']); } } diff --git a/lib/pages/common/common_controller.dart b/lib/pages/common/common_controller.dart index 59a3f53c..4a4806d9 100644 --- a/lib/pages/common/common_controller.dart +++ b/lib/pages/common/common_controller.dart @@ -29,7 +29,9 @@ abstract class CommonController extends GetxController { LoadingState response = await customGetData(); if (response is Success) { if (!customHandleResponse(response)) { - isEnd = response.response.isEmpty; + if ((response.response as List?).isNullOrEmpty) { + isEnd = true; + } List currentList = loadingState.value is Success ? (loadingState.value as Success).response : []; diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 2bfdb9a8..4c2dff1d 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -116,7 +116,7 @@ abstract class ReplyController extends CommonController { } else if (loadingState.value is Success) { replies.insertAll(0, (loadingState.value as Success).response.replies); } - if (replies.length >= count.value) { + if (isEnd.not && replies.length >= count.value) { isEnd = true; } loadingState.value = LoadingState.success(response.response); diff --git a/lib/pages/dynamics/tab/controller.dart b/lib/pages/dynamics/tab/controller.dart index 38669d5c..1186de27 100644 --- a/lib/pages/dynamics/tab/controller.dart +++ b/lib/pages/dynamics/tab/controller.dart @@ -1,8 +1,9 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/msg.dart'; +import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/pages/main/controller.dart'; -import 'package:PiliPlus/utils/storage.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -33,23 +34,23 @@ class DynamicsTabController extends CommonController { @override bool customHandleResponse(Success response) { offset = response.response.offset; - isEnd = response.response.items.isEmpty; + if ((response.response.items as List?).isNullOrEmpty) { + isEnd = true; + } if (currentPage != 1 && loadingState.value is Success) { - response.response.items + response.response.items ??= []; + response.response.items! .insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(response.response.items); return true; } - late final antiGoodsDyn = GStorage.antiGoodsDyn; - @override Future customGetData() => DynamicsHttp.followDynamic( type: dynamicsType == "up" ? "all" : dynamicsType, offset: offset, mid: dynamicsType == "up" ? mid : -1, - antiGoodsDyn: antiGoodsDyn, ); Future onRemove(dynamic dynamicId) async { diff --git a/lib/pages/fan/controller.dart b/lib/pages/fan/controller.dart index 447de820..6b8b5fd8 100644 --- a/lib/pages/fan/controller.dart +++ b/lib/pages/fan/controller.dart @@ -1,6 +1,8 @@ import 'package:PiliPlus/http/fan.dart'; import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/fans/result.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:get/get.dart'; import 'package:PiliPlus/utils/storage.dart'; @@ -28,11 +30,12 @@ class FansController extends CommonController { @override bool customHandleResponse(Success response) { if ((currentPage == 1 && response.response.total < ps) || - response.response.list.isEmpty) { + (response.response.list as List?).isNullOrEmpty) { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - response.response.list + response.response.list ??= []; + response.response.list! .insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(response.response.list); diff --git a/lib/pages/fav/controller.dart b/lib/pages/fav/controller.dart index 79753435..f40f2625 100644 --- a/lib/pages/fav/controller.dart +++ b/lib/pages/fav/controller.dart @@ -1,6 +1,8 @@ import 'package:PiliPlus/http/loading_state.dart'; +import 'package:PiliPlus/models/user/fav_folder.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/http/user.dart'; +import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; class FavController extends CommonController { @@ -23,11 +25,13 @@ class FavController extends CommonController { @override bool customHandleResponse(Success response) { - if (!response.response.hasMore || response.response.list.isEmpty) { + if (response.response.hasMore == false || + (response.response.list as List?).isNullOrEmpty) { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - response.response.list + response.response.list ??= []; + response.response.list! .insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(response.response.list); diff --git a/lib/pages/fav_detail/controller.dart b/lib/pages/fav_detail/controller.dart index 11319335..1495e39c 100644 --- a/lib/pages/fav_detail/controller.dart +++ b/lib/pages/fav_detail/controller.dart @@ -45,12 +45,14 @@ class FavDetailController extends MultiSelectController { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - data.medias?.insertAll( + data.medias ??= []; + data.medias!.insertAll( 0, List.from((loadingState.value as Success).response), ); } - if ((data.medias?.length ?? 0) >= (data.info?.mediaCount ?? 0)) { + if (isEnd.not && + (data.medias?.length ?? 0) >= (data.info?.mediaCount ?? 0)) { isEnd = true; } loadingState.value = LoadingState.success(data.medias); diff --git a/lib/pages/fav_search/controller.dart b/lib/pages/fav_search/controller.dart index c4ca24a0..c2efe2fb 100644 --- a/lib/pages/fav_search/controller.dart +++ b/lib/pages/fav_search/controller.dart @@ -46,10 +46,10 @@ class FavSearchController extends CommonController { @override bool customHandleResponse(Success response) { - List currentList = loadingState.value is Success + late List currentList = loadingState.value is Success ? (loadingState.value as Success).response : []; - List dataList = searchType == SearchType.fav + List? dataList = searchType == SearchType.fav ? (currentPage == 1 ? response.response.medias : currentList + response.response.medias) @@ -57,7 +57,7 @@ class FavSearchController extends CommonController { ? response.response.list : currentList + response.response.list); isEnd = searchType == SearchType.fav - ? !response.response.hasMore + ? response.response.hasMore == false : response.response.list.isEmpty; loadingState.value = LoadingState.success(dataList); return true; diff --git a/lib/pages/history/controller.dart b/lib/pages/history/controller.dart index b0333848..340413aa 100644 --- a/lib/pages/history/controller.dart +++ b/lib/pages/history/controller.dart @@ -35,7 +35,8 @@ class HistoryController extends MultiSelectController { max = data.list?.lastOrNull?.history?.oid; viewAt = data.list?.lastOrNull?.viewAt; if (currentPage != 1 && loadingState.value is Success) { - data.list?.insertAll( + data.list ??= []; + data.list!.insertAll( 0, List.from((loadingState.value as Success).response), ); diff --git a/lib/pages/member/new/content/member_contribute/content/article/member_article_ctr.dart b/lib/pages/member/new/content/member_contribute/content/article/member_article_ctr.dart index 8456f521..412b2b49 100644 --- a/lib/pages/member/new/content/member_contribute/content/article/member_article_ctr.dart +++ b/lib/pages/member/new/content/member_contribute/content/article/member_article_ctr.dart @@ -1,5 +1,6 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/member.dart'; +import 'package:PiliPlus/models/space_article/item.dart'; import 'package:PiliPlus/models/space_article/data.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/utils/extension.dart'; @@ -25,10 +26,10 @@ class MemberArticleCtr extends CommonController { if (data.item.isNullOrEmpty) { isEnd = true; } - if (currentPage == 1) { - count = data.count ?? -1; - } else if (loadingState.value is Success) { - data.item?.insertAll(0, (loadingState.value as Success).response); + count = data.count ?? -1; + if (currentPage != 1 && loadingState.value is Success) { + data.item ??= []; + data.item!.insertAll(0, (loadingState.value as Success).response); } if ((data.item?.length ?? -1) >= count) { isEnd = true; diff --git a/lib/pages/member/new/content/member_contribute/content/bangumi/member_bangumi_ctr.dart b/lib/pages/member/new/content/member_contribute/content/bangumi/member_bangumi_ctr.dart index 592dd5da..9d7efe7c 100644 --- a/lib/pages/member/new/content/member_contribute/content/bangumi/member_bangumi_ctr.dart +++ b/lib/pages/member/new/content/member_contribute/content/bangumi/member_bangumi_ctr.dart @@ -1,6 +1,7 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/models/space_archive/data.dart'; +import 'package:PiliPlus/models/space_archive/item.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/pages/member/new/content/member_contribute/member_contribute.dart' show ContributeType; @@ -36,7 +37,8 @@ class MemberBangumiCtr extends CommonController { isEnd = true; } if (currentPage != 1 && loadingState.value is Success) { - data.item?.insertAll(0, (loadingState.value as Success).response); + data.item ??= []; + data.item!.insertAll(0, (loadingState.value as Success).response); } if (data.item!.length >= count) { isEnd = true; diff --git a/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart b/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart index caf61dc9..16fff720 100644 --- a/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart +++ b/lib/pages/member/new/content/member_contribute/content/video/member_video_ctr.dart @@ -59,14 +59,18 @@ class MemberVideoCtr extends CommonController { episodicButton.refresh(); next = data.next; aid = data.item?.lastOrNull?.param; - isEnd = - type == ContributeType.video ? data.hasNext == false : data.next == 0; - if (currentPage == 0) { - count.value = type == ContributeType.season - ? (data.item?.length ?? -1) - : (data.count ?? -1); - } else if (loadingState.value is Success) { - data.item?.insertAll(0, (loadingState.value as Success).response); + if ((type == ContributeType.video + ? data.hasNext == false + : data.next == 0) || + data.item.isNullOrEmpty) { + isEnd = true; + } + count.value = type == ContributeType.season + ? (data.item?.length ?? -1) + : (data.count ?? -1); + if (currentPage != 0 && loadingState.value is Success) { + data.item ??= []; + data.item!.insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(data.item); return true; diff --git a/lib/pages/member_dynamics/controller.dart b/lib/pages/member_dynamics/controller.dart index ae29bc6c..54562777 100644 --- a/lib/pages/member_dynamics/controller.dart +++ b/lib/pages/member_dynamics/controller.dart @@ -4,14 +4,12 @@ import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/models/dynamics/result.dart'; -import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; class MemberDynamicsController extends CommonController { MemberDynamicsController(this.mid); int mid; String offset = ''; - late final antiGoodsDyn = GStorage.antiGoodsDyn; @override void onInit() async { @@ -37,8 +35,11 @@ class MemberDynamicsController extends CommonController { bool customHandleResponse(Success response) { DynamicsDataModel data = response.response; offset = data.offset?.isNotEmpty == true ? data.offset! : '-1'; - isEnd = !(data.hasMore ?? false); + if (data.hasMore == false || data.items.isNullOrEmpty) { + isEnd = true; + } if (currentPage != 1 && loadingState.value is Success) { + data.items ??= []; data.items?.insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(data.items); @@ -49,7 +50,6 @@ class MemberDynamicsController extends CommonController { Future customGetData() => MemberHttp.memberDynamic( offset: offset, mid: mid, - antiGoodsDyn: antiGoodsDyn, ); Future onRemove(dynamicId) async { diff --git a/lib/pages/search_panel/controller.dart b/lib/pages/search_panel/controller.dart index 61b4a4d1..7a38fd0e 100644 --- a/lib/pages/search_panel/controller.dart +++ b/lib/pages/search_panel/controller.dart @@ -46,7 +46,7 @@ class SearchPanelController extends CommonController { isEnd = response.response.list.isEmpty; if (currentPage != 1 && loadingState.value is Success) { response.response.list - ?.insertAll(0, (loadingState.value as Success).response); + .insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(response.response.list); if (searchType == SearchType.video && diff --git a/lib/pages/setting/sponsor_block_page.dart b/lib/pages/setting/sponsor_block_page.dart index 8779b172..9c3c27d1 100644 --- a/lib/pages/setting/sponsor_block_page.dart +++ b/lib/pages/setting/sponsor_block_page.dart @@ -24,7 +24,7 @@ class SponsorBlockPage extends StatefulWidget { } class _SponsorBlockPageState extends State { - static const _url = 'https://github.com/hanydd/BilibiliSponsorBlock'; + final _url = 'https://github.com/hanydd/BilibiliSponsorBlock'; final _textController = TextEditingController(); late double _blockLimit; late List> _blockSettings; diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index da21bb51..206a9ebd 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -2086,6 +2086,9 @@ List get extraSettings => [ ), setKey: SettingBoxKey.antiGoodsDyn, defaultVal: false, + onChanged: (value) { + GStorage.antiGoodsDyn = value; + }, ), SettingsModel( settingsType: SettingsType.sw1tch, diff --git a/lib/pages/video/detail/member/controller.dart b/lib/pages/video/detail/member/controller.dart index b936aa7a..ed335ec8 100644 --- a/lib/pages/video/detail/member/controller.dart +++ b/lib/pages/video/detail/member/controller.dart @@ -1,9 +1,11 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/models/space_archive/data.dart'; +import 'package:PiliPlus/models/space_archive/item.dart'; import 'package:PiliPlus/pages/common/common_controller.dart'; import 'package:PiliPlus/pages/member/new/content/member_contribute/member_contribute.dart' show ContributeType; +import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:get/get.dart'; @@ -55,11 +57,13 @@ class HorizontalMemberPageController extends CommonController { Data data = response.response; next = data.next; aid = data.item?.lastOrNull?.param; - isEnd = data.hasNext == false; - if (currentPage == 0) { - count.value = data.count ?? -1; - } else if (loadingState.value is Success) { - data.item?.insertAll(0, (loadingState.value as Success).response); + if (data.hasNext == false || data.item.isNullOrEmpty) { + isEnd = true; + } + count.value = data.count ?? -1; + if (currentPage != 0 && loadingState.value is Success) { + data.item ??= []; + data.item!.insertAll(0, (loadingState.value as Success).response); } loadingState.value = LoadingState.success(data.item); return true; diff --git a/lib/pages/video/detail/view_v.dart b/lib/pages/video/detail/view_v.dart index e4261a2e..f7ec75c3 100644 --- a/lib/pages/video/detail/view_v.dart +++ b/lib/pages/video/detail/view_v.dart @@ -2378,9 +2378,11 @@ class _VideoDetailPageVState extends State } else { videoDetailController.childKey.currentState?.showBottomSheet( backgroundColor: Colors.transparent, - (context) => ViewPointsPage( - child: listSheetContent(), - ), + (context) => GStorage.collapsibleVideoPage + ? ViewPointsPage( + child: listSheetContent(), + ) + : listSheetContent(), ); } } diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index c1844b59..25643f7f 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -379,7 +379,7 @@ class GStorage { static bool get isPureBlackTheme => GStorage.setting.get(SettingBoxKey.isPureBlackTheme, defaultValue: false); - static bool get antiGoodsDyn => + static bool antiGoodsDyn = GStorage.setting.get(SettingBoxKey.antiGoodsDyn, defaultValue: false); static bool get antiGoodsReply =>