1 Star 2 Fork 1

AriesHoo / flutter_readhub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

flutter_readhub

GitHub license

相关文章一:用Flutter给Readhub写一个App

相关文章二:Flutter版本Readhub开源

相关文章三:Flutter iOS真机调试及打包过程记录

相关文章四:Flutter iOS打包过程及构建上线审核通过流程总结

相关文章五:Freadhub终于升级Flutter2.0了

相关文章六:Freadhub Mac版它来了

该项目为Flutter实战项目,为Readhub非官方客户端。

数据来源于Readhub官方API接口。版权及最终解释权归Readhub官方所有,如有侵权请邮箱联系删除!

仅供学习使用,禁止商用

Stargazers over time

前言

Freadhub是由AriesHoo开发维护的一个Flutter开源项目--readhub的非官方产品。

之前Freadhub已有AndrodiOS版本,随着Flutter2.0的发布Flutter进入了全平台stable时代, 经过一段时间的平台及屏幕适配,MacOS版本它终于来了说得好像有人在期待一样😭

  • 镇楼图 1024*768 默认尺寸

Fredhub 链接
开源 Github flutter_readhub
开源 Gitee flutter_readhub
Android Freadhub
iOS clone自行运行或邮箱给下设备UUID
MacOS Gitee下载 共享盘下载

下载了 MacOS的压缩包解压后点击 图标 打开。

点击打开

出现 来自身份不明的开发者提示。依次系统偏好设置->安全性与隐私->通用中解锁并允许应用安装即可。

解锁运行

打开

Mac版本准备工作

1、获取MacOS代码

本着Flutter-Write Once Run Anywhere的原则,MacOS版本也在master分支未开新分支。

  • 有原始版本代码只需Update一下,然后flutter pub get一下即可。
  • 没有原始代码则可在GithubGiteeclone一下,然后flutter pub get一下即可。

2、开启MacOS支持

目前Flutter 2.0 Stable已支持MacOS,只需开启下MacOS支持即可。

  • 环境:Flutter SDK Flutter stable 2.0+
  • 开启MacOS支持:flutter config --enable-macos-desktop
  • 创建MacOS环境配置:flutter create --platforms=macos .
 % flutter --version
Flutter 2.2.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b22742018b (12 days ago) • 2021-05-14 19:12:57 -0700
Engine • revision a9d88a4d18
Tools • Dart 2.13.0

% flutter config --enable-macos-desktop
Setting "enable-macos-desktop" value to "true".

  % flutter create --platforms=macos .
Recreating project ....
  flutter_readhub_github.iml (created)
  macos/Runner.xcworkspace/contents.xcworkspacedata (created)
  macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created)
  macos/Flutter/Flutter-Debug.xcconfig (created)
  macos/Flutter/Flutter-Release.xcconfig (created)
  .idea/runConfigurations/main_dart.xml (created)
  .idea/libraries/KotlinJavaRuntime.xml (created)
Running "flutter pub get" in flutter_readhub_github...           1,078ms
Wrote 7 files.

All done!

3、基础配置-icon、name、网络等

  • 准备MacOS需要的各种尺寸icon,推荐使用 Image Asset Icon Resizer Lite 可以裁剪出各种尺寸的icon、launch image --包括AndroidiOSMacOS等。

生成icon

将生成的icon资源及配置文件拷贝到对应文件夹即可

macos icon配置

这里推荐文件名保持和Flutter默认生成的一致,可在Image Asset Icon Resizer Lite设置。如下图:

设置导出flieName

  • 设置App 信息:依次进入macos->Runner->Configs文件夹打开AppInfo.xcconfig编辑PRODUCT_NAME值,该值决定了App窗口标题名和程序坞鼠标悬浮提示文字以及关于页面信息;PRODUCT_COPYRIGHT决定了关于页面版权声明信息。如下图:

AppInfo.xcconfig

程序坞

关于信息

  • 网络配置:因涉及请求接口需在macos->Runner文件夹下的DebugProfile.entitlementsRelease.entitlements文件添加以下配置
    <key>com.apple.security.network.server</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>

网络配置

4、运行与打包

  • 执行命令:flutter run -d macos 或直接通过 Android Studio选择macOS(desktop)运行
 % flutter run -d macos
