diff --git a/README.md b/README.md index 8c7794d..2e6c77b 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,8 @@ VPN->代理->分流, 这三个功能如果同时设置, 您会在您手机的VPN - [安装hover(go-flutter编译脚手架)](https://github.com/go-flutter-desktop/hover) ```shell GO111MODULE=on go get -u -a github.com/go-flutter-desktop/hover + # 或 + go install github.com/go-flutter-desktop/hover@latest ``` - 安装gcc ```shell @@ -139,11 +141,11 @@ VPN->代理->分流, 这三个功能如果同时设置, 您会在您手机的VPN - [安装gomobile](https://github.com/golang/mobile) ```shell go install golang.org/x/mobile/cmd/gomobile@latest - go get golang.org/x/mobile/cmd/gobind ``` - 执行编译命令 (bind-android.sh/bind-ios.sh根据平台选择, $system替换为apk/ipa等) ```shell cd go/mobile + go get golang.org/x/mobile/cmd/gobind sh bind-ios.sh sh bind-android.sh cd ../../ diff --git a/go/cmd/options.go b/go/cmd/options.go index 533688e..6923d08 100644 --- a/go/cmd/options.go +++ b/go/cmd/options.go @@ -74,8 +74,10 @@ func (p *Plugin) InitPlugin(messenger plugin.BinaryMessenger) error { func (p *Plugin) InitPluginGLFW(window *glfw.Window) error { window.SetSizeCallback(func(w *glfw.Window, width int, height int) { - properties.SaveProperty("window_width", strconv.Itoa(width)) - properties.SaveProperty("window_height", strconv.Itoa(height)) + go func() { + properties.SaveProperty("window_width", strconv.Itoa(width)) + properties.SaveProperty("window_height", strconv.Itoa(height)) + }() }) return nil } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 24b1049..34bde7c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -25,4 +25,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/lib/screens/DownloadListScreen.dart b/lib/screens/DownloadListScreen.dart index 6fb9a66..2856a8b 100644 --- a/lib/screens/DownloadListScreen.dart +++ b/lib/screens/DownloadListScreen.dart @@ -68,20 +68,18 @@ class _DownloadListScreenState extends State { future: _f, builder: (BuildContext context, AsyncSnapshot> snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return ContentLoading(label: '加载中'); + } + if (snapshot.hasError) { print("${snapshot.error}"); print("${snapshot.stackTrace}"); return Center(child: Text('加载失败')); } - if (snapshot.connectionState != ConnectionState.done) { - return ContentLoading(label: '加载中'); - } - var data = snapshot.data!; - if (_downloading != null) { - print(_downloading); try { for (var i = 0; i < data.length; i++) { if (_downloading!.id == data[i].id) { @@ -94,46 +92,53 @@ class _DownloadListScreenState extends State { } } - return ListView( - children: [ - ...data.map( - (e) => InkWell( - onTap: () { - if (e.deleting) { - return; - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => DownloadInfoScreen( - comicId: e.id, - comicTitle: e.title, - ), - ), - ); - }, - onLongPress: () async { - String? action = - await chooseListDialog(context, e.title, ['删除']); - if (action == '删除') { - await method.deleteDownloadComic(e.id); - setState(() => e.deleting = true); - } - }, - child: DownloadInfoCard( - task: e, - downloading: - _downloading != null && _downloading!.id == e.id, - ), - ), - ), - ], + return RefreshIndicator( + onRefresh: () async { + setState(() { + _f = method.allDownloads(); + }); + }, + child: ListView( + children: [ + ...data.map(downloadWidget), + ], + ), ); }, ), ); } + Widget downloadWidget(DownloadComic e) { + return InkWell( + onTap: () { + if (e.deleting) { + return; + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DownloadInfoScreen( + comicId: e.id, + comicTitle: e.title, + ), + ), + ); + }, + onLongPress: () async { + String? action = await chooseListDialog(context, e.title, ['删除']); + if (action == '删除') { + await method.deleteDownloadComic(e.id); + setState(() => e.deleting = true); + } + }, + child: DownloadInfoCard( + task: e, + downloading: _downloading != null && _downloading!.id == e.id, + ), + ); + } + Widget importButton() { return MaterialButton( minWidth: 0,