diff --git "a/assets/emoji/gogo\351\230\237.webp" "b/assets/emoji/gogo\351\230\237.webp" new file mode 100644 index 0000000..fa169f8 Binary files /dev/null and "b/assets/emoji/gogo\351\230\237.webp" differ diff --git "a/assets/emoji/\345\260\217\350\216\236\347\206\212.webp" "b/assets/emoji/\345\260\217\350\216\236\347\206\212.webp" new file mode 100644 index 0000000..7116639 Binary files /dev/null and "b/assets/emoji/\345\260\217\350\216\236\347\206\212.webp" differ diff --git "a/assets/emoji/\346\237\232\346\201\251\350\234\234.webp" "b/assets/emoji/\346\237\232\346\201\251\350\234\234.webp" new file mode 100644 index 0000000..4f49dee Binary files /dev/null and "b/assets/emoji/\346\237\232\346\201\251\350\234\234.webp" differ diff --git "a/assets/emoji/\347\276\216\344\272\272\350\231\236.webp" "b/assets/emoji/\347\276\216\344\272\272\350\231\236.webp" new file mode 100644 index 0000000..88b0788 Binary files /dev/null and "b/assets/emoji/\347\276\216\344\272\272\350\231\236.webp" differ diff --git "a/assets/emoji/\351\205\267\350\257\272\347\261\263.webp" "b/assets/emoji/\351\205\267\350\257\272\347\261\263.webp" new file mode 100644 index 0000000..0ec2202 Binary files /dev/null and "b/assets/emoji/\351\205\267\350\257\272\347\261\263.webp" differ diff --git a/assets/eoe.webp b/assets/eoe.webp new file mode 100644 index 0000000..f572add Binary files /dev/null and b/assets/eoe.webp differ diff --git a/assets/mi/head_bg.jpg b/assets/mi/head_bg.jpg new file mode 100644 index 0000000..8c44cdc Binary files /dev/null and b/assets/mi/head_bg.jpg differ diff --git a/assets/mi/head_myself_mp4_bg.mp4 b/assets/mi/head_myself_mp4_bg.mp4 new file mode 100644 index 0000000..8d73305 Binary files /dev/null and b/assets/mi/head_myself_mp4_bg.mp4 differ diff --git a/assets/mi/head_myself_squared_bg.png b/assets/mi/head_myself_squared_bg.png new file mode 100644 index 0000000..bbb7556 Binary files /dev/null and b/assets/mi/head_myself_squared_bg.png differ diff --git a/assets/mi/head_tab_bg.jpg b/assets/mi/head_tab_bg.jpg new file mode 100644 index 0000000..b112aea Binary files /dev/null and b/assets/mi/head_tab_bg.jpg differ diff --git a/assets/mi/tail_bg.png b/assets/mi/tail_bg.png new file mode 100644 index 0000000..3d287ba Binary files /dev/null and b/assets/mi/tail_bg.png differ diff --git a/assets/mi/tail_icon_channel.png b/assets/mi/tail_icon_channel.png new file mode 100644 index 0000000..2a30e52 Binary files /dev/null and b/assets/mi/tail_icon_channel.png differ diff --git a/assets/mi/tail_icon_dynamic.png b/assets/mi/tail_icon_dynamic.png new file mode 100644 index 0000000..84870c2 Binary files /dev/null and b/assets/mi/tail_icon_dynamic.png differ diff --git a/assets/mi/tail_icon_main.png b/assets/mi/tail_icon_main.png new file mode 100644 index 0000000..c761e53 Binary files /dev/null and b/assets/mi/tail_icon_main.png differ diff --git a/assets/mi/tail_icon_myself.png b/assets/mi/tail_icon_myself.png new file mode 100644 index 0000000..4d2c21d Binary files /dev/null and b/assets/mi/tail_icon_myself.png differ diff --git a/assets/mi/tail_icon_pub_btn_bg.png b/assets/mi/tail_icon_pub_btn_bg.png new file mode 100644 index 0000000..84870c2 Binary files /dev/null and b/assets/mi/tail_icon_pub_btn_bg.png differ diff --git a/assets/mi/tail_icon_selected_channel.png b/assets/mi/tail_icon_selected_channel.png new file mode 100644 index 0000000..f2ca156 Binary files /dev/null and b/assets/mi/tail_icon_selected_channel.png differ diff --git a/assets/mi/tail_icon_selected_dynamic.png b/assets/mi/tail_icon_selected_dynamic.png new file mode 100644 index 0000000..1f5d03e Binary files /dev/null and b/assets/mi/tail_icon_selected_dynamic.png differ diff --git a/assets/mi/tail_icon_selected_main.png b/assets/mi/tail_icon_selected_main.png new file mode 100644 index 0000000..dfe5927 Binary files /dev/null and b/assets/mi/tail_icon_selected_main.png differ diff --git a/assets/mi/tail_icon_selected_myself.png b/assets/mi/tail_icon_selected_myself.png new file mode 100644 index 0000000..baaaad3 Binary files /dev/null and b/assets/mi/tail_icon_selected_myself.png differ diff --git a/assets/mi/tail_icon_selected_pub_btn_bg.png b/assets/mi/tail_icon_selected_pub_btn_bg.png new file mode 100644 index 0000000..1f5d03e Binary files /dev/null and b/assets/mi/tail_icon_selected_pub_btn_bg.png differ diff --git a/assets/mi/tail_icon_selected_shop.png b/assets/mi/tail_icon_selected_shop.png new file mode 100644 index 0000000..dda4ff8 Binary files /dev/null and b/assets/mi/tail_icon_selected_shop.png differ diff --git a/assets/mi/tail_icon_shop.png b/assets/mi/tail_icon_shop.png new file mode 100644 index 0000000..735e6f7 Binary files /dev/null and b/assets/mi/tail_icon_shop.png differ diff --git a/assets/mo/head_bg.jpg b/assets/mo/head_bg.jpg new file mode 100644 index 0000000..3b874a2 Binary files /dev/null and b/assets/mo/head_bg.jpg differ diff --git a/assets/mo/head_myself_mp4_bg.mp4 b/assets/mo/head_myself_mp4_bg.mp4 new file mode 100644 index 0000000..d7576f4 Binary files /dev/null and b/assets/mo/head_myself_mp4_bg.mp4 differ diff --git a/assets/mo/head_myself_squared_bg.png b/assets/mo/head_myself_squared_bg.png new file mode 100644 index 0000000..7410d72 Binary files /dev/null and b/assets/mo/head_myself_squared_bg.png differ diff --git a/assets/mo/head_tab_bg.jpg b/assets/mo/head_tab_bg.jpg new file mode 100644 index 0000000..b92a599 Binary files /dev/null and b/assets/mo/head_tab_bg.jpg differ diff --git a/assets/mo/tail_bg.png b/assets/mo/tail_bg.png new file mode 100644 index 0000000..dcfcb48 Binary files /dev/null and b/assets/mo/tail_bg.png differ diff --git a/assets/mo/tail_icon_channel.png b/assets/mo/tail_icon_channel.png new file mode 100644 index 0000000..a34aeaa Binary files /dev/null and b/assets/mo/tail_icon_channel.png differ diff --git a/assets/mo/tail_icon_dynamic.png b/assets/mo/tail_icon_dynamic.png new file mode 100644 index 0000000..4744b56 Binary files /dev/null and b/assets/mo/tail_icon_dynamic.png differ diff --git a/assets/mo/tail_icon_main.png b/assets/mo/tail_icon_main.png new file mode 100644 index 0000000..e225f3e Binary files /dev/null and b/assets/mo/tail_icon_main.png differ diff --git a/assets/mo/tail_icon_myself.png b/assets/mo/tail_icon_myself.png new file mode 100644 index 0000000..6563401 Binary files /dev/null and b/assets/mo/tail_icon_myself.png differ diff --git a/assets/mo/tail_icon_pub_btn_bg.png b/assets/mo/tail_icon_pub_btn_bg.png new file mode 100644 index 0000000..4744b56 Binary files /dev/null and b/assets/mo/tail_icon_pub_btn_bg.png differ diff --git a/assets/mo/tail_icon_selected_channel.png b/assets/mo/tail_icon_selected_channel.png new file mode 100644 index 0000000..3230117 Binary files /dev/null and b/assets/mo/tail_icon_selected_channel.png differ diff --git a/assets/mo/tail_icon_selected_dynamic.png b/assets/mo/tail_icon_selected_dynamic.png new file mode 100644 index 0000000..f574e7c Binary files /dev/null and b/assets/mo/tail_icon_selected_dynamic.png differ diff --git a/assets/mo/tail_icon_selected_main.png b/assets/mo/tail_icon_selected_main.png new file mode 100644 index 0000000..4c85f66 Binary files /dev/null and b/assets/mo/tail_icon_selected_main.png differ diff --git a/assets/mo/tail_icon_selected_myself.png b/assets/mo/tail_icon_selected_myself.png new file mode 100644 index 0000000..d056835 Binary files /dev/null and b/assets/mo/tail_icon_selected_myself.png differ diff --git a/assets/mo/tail_icon_selected_pub_btn_bg.png b/assets/mo/tail_icon_selected_pub_btn_bg.png new file mode 100644 index 0000000..f574e7c Binary files /dev/null and b/assets/mo/tail_icon_selected_pub_btn_bg.png differ diff --git a/assets/mo/tail_icon_selected_shop.png b/assets/mo/tail_icon_selected_shop.png new file mode 100644 index 0000000..8a557d7 Binary files /dev/null and b/assets/mo/tail_icon_selected_shop.png differ diff --git a/assets/mo/tail_icon_shop.png b/assets/mo/tail_icon_shop.png new file mode 100644 index 0000000..a5825c7 Binary files /dev/null and b/assets/mo/tail_icon_shop.png differ diff --git a/assets/un/head_bg.jpg b/assets/un/head_bg.jpg new file mode 100644 index 0000000..1051efd Binary files /dev/null and b/assets/un/head_bg.jpg differ diff --git a/assets/un/head_myself_mp4_bg.mp4 b/assets/un/head_myself_mp4_bg.mp4 new file mode 100644 index 0000000..9abe687 Binary files /dev/null and b/assets/un/head_myself_mp4_bg.mp4 differ diff --git a/assets/un/head_myself_squared_bg.png b/assets/un/head_myself_squared_bg.png new file mode 100644 index 0000000..27feb0e Binary files /dev/null and b/assets/un/head_myself_squared_bg.png differ diff --git a/assets/un/head_tab_bg.jpg b/assets/un/head_tab_bg.jpg new file mode 100644 index 0000000..e2e2454 Binary files /dev/null and b/assets/un/head_tab_bg.jpg differ diff --git a/assets/un/tail_bg.png b/assets/un/tail_bg.png new file mode 100644 index 0000000..65f3a67 Binary files /dev/null and b/assets/un/tail_bg.png differ diff --git a/assets/un/tail_icon_channel.png b/assets/un/tail_icon_channel.png new file mode 100644 index 0000000..5d40afd Binary files /dev/null and b/assets/un/tail_icon_channel.png differ diff --git a/assets/un/tail_icon_dynamic.png b/assets/un/tail_icon_dynamic.png new file mode 100644 index 0000000..8f8b1c9 Binary files /dev/null and b/assets/un/tail_icon_dynamic.png differ diff --git a/assets/un/tail_icon_main.png b/assets/un/tail_icon_main.png new file mode 100644 index 0000000..1212e36 Binary files /dev/null and b/assets/un/tail_icon_main.png differ diff --git a/assets/un/tail_icon_myself.png b/assets/un/tail_icon_myself.png new file mode 100644 index 0000000..99e9d09 Binary files /dev/null and b/assets/un/tail_icon_myself.png differ diff --git a/assets/un/tail_icon_pub_btn_bg.png b/assets/un/tail_icon_pub_btn_bg.png new file mode 100644 index 0000000..8f8b1c9 Binary files /dev/null and b/assets/un/tail_icon_pub_btn_bg.png differ diff --git a/assets/un/tail_icon_selected_channel.png b/assets/un/tail_icon_selected_channel.png new file mode 100644 index 0000000..61953ac Binary files /dev/null and b/assets/un/tail_icon_selected_channel.png differ diff --git a/assets/un/tail_icon_selected_dynamic.png b/assets/un/tail_icon_selected_dynamic.png new file mode 100644 index 0000000..d941185 Binary files /dev/null and b/assets/un/tail_icon_selected_dynamic.png differ diff --git a/assets/un/tail_icon_selected_main.png b/assets/un/tail_icon_selected_main.png new file mode 100644 index 0000000..4466daa Binary files /dev/null and b/assets/un/tail_icon_selected_main.png differ diff --git a/assets/un/tail_icon_selected_myself.png b/assets/un/tail_icon_selected_myself.png new file mode 100644 index 0000000..08711e0 Binary files /dev/null and b/assets/un/tail_icon_selected_myself.png differ diff --git a/assets/un/tail_icon_selected_pub_btn_bg.png b/assets/un/tail_icon_selected_pub_btn_bg.png new file mode 100644 index 0000000..d941185 Binary files /dev/null and b/assets/un/tail_icon_selected_pub_btn_bg.png differ diff --git a/assets/un/tail_icon_selected_shop.png b/assets/un/tail_icon_selected_shop.png new file mode 100644 index 0000000..f5d4b10 Binary files /dev/null and b/assets/un/tail_icon_selected_shop.png differ diff --git a/assets/un/tail_icon_shop.png b/assets/un/tail_icon_shop.png new file mode 100644 index 0000000..2a3d18a Binary files /dev/null and b/assets/un/tail_icon_shop.png differ diff --git a/assets/wan/head_bg.jpg b/assets/wan/head_bg.jpg new file mode 100644 index 0000000..b41bca7 Binary files /dev/null and b/assets/wan/head_bg.jpg differ diff --git a/assets/wan/head_myself_mp4_bg.mp4 b/assets/wan/head_myself_mp4_bg.mp4 new file mode 100644 index 0000000..a2a0df9 Binary files /dev/null and b/assets/wan/head_myself_mp4_bg.mp4 differ diff --git a/assets/wan/head_myself_squared_bg.png b/assets/wan/head_myself_squared_bg.png new file mode 100644 index 0000000..aceef96 Binary files /dev/null and b/assets/wan/head_myself_squared_bg.png differ diff --git a/assets/wan/head_tab_bg.jpg b/assets/wan/head_tab_bg.jpg new file mode 100644 index 0000000..15d2bd0 Binary files /dev/null and b/assets/wan/head_tab_bg.jpg differ diff --git a/assets/wan/tail_bg.png b/assets/wan/tail_bg.png new file mode 100644 index 0000000..a09bcab Binary files /dev/null and b/assets/wan/tail_bg.png differ diff --git a/assets/wan/tail_icon_channel.png b/assets/wan/tail_icon_channel.png new file mode 100644 index 0000000..dc18c2b Binary files /dev/null and b/assets/wan/tail_icon_channel.png differ diff --git a/assets/wan/tail_icon_dynamic.png b/assets/wan/tail_icon_dynamic.png new file mode 100644 index 0000000..494724c Binary files /dev/null and b/assets/wan/tail_icon_dynamic.png differ diff --git a/assets/wan/tail_icon_main.png b/assets/wan/tail_icon_main.png new file mode 100644 index 0000000..3be9103 Binary files /dev/null and b/assets/wan/tail_icon_main.png differ diff --git a/assets/wan/tail_icon_myself.png b/assets/wan/tail_icon_myself.png new file mode 100644 index 0000000..65a159e Binary files /dev/null and b/assets/wan/tail_icon_myself.png differ diff --git a/assets/wan/tail_icon_pub_btn_bg.png b/assets/wan/tail_icon_pub_btn_bg.png new file mode 100644 index 0000000..494724c Binary files /dev/null and b/assets/wan/tail_icon_pub_btn_bg.png differ diff --git a/assets/wan/tail_icon_selected_channel.png b/assets/wan/tail_icon_selected_channel.png new file mode 100644 index 0000000..d3d8cb9 Binary files /dev/null and b/assets/wan/tail_icon_selected_channel.png differ diff --git a/assets/wan/tail_icon_selected_dynamic.png b/assets/wan/tail_icon_selected_dynamic.png new file mode 100644 index 0000000..1b38e8a Binary files /dev/null and b/assets/wan/tail_icon_selected_dynamic.png differ diff --git a/assets/wan/tail_icon_selected_main.png b/assets/wan/tail_icon_selected_main.png new file mode 100644 index 0000000..8f8e7af Binary files /dev/null and b/assets/wan/tail_icon_selected_main.png differ diff --git a/assets/wan/tail_icon_selected_myself.png b/assets/wan/tail_icon_selected_myself.png new file mode 100644 index 0000000..5db4089 Binary files /dev/null and b/assets/wan/tail_icon_selected_myself.png differ diff --git a/assets/wan/tail_icon_selected_pub_btn_bg.png b/assets/wan/tail_icon_selected_pub_btn_bg.png new file mode 100644 index 0000000..1b38e8a Binary files /dev/null and b/assets/wan/tail_icon_selected_pub_btn_bg.png differ diff --git a/assets/wan/tail_icon_selected_shop.png b/assets/wan/tail_icon_selected_shop.png new file mode 100644 index 0000000..92c48e9 Binary files /dev/null and b/assets/wan/tail_icon_selected_shop.png differ diff --git a/assets/wan/tail_icon_shop.png b/assets/wan/tail_icon_shop.png new file mode 100644 index 0000000..a9fae4e Binary files /dev/null and b/assets/wan/tail_icon_shop.png differ diff --git a/assets/zao/head_bg.jpg b/assets/zao/head_bg.jpg new file mode 100644 index 0000000..4910412 Binary files /dev/null and b/assets/zao/head_bg.jpg differ diff --git a/assets/zao/head_myself_mp4_bg.mp4 b/assets/zao/head_myself_mp4_bg.mp4 new file mode 100644 index 0000000..7e0a3b2 Binary files /dev/null and b/assets/zao/head_myself_mp4_bg.mp4 differ diff --git a/assets/zao/head_myself_squared_bg.png b/assets/zao/head_myself_squared_bg.png new file mode 100644 index 0000000..ea127ca Binary files /dev/null and b/assets/zao/head_myself_squared_bg.png differ diff --git a/assets/zao/head_tab_bg.jpg b/assets/zao/head_tab_bg.jpg new file mode 100644 index 0000000..e0214d5 Binary files /dev/null and b/assets/zao/head_tab_bg.jpg differ diff --git a/assets/zao/tail_bg.png b/assets/zao/tail_bg.png new file mode 100644 index 0000000..d1d36b1 Binary files /dev/null and b/assets/zao/tail_bg.png differ diff --git a/assets/zao/tail_icon_channel.png b/assets/zao/tail_icon_channel.png new file mode 100644 index 0000000..47ca3df Binary files /dev/null and b/assets/zao/tail_icon_channel.png differ diff --git a/assets/zao/tail_icon_dynamic.png b/assets/zao/tail_icon_dynamic.png new file mode 100644 index 0000000..e6db36d Binary files /dev/null and b/assets/zao/tail_icon_dynamic.png differ diff --git a/assets/zao/tail_icon_main.png b/assets/zao/tail_icon_main.png new file mode 100644 index 0000000..ad8f95e Binary files /dev/null and b/assets/zao/tail_icon_main.png differ diff --git a/assets/zao/tail_icon_myself.png b/assets/zao/tail_icon_myself.png new file mode 100644 index 0000000..95efd94 Binary files /dev/null and b/assets/zao/tail_icon_myself.png differ diff --git a/assets/zao/tail_icon_pub_btn_bg.png b/assets/zao/tail_icon_pub_btn_bg.png new file mode 100644 index 0000000..e6db36d Binary files /dev/null and b/assets/zao/tail_icon_pub_btn_bg.png differ diff --git a/assets/zao/tail_icon_selected_channel.png b/assets/zao/tail_icon_selected_channel.png new file mode 100644 index 0000000..ccce7ef Binary files /dev/null and b/assets/zao/tail_icon_selected_channel.png differ diff --git a/assets/zao/tail_icon_selected_dynamic.png b/assets/zao/tail_icon_selected_dynamic.png new file mode 100644 index 0000000..9f3fc54 Binary files /dev/null and b/assets/zao/tail_icon_selected_dynamic.png differ diff --git a/assets/zao/tail_icon_selected_main.png b/assets/zao/tail_icon_selected_main.png new file mode 100644 index 0000000..02f7a3e Binary files /dev/null and b/assets/zao/tail_icon_selected_main.png differ diff --git a/assets/zao/tail_icon_selected_myself.png b/assets/zao/tail_icon_selected_myself.png new file mode 100644 index 0000000..3183c88 Binary files /dev/null and b/assets/zao/tail_icon_selected_myself.png differ diff --git a/assets/zao/tail_icon_selected_pub_btn_bg.png b/assets/zao/tail_icon_selected_pub_btn_bg.png new file mode 100644 index 0000000..9f3fc54 Binary files /dev/null and b/assets/zao/tail_icon_selected_pub_btn_bg.png differ diff --git a/assets/zao/tail_icon_selected_shop.png b/assets/zao/tail_icon_selected_shop.png new file mode 100644 index 0000000..a879990 Binary files /dev/null and b/assets/zao/tail_icon_selected_shop.png differ diff --git a/assets/zao/tail_icon_shop.png b/assets/zao/tail_icon_shop.png new file mode 100644 index 0000000..6245abe Binary files /dev/null and b/assets/zao/tail_icon_shop.png differ diff --git a/jsons/cacheConfig.json b/jsons/cacheConfig.json new file mode 100644 index 0000000..b80d247 --- /dev/null +++ b/jsons/cacheConfig.json @@ -0,0 +1,5 @@ +{ + "enable":true, + "maxAge":1000, + "maxCount":100 +} diff --git a/jsons/profile.json b/jsons/profile.json deleted file mode 100644 index 017b5ff..0000000 --- a/jsons/profile.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "theme": "zao", - "cache": "$cacheConfig", - "lastLogin": "", - "locale": "" -} diff --git a/jsons/video.json b/jsons/video.json new file mode 100644 index 0000000..375abc5 --- /dev/null +++ b/jsons/video.json @@ -0,0 +1,27 @@ +{ + "bvid": "String", + "aid": 0, + "name": "String", + "mid": 0, + "face": "String", + "tid": 0, + "tname": "String", + "copyright": 0, + "title": "String", + "desc": "String", + "pic": "String", + "tag": "String", + "pubdate": 0, + "duration": "String", + "view": 0, + "danmaku": 0, + "reply": 0, + "favorite": 0, + "coin": 0, + "share": 0, + "like": 0, + "score": 0, + "status": 0, + "created_at": 0, + "updated_at": 0 +} diff --git a/jsons/videos.json b/jsons/videos.json new file mode 100644 index 0000000..4920a75 --- /dev/null +++ b/jsons/videos.json @@ -0,0 +1,5 @@ +{ + "page": 0, + "numResults": 0, + "result": "$[]video" +} diff --git a/lib/common/Api.dart b/lib/common/Api.dart new file mode 100644 index 0000000..61a9ef8 --- /dev/null +++ b/lib/common/Api.dart @@ -0,0 +1,53 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:eoe_fans/models/videos.dart'; +import 'package:eoe_fans/models/iResponse.dart'; +import 'package:eoe_fans/models/videosRequest.dart'; +import 'package:flutter/cupertino.dart'; + +import 'Global.dart'; + +class Api { + Api([this.context]); + + BuildContext? context; + + static String key = '7e013c02952c41078c18ab26f639f02e'; + + // Options _options; + static Dio dio = + Dio(BaseOptions(baseUrl: 'https://api.eoe.best/eoefans-api/v1', headers: { + 'ocp-apim-subscription-key': key, + 'Content-Type': 'application/json', + })); + + static void init() { + //添加缓存插件 + dio.interceptors.add(Global.netCache); + //设置用户token(null,为未登录) + // dio.options.headers[HttpHeaders.authorizationHeader] = Global.profile.token; + } + + Future videos(VideosRequest params) async { + var paramsData = ({...params.toJson(), 'subscription-key': key}); + paramsData.removeWhere((key, value) => value == null); + print(paramsData); + var r = await dio.get('/video-interface/advanced-search', + queryParameters: paramsData); + var tmpVideos = Videos() + ..page = 0 + ..numResults = 0 + ..result = []; + if (r.statusCode == 200) { + var videoRes = + IResponse.fromJson(r.data, (json) => Videos.fromJson(json)); + print(videoRes.data?.page); + print(videoRes.data?.numResults); + if (videoRes.data != null) { + tmpVideos = videoRes.data!; + } + } + return tmpVideos; + } +} diff --git a/lib/common/CacheObject.dart b/lib/common/CacheObject.dart index ebd4dfb..57f8466 100644 --- a/lib/common/CacheObject.dart +++ b/lib/common/CacheObject.dart @@ -78,9 +78,9 @@ class NetCache extends Interceptor { ResponseInterceptorHandler handler, ) async { // 如果启用缓存,将返回结果保存到缓存 - if (Global.profile.cache.enable) { - _saveCache(response); - } + // if (Global.profile.cache.enable) { + // _saveCache(response); + // } } _saveCache(Response object) { diff --git a/lib/common/Global.dart b/lib/common/Global.dart index 2f8c457..95e2339 100644 --- a/lib/common/Global.dart +++ b/lib/common/Global.dart @@ -1,5 +1,7 @@ import 'dart:convert'; +import 'package:eoe_fans/models/eoeTheme.dart'; +import 'package:eoe_fans/models/memberMap.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -7,38 +9,84 @@ import '../models/cacheConfig.dart'; import '../models/profile.dart'; import 'CacheObject.dart'; -const Map myPink = { - 50: Color.fromRGBO(251, 114, 153, .1), - 100: Color.fromRGBO(251, 114, 153, .2), - 200: Color.fromRGBO(251, 114, 153, .3), - 300: Color.fromRGBO(251, 114, 153, .4), - 400: Color.fromRGBO(251, 114, 153, .5), - 500: Color.fromRGBO(251, 114, 153, .6), - 600: Color.fromRGBO(251, 114, 153, .7), - 700: Color.fromRGBO(251, 114, 153, .8), - 800: Color.fromRGBO(251, 114, 153, .9), - 900: Color.fromRGBO(251, 114, 153, 1), -}; - -const MaterialColor pink = MaterialColor(0xFFFB7299, myPink); - -const _themes = [ - pink, - Colors.blue, - Colors.yellow, - Colors.orange, - Colors.purple, +const _themes = [ + { + 'id': 'zao', + 'name': 'zao', + 'assetsPath': 'zao', + }, + { + 'id': 'wan', + 'name': 'wan', + 'assetsPath': 'zao', + }, + { + 'id': 'mo', + 'name': 'mo', + 'assetsPath': 'zao', + }, + { + 'id': 'un', + 'name': 'un', + 'assetsPath': 'zao', + }, + { + 'id': 'mi', + 'name': 'mi', + 'assetsPath': 'zao', + } ]; +const Map membersJson = { + 'zao': { + 'lastName': '白', + 'firstName': '露早', + 'bilibiliName': '露早GOGO', + 'bilibiliUID': 1669777785, + 'nickNames': ['早早'], + }, + 'wan': { + 'lastName': '唐', + 'firstName': '莞儿', + 'bilibiliName': '莞儿睡不醒', + 'bilibiliUID': 1875044092, + 'nickNames': [''], + }, + 'mo': { + 'lastName': '苏', + 'firstName': '虞莫', + 'bilibiliName': '虞莫MOMO', + 'bilibiliUID': 1811071010, + 'nickNames': ['莫莫'], + }, + 'un': { + 'lastName': '姜', + 'firstName': '柚恩', + 'bilibiliName': '柚恩不加糖', + 'bilibiliUID': 1795147802, + 'nickNames': ['柚柚'], + }, + 'mi': { + 'lastName': '安', + 'firstName': '米诺', + 'bilibiliName': '米诺高分少女', + 'bilibiliUID': 1778026586, + 'nickNames': ['大米'], + } +}; + class Global { static late SharedPreferences _prefs; static Profile profile = Profile(); + static MemberMap members = MemberMap.fromJson(membersJson); //网络缓存对象 static NetCache netCache = NetCache(); + static String currentTheme = 'zao'; + //可选主题列表 - static List get themes => _themes; + static List get themes => _themes.map((e) => EoeTheme.fromJson(e)).toList(); //是否为release版 static bool get isRelease => bool.fromEnvironment("dart.vm.product"); diff --git a/lib/common/Time.dart b/lib/common/Time.dart new file mode 100644 index 0000000..e78d422 --- /dev/null +++ b/lib/common/Time.dart @@ -0,0 +1,12 @@ +String SecondToDate(num seconds) { + var h = seconds ~/ 3600; + var m = seconds ~/ 60 % 60; + var s = seconds % 60; + var res = ''; + if (h != 0) { + res += '$h:'; + } + res += '$m:'; + res += s.toString(); + return res; +} diff --git a/lib/main.dart b/lib/main.dart index 1196e38..36292ce 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,19 +1,22 @@ import 'dart:io'; -import 'package:eoe_fans/states/ProfileChangeNotifier.dart'; +import 'package:eoe_fans/routes/mainPage.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:eoe_fans/states/ProfileChangeNotifier.dart'; import 'package:provider/provider.dart'; +import 'common/Global.dart'; + void main() { WidgetsFlutterBinding.ensureInitialized(); - if (Platform.isAndroid) { - // 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。 - SystemUiOverlayStyle systemUiOverlayStyle = - SystemUiOverlayStyle(statusBarColor: Colors.transparent); - SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); - } - runApp(MyApp()); + // if (Platform.isAndroid) { + // // 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。 + // SystemUiOverlayStyle systemUiOverlayStyle = + // SystemUiOverlayStyle(statusBarColor: Colors.transparent); + // SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); + // } + Global.init().then((e) => runApp(MyApp())); } class MyApp extends StatelessWidget { @@ -25,13 +28,15 @@ class MyApp extends StatelessWidget { ], child: Consumer( builder: (BuildContext context, themeModel, Widget? child) { - const theme = ThemeData(); - const app = MaterialApp( - theme: theme, - initialRoute: "/", - routes: {}, - ); - return app; + return MaterialApp( + initialRoute: '/', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + routes: { + '/': (BuildContext context) => MainPage(), + }, + ); })); } } diff --git a/lib/models/cacheConfig.dart b/lib/models/cacheConfig.dart index 943d3c1..3bdecba 100644 --- a/lib/models/cacheConfig.dart +++ b/lib/models/cacheConfig.dart @@ -4,12 +4,12 @@ part 'cacheConfig.g.dart'; @JsonSerializable() class CacheConfig { - CacheConfig({this.enable, this.maxAge, this.maxCount}); - - bool? enable; - num? maxAge; - num? maxCount; + CacheConfig(); + late bool enable; + late num maxAge; + late num maxCount; + factory CacheConfig.fromJson(Map json) => _$CacheConfigFromJson(json); Map toJson() => _$CacheConfigToJson(this); } diff --git a/lib/models/cacheConfig.g.dart b/lib/models/cacheConfig.g.dart index cbddbaa..4cdb3fe 100644 --- a/lib/models/cacheConfig.g.dart +++ b/lib/models/cacheConfig.g.dart @@ -6,11 +6,10 @@ part of 'cacheConfig.dart'; // JsonSerializableGenerator // ************************************************************************** -CacheConfig _$CacheConfigFromJson(Map json) => CacheConfig( - enable: json['enable'] as bool?, - maxAge: json['maxAge'] as num?, - maxCount: json['maxCount'] as num?, - ); +CacheConfig _$CacheConfigFromJson(Map json) => CacheConfig() + ..enable = json['enable'] as bool + ..maxAge = json['maxAge'] as num + ..maxCount = json['maxCount'] as num; Map _$CacheConfigToJson(CacheConfig instance) => { diff --git a/lib/models/eoeTheme.dart b/lib/models/eoeTheme.dart new file mode 100644 index 0000000..c2c3646 --- /dev/null +++ b/lib/models/eoeTheme.dart @@ -0,0 +1,17 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'eoeTheme.g.dart'; + +@JsonSerializable() +class EoeTheme { + EoeTheme({required this.id, required this.name, required this.assetsPath}); + + String id; + String name; + String assetsPath; + + factory EoeTheme.fromJson(Map json) => + _$EoeThemeFromJson(json); + + Map toJson() => _$EoeThemeToJson(this); +} diff --git a/lib/models/eoeTheme.g.dart b/lib/models/eoeTheme.g.dart new file mode 100644 index 0000000..2289000 --- /dev/null +++ b/lib/models/eoeTheme.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'eoeTheme.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +EoeTheme _$EoeThemeFromJson(Map json) => EoeTheme( + id: json['id'] as String, + name: json['name'] as String, + assetsPath: json['assetsPath'] as String, + ); + +Map _$EoeThemeToJson(EoeTheme instance) => { + 'id': instance.id, + 'name': instance.name, + 'assetsPath': instance.assetsPath, + }; diff --git a/lib/models/iResponse.dart b/lib/models/iResponse.dart new file mode 100644 index 0000000..86b40c7 --- /dev/null +++ b/lib/models/iResponse.dart @@ -0,0 +1,31 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'iResponse.g.dart'; + +enum IResponseCode { + @JsonValue(0) + OK, + @JsonValue(400) + ParamError, + @JsonValue(4001) + NeedLogin, +} + +@JsonSerializable(genericArgumentFactories: true) +class IResponse { + IResponse(); + + late IResponseCode code; + late String message; + late num ttl; + T? data; + + factory IResponse.fromJson( + Map json, + T Function(dynamic json) fromJsonT, + ) => + _$IResponseFromJson(json, fromJsonT); + + Map toJson(Object? Function(T value) toJsonT) => + _$IResponseToJson(this, toJsonT); +} diff --git a/lib/models/iResponse.g.dart b/lib/models/iResponse.g.dart new file mode 100644 index 0000000..101a906 --- /dev/null +++ b/lib/models/iResponse.g.dart @@ -0,0 +1,46 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'iResponse.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +IResponse _$IResponseFromJson( + Map json, + T Function(Object? json) fromJsonT, +) => + IResponse() + ..code = $enumDecode(_$IResponseCodeEnumMap, json['code']) + ..message = json['message'] as String + ..ttl = json['ttl'] as num + ..data = _$nullableGenericFromJson(json['data'], fromJsonT); + +Map _$IResponseToJson( + IResponse instance, + Object? Function(T value) toJsonT, +) => + { + 'code': _$IResponseCodeEnumMap[instance.code]!, + 'message': instance.message, + 'ttl': instance.ttl, + 'data': _$nullableGenericToJson(instance.data, toJsonT), + }; + +const _$IResponseCodeEnumMap = { + IResponseCode.OK: 0, + IResponseCode.ParamError: 400, + IResponseCode.NeedLogin: 4001, +}; + +T? _$nullableGenericFromJson( + Object? input, + T Function(Object? json) fromJson, +) => + input == null ? null : fromJson(input); + +Object? _$nullableGenericToJson( + T? input, + Object? Function(T value) toJson, +) => + input == null ? null : toJson(input); diff --git a/lib/models/index.dart b/lib/models/index.dart new file mode 100644 index 0000000..038914a --- /dev/null +++ b/lib/models/index.dart @@ -0,0 +1,3 @@ +export 'cacheConfig.dart' ; +export 'video.dart' ; +export 'videos.dart' ; diff --git a/lib/models/member.dart b/lib/models/member.dart index 76d0744..046a3c8 100644 --- a/lib/models/member.dart +++ b/lib/models/member.dart @@ -10,7 +10,7 @@ class Member { String lastName; String firstName; String bilibiliName; - String bilibiliUID; + num bilibiliUID; List nickNames; factory Member.fromJson(Map json) => _$MemberFromJson(json); diff --git a/lib/models/member.g.dart b/lib/models/member.g.dart index b5fde94..282332c 100644 --- a/lib/models/member.g.dart +++ b/lib/models/member.g.dart @@ -10,7 +10,7 @@ Member _$MemberFromJson(Map json) => Member( json['lastName'] as String, json['firstName'] as String, json['bilibiliName'] as String, - json['bilibiliUID'] as String, + json['bilibiliUID'] as num, (json['nickNames'] as List).map((e) => e as String).toList(), ); diff --git a/lib/models/profile.dart b/lib/models/profile.dart index 6a30d5c..4f23464 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -8,7 +8,6 @@ class Profile { Profile({ this.token, this.theme, - this.cache, this.lastLogin, this.locale, }); diff --git a/lib/models/profile.g.dart b/lib/models/profile.g.dart index 0b2077f..3b86d1c 100644 --- a/lib/models/profile.g.dart +++ b/lib/models/profile.g.dart @@ -9,12 +9,11 @@ part of 'profile.dart'; Profile _$ProfileFromJson(Map json) => Profile( token: json['token'] as String?, theme: json['theme'] as num?, - cache: json['cache'] == null - ? null - : CacheConfig.fromJson(json['cache'] as Map), lastLogin: json['lastLogin'] as String?, locale: json['locale'] as String?, - ); + )..cache = json['cache'] == null + ? null + : CacheConfig.fromJson(json['cache'] as Map); Map _$ProfileToJson(Profile instance) => { 'token': instance.token, diff --git a/lib/models/video.dart b/lib/models/video.dart new file mode 100644 index 0000000..ab89de4 --- /dev/null +++ b/lib/models/video.dart @@ -0,0 +1,37 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'video.g.dart'; + +@JsonSerializable() +class Video { + Video(); + + late String bvid; + late num aid; + late String name; + late num mid; + late String face; + late num tid; + late String tname; + late num copyright; + late String title; + late String desc; + late String pic; + late String tag; + late num pubdate; + late String duration; + late num view; + late num danmaku; + late num reply; + late num favorite; + late num coin; + late num share; + late num like; + late num score; + late num status; + late num created_at; + late num updated_at; + + factory Video.fromJson(Map json) => _$VideoFromJson(json); + Map toJson() => _$VideoToJson(this); +} diff --git a/lib/models/video.g.dart b/lib/models/video.g.dart new file mode 100644 index 0000000..a889211 --- /dev/null +++ b/lib/models/video.g.dart @@ -0,0 +1,62 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'video.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Video _$VideoFromJson(Map json) => Video() + ..bvid = json['bvid'] as String + ..aid = json['aid'] as num + ..name = json['name'] as String + ..mid = json['mid'] as num + ..face = json['face'] as String + ..tid = json['tid'] as num + ..tname = json['tname'] as String + ..copyright = json['copyright'] as num + ..title = json['title'] as String + ..desc = json['desc'] as String + ..pic = json['pic'] as String + ..tag = json['tag'] as String + ..pubdate = json['pubdate'] as num + ..duration = json['duration'] as String + ..view = json['view'] as num + ..danmaku = json['danmaku'] as num + ..reply = json['reply'] as num + ..favorite = json['favorite'] as num + ..coin = json['coin'] as num + ..share = json['share'] as num + ..like = json['like'] as num + ..score = json['score'] as num + ..status = json['status'] as num + ..created_at = json['created_at'] as num + ..updated_at = json['updated_at'] as num; + +Map _$VideoToJson(Video instance) => { + 'bvid': instance.bvid, + 'aid': instance.aid, + 'name': instance.name, + 'mid': instance.mid, + 'face': instance.face, + 'tid': instance.tid, + 'tname': instance.tname, + 'copyright': instance.copyright, + 'title': instance.title, + 'desc': instance.desc, + 'pic': instance.pic, + 'tag': instance.tag, + 'pubdate': instance.pubdate, + 'duration': instance.duration, + 'view': instance.view, + 'danmaku': instance.danmaku, + 'reply': instance.reply, + 'favorite': instance.favorite, + 'coin': instance.coin, + 'share': instance.share, + 'like': instance.like, + 'score': instance.score, + 'status': instance.status, + 'created_at': instance.created_at, + 'updated_at': instance.updated_at, + }; diff --git a/lib/models/videos.dart b/lib/models/videos.dart new file mode 100644 index 0000000..5e30ee8 --- /dev/null +++ b/lib/models/videos.dart @@ -0,0 +1,15 @@ +import 'package:json_annotation/json_annotation.dart'; +import "video.dart"; +part 'videos.g.dart'; + +@JsonSerializable() +class Videos { + Videos(); + + late num page; + late num numResults; + late List