Launching lib/main.dart on macOS in debug mode...
Running pod install...                                           1,956ms

Android Studio运行

  • 执行命令:flutter build macos --release等待执行完成即可
% flutter build macos --release

💪 Building with sound null safety 💪

Running pod install...                                           1,709ms
  • 执行完成后,在build->macos->Build->Products->Release文件夹里可看到打包后的应用,直接双击打开即可。

打包后的app

Freadhub MacOS功能简介

1、主界面布局

  • 桌面端尺寸相较移动端更大如果采用移动端的底部/顶部tab模式会很丑,故在做MacOS适配过程中顺手做了下响应式布局--这里不做展开后期会单开文章阐述。
  • 使用GridView来让屏幕展示更多可用信息
  • 左侧顶部导航栏、底部为今日诗词推荐--使用今日诗词,在此感谢🙏、最底部仍然为更多信息深色/浅色主题切换按钮

宽屏:1280*800 最大尺寸

宽屏最大尺寸

窄屏:480*640 最小尺寸

窄屏

  • 这里设置widow 窗口大小用到了desktop_window插件-支持MacOSWindowsLinuxFreadhub 设置默认尺寸1024*768、最小尺寸480*640、最大尺寸1280*800

2、今日诗词

  • 因屏幕尺寸过大,左侧导航栏部分只有导航tab功能会显得很空故在tab底部增加今日诗词功能
  • 为保持适配一致性和美观性:宽屏模式显示诗词内容+匹配标签+切歌三部分内容;窄屏模式只显示诗词内容。--当然这里的美观性是个见仁见智的事情,大家轻喷。
  • 增加tooltip功能当鼠标悬浮或手指长按则显示更多信息 诗词标题+朝代作者+诗词全文+诗词翻译(如果有)

今日诗词tooltip

3、更多信息

  • 布局样式和移动端一致--开源地址显示了GithubGitee
  • 分享功能与移动端有差异--移动端弹出卡片分享移动端蒲公英下载链接;桌面端的跳转网页显示apkmacOS压缩包分享页面

更多信息

下载分享页面

4、资讯卡片

  • 资讯卡片背景样式优化-增加边框线区分不同资讯、鼠标悬浮/手指按下边界线及背景变为主题相关色

悬浮边框色变化

  • 修改点击事件-将原来点击事件资讯摘要信息全部展示变更为打开查看资讯详情热门话题详情直接跳转readhub网页详情

查看详情

该功能使用到了flutter_macos_webview插件

  • 去掉热门话题相关推荐icon变更为分享icon-原长按弹出分享卡片不变

分享

该功能使用到了share_plus插件

5、其它功能

啥也不说了,都在代码里了, GithubGitee。欢迎拍砖 扔鸡蛋

总结

1、就着这次适配MacOS过程,鄙人感觉Flutter确实很香!在UI层面确实在各个平台上的复用率在90%以上。但是确实需要根据不同的平台特性做调整:如在桌面系统使用移动端的顶部/底部导航就很别扭。

2、 平台相关插件除开移动端的其它平台确实要走的路还很漫长。--所以未来会有插件工程师这个专门工种?

3、桌面系统能多窗口就更好了。--Android是单Activity的模式的,iOS也是类似的。这种模式在移动端的没啥问题,毕竟设备就那么大点。但是桌面系统普遍较大,所有页面跳转都在同一个窗口就感觉差点意思。也许是支持的只是我不知道?--有知道的大佬万望不吝赐教,感谢🙏!

4、Flutter仍然是未来跨平台的最佳选择 没有之一

结语

该App为笔者学习Flutter练手开发的 ,权当抛砖引玉了,万望各位不吝赐教

关于我

掘金: AriesHoo

简书: AriesHoo

GitHub: AriesHoo

Email: AriesHoo@126.com

License

Copyright 2019-2021 Aries Hoo

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

Flutter版本Readhub非官方客户端 展开 收起
Dart 等 6 种语言
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Dart
1
https://gitee.com/AriesHoo/flutter_readhub.git
git@gitee.com:AriesHoo/flutter_readhub.git
AriesHoo
flutter_readhub
flutter_readhub
master

搜索帮助