├── .gitignore
├── .metadata
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── toly1994
│ │ │ └── toly
│ │ │ ├── MainActivity.java
│ │ │ └── app
│ │ │ └── Cons.java
│ │ └── res
│ │ ├── drawable
│ │ └── launch_background.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── iconfont
├── icon_by_toly.dart
├── iconfont.css
└── iconfont.ttf
├── images
├── compass.png
├── icon_90.png
├── icon_gql.jpg
├── wy_200x300.jpg
└── wy_300x200.jpg
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── main.m
├── lib
├── helper
│ ├── color_utils.dart
│ ├── common_path.dart
│ ├── day2
│ │ └── cons.dart
│ ├── help_view.dart
│ ├── io_utils.dart
│ └── layout_utils.dart
├── iconfont.dart
├── main.dart
├── pager
│ ├── day1
│ │ └── first_home_pager.dart
│ ├── day2
│ │ ├── anima_pager.dart
│ │ ├── clock_pager.dart
│ │ └── run_ball_pager.dart
│ ├── day3
│ │ ├── 2_layout.dart
│ │ └── 6_card.dart
│ ├── day4
│ │ ├── bs_sk_pager.dart
│ │ ├── flex.dart
│ │ ├── item.dart
│ │ └── res_load.dart
│ ├── day5
│ │ ├── canvas_pager.dart
│ │ ├── layout_test.dart
│ │ └── op.dart
│ ├── day6
│ │ ├── io_test.dart
│ │ └── list_file_pager.dart
│ └── day7
│ │ ├── android_stack.dart
│ │ ├── bean.dart
│ │ ├── cons.dart
│ │ ├── data_fetcher.dart
│ │ ├── home_list.dart
│ │ ├── left_draw.dart
│ │ └── plg
│ │ ├── shape.dart
│ │ └── test.dart
└── view
│ ├── day1
│ └── star_view.dart
│ ├── day2
│ ├── anima_view.dart
│ ├── clock_view.dart
│ └── run_ball_view.dart
│ └── day5
│ └── canvas_draw.dart
├── pubspec.yaml
├── test
├── base
│ ├── 1_圆周长.dart
│ ├── 2_列表.dart
│ ├── 3_映射表.dart
│ ├── 4_dynamic.dart
│ ├── 5_other.dart
│ ├── 6_fun.dart
│ ├── 7_class
│ │ └── person.dart
│ ├── 8_io.dart
│ └── 9_net.dart
└── widget_test.dart
└── tran.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.lock
4 | *.log
5 | *.pyc
6 | *.swp
7 | .DS_Store
8 | .atom/
9 | .buildlog/
10 | .history
11 | .svn/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # Visual Studio Code related
20 | .vscode/
21 |
22 | # Flutter/Dart/Pub related
23 | **/doc/api/
24 | .dart_tool/
25 | .flutter-plugins
26 | .packages
27 | .pub-cache/
28 | .pub/
29 | build/
30 |
31 | # Android related
32 | **/android/**/gradle-wrapper.jar
33 | **/android/.gradle
34 | **/android/captures/
35 | **/android/gradlew
36 | **/android/gradlew.bat
37 | **/android/local.properties
38 | **/android/**/GeneratedPluginRegistrant.java
39 |
40 | # iOS/XCode related
41 | **/ios/**/*.mode1v3
42 | **/ios/**/*.mode2v3
43 | **/ios/**/*.moved-aside
44 | **/ios/**/*.pbxuser
45 | **/ios/**/*.perspectivev3
46 | **/ios/**/*sync/
47 | **/ios/**/.sconsign.dblite
48 | **/ios/**/.tags*
49 | **/ios/**/.vagrant/
50 | **/ios/**/DerivedData/
51 | **/ios/**/Icon?
52 | **/ios/**/Pods/
53 | **/ios/**/.symlinks/
54 | **/ios/**/profile
55 | **/ios/**/xcuserdata
56 | **/ios/.generated/
57 | **/ios/Flutter/App.framework
58 | **/ios/Flutter/Flutter.framework
59 | **/ios/Flutter/Generated.xcconfig
60 | **/ios/Flutter/app.flx
61 | **/ios/Flutter/app.zip
62 | **/ios/Flutter/flutter_assets/
63 | **/ios/ServiceDefinitions.json
64 | **/ios/Runner/GeneratedPluginRegistrant.*
65 |
66 | # Exceptions to above rules.
67 | !**/ios/**/default.mode1v3
68 | !**/ios/**/default.mode2v3
69 | !**/ios/**/default.pbxuser
70 | !**/ios/**/default.perspectivev3
71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
72 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
8 | channel: beta
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #### `多看星空方知何谓渺小,多看细胞方知何谓浩大,我是巨人,也是沙粒,崇高并谦卑着----张风捷特烈`
2 |
3 | ---
4 |
5 | ##### 写这个系列主要是出于以下目的:
6 |
7 | ```
8 | 1.给自己一个挑战,并附加时间限制
9 | 2.一直想要表达一下:遇到新技术时的态度,借此分析一下我对于一件新事物认知的过程
10 | 3.Flutter对于Android开发者,确实需要去稍微了解一下
11 | 4.作为一个地道的javaer+Androider,希望可以为想入坑Flutter的朋友铺条小路
12 | 5.整个7篇文章贯穿着我学习的心+思,基本上敲一段测试代码,写一段文章。对我的学习方式也是一种记录与沉淀
13 | ```
14 |
15 | ---
16 |
17 | ##### 七篇文章如下:
18 |
19 | - [Flutter第1天--初始分析+Dart方言+Canvas简绘](https://juejin.im/post/5c1637fe6fb9a049d5196438)
20 | - [Flutter第2天--Animation动画+粒子运动](https://juejin.im/post/5c176700f265da61602cd6ff)
21 | - [Flutter第3天--基础控件(上)](https://juejin.im/post/5c18d181f265da611f07a128)
22 | - [Flutter第4天--基础控件(下)+Flex布局详解](https://juejin.im/post/5c1a34f95188253ff1477cfd)
23 | - [Flutter第5天--布局实例+操作交互](https://juejin.im/post/5c1b7af2518825566d237655)
24 | - [Flutter第6天--异步-IO+网络访问+json](https://juejin.im/post/5c1cd2426fb9a049a711cb75)
25 | - [Flutter第7天--字体图标+综合小案例+Android代码交互](https://juejin.im/post/5c1df995e51d451611220186)
26 |
27 |
28 | ---
29 |
30 | ##### 下面是一边学习一边画出来的widget树
31 | >虽然离完整版还差一大半,不过入门还是够用了,常用的基本涉及
32 | 当你这些用熟练了,其他控件看看属性也就无师自通了(推荐看原图,比较清楚)
33 |
34 | 
35 | ---
36 |
37 | ##### 第一天及体悟:
38 |
39 | ```
40 | Flutter的环境搭建并没走多少弯路,网上教程一大堆。
41 | 新建了一个工程,发现代码有点不对劲,虽然知道Flutter是跨平台框架,
42 | 但是代码在哪写?不应该有个单独的src吗?以前玩过libgdx,认为应该差不多
43 | 然后全文搜索一下界面上的字,找到在lib包的main.dart里
44 | ```
45 |
46 | ---
47 |
48 | ```
49 | 我要在lib里写代码?不会这么奇葩吧?然后我用面向对象的天眼看了一下main.dart
50 | 正如第一篇的分析,果然这么奇葩。而且语法与Java,c++,Python,Js都不一样,
51 | 好吧,又要学方言了,自从JS的Es6玩转了以后,我就不怕语言了,
52 | Kotlin也好,Python也好,这些性格"不羁"一些的和ES6都八九不离十
53 | 只要语法通了,之后就是个人能力的问题了,所以Dart入门很快,半天就基本掌握了
54 | 想要熟练,那还必须去实际操练才行
55 | ```
56 |
57 | ---
58 |
59 | ###### [番外]:分享一些心情-------------
60 |
61 | ```
62 | 我经常把编程当做锻剑,我一直在精炼Java这把剑,用Android这把剑鞘盛放
63 | Python也好,C++也好,Js也好我只是玩玩,都被我当做光环对Java之剑进行附加
64 | 至今在Android中我遇三次瓶颈期,我选择暂时离开Android,去拓展一下视野,
65 | 死磕已经作用不大了,记得第二次瓶颈是被网络束缚地无法前进一步,
66 | 于是一咬牙,暂停安卓,去专门找后端的书和资料去看,也因此萌生了搭建自己网站的念头
67 | 然后前后并行,两大光环加持,也上线了我的个人网站,两端的基础知识已基本在心中。
68 | ```
69 |
70 | ---
71 |
72 |
73 | ```
74 | 由于个人网站的搭建,我对服务端有了些认识,网络请求与上传下载也都知道是怎么回事
75 | 也有了测试的渠道,如果一个对前后端毫不知情的Androider,肯定会卡网络瓶颈上
76 | 数据流的概念初步形成,在我的眼中,界面的展示、上传下载、网络上的一切都是字节的流动
77 | 然后重归Android之时,前后端已经像一条线贯穿了,Android顺利和服务器交互时,第二瓶颈已过
78 | 有种"断剑重铸之日,骑士归来之时的感觉",具体细节,打算写个2018年终总结来记录一下
79 | ```
80 | ###### [番外]:截止-------------
81 |
82 |
83 | ```
84 | 如何很快地接收一件新事物(新知识)? 用你最擅长的技术去对接新知识,
85 | 比如你是个天文迷,如果你想学英语,去看天文方面的读物会更有利,
86 | 因为你有这方面的知识储备,即使知识储备是中文又如何?难道英文的地球能出太阳系?
87 | 语言和知识本就是两码事,语言表述知识并不会更改知识本身。
88 | 所以知识对接上,两种语言之间的交错,会让你更快接受语言的本身,也能强化知识
89 | ```
90 |
91 | ---
92 |
93 | ```
94 | 所以我并没有一开始就上控件,而是基于我最熟悉的Canvas来绘图,熟悉Dart语法,否则后面工作不好开展,
95 | 在Android中Canvas的丰富知识储备让我很好的与Flutter中的Canvas对接,这一棋自认为不错
96 | 对接之后,以前画网格,坐标系,n角星的东西又能拿出来秀了,旧知识转化成新知识
97 | 通过Java代码更改成Dart代码,也让我更清楚了两者的异同点,以后把握起来就轻松写
98 | ```
99 |
100 | >总的来说第一天还是蛮轻松好玩的。
101 |
102 | ---
103 |
104 | ##### 第二天及体悟:
105 |
106 | ```
107 | 第二天可以说是兵行险招,本打算把基础控件说一下的(依稀听过Flutter的控件超级多)
108 | 但第一天图画好之后,非常想玩动画,如果放在后面,感觉不连贯
109 | 然而并没有把握把动画写好,毕竟才更接触一天而已。挑战一下呗,然后就玩动画了
110 | ```
111 |
112 |
113 | ```
114 | 第二天可以说是这七天里我感觉最成功的,动画+粒子运动全都复刻到Flutter上了
115 | 粒子时钟完成后,挺激动的,然后就拿去分(xian)享(bai),心想,Flutter还是不错的嘛
116 | 这绝对是Flutter的第一个粒子时钟(除了我,也许没有人会这么无聊做这种特效)
117 | ```
118 |
119 |
120 | ```
121 | 看上去第二天的文章好像一气呵成,其实也遇到了些阻碍,
122 | dart的时间处理和三维数组和Java有些出入,还有就是时钟的粒子运动,
123 | 差一点就放弃了,因为效果总是出不来。心想,搞出个时钟就算了吧,不也挺好嘛。
124 | 可是真的很不甘心,都到这步了。然后输出小球集合的个数、第一个小球的位置,
125 | 数据好好的啊,可为什么出不来效果……最后发现小球半径没有设置……出来才有鬼呢
126 | ```
127 |
128 |
129 |
130 | ```
131 | 有人问我有没有什么心得,心得这东西说出来都懂,做起来却不简单,
132 | 如果你觉得一个人的学习方式很好,你应该去观察他,然后取长补短。
133 | 每个人的境遇都是不同的,别人的学习方法不一定适合你,你没有必要和别人一样。
134 | 比如我大学喜欢写诗,然后通读各大名著,不断思考世界,如果你没有这些基础,
135 | 我的心得就不一定适合你。每个人的价值观也是不同的,我是更倾向提升自我境界的那种人,
136 | 物质并不多求。心得这东西,别人的都是废话,需要的话,网上鸡汤自己挑,
137 | 一般人豪言壮语,大多只是自欺欺人。最近看到八个字挺实在:"生死看淡,不服就干"。
138 | ```
139 |
140 | >总的来说第二天收获颇丰。
141 |
142 | ---
143 |
144 | ##### 第三、四天及体悟:
145 |
146 | ```
147 | 第三天基础控件,感觉应该很枯燥,所以我尽可能让它变得有趣
148 | 我喜欢画体系的树状图,因为这样看起来很清晰,也助于整理思路
149 | 我喜欢卡片,源于游戏王,对于繁多的事物,感觉用卡片记录一下比较有趣
150 | ```
151 |
152 |
153 | ---
154 |
155 | ```
156 | 第三天源码翻得比较多,基本上是进去看控件属性,代码测试
157 | 通过Android和html+css的布局经验,基本上套路都是那回事
158 | 而且Flutter的Flex布局和css的flex布局不谋而合,所以入手容易很多
159 | 遇到margin的时候,有点感触,写了点看到新东西的态度:
160 |
161 | 新事物往往都与旧事物有联系,学习新事物最好快速找到它与你知识库中旧事物的联系,
162 | 联系的多少取决于你知识库中内容的多少,连接得越多,你会越快或越能掌握旧事物
163 | ```
164 |
165 | ---
166 |
167 | ```
168 | 本以为第四天可以把剩余的控件讲完,再写几个小案例呢,万万没想到:
169 | Flutter的布局如此之多,再加上卡了一点小壳,只勉强把控件了结(实际上还有很多未涉及)
170 | Flutter里面29种叠合模式也是吓到我了,也借此分析了一下这种多情况的分析方式
171 | 第三天把我的激情燃烧殆尽,第四天,三个控件一组,一共六组18张,没那么多花哨
172 | 最后将Flex布局详细说明了一下
173 | ```
174 |
175 | ---
176 |
177 |
178 | ```
179 | 这两天难度不是很大,就是有点麻烦,画图,配卡什么的,
180 | 只是敲代码的估计一天就够了,不过那样会及其无聊,不是我想要的
181 | 第四天写到最后其实还是有不少控件没涉及到呢,但感觉也就那回事
182 | 认识一个控件可就那点套路,属性基本上也就那些,遇到新的看看也就明白了
183 | 没有必要全部列出来,这就是"鱼与渔"的区别吧,鱼是抓不完的,你也放不下
184 | ```
185 |
186 | ---
187 |
188 |
189 | ```
190 | 两条源码翻得比较勤,有点小感悟:
191 |
192 | 有问题就去解决,即使牵涉出十个新问题,你就想象成问题栈,
193 | 有问题就进栈,解决了就出栈,这样不会乱,你可见的就是栈顶而已,
194 | 一个一个来,这样会相对于11个问题摆在你面前更容易接受。
195 | 至于什么时候stackover(栈溢出)就看你的决心和耐力了。
196 | 当然新手感觉hold不住时,可以深呼吸,咬一下牙坚持一下。
197 | 还是不行的话,记录下问题,果断退出。也许你现在等级不够,
198 | 这个boss你打不过,那就去刷怪升级吧。短剑重铸之日,骑士归来之时。
199 | 现在回头来看以前困扰我的问题,其实也并没有什么,这样你才能感觉成长
200 | ```
201 |
202 | >总的来说第三、四天挺苦闷,但也是必经之路
203 |
204 | ---
205 |
206 | ##### 第五、六、七天及体悟:
207 |
208 | ```
209 | 经过前四天,基本上语法、控件也就熟悉了,接下来统一说一下:
210 | 第五天可以说非常有料,网上很少有详细分析Flutter怎么布局的
211 | 中文网的例子有点小复杂,我打算循序渐进地由简到难进行陈述
212 | 首先是最简单的条目入手一步步递进成掘金的条目,
213 | 交互操作看似很多,其实常用的也就那几个,操作也是widget这点非常有趣
214 |
215 | ```
216 |
217 | ```
218 | 第六天Dart的io,以及网络和json的处理,这是一门语言的基础
219 | Java和Python还有node的io有所接触,所以dart这方面并不麻烦
220 | 但一在Flutter上,路径不好拿,背景是跨平台,还好有三根救命稻草:`path_provider`
221 | 然后是权限问题,当然也有相应的依赖库`simple_permissions`,
222 | 网络库用起来比较简单,基本上和前端的网络库操作一致
223 | ```
224 |
225 |
226 | ```
227 | 第七天是前六天的知识整合,并扫一下其他小的知识点
228 | Flutter与安卓的原生交互让我感觉它还是蛮好的,虽然有点麻烦
229 | 不过要跨平台,只与Android交互只是有半壁江山,ios那块就不好办了
230 | 虽说Flutter可以跨平台,但如果要玩得转,需要一个人兼具Android和ios
231 | 这样算来,这个跨平台代价还是有的,你也许会说,有插件包啊
232 | 但是插件包只能解决一部分问题,各种业务千差万别,如果只靠插件包,有点牵强
233 | 毕竟有些逻辑上的小修小补,具体问题框架无能为力,只能"凑合用"
234 | Flutter是一个很好的UI框架,但可操作性,略有不足
235 | ```
236 |
237 | ---
238 |
239 | ##### 结束语
240 |
241 | ```
242 | React玩的好的人入手Flutter可以说会轻松很多,因为思想非常相似
243 | 任何人都会有不足,不可能对这个世界全识全知,也就是"术业有专攻"
244 | 但并不意味这要闭关锁国,排斥外物。程序员读读诗,看看史也没有什么不可
245 | 多看星空方知何谓渺小,多看细胞方知何谓浩大,你是巨人也是沙,崇高并谦卑着
246 | 程序源于对这个世界的认知,何为境界,你眼中所视之物,究竟为何?
247 | 学无止境,不要飘,脚踏实地,一步一印,殊途同归,新即远方,思之将至。
248 | ```
249 |
250 | ---
251 |
252 | ##### 最后插播一段感悟:我经常思考工具与使用者间的关系:
253 |
254 |
255 | ```
256 | `用工具`和`会用工具`之差异:[良庖岁更刀,割也;族庖月更刀,折也],
257 | 工具的使用方法体现了一位`工匠`的技艺
258 |
259 | 《庖丁解牛》是我最喜欢的一篇古文,如何在做任何事上:
260 | [以无厚入有间,恢恢乎其于游刃必有余地矣]是我的思考
261 |
262 | 文中的八字成为我接触新事物的律典:[依乎天理,因其固然]。
263 | 通其理,方用之,是`匠者`与`匠师`的差异
264 |
265 | 如果你不懂牛的构造原理,拿一把屠刀固然可杀牛取肉,
266 | 但庖丁的[以神遇而不以目视,官知止而神欲行]
267 | [提刀而立,为之四顾,为之踌躇满志,善刀而藏之]感觉也就与你无缘,
268 | 而这是一位匠者的自豪。
269 |
270 | 写一个程序就像打造一件艺术品,制造的过程便是`解牛`,
271 | IDE、API、运行环境就是我手中的剑
272 |
273 | 普通屠夫遇牛则斩,好肉坏肉在一起切,煮成一大杂烩。
274 | 庖丁的匠心独运是我追求的境界:
275 | [吾生也有涯,而知也无涯,以有涯随无涯] 愿君且行且珍惜。
276 | ```
277 |
278 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 27
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.toly1994.toly"
37 | minSdkVersion 16
38 | targetSdkVersion 27
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | }
62 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
17 |
21 |
28 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/toly1994/toly/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.toly1994.toly;
2 |
3 | import android.os.Bundle;
4 | import android.widget.Toast;
5 |
6 | import java.security.MessageDigest;
7 | import java.security.NoSuchAlgorithmException;
8 |
9 | import io.flutter.app.FlutterActivity;
10 | import io.flutter.plugin.common.MethodCall;
11 | import io.flutter.plugin.common.MethodChannel;
12 | import io.flutter.plugins.GeneratedPluginRegistrant;
13 |
14 | public class MainActivity extends FlutterActivity {
15 | private static final String CHANNEL = "www.toly1994.com/test.名字随意起";
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | GeneratedPluginRegistrant.registerWith(this);
21 |
22 | new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(
23 | new MethodChannel.MethodCallHandler() {
24 | @Override
25 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
26 | if (methodCall.method.equals("showToast")) {
27 | //解析参数
28 | String msg = methodCall.argument("msg");
29 | showToast(msg);
30 | }
31 | if (methodCall.method.equals("getMD5")) {
32 | String arg = methodCall.argument("arg");
33 | String md5 = getMD5(arg);
34 | result.success(md5);
35 | } else {
36 | result.notImplemented();
37 | }
38 | }
39 | }
40 | );
41 | }
42 |
43 | /**
44 | * 显示吐司
45 | *
46 | * @param msg 信息
47 | */
48 | public void showToast(String msg) {
49 | Toast toast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);
50 | toast.show();
51 | }
52 |
53 |
54 | /**
55 | * 获取一个字符串的Md5值
56 | *
57 | * @param content 内容
58 | * @return Md5值
59 | */
60 | public String getMD5(String content) {
61 | content = content + "芝麻开门";
62 | try {
63 | MessageDigest digest = MessageDigest.getInstance("MD5");
64 | digest.update(content.getBytes());
65 | return getHashString(digest);
66 | } catch (NoSuchAlgorithmException e) {
67 | e.printStackTrace();
68 | }
69 | return null;
70 | }
71 |
72 | private static String getHashString(MessageDigest digest) {
73 | StringBuilder builder = new StringBuilder();
74 | for (byte b : digest.digest()) {
75 | builder.append(Integer.toHexString((b >> 4) & 0xf));
76 | builder.append(Integer.toHexString(b & 0xf));
77 | }
78 | return builder.toString();
79 | }
80 | }
81 |
82 |
83 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/toly1994/toly/app/Cons.java:
--------------------------------------------------------------------------------
1 | package com.toly1994.toly.app;
2 |
3 | /**
4 | * 作者:张风捷特烈
5 | * 时间:2018/12/22 0022:12:55
6 | * 邮箱:1981462002@qq.com
7 | * 说明:
8 | */
9 | public class Cons {
10 | public static final String CHANNEL = "www.toly1994.com/test.名字随意起";
11 | }
12 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.2.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/iconfont/icon_by_toly.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | main() {
4 | var result = """import 'package:flutter/widgets.dart';
5 | //Power By 张风捷特烈---
6 |
7 | class TolyIcon {
8 |
9 | TolyIcon._();
10 | """;
11 | var file = File.fromUri(Uri.parse("${Uri.base}iconfont./iconfont.css"));
12 | var read = file.readAsStringSync();
13 |
14 | var split = read.split(".icon-");
15 | split.forEach((str) {
16 | if (str.contains("before")) {
17 | var split = str.split(":");
18 | result += "static const IconData " +
19 | split[0].replaceAll("-", "_") +
20 | " = const IconData(" +
21 | split[2].replaceAll("\"\\", "0x").split("\"")[0] +
22 | ", fontFamily: \"TolyIcon\");\n";
23 | }
24 | });
25 | result+="}";
26 | var fileOut = File.fromUri(Uri.parse("${Uri.base}lib./iconfont.dart"));
27 | fileOut.writeAsStringSync(result);
28 | }
29 |
--------------------------------------------------------------------------------
/iconfont/iconfont.css:
--------------------------------------------------------------------------------
1 |
2 | @font-face {font-family: "iconfont";
3 | src: url('iconfont.eot?t=1545401070604'); /* IE9*/
4 | src: url('iconfont.eot?t=1545401070604#iefix') format('embedded-opentype'), /* IE6-IE8 */
5 | url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAuwAAsAAAAAETwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8d0juY21hcAAAAYAAAABvAAAByIE2hChnbHlmAAAB8AAAB5IAAAqsto3+4GhlYWQAAAmEAAAAMQAAADYUGGvZaGhlYQAACbgAAAAgAAAAJAhSA/pobXR4AAAJ2AAAABYAAAAYGHX//WxvY2EAAAnwAAAADgAAAA4KCAjCbWF4cAAACgAAAAAfAAAAIAEfAl1uYW1lAAAKIAAAAUUAAAJtPlT+fXBvc3QAAAtoAAAASAAAAFuYiEnNeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkEWacwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByeMT57ydzwv4EhhrmBoQEozAiSAwD0rgzgeJztkdEJgDAMRF9sFSmO4iTiDI7hlx9OG3AKTRoV3MErr/SOtIUEaIFkjEYG2RBcq6VS80SpeWYyP9DTkFW06KK7HucJX/dKrPpZ/pPdi1el49dQ9/l2rXcxqOcSWM/QJfD56B74zPQIkAuxPCBKAHicVVZLrBxHFe1b3fXpX1X/e7rn2zN+PdFz8gbP144/Dxs5thSwQkAoCzbYKFlESFjY3niBhRUUNkTC8YZFpAjBmkUko0g2yiYLJEBCYMTKMSwRnx0s8vpxq8exyat53VW3bt2699xTddswDfwzPyLfNHJjZlw0DJjWUwncZGmS5QPIz8AmXq+WNUw36+UM6rECxrMhZPl8H9bL6U6NwqmWJkPg+pGtcWK1JK8ILoKCXSPKpy4PCv49M2j+9c4d3xX+VD6wAdwPZRb5juuTKwD3lO473rtaQdby1zZZmAQgkM0fmVAdTkw9gKNcqKK5985P1FRy13vgh4n/oQTX8Wv5AcCvnnTfvSNx3oNWwTDUYXP4S/NT84LxJ6OBXTgOr8HrcAPeg9/Bn+Gv8A+SkHPkFYx/td5s22K+GMAQEINsaGVpwpkieZa3qGSfNRQjWgzb/70UtADhpCIoIXpiwqZ7GlvdtAbqadUpw/EemdYz0s6tlhuET8v0Y63fiO8+QYf2zdavfdja2Sy3o62QnIF9WGydaz0mwHSmtC9bhwdkMW+1t7rYQSMzqLRzQ6YdxljJ1h4mfetFPZ20WpRNJ23ALTJxfVSb3hrHrbLNvJW3EWhlnNMToAU7rSZ/qrCzBUmCxqAPCe7duj18tudOa/rZfk9c0l6t1tNlPaP19LNGB5Cwcb1cb7T6dpNq61iO9nbapat6xtpgcFfSJipv/UNgduot2BrUGUyehKX1WMq0zvopzPuQ67n1SZjnWpnA6Ei377hF6VnUjrgtXMthpomsJaZFLTvLozAYSt8TglJuIZlR6FkW84Tt+H44jgKFyhbFf9PCFV7gCOHLKHJzT/qBrCuqgkqNAjd3o0hKW1DBiC+EPhigd+FengU9f9glzOKOSXATwiS3XRXjBtGoolSYrS5YhOAk99E1W0QOdXignMRRAxVGJQNy9hyPkiRjvcovfMcToWKOTZlFKUZk6tMHGJtFDj41ud4fRRYK0ZpJXZ8pRxS57EshAjdLw8Aa9LvdFI6feJH5cUIpTRIhBi+8UA1HURhHqedFyWja7c32gqDqO46USW42v+fcFUHYKXzXSWP4mWN7GqxOnsQCsWmUrCeydG2JYVGTCM92AtvFUEdS+b50XelzSjaUuYEXSJdTLr2yo6SHSxjlxEKHLSKY8DmC5EkVZnnzaLpcXlos7geBQmxtMZs1D+udyLa5COMC7hAddhs9oRZ3uXCoz6PYL7xhzy7SUJX942XzGEjZl13fiWzOPdt3ETrLRNA1dIRw6jh5pyyDIMhyd+Imsdvtiv7ASTNBHsKwjCW1HDy2FmU+CwLXDzMpozhPuwHhNrN55DquBsH3BebFDkWAK6iLlBDcVpxSECLP8zgsi0h6nh0GzMKAKYbLhHDLkaX8wok4FRoGSqiJUKkoR3Ouo2QU5vkRC3eSIiocFxlt21LZPAkd4bhSoAfShmQ3C5GJrhMo5LRphso0NUk0xRBYKkLXUzk7+K9iUBbdDu/lDvqG/EaOm5QLyqnHIuGku0kYuvFolKVx6NnIa0IF1RzVzLJ9O/GYwOSVWY5nw6KlSYJOxijNO44H37WAdLujajfPxqO5XtPpHH8xicvOZGz9JYy6PQvjgyA8coQg2VIpAdlKu0Ucf2B5IVcYJnOpJyw8TL4UtocYISss+tx4VHSqcRxDGEyq7ng4CkJiUSSMzW0qheViEMSkHmZLM4Gy9s6w2RgWlzSPzna7RRknRcdFwlndMoqq0bTEbGTPZ44Teg53mENbTuAqZeddu+ynqWk67PtAOpkTaKLiUdVUQLxMQb3AdtJ0VKWIkYWcStNe4Y+9vCMJ8cvCNgz8Hd4y75m3DNPghmt4RmCERmKkxjGsaVXaNsg3Ux5zfAJ2NmHCJtW4XoXL9aLaVHgvhnghVnjNhiDAbv4DN5u34OTtu7fv/ru+Xd9u/vCDN/Pf9NNmN+31Unj7fLNYXQC4sIKHqwsErpy7fpFk139+4xfAdm/s3mj2jr32o05zIh30MnIn7X0ZNQ++s9Yr1qTEzw6GPj8w3zO/ZAyMqfEFY9+4ZLyJ3uobebOeHtvDEoGVZsyn9Rhr1LaaVTt7sFzPs4TlTzvoeZoMYH4GTmNx3Pn8MB7ASUhxuN6sFmmSZycBI1wt5utVWJnCSsfnp5awODm6+KK5P9/Fy42b9fkqRYZFzdsqSYZJ8tv2lf6tHEPQH/UDGB/Uz/qnIZYnYbyYwBt5mEJZwWmpDv5JTiz2LlZ7nGMu53E8JyZjs+ribEFfRoe0QXjyPgvj8lHQD8N+8AjNfm7UfEMVV8uqKq9e7cUSp652FPyw/Ww7PDy8ZV3HnOeIn/52M7GKVe3XW5LHT3IZr5ewPAPzAaY3w/V7sIp1scOCNtBlGEuvrqxtCTyjRyizXn+sTg+a/eGp4BOlPglODeGjwWn1WB3cdfMi8wC8rMjdvTfeHw9PvRofpdG556ojP371q98mcOx5SZNKfu3UsHof7sNb5QRgUjQ3uy+Vzc12UKLwJWB+5uOv+fuT98fk2uXL9/f9aE8tfvqVly+G8c2vH/9W5VY96uzfv3L52v8Arto9RwAAeJxjYGRgYADiZ6yhivH8Nl8ZuFkYQOCGs/A7GP3/3/8GllLmBiCXg4EJJAoAL3MLzAAAAHicY2BkYGBu+N/AEMNS8v/f//8spQxAERTABgC0ngdTeJxjYWBgYAHj//9YYOyS//8BIJkEiAAAAAAAAAB0A+QEPgTeBVYAAHicY2BkYGBgYwpk4GcAASYg5gJCBob/YD4DABJiAX8AeJxlj01OwzAQhV/6B6QSqqhgh+QFYgEo/RGrblhUavdddN+mTpsqiSPHrdQDcB6OwAk4AtyAO/BIJ5s2lsffvHljTwDc4Acejt8t95E9XDI7cg0XuBeuU38QbpBfhJto41W4Rf1N2MczpsJtdGF5g9e4YvaEd2EPHXwI13CNT+E69S/hBvlbuIk7/Aq30PHqwj7mXle4jUcv9sdWL5xeqeVBxaHJIpM5v4KZXu+Sha3S6pxrW8QmU4OgX0lTnWlb3VPs10PnIhVZk6oJqzpJjMqt2erQBRvn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicbcExDoAwCABAqKVNnPxIH0WLMZgIBvv/OLh6Bwk+K/wrmHDBjIQFK5CwXkyx85i566mVTcJVNh1u7blD7WjdfQK8XScPLQ==') format('woff'),
6 | url('iconfont.ttf?t=1545401070604') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7 | url('iconfont.svg?t=1545401070604#iconfont') format('svg'); /* iOS 4.1- */
8 | }
9 |
10 | .iconfont {
11 | font-family:"iconfont" !important;
12 | font-size:16px;
13 | font-style:normal;
14 | -webkit-font-smoothing: antialiased;
15 | -moz-osx-font-smoothing: grayscale;
16 | }
17 |
18 | .icon-daima:before { content: "\e6e9"; }
19 |
20 | .icon-react:before { content: "\e60a"; }
21 |
22 | .icon-biji:before { content: "\e680"; }
23 |
24 | .icon-android:before { content: "\e65e"; }
25 |
26 | .icon-icon-spring-boot:before { content: "\e601"; }
27 |
28 |
--------------------------------------------------------------------------------
/iconfont/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/iconfont/iconfont.ttf
--------------------------------------------------------------------------------
/images/compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/images/compass.png
--------------------------------------------------------------------------------
/images/icon_90.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/images/icon_90.png
--------------------------------------------------------------------------------
/images/icon_gql.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/images/icon_gql.jpg
--------------------------------------------------------------------------------
/images/wy_200x300.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/images/wy_200x300.jpg
--------------------------------------------------------------------------------
/images/wy_300x200.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/images/wy_300x200.jpg
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXCopyFilesBuildPhase section */
26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
27 | isa = PBXCopyFilesBuildPhase;
28 | buildActionMask = 2147483647;
29 | dstPath = "";
30 | dstSubfolderSpec = 10;
31 | files = (
32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
34 | );
35 | name = "Embed Frameworks";
36 | runOnlyForDeploymentPostprocessing = 0;
37 | };
38 | /* End PBXCopyFilesBuildPhase section */
39 |
40 | /* Begin PBXFileReference section */
41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
58 | /* End PBXFileReference section */
59 |
60 | /* Begin PBXFrameworksBuildPhase section */
61 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | /* End PBXFrameworksBuildPhase section */
71 |
72 | /* Begin PBXGroup section */
73 | 9740EEB11CF90186004384FC /* Flutter */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
77 | 3B80C3931E831B6300D905FE /* App.framework */,
78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
83 | );
84 | name = Flutter;
85 | sourceTree = "";
86 | };
87 | 97C146E51CF9000F007C117D = {
88 | isa = PBXGroup;
89 | children = (
90 | 9740EEB11CF90186004384FC /* Flutter */,
91 | 97C146F01CF9000F007C117D /* Runner */,
92 | 97C146EF1CF9000F007C117D /* Products */,
93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
94 | );
95 | sourceTree = "";
96 | };
97 | 97C146EF1CF9000F007C117D /* Products */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 97C146EE1CF9000F007C117D /* Runner.app */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 97C146F01CF9000F007C117D /* Runner */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
110 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
113 | 97C147021CF9000F007C117D /* Info.plist */,
114 | 97C146F11CF9000F007C117D /* Supporting Files */,
115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
117 | );
118 | path = Runner;
119 | sourceTree = "";
120 | };
121 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 97C146F21CF9000F007C117D /* main.m */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | /* End PBXGroup section */
130 |
131 | /* Begin PBXNativeTarget section */
132 | 97C146ED1CF9000F007C117D /* Runner */ = {
133 | isa = PBXNativeTarget;
134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
135 | buildPhases = (
136 | 9740EEB61CF901F6004384FC /* Run Script */,
137 | 97C146EA1CF9000F007C117D /* Sources */,
138 | 97C146EB1CF9000F007C117D /* Frameworks */,
139 | 97C146EC1CF9000F007C117D /* Resources */,
140 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142 | );
143 | buildRules = (
144 | );
145 | dependencies = (
146 | );
147 | name = Runner;
148 | productName = Runner;
149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
150 | productType = "com.apple.product-type.application";
151 | };
152 | /* End PBXNativeTarget section */
153 |
154 | /* Begin PBXProject section */
155 | 97C146E61CF9000F007C117D /* Project object */ = {
156 | isa = PBXProject;
157 | attributes = {
158 | LastUpgradeCheck = 0910;
159 | ORGANIZATIONNAME = "The Chromium Authors";
160 | TargetAttributes = {
161 | 97C146ED1CF9000F007C117D = {
162 | CreatedOnToolsVersion = 7.3.1;
163 | };
164 | };
165 | };
166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
167 | compatibilityVersion = "Xcode 3.2";
168 | developmentRegion = English;
169 | hasScannedForEncodings = 0;
170 | knownRegions = (
171 | en,
172 | Base,
173 | );
174 | mainGroup = 97C146E51CF9000F007C117D;
175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
176 | projectDirPath = "";
177 | projectRoot = "";
178 | targets = (
179 | 97C146ED1CF9000F007C117D /* Runner */,
180 | );
181 | };
182 | /* End PBXProject section */
183 |
184 | /* Begin PBXResourcesBuildPhase section */
185 | 97C146EC1CF9000F007C117D /* Resources */ = {
186 | isa = PBXResourcesBuildPhase;
187 | buildActionMask = 2147483647;
188 | files = (
189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | };
198 | /* End PBXResourcesBuildPhase section */
199 |
200 | /* Begin PBXShellScriptBuildPhase section */
201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
202 | isa = PBXShellScriptBuildPhase;
203 | buildActionMask = 2147483647;
204 | files = (
205 | );
206 | inputPaths = (
207 | );
208 | name = "Thin Binary";
209 | outputPaths = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | shellPath = /bin/sh;
213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
214 | };
215 | 9740EEB61CF901F6004384FC /* Run Script */ = {
216 | isa = PBXShellScriptBuildPhase;
217 | buildActionMask = 2147483647;
218 | files = (
219 | );
220 | inputPaths = (
221 | );
222 | name = "Run Script";
223 | outputPaths = (
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | shellPath = /bin/sh;
227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
228 | };
229 | /* End PBXShellScriptBuildPhase section */
230 |
231 | /* Begin PBXSourcesBuildPhase section */
232 | 97C146EA1CF9000F007C117D /* Sources */ = {
233 | isa = PBXSourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
237 | 97C146F31CF9000F007C117D /* main.m in Sources */,
238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXSourcesBuildPhase section */
243 |
244 | /* Begin PBXVariantGroup section */
245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
246 | isa = PBXVariantGroup;
247 | children = (
248 | 97C146FB1CF9000F007C117D /* Base */,
249 | );
250 | name = Main.storyboard;
251 | sourceTree = "";
252 | };
253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
254 | isa = PBXVariantGroup;
255 | children = (
256 | 97C147001CF9000F007C117D /* Base */,
257 | );
258 | name = LaunchScreen.storyboard;
259 | sourceTree = "";
260 | };
261 | /* End PBXVariantGroup section */
262 |
263 | /* Begin XCBuildConfiguration section */
264 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
265 | isa = XCBuildConfiguration;
266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
267 | buildSettings = {
268 | ALWAYS_SEARCH_USER_PATHS = NO;
269 | CLANG_ANALYZER_NONNULL = YES;
270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
271 | CLANG_CXX_LIBRARY = "libc++";
272 | CLANG_ENABLE_MODULES = YES;
273 | CLANG_ENABLE_OBJC_ARC = YES;
274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
275 | CLANG_WARN_BOOL_CONVERSION = YES;
276 | CLANG_WARN_COMMA = YES;
277 | CLANG_WARN_CONSTANT_CONVERSION = YES;
278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
279 | CLANG_WARN_EMPTY_BODY = YES;
280 | CLANG_WARN_ENUM_CONVERSION = YES;
281 | CLANG_WARN_INFINITE_RECURSION = YES;
282 | CLANG_WARN_INT_CONVERSION = YES;
283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
287 | CLANG_WARN_STRICT_PROTOTYPES = YES;
288 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
289 | CLANG_WARN_UNREACHABLE_CODE = YES;
290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
292 | COPY_PHASE_STRIP = NO;
293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
294 | ENABLE_NS_ASSERTIONS = NO;
295 | ENABLE_STRICT_OBJC_MSGSEND = YES;
296 | GCC_C_LANGUAGE_STANDARD = gnu99;
297 | GCC_NO_COMMON_BLOCKS = YES;
298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
300 | GCC_WARN_UNDECLARED_SELECTOR = YES;
301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
302 | GCC_WARN_UNUSED_FUNCTION = YES;
303 | GCC_WARN_UNUSED_VARIABLE = YES;
304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
305 | MTL_ENABLE_DEBUG_INFO = NO;
306 | SDKROOT = iphoneos;
307 | TARGETED_DEVICE_FAMILY = "1,2";
308 | VALIDATE_PRODUCT = YES;
309 | };
310 | name = Profile;
311 | };
312 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
313 | isa = XCBuildConfiguration;
314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
315 | buildSettings = {
316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
318 | DEVELOPMENT_TEAM = S8QB4VV633;
319 | ENABLE_BITCODE = NO;
320 | FRAMEWORK_SEARCH_PATHS = (
321 | "$(inherited)",
322 | "$(PROJECT_DIR)/Flutter",
323 | );
324 | INFOPLIST_FILE = Runner/Info.plist;
325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
326 | LIBRARY_SEARCH_PATHS = (
327 | "$(inherited)",
328 | "$(PROJECT_DIR)/Flutter",
329 | );
330 | PRODUCT_BUNDLE_IDENTIFIER = com.toly1994.toly;
331 | PRODUCT_NAME = "$(TARGET_NAME)";
332 | VERSIONING_SYSTEM = "apple-generic";
333 | };
334 | name = Profile;
335 | };
336 | 97C147031CF9000F007C117D /* Debug */ = {
337 | isa = XCBuildConfiguration;
338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
339 | buildSettings = {
340 | ALWAYS_SEARCH_USER_PATHS = NO;
341 | CLANG_ANALYZER_NONNULL = YES;
342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
343 | CLANG_CXX_LIBRARY = "libc++";
344 | CLANG_ENABLE_MODULES = YES;
345 | CLANG_ENABLE_OBJC_ARC = YES;
346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
347 | CLANG_WARN_BOOL_CONVERSION = YES;
348 | CLANG_WARN_COMMA = YES;
349 | CLANG_WARN_CONSTANT_CONVERSION = YES;
350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
351 | CLANG_WARN_EMPTY_BODY = YES;
352 | CLANG_WARN_ENUM_CONVERSION = YES;
353 | CLANG_WARN_INFINITE_RECURSION = YES;
354 | CLANG_WARN_INT_CONVERSION = YES;
355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
359 | CLANG_WARN_STRICT_PROTOTYPES = YES;
360 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
361 | CLANG_WARN_UNREACHABLE_CODE = YES;
362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
364 | COPY_PHASE_STRIP = NO;
365 | DEBUG_INFORMATION_FORMAT = dwarf;
366 | ENABLE_STRICT_OBJC_MSGSEND = YES;
367 | ENABLE_TESTABILITY = YES;
368 | GCC_C_LANGUAGE_STANDARD = gnu99;
369 | GCC_DYNAMIC_NO_PIC = NO;
370 | GCC_NO_COMMON_BLOCKS = YES;
371 | GCC_OPTIMIZATION_LEVEL = 0;
372 | GCC_PREPROCESSOR_DEFINITIONS = (
373 | "DEBUG=1",
374 | "$(inherited)",
375 | );
376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
378 | GCC_WARN_UNDECLARED_SELECTOR = YES;
379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
380 | GCC_WARN_UNUSED_FUNCTION = YES;
381 | GCC_WARN_UNUSED_VARIABLE = YES;
382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
383 | MTL_ENABLE_DEBUG_INFO = YES;
384 | ONLY_ACTIVE_ARCH = YES;
385 | SDKROOT = iphoneos;
386 | TARGETED_DEVICE_FAMILY = "1,2";
387 | };
388 | name = Debug;
389 | };
390 | 97C147041CF9000F007C117D /* Release */ = {
391 | isa = XCBuildConfiguration;
392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
393 | buildSettings = {
394 | ALWAYS_SEARCH_USER_PATHS = NO;
395 | CLANG_ANALYZER_NONNULL = YES;
396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
397 | CLANG_CXX_LIBRARY = "libc++";
398 | CLANG_ENABLE_MODULES = YES;
399 | CLANG_ENABLE_OBJC_ARC = YES;
400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
401 | CLANG_WARN_BOOL_CONVERSION = YES;
402 | CLANG_WARN_COMMA = YES;
403 | CLANG_WARN_CONSTANT_CONVERSION = YES;
404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
405 | CLANG_WARN_EMPTY_BODY = YES;
406 | CLANG_WARN_ENUM_CONVERSION = YES;
407 | CLANG_WARN_INFINITE_RECURSION = YES;
408 | CLANG_WARN_INT_CONVERSION = YES;
409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
413 | CLANG_WARN_STRICT_PROTOTYPES = YES;
414 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
415 | CLANG_WARN_UNREACHABLE_CODE = YES;
416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
418 | COPY_PHASE_STRIP = NO;
419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
420 | ENABLE_NS_ASSERTIONS = NO;
421 | ENABLE_STRICT_OBJC_MSGSEND = YES;
422 | GCC_C_LANGUAGE_STANDARD = gnu99;
423 | GCC_NO_COMMON_BLOCKS = YES;
424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
426 | GCC_WARN_UNDECLARED_SELECTOR = YES;
427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
428 | GCC_WARN_UNUSED_FUNCTION = YES;
429 | GCC_WARN_UNUSED_VARIABLE = YES;
430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
431 | MTL_ENABLE_DEBUG_INFO = NO;
432 | SDKROOT = iphoneos;
433 | TARGETED_DEVICE_FAMILY = "1,2";
434 | VALIDATE_PRODUCT = YES;
435 | };
436 | name = Release;
437 | };
438 | 97C147061CF9000F007C117D /* Debug */ = {
439 | isa = XCBuildConfiguration;
440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
441 | buildSettings = {
442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
444 | ENABLE_BITCODE = NO;
445 | FRAMEWORK_SEARCH_PATHS = (
446 | "$(inherited)",
447 | "$(PROJECT_DIR)/Flutter",
448 | );
449 | INFOPLIST_FILE = Runner/Info.plist;
450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
451 | LIBRARY_SEARCH_PATHS = (
452 | "$(inherited)",
453 | "$(PROJECT_DIR)/Flutter",
454 | );
455 | PRODUCT_BUNDLE_IDENTIFIER = com.toly1994.toly;
456 | PRODUCT_NAME = "$(TARGET_NAME)";
457 | VERSIONING_SYSTEM = "apple-generic";
458 | };
459 | name = Debug;
460 | };
461 | 97C147071CF9000F007C117D /* Release */ = {
462 | isa = XCBuildConfiguration;
463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
464 | buildSettings = {
465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
467 | ENABLE_BITCODE = NO;
468 | FRAMEWORK_SEARCH_PATHS = (
469 | "$(inherited)",
470 | "$(PROJECT_DIR)/Flutter",
471 | );
472 | INFOPLIST_FILE = Runner/Info.plist;
473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
474 | LIBRARY_SEARCH_PATHS = (
475 | "$(inherited)",
476 | "$(PROJECT_DIR)/Flutter",
477 | );
478 | PRODUCT_BUNDLE_IDENTIFIER = com.toly1994.toly;
479 | PRODUCT_NAME = "$(TARGET_NAME)";
480 | VERSIONING_SYSTEM = "apple-generic";
481 | };
482 | name = Release;
483 | };
484 | /* End XCBuildConfiguration section */
485 |
486 | /* Begin XCConfigurationList section */
487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
488 | isa = XCConfigurationList;
489 | buildConfigurations = (
490 | 97C147031CF9000F007C117D /* Debug */,
491 | 97C147041CF9000F007C117D /* Release */,
492 | 249021D3217E4FDB00AE95B9 /* Profile */,
493 | );
494 | defaultConfigurationIsVisible = 0;
495 | defaultConfigurationName = Release;
496 | };
497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
498 | isa = XCConfigurationList;
499 | buildConfigurations = (
500 | 97C147061CF9000F007C117D /* Debug */,
501 | 97C147071CF9000F007C117D /* Release */,
502 | 249021D4217E4FDB00AE95B9 /* Profile */,
503 | );
504 | defaultConfigurationIsVisible = 0;
505 | defaultConfigurationName = Release;
506 | };
507 | /* End XCConfigurationList section */
508 | };
509 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
510 | }
511 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | toly
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/lib/helper/color_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 | import 'dart:ui';
3 |
4 | Color randomRGB(){
5 | Random random = new Random();
6 | int r = 30 + random.nextInt(200);
7 | int g = 30 + random.nextInt(200);
8 | int b = 30 + random.nextInt(200);
9 | return Color.fromARGB(255, r, g, b);
10 | }
11 |
12 |
13 | Color randomARGB(){
14 | Random random = new Random();
15 | int r = 30 + random.nextInt(200);
16 | int g = 30 + random.nextInt(200);
17 | int b = 30 + random.nextInt(200);
18 | int a = 50 + random.nextInt(150);
19 | return Color.fromARGB(a, r, g, b);
20 | }
--------------------------------------------------------------------------------
/lib/helper/common_path.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 | import 'dart:ui';
3 |
4 | /**
5 | * n角星路径
6 | *
7 | * @param num 几角星
8 | * @param R 外接圆半径
9 | * @param r 内接圆半径
10 | * @return n角星路径
11 | */
12 | Path nStarPath(int num, double R, double r, {x = 0, y = 0}) {
13 | Path path = new Path();
14 | double perDeg = 360 / num; //尖角的度数
15 | double degA = perDeg / 2 / 2;
16 | double degB = 360 / (num - 1) / 2 - degA / 2 + degA;
17 |
18 | path.moveTo(cos(_rad(degA)) * R+x, (-sin(_rad(degA)) * R+y));
19 | for (int i = 0; i < num; i++) {
20 | path.lineTo(
21 | cos(_rad(degA + perDeg * i)) * R+x, -sin(_rad(degA + perDeg * i)) * R+y);
22 | path.lineTo(
23 | cos(_rad(degB + perDeg * i)) * r+x, -sin(_rad(degB + perDeg * i)) * r+y);
24 | }
25 | path.close();
26 | return path;
27 | }
28 |
29 | /**
30 | * 画正n角星的路径:
31 | *
32 | * @param num 角数
33 | * @param R 外接圆半径
34 | * @return 画正n角星的路径
35 | */
36 | Path regularStarPath(int num, double R,{x = 0, y = 0}) {
37 | double degA, degB;
38 | if (num % 2 == 1) {
39 | //奇数和偶数角区别对待
40 | degA = 360 / num / 2 / 2;
41 | degB = 180 - degA - 360 / num / 2;
42 | } else {
43 | degA = 360 / num / 2;
44 | degB = 180 - degA - 360 / num / 2;
45 | }
46 | double r = R * sin(_rad(degA)) / sin(_rad(degB));
47 | return nStarPath(num, R, r,x: x,y:y);
48 | }
49 |
50 | /**
51 | * 画正n边形的路径
52 | *
53 | * @param num 边数
54 | * @param R 外接圆半径
55 | * @return 画正n边形的路径
56 | */
57 | Path regularPolygonPath(int num, double R,{x = 0, y = 0}) {
58 | double r = R * cos(_rad(360 / num / 2)); //!!一点解决
59 | return nStarPath(num, R, r,x: x,y:y);
60 | }
61 |
62 | /**
63 | * 角度制化为弧度制
64 | *
65 | * @param deg 角度
66 | * @return 弧度
67 | */
68 | double _rad(double deg) {
69 | return deg * pi / 180;
70 | }
71 |
72 | /**
73 | * 绘制网格路径
74 | *
75 | * @param step 小正方形边长
76 | * @param winSize 屏幕尺寸
77 | */
78 | Path gridPath(Size winSize, int step) {
79 | Path path = new Path();
80 |
81 | for (int i = 0; i < winSize.height / step + 1; i++) {
82 | path.moveTo(0, step * i.toDouble());
83 | path.lineTo(winSize.width, step * i.toDouble());
84 | }
85 |
86 | for (int i = 0; i < winSize.width / step + 1; i++) {
87 | path.moveTo(step * i.toDouble(), 0);
88 | path.lineTo(step * i.toDouble(), winSize.height);
89 | }
90 | return path;
91 | }
92 |
93 | /**
94 | * 坐标系路径
95 | *
96 | * @param coo 坐标点
97 | * @param winSize 屏幕尺寸
98 | * @return 坐标系路径
99 | */
100 | Path cooPath(Size coo, Size winSize) {
101 | Path path = new Path();
102 | //x正半轴线
103 | path.moveTo(coo.width, coo.height);
104 | path.lineTo(winSize.width, coo.height);
105 | //x负半轴线
106 | path.moveTo(coo.width, coo.height);
107 | path.lineTo(coo.width - winSize.width, coo.height);
108 | //y负半轴线
109 | path.moveTo(coo.width, coo.height);
110 | path.lineTo(coo.width, coo.height - winSize.height);
111 | //y负半轴线
112 | path.moveTo(coo.width, coo.height);
113 | path.lineTo(coo.width, winSize.height);
114 | return path;
115 | }
116 |
--------------------------------------------------------------------------------
/lib/helper/day2/cons.dart:
--------------------------------------------------------------------------------
1 | //颜色常量
2 | import 'dart:ui';
3 |
4 | const colors = [
5 | Color(0x8833B5E5),
6 | Color(0x880099CC),
7 | Color(0x889933CC),
8 | Color(0x8899CC00),
9 | Color(0x88669900),
10 | Color(0x88FFBB33),
11 | Color(0x88FF8800),
12 | Color(0x88FF4444),
13 | Color(0x88CC0000)
14 | ];
15 |
16 | const digit = [
17 | [
18 | [0, 0, 1, 1, 1, 0, 0],
19 | [0, 1, 1, 0, 1, 1, 0],
20 | [1, 1, 0, 0, 0, 1, 1],
21 | [1, 1, 0, 0, 0, 1, 1],
22 | [1, 1, 0, 0, 0, 1, 1],
23 | [1, 1, 0, 0, 0, 1, 1],
24 | [1, 1, 0, 0, 0, 1, 1],
25 | [1, 1, 0, 0, 0, 1, 1],
26 | [0, 1, 1, 0, 1, 1, 0],
27 | [0, 0, 1, 1, 1, 0, 0]
28 | ], //0
29 |
30 | [
31 | [0, 0, 0, 1, 1, 0, 0],
32 | [0, 1, 1, 1, 1, 0, 0],
33 | [0, 0, 0, 1, 1, 0, 0],
34 | [0, 0, 0, 1, 1, 0, 0],
35 | [0, 0, 0, 1, 1, 0, 0],
36 | [0, 0, 0, 1, 1, 0, 0],
37 | [0, 0, 0, 1, 1, 0, 0],
38 | [0, 0, 0, 1, 1, 0, 0],
39 | [0, 0, 0, 1, 1, 0, 0],
40 | [1, 1, 1, 1, 1, 1, 1]
41 | ], //1
42 | [
43 | [0, 1, 1, 1, 1, 1, 0],
44 | [1, 1, 0, 0, 0, 1, 1],
45 | [0, 0, 0, 0, 0, 1, 1],
46 | [0, 0, 0, 0, 1, 1, 0],
47 | [0, 0, 0, 1, 1, 0, 0],
48 | [0, 0, 1, 1, 0, 0, 0],
49 | [0, 1, 1, 0, 0, 0, 0],
50 | [1, 1, 0, 0, 0, 0, 0],
51 | [1, 1, 0, 0, 0, 1, 1],
52 | [1, 1, 1, 1, 1, 1, 1]
53 | ], //2
54 | [
55 | [1, 1, 1, 1, 1, 1, 1],
56 | [0, 0, 0, 0, 0, 1, 1],
57 | [0, 0, 0, 0, 1, 1, 0],
58 | [0, 0, 0, 1, 1, 0, 0],
59 | [0, 0, 1, 1, 1, 0, 0],
60 | [0, 0, 0, 0, 1, 1, 0],
61 | [0, 0, 0, 0, 0, 1, 1],
62 | [0, 0, 0, 0, 0, 1, 1],
63 | [1, 1, 0, 0, 0, 1, 1],
64 | [0, 1, 1, 1, 1, 1, 0]
65 | ], //3
66 |
67 | [
68 | [0, 0, 0, 0, 1, 1, 0],
69 | [0, 0, 0, 1, 1, 1, 0],
70 | [0, 0, 1, 1, 1, 1, 0],
71 | [0, 1, 1, 0, 1, 1, 0],
72 | [1, 1, 0, 0, 1, 1, 0],
73 | [1, 1, 1, 1, 1, 1, 1],
74 | [0, 0, 0, 0, 1, 1, 0],
75 | [0, 0, 0, 0, 1, 1, 0],
76 | [0, 0, 0, 0, 1, 1, 0],
77 | [0, 0, 0, 1, 1, 1, 1]
78 | ], //4
79 | [
80 | [1, 1, 1, 1, 1, 1, 1],
81 | [1, 1, 0, 0, 0, 0, 0],
82 | [1, 1, 0, 0, 0, 0, 0],
83 | [1, 1, 1, 1, 1, 1, 0],
84 | [0, 0, 0, 0, 0, 1, 1],
85 | [0, 0, 0, 0, 0, 1, 1],
86 | [0, 0, 0, 0, 0, 1, 1],
87 | [0, 0, 0, 0, 0, 1, 1],
88 | [1, 1, 0, 0, 0, 1, 1],
89 | [0, 1, 1, 1, 1, 1, 0]
90 | ], //5
91 | [
92 | [0, 0, 0, 0, 1, 1, 0],
93 | [0, 0, 1, 1, 0, 0, 0],
94 | [0, 1, 1, 0, 0, 0, 0],
95 | [1, 1, 0, 0, 0, 0, 0],
96 | [1, 1, 0, 1, 1, 1, 0],
97 | [1, 1, 0, 0, 0, 1, 1],
98 | [1, 1, 0, 0, 0, 1, 1],
99 | [1, 1, 0, 0, 0, 1, 1],
100 | [1, 1, 0, 0, 0, 1, 1],
101 | [0, 1, 1, 1, 1, 1, 0]
102 | ], //6
103 | [
104 | [1, 1, 1, 1, 1, 1, 1],
105 | [1, 1, 0, 0, 0, 1, 1],
106 | [0, 0, 0, 0, 1, 1, 0],
107 | [0, 0, 0, 0, 1, 1, 0],
108 | [0, 0, 0, 1, 1, 0, 0],
109 | [0, 0, 0, 1, 1, 0, 0],
110 | [0, 0, 1, 1, 0, 0, 0],
111 | [0, 0, 1, 1, 0, 0, 0],
112 | [0, 0, 1, 1, 0, 0, 0],
113 | [0, 0, 1, 1, 0, 0, 0]
114 | ], //7
115 | [
116 | [0, 1, 1, 1, 1, 1, 0],
117 | [1, 1, 0, 0, 0, 1, 1],
118 | [1, 1, 0, 0, 0, 1, 1],
119 | [1, 1, 0, 0, 0, 1, 1],
120 | [0, 1, 1, 1, 1, 1, 0],
121 | [1, 1, 0, 0, 0, 1, 1],
122 | [1, 1, 0, 0, 0, 1, 1],
123 | [1, 1, 0, 0, 0, 1, 1],
124 | [1, 1, 0, 0, 0, 1, 1],
125 | [0, 1, 1, 1, 1, 1, 0]
126 | ], //8
127 | [
128 | [0, 1, 1, 1, 1, 1, 0],
129 | [1, 1, 0, 0, 0, 1, 1],
130 | [1, 1, 0, 0, 0, 1, 1],
131 | [1, 1, 0, 0, 0, 1, 1],
132 | [0, 1, 1, 1, 0, 1, 1],
133 | [0, 0, 0, 0, 0, 1, 1],
134 | [0, 0, 0, 0, 0, 1, 1],
135 | [0, 0, 0, 0, 1, 1, 0],
136 | [0, 0, 0, 1, 1, 0, 0],
137 | [0, 1, 1, 0, 0, 0, 0]
138 | ], //9
139 | [
140 | [0, 0, 0, 0],
141 | [0, 0, 0, 0],
142 | [0, 1, 1, 0],
143 | [0, 1, 1, 0],
144 | [0, 0, 0, 0],
145 | [0, 0, 0, 0],
146 | [0, 1, 1, 0],
147 | [0, 1, 1, 0],
148 | [0, 0, 0, 0],
149 | [0, 0, 0, 0]
150 | ] //:
151 | ];
152 |
--------------------------------------------------------------------------------
/lib/helper/help_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:toly/helper/common_path.dart';
4 |
5 | //绘制网格
6 | drawGrid(Canvas canvas, Size winSize, [int step = 20, int color = 0xff06BDF8]) {
7 | var paint = new Paint();
8 | paint.style = PaintingStyle.stroke;
9 | paint.color = Color(color);
10 | paint.isAntiAlias = true;
11 | canvas.drawPath(gridPath(winSize, step), paint);
12 | }
13 |
14 | //绘制坐标系
15 | drawCoo(Canvas canvas, Size coo, Size winSize) {
16 | //初始化网格画笔
17 | Paint paint = new Paint();
18 | paint.strokeWidth = 2;
19 | paint.style = PaintingStyle.stroke;
20 |
21 | //绘制直线
22 | canvas.drawPath(cooPath(coo, winSize), paint);
23 | //左箭头
24 | canvas.drawLine(new Offset(winSize.width, coo.height),
25 | new Offset(winSize.width - 10, coo.height - 6), paint);
26 | canvas.drawLine(new Offset(winSize.width, coo.height),
27 | new Offset(winSize.width - 10, coo.height + 6), paint);
28 | //下箭头
29 | canvas.drawLine(new Offset(coo.width, winSize.height-90),
30 | new Offset(coo.width - 6, winSize.height - 10-90), paint);
31 | canvas.drawLine(new Offset(coo.width, winSize.height-90),
32 | new Offset(coo.width + 6, winSize.height - 10-90), paint);
33 | }
34 |
--------------------------------------------------------------------------------
/lib/helper/io_utils.dart:
--------------------------------------------------------------------------------
1 | //根据名称读取文件
2 | import 'dart:io';
3 |
4 | readFile(name) async {
5 | //创建文件对象
6 | var file = File(name);
7 | try {
8 | //判断是否存在
9 | bool exists = await file.exists();
10 | if (exists) {
11 | //如果存在
12 | print(await file.length()); //文件大小(字节)---137
13 | print(await file.lastModified()); //最后修改时间---2018-12-21 13:49:35.000
14 | print(file.parent.path); //获取父文件夹的路径---C:\Users\Administrator\Desktop\dart
15 | return await file.readAsString(); //读取文件并返回
16 | } else {
17 | await file.create(recursive: true); //不存在则创建文件
18 | return "未发现文件,已为您创建!Dart机器人:2333";
19 | }
20 | } catch (e) {
21 | //异常处理
22 | print(e);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/helper/layout_utils.dart:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | //-----------------------------------------------------------------------------
3 |
4 | //正常文字
5 | import 'package:flutter/material.dart';
6 | import 'package:toly/helper/color_utils.dart';
7 |
8 | var commonStyle = TextStyle(color: Colors.black, fontSize: 18);
9 | var littelStyle = TextStyle(color: Colors.black, fontSize: 16);
10 | //灰色较小文字
11 | var infoStyle = TextStyle(color: Color(0xff999999), fontSize: 13);
12 | //较大文字
13 | var bigStyle =
14 | TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold);
15 | //btn文字
16 | var btnStyle = TextStyle(color: Color(0xffffffff), fontSize: 13);
17 |
18 | //-----------------------------------------------------------------------------
19 | //-----------------------------------辅助方法
20 | pd(Widget w, {double l, double t, double r, double b}) {
21 | return Padding(
22 | child: w,
23 | padding: EdgeInsets.fromLTRB(l ?? 0, t ?? 0, r ?? 0, b ?? 0),
24 | );
25 | }
26 |
27 | //全部padding
28 | pda(Widget w, double a) {
29 | return Padding(
30 | child: w,
31 | padding: EdgeInsets.all(a),
32 | );
33 | }
34 |
35 | //水平、竖直的两个padding
36 | pdhv(Widget w, {double h, double v}) {
37 | return Padding(
38 | child: w,
39 | padding: EdgeInsets.fromLTRB(h ?? 0, v ?? 0, h ?? 0, v ?? 0),
40 | );
41 | }
42 |
43 | bg(Widget w, [Color color]) {
44 | return Container(color: color ?? randomARGB(), child: w);
45 | }
--------------------------------------------------------------------------------
/lib/iconfont.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 | //Power By 张风捷特烈---
3 |
4 | class TolyIcon {
5 | TolyIcon._();
6 |
7 | static const IconData daima = const IconData(0xe6e9, fontFamily: "TolyIcon");
8 | static const IconData react = const IconData(0xe60a, fontFamily: "TolyIcon");
9 | static const IconData biji = const IconData(0xe680, fontFamily: "TolyIcon");
10 | static const IconData android =
11 | const IconData(0xe65e, fontFamily: "TolyIcon");
12 | static const IconData icon_spring_boot =
13 | const IconData(0xe601, fontFamily: "TolyIcon");
14 | }
15 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/pager/day2/clock_pager.dart';
3 | import 'package:toly/pager/day4/res_load.dart';
4 | import 'package:toly/pager/day5/canvas_pager.dart';
5 | import 'package:toly/pager/day5/op.dart';
6 | import 'package:toly/pager/day6/io_test.dart';
7 | import 'package:toly/pager/day6/list_file_pager.dart';
8 | import 'package:toly/pager/day7/android_stack.dart';
9 | import 'package:toly/pager/day7/plg/shape.dart';
10 | import 'package:toly/pager/day7/plg/test.dart';
11 |
12 | void main() => runApp(MyApp());
13 |
14 | class MyApp extends StatelessWidget {
15 | var scContext;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | // localPath();
20 |
21 | var scaffold = Scaffold(
22 | appBar: AppBar(
23 | title: Text("张风捷特烈"),
24 | bottom: tabBar,
25 | backgroundColor: Color(0xff54C5F8),
26 | centerTitle: true,
27 | toolbarOpacity: .4),
28 | body: Builder(builder: (context) {
29 | scContext = context;
30 |
31 | return card_shape;
32 | }),
33 | drawer: draw,
34 | bottomNavigationBar: bottomNavigationBar,
35 | floatingActionButton: FloatingActionButton(
36 | onPressed: () {
37 | Scaffold.of(scContext).showBottomSheet(bottomSheet.builder);
38 | // Navigator.pop(context);
39 | // Scaffold.of(scContext).showSnackBar(snackBar);
40 | },
41 | tooltip: 'Increment',
42 | child: Icon(Icons.add),
43 | ),
44 | );
45 |
46 | return MaterialApp(
47 | title: 'Flutter Demo',
48 | theme: ThemeData(
49 | primarySwatch: Colors.lightBlue,
50 | ),
51 | home: new DefaultTabController(child: scaffold, length: 4),
52 | // home: AndroidPage(),
53 | routes: {
54 | '/clock': (BuildContext context) => ClockPage(),
55 | },);
56 |
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/lib/pager/day1/first_home_pager.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:toly/helper/color_utils.dart';
6 | import 'package:toly/view/day1/star_view.dart';
7 |
8 | class MyHomePage extends StatefulWidget {
9 | MyHomePage({Key key, this.title}) : super(key: key);
10 |
11 | final String title;
12 |
13 | @override
14 | _MyHomePageState createState() => _MyHomePageState();
15 | }
16 |
17 | class _MyHomePageState extends State {
18 | Color _color = Colors.black;
19 |
20 | void _changeColor() {
21 | setState(() {
22 | _color = randomRGB();
23 | });
24 | }
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | return Scaffold(
29 | appBar: AppBar(
30 | title: Text(widget.title),
31 | ),
32 | body: CustomPaint(
33 | painter: StarView(context, _color),
34 | ),
35 | floatingActionButton: FloatingActionButton(
36 | onPressed: _changeColor,
37 | tooltip: 'Increment',
38 | child: Icon(Icons.add),
39 | ),
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/pager/day2/anima_pager.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:toly/view/day2/anima_view.dart';
4 |
5 | class AnimaPage extends StatefulWidget {
6 | @override
7 | _AnimaPageState createState() => _AnimaPageState();
8 | }
9 |
10 | class _AnimaPageState extends State
11 | with SingleTickerProviderStateMixin {
12 | AnimationController controller;
13 | Animation animation;
14 | Animation numAnima;
15 | Animation colorAnima;
16 | double _R = 25;
17 | int _num = 5;
18 | Color _color = Colors.yellow;
19 |
20 | @override
21 | void initState() {
22 | super.initState();
23 | // 创建 AnimationController 对象
24 | //|----vsync时会防止屏幕外动画(动画的UI不在当前屏幕时)消耗不必要的资源
25 | controller = AnimationController(
26 | duration: const Duration(milliseconds: 2000), vsync: this);
27 |
28 | numAnima = IntTween(begin: 5, end: 220).animate(controller)
29 | ..addListener(() {
30 | setState(() {
31 | _num = numAnima.value;
32 | });
33 | })
34 | ..addStatusListener((status) {
35 | if (status == AnimationStatus.completed) {
36 | controller.reverse();
37 | } else if (status == AnimationStatus.dismissed) {
38 | controller.forward();
39 | }
40 | });
41 |
42 | colorAnima =
43 | ColorTween(begin: Colors.yellow, end: Colors.red).animate(controller)
44 | ..addListener(() {
45 | setState(() {
46 | _color = colorAnima.value;
47 | });
48 | })
49 | ..addStatusListener((status) {
50 | if (status == AnimationStatus.completed) {
51 | controller.reverse();
52 | } else if (status == AnimationStatus.dismissed) {
53 | controller.forward();
54 | }
55 | });
56 |
57 | animation = Tween(begin: 25.0, end: 150.0).animate(
58 | CurveTween(curve: Cubic(0.96, 0.13, 0.1, 1.2)).animate(controller))
59 | ..addListener(() {
60 | setState(() {
61 | _R = animation.value;
62 | });
63 | })
64 | ..addStatusListener((status) {
65 | if (status == AnimationStatus.completed) {
66 | controller.reverse();
67 | } else if (status == AnimationStatus.dismissed) {
68 | controller.forward();
69 | }
70 | });
71 | }
72 |
73 | @override
74 | void dispose() {
75 | super.dispose();
76 | controller.dispose(); // 资源释放
77 | }
78 |
79 | @override
80 | Widget build(BuildContext context) {
81 | return Scaffold(
82 | appBar: AppBar(
83 | title: Text("张风捷特烈"),
84 | ),
85 | body: CustomPaint(
86 | painter: AnimaView(context, R: _R, num: _num, color: _color),
87 | ),
88 | floatingActionButton: FloatingActionButton(
89 | onPressed: () {
90 | controller.forward(); //执行动画
91 | },
92 | tooltip: 'Increment',
93 | child: Icon(Icons.add),
94 | ),
95 | );
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/lib/pager/day2/clock_pager.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:toly/helper/color_utils.dart';
4 | import 'package:toly/view/day2/clock_view.dart';
5 |
6 | class ClockPage extends StatefulWidget {
7 | @override
8 | _ClockPageState createState() => _ClockPageState();
9 | }
10 |
11 | class _ClockPageState extends State
12 | with SingleTickerProviderStateMixin {
13 | AnimationController controller;
14 |
15 | var _limit = Rect.fromLTRB(-150, -100, 150, 100); //矩形边界
16 |
17 | @override
18 | void initState() {
19 | super.initState();
20 |
21 |
22 | // 创建 AnimationController 对象
23 | //|----vsync时会防止屏幕外动画(动画的UI不在当前屏幕时)消耗不必要的资源
24 | controller = AnimationController(
25 | duration: const Duration(milliseconds: 200000), vsync: this);
26 | controller.addListener(() {
27 | setState(() {});
28 | });
29 |
30 | controller.addStatusListener((status) {
31 | if (status == AnimationStatus.completed) {
32 | controller.reverse();
33 | } else if (status == AnimationStatus.dismissed) {
34 | controller.forward();
35 | }
36 | });
37 |
38 | controller.forward(); //执行动画
39 | }
40 |
41 | @override
42 | void dispose() {
43 | super.dispose();
44 | controller.dispose(); // 资源释放
45 | }
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | return Scaffold(
50 | appBar: AppBar(
51 | title: Text("张风捷特烈"),
52 | ),
53 | body: CustomPaint(
54 | painter: ClockView(context),
55 | ),
56 | floatingActionButton: FloatingActionButton(
57 | onPressed: () {
58 | Navigator.pop(context);
59 | },
60 | tooltip: 'Increment',
61 | child: Icon(Icons.add),
62 | ),
63 | );
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/lib/pager/day2/run_ball_pager.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:toly/helper/color_utils.dart';
4 | import 'package:toly/view/day2/run_ball_view.dart';
5 |
6 | class RunBallPage extends StatefulWidget {
7 | @override
8 | _RunBallPageState createState() => _RunBallPageState();
9 | }
10 |
11 | class _RunBallPageState extends State
12 | with SingleTickerProviderStateMixin {
13 | AnimationController controller;
14 | var _balls = List();
15 |
16 | var _limit = Rect.fromLTRB(-150, -100, 150, 100); //矩形边界
17 |
18 | @override
19 | void initState() {
20 | super.initState();
21 |
22 | var ball =
23 | Ball(x: 0, y: 0, color: Colors.blue, r: 40, aX: 0.05, aY: 0.1, vX: 3, vY: -3);
24 |
25 | _balls.add(ball);
26 |
27 | // 创建 AnimationController 对象
28 | //|----vsync时会防止屏幕外动画(动画的UI不在当前屏幕时)消耗不必要的资源
29 | controller = AnimationController(
30 | duration: const Duration(milliseconds: 200000), vsync: this);
31 | controller.addListener(() {
32 | updateBall();
33 | setState(() {});
34 | });
35 |
36 | controller.addStatusListener((status) {
37 | if (status == AnimationStatus.completed) {
38 | controller.reverse();
39 | } else if (status == AnimationStatus.dismissed) {
40 | controller.forward();
41 | }
42 | });
43 | }
44 |
45 | @override
46 | void dispose() {
47 | super.dispose();
48 | controller.dispose(); // 资源释放
49 | }
50 |
51 | @override
52 | Widget build(BuildContext context) {
53 | return Scaffold(
54 | appBar: AppBar(
55 | title: Text("张风捷特烈"),
56 | ),
57 | body: CustomPaint(
58 | painter: RunBallView(context, _balls, _limit),
59 | ),
60 | floatingActionButton: FloatingActionButton(
61 | onPressed: () {
62 | controller.forward(); //执行动画
63 | },
64 | tooltip: 'Increment',
65 | child: Icon(Icons.add),
66 | ),
67 | );
68 | }
69 |
70 | //更新小球位置
71 | void updateBall() {
72 | for (int i = 0; i < _balls.length; i++) {
73 | var ball = _balls[i];
74 | if (ball.r < 0.3) {
75 | //帮半径小于0.3就移除
76 | _balls.removeAt(i);
77 | }
78 |
79 | //运动学公式
80 | ball.x += ball.vX;
81 | ball.y += ball.vY;
82 | ball.vX += ball.aX;
83 | ball.vY += ball.aY;
84 | //限定下边界
85 | if (ball.y > _limit.bottom) {
86 |
87 |
88 | var newBall = Ball.fromBall(ball);
89 | newBall.r = newBall.r / 2;
90 | newBall.vX = -newBall.vX;
91 | newBall.vY = -newBall.vY;
92 | _balls.add(newBall);
93 |
94 | ball.r = ball.r / 2;
95 |
96 | ball.y = _limit.bottom;
97 | ball.vY = -ball.vY;
98 | ball.color = randomRGB(); //碰撞后随机色
99 | }
100 | //限定上边界
101 | if (ball.y < _limit.top) {
102 | ball.y = _limit.top;
103 | ball.vY = -ball.vY;
104 | ball.color = randomRGB(); //碰撞后随机色
105 | }
106 |
107 | //限定左边界
108 | if (ball.x < _limit.left) {
109 | ball.x = _limit.left;
110 | ball.vX = -ball.vX;
111 | ball.color = randomRGB(); //碰撞后随机色
112 | }
113 |
114 | //限定右边界
115 | if (ball.x > _limit.right) {
116 | var newBall = Ball.fromBall(ball);
117 | newBall.r = newBall.r / 2;
118 | newBall.vX = -newBall.vX;
119 | newBall.vY = -newBall.vY;
120 | _balls.add(newBall);
121 |
122 | ball.r = ball.r / 2;
123 |
124 | ball.x = _limit.right;
125 | ball.vX = -ball.vX;
126 | ball.color = randomRGB(); //碰撞后随机色
127 |
128 | }
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/lib/pager/day3/2_layout.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:toly/helper/color_utils.dart';
5 |
6 | var table_test = Table(
7 | columnWidths: const {
8 | 0: FixedColumnWidth(60.0),
9 | 1: FixedColumnWidth(100.0),
10 | 2: FixedColumnWidth(100.0),
11 | 3: FixedColumnWidth(80.0),
12 | },
13 | defaultVerticalAlignment: TableCellVerticalAlignment.middle,
14 | border: TableBorder.all(
15 | color: Color(0xff16DAF1), width: 1.0, style: BorderStyle.solid),
16 | children: const [
17 | TableRow(
18 | children: [
19 | Center(child: Text('姓名')),
20 | Center(child: Text('年龄')),
21 | Center(child: Text('称号')),
22 | Center(child: Text('武器')),
23 | ],
24 | ),
25 | TableRow(
26 | children: [
27 | Text('捷特'),
28 | Text('24'),
29 | Text('风神'),
30 | Text('黑风剑'),
31 | ],
32 | ),
33 | TableRow(
34 | children: [
35 | Text('巫缨'),
36 | Text('23'),
37 | Text('百里巫缨'),
38 | Text('百里弓'),
39 | ],
40 | ),
41 | TableRow(
42 | children: [
43 | Text('龙少'),
44 | Text('23'),
45 | Text('控尊'),
46 | Text('控尊戒'),
47 | ],
48 | ),
49 | ],
50 | );
51 |
52 | formColorList(int count) {
53 | var random = new Random();
54 | var li = [];
55 |
56 | for (int i = 0; i < count; i++) {
57 | li.add(new Container(
58 | width: 100 * (random.nextDouble() + 0.3),
59 | height: 30,
60 | color: randomRGB(),
61 | ));
62 | }
63 | return li;
64 | }
65 |
66 | var flow_test = Flow(
67 | delegate: MarginFlowDelegate(EdgeInsets.all(5)),
68 | children: formColorList(60));
69 |
70 | class MarginFlowDelegate extends FlowDelegate {
71 | EdgeInsets _margin = EdgeInsets.zero; //成员变量_margin
72 |
73 | MarginFlowDelegate(this._margin); //构造函数
74 |
75 | @override //绘制孩子的方法
76 | void paintChildren(FlowPaintingContext context) {
77 | var offsetX = _margin.left;
78 | var offsetY = _margin.top;
79 | for (int i = 0; i < context.childCount; i++) {
80 | var w = context.getChildSize(i).width + offsetX + _margin.right;
81 | if (w < context.size.width) {
82 | context.paintChild(i,
83 | transform: new Matrix4.translationValues(offsetX, offsetY, 0.0));
84 | offsetX = w + _margin.left;
85 | } else {
86 | offsetX = _margin.left;
87 | offsetY +=
88 | context.getChildSize(i).height + _margin.top + _margin.bottom;
89 | context.paintChild(i,
90 | transform: new Matrix4.translationValues(offsetX, offsetY, 0.0));
91 | offsetX += context.getChildSize(i).width + _margin.left + _margin.right;
92 | }
93 | }
94 | }
95 |
96 | @override
97 | bool shouldRepaint(FlowDelegate oldDelegate) {
98 | return oldDelegate != this;
99 | }
100 | }
101 |
102 | var wrap_test = Wrap(
103 | spacing: 8.0,
104 | // 列间距
105 | runSpacing: 4.0,
106 | //行间距
107 | direction: Axis.horizontal,
108 | alignment: WrapAlignment.spaceBetween,
109 | children: formColorList(50));
110 |
111 | var grid_view_test = GridView.count(
112 | crossAxisCount: 4,
113 | scrollDirection:Axis.horizontal,
114 | children: List.generate(
115 | 100,
116 | (index) {
117 | return Card(
118 | child: Center(child: Text('toly $index')),
119 | );
120 | },
121 | ),
122 | );
123 |
124 | var list_view_test = ListView.builder(
125 | itemCount: 20,
126 | padding: EdgeInsets.all(8.0),
127 | scrollDirection:Axis.horizontal,
128 | itemExtent: 60.0,
129 | itemBuilder: (BuildContext context, int index) {
130 | return Card(
131 | child: Center(child: Text('toly $index')),
132 | );
133 | },
134 | );
135 | var list_body_test = Row(
136 | children: [
137 | ListBody(
138 | mainAxis: Axis.horizontal,
139 | reverse: false,
140 | children: formColorList(5)
141 | )],
142 | );
143 |
144 |
--------------------------------------------------------------------------------
/lib/pager/day3/6_card.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | var six_card = Scaffold(
6 | appBar: AppBar(
7 | title: Text("张风捷特烈"),
8 | //标题
9 | backgroundColor: Color(0xffcbf231),
10 | //背景色
11 | elevation: 12,
12 | //阴影
13 | centerTitle: true,
14 | toolbarOpacity: .4), //透明度
15 | body: Text(
16 | "一箫一剑平生意,负尽狂名十五年",
17 | maxLines: 1,
18 | overflow: TextOverflow.fade,
19 | style: TextStyle(
20 | color: Colors.blue,
21 | fontSize: 20,
22 | letterSpacing: 10,
23 | fontWeight: FontWeight.bold,
24 | background: Paint()..color = Colors.amberAccent),
25 | ),
26 | floatingActionButton: FloatingActionButton(
27 | backgroundColor: Colors.deepOrangeAccent,
28 | elevation: 12,
29 | highlightElevation: 24,
30 | onPressed: () {},
31 | tooltip: 'Increment',
32 | child:
33 | Icon(Icons.add, size: 40, color: Colors.white, semanticLabel: "toly"),
34 | ),
35 | );
36 |
37 | var row_test = Row(
38 | children: [
39 | Expanded(
40 | child: Text('绝域从军计惘然,'),
41 | ),
42 | Expanded(
43 | child: Text('东南幽恨满词笺。'),
44 | ),
45 | Expanded(
46 | child: Text('一箫一剑平生意,'),
47 | ),
48 | Expanded(
49 | child: Text('负尽狂名十五年。'),
50 | ),
51 | ],
52 | );
53 |
54 | var column_test = Column(
55 | children: [
56 | Text('绝域从军计惘然,,'),
57 | Text('东南幽恨满词笺。'),
58 | Text('一箫一剑平生意,'),
59 | Text('负尽狂名十五年。'),
60 | ],
61 | );
62 |
63 | formTextList(int count) {
64 | var random = new Random();
65 | var li = [];
66 |
67 | for (int i = 0; i < count; i++) {
68 | li.add(new Baseline(
69 | baselineType: TextBaseline.alphabetic,
70 | child: new Text(
71 | 'Toly',
72 | style: new TextStyle(
73 | fontSize: 20.0 + random.nextInt(40),
74 | textBaseline: TextBaseline.alphabetic,
75 | ),
76 | ),
77 | baseline: 80,
78 | ));
79 | }
80 | return li;
81 | }
82 |
83 | var base_line_test = new Row(
84 | children: formTextList(5),
85 | );
86 | var fsb_test = new Container(
87 | color: Color(0xff1ADEF6),
88 | height: 200.0,
89 | width: 200.0,
90 | padding: EdgeInsets.all(10),
91 | child: new FractionallySizedBox(
92 | alignment: Alignment.bottomCenter,
93 | widthFactor: 1.5,
94 | heightFactor: 0.5,
95 | child: new Container(
96 | color: Colors.red,
97 | ),
98 | ),
99 | );
100 |
101 | var container_test = Container(
102 | color: Color.fromARGB(100, 81, 211, 253),
103 | height: 100,
104 | width: 200,
105 | child: Text("张风捷特烈"),
106 | margin: EdgeInsets.fromLTRB(5, 10, 15, 20),
107 | padding: EdgeInsets.all(40),
108 | );
109 |
110 | var padding_test = Container(
111 | color: Color.fromARGB(100, 81, 211, 253),
112 | height: 150,
113 | width: 250,
114 | child: Padding(
115 | padding: EdgeInsets.all(10),
116 | child: Text("张风捷特烈"),
117 | ),
118 | );
119 |
120 | var center_test = Container(
121 | color: Color.fromARGB(100, 81, 211, 253),
122 | height: 150,
123 | width: 250,
124 | child: Center(
125 | child: Text("张风捷特烈"),
126 | ),
127 | );
128 |
129 | var stack_test = Container(
130 | color: Color.fromARGB(100, 81, 211, 253),
131 | height: 150,
132 | width: 250,
133 | child: Stack(
134 | alignment: Alignment.centerLeft,
135 | children: [
136 | Text('绝域从军计惘然,,'),
137 | Align(
138 | alignment: Alignment.topRight,
139 | widthFactor: 1.5,
140 | child: Card(
141 | elevation: 10, color: Color(0xffffffff), child: Text('东南幽恨满词笺。')),
142 | ),
143 | Text('一箫一剑平生意,'),
144 | Text('负尽狂名十五年。'),
145 | ],
146 | ));
147 |
148 | var index_stack_test = Transform(
149 | origin: Offset(0, 150),
150 | transform: Matrix4.rotationZ(3.1415 / 4),
151 | child: Container(
152 | color: Color.fromARGB(100, 81, 211, 253),
153 | height: 150,
154 | width: 250,
155 | child: IndexedStack(
156 | index: 3,
157 | alignment: Alignment.centerLeft,
158 | children: [
159 | Text('绝域从军计惘然,'),
160 | Align(
161 | alignment: Alignment.topRight,
162 | widthFactor: 1.5,
163 | child: Card(
164 | elevation: 10,
165 | color: Color(0xffffffff),
166 | child: Text('东南幽恨满词笺。')),
167 | ),
168 | Text('一箫一剑平生意,'),
169 | Offstage(
170 | offstage: false,
171 | child: Text('负尽狂名十五年。'),
172 | ),
173 | ],
174 | )));
175 |
176 | var aspectratio_test = new Container(
177 | width: 200.0,
178 | child: new AspectRatio(
179 | aspectRatio: 1.5,
180 | child: new Container(
181 | color: Colors.red,
182 | ),
183 | ),
184 | );
185 |
--------------------------------------------------------------------------------
/lib/pager/day4/bs_sk_pager.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:toly/helper/color_utils.dart';
4 | import 'package:toly/pager/day4/res_load.dart';
5 | import 'package:toly/view/day2/clock_view.dart';
6 |
7 | class BSPage extends StatefulWidget {
8 | @override
9 | _BSPageState createState() => _BSPageState();
10 | }
11 |
12 | class _BSPageState extends State
13 | with SingleTickerProviderStateMixin {
14 | AnimationController controller;
15 |
16 |
17 | @override
18 | void initState() {
19 | super.initState();
20 |
21 | }
22 |
23 | @override
24 | void dispose() {
25 | super.dispose();
26 | controller.dispose(); // 资源释放
27 | }
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 |
32 | var scaffold = Scaffold(
33 | appBar: AppBar(
34 | title: Text("张风捷特烈"),
35 | bottom: tabBar,
36 | backgroundColor: Color(0xff54C5F8),
37 | elevation: 12,
38 | centerTitle: true,
39 | toolbarOpacity: .4),
40 | body: tabBarView,
41 | drawer: draw,
42 | bottomSheet: bottomSheet,
43 | bottomNavigationBar: bottomNavigationBar,
44 |
45 | floatingActionButton: FloatingActionButton(
46 | onPressed: (){
47 |
48 | Scaffold.of(context).showSnackBar(snackBar);
49 | },
50 | tooltip: 'Increment',
51 | child: Icon(Icons.add),
52 | ),
53 | );
54 |
55 |
56 | return new DefaultTabController(child: scaffold, length: 4);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/lib/pager/day4/flex.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | var c1 = Container(
5 | width: 50,
6 | height: 50,
7 | color: Colors.blue,
8 | );
9 | var c2 = Container(
10 | width: 100,
11 | height: 80,
12 | color: Colors.red,
13 | );
14 | var c3 = Container(
15 | width: 150,
16 | height: 50,
17 | color: Colors.yellow,
18 | );
19 |
20 | var flex_test = Flex(
21 | direction: Axis.horizontal,
22 | children: [
23 | Expanded(
24 | child: c1,
25 | ),
26 | Expanded(
27 | child: c2,
28 | ),
29 | Expanded(
30 | child: c3,
31 | ),
32 | ],
33 | );
34 |
--------------------------------------------------------------------------------
/lib/pager/day4/item.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | var imgHead = Image.asset(
5 | "images/icon_90.png",
6 | width: 80,
7 | );
8 |
9 | var box = Container(
10 | color: Colors.lightBlueAccent,
11 | width: 150,
12 | height: 80,
13 | );
14 | var center = Align(
15 | alignment: Alignment.centerLeft,
16 | child: Container(
17 | color: Colors.amberAccent,
18 | width: 50,
19 | height: 80,
20 | ));
21 | var right = Container(
22 | color: Colors.black45,
23 | width: 80,
24 | height: 80,
25 | );
26 |
27 | var juejin_item = Card(
28 | color: Colors.white,
29 | child: Flex(
30 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
31 | direction: Axis.horizontal,
32 | children: [imgHead, center, right],
33 | ),
34 | );
35 |
--------------------------------------------------------------------------------
/lib/pager/day4/res_load.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:toly/helper/color_utils.dart';
5 | import 'package:toly/pager/day4/item.dart';
6 |
7 | var img_test = Image(
8 | image: AssetImage("images/icon_90.png"),
9 | width: 200,
10 | height: 100,
11 | color: Colors.tealAccent,
12 | );
13 |
14 | var img_test1 = Image.asset(
15 | "images/icon_90.png",
16 | width: 80.0,
17 | );
18 |
19 | var fitMode = [
20 | BoxFit.none,
21 | BoxFit.contain,
22 | BoxFit.cover,
23 | BoxFit.fill,
24 | BoxFit.fitHeight,
25 | BoxFit.fitWidth,
26 | BoxFit.scaleDown
27 | ];
28 |
29 | //循环生成Image控件
30 | formImgs() {
31 | var imgLi = [];
32 | fitMode.forEach((fit) {
33 | imgLi.add(Container(
34 | width: 100,
35 | height: 50,
36 | color: randomRGB(),
37 | child: Image(
38 | image: AssetImage("images/wy_200x300.jpg"),
39 | fit: fit,
40 | )));
41 | });
42 | return imgLi;
43 | }
44 |
45 | //叠合模式数组
46 | var colorBlendMode = [
47 | BlendMode.clear,
48 | BlendMode.src,
49 | BlendMode.dst,
50 | BlendMode.srcOver,
51 | BlendMode.dstOver,
52 | BlendMode.srcIn,
53 | BlendMode.dstIn,
54 | BlendMode.srcOut,
55 | BlendMode.dstOut,
56 | BlendMode.srcATop,
57 | BlendMode.dstATop,
58 | BlendMode.xor,
59 | BlendMode.plus,
60 | BlendMode.modulate,
61 | BlendMode.screen,
62 | BlendMode.overlay,
63 | BlendMode.darken,
64 | BlendMode.lighten,
65 | BlendMode.colorDodge,
66 | BlendMode.colorBurn,
67 | BlendMode.hardLight,
68 | BlendMode.softLight,
69 | BlendMode.difference,
70 | BlendMode.exclusion,
71 | BlendMode.multiply,
72 | BlendMode.hue,
73 | BlendMode.saturation,
74 | BlendMode.color,
75 | BlendMode.luminosity,
76 | ];
77 |
78 | //循环生成Image控件
79 | formImgsColorBlendMode() {
80 | var imgLi = [];
81 | colorBlendMode.forEach((mode) {
82 | imgLi.add(Column(children: [
83 | Padding(
84 | child: Image(
85 | width: 60,
86 | height: 60,
87 | image: AssetImage("images/icon_90.png"),
88 | color: Colors.red,
89 | colorBlendMode: mode,
90 | ),
91 | padding: EdgeInsets.all(5),
92 | ),
93 | Text(mode.toString().split(".")[1])
94 | ]));
95 | });
96 | return imgLi;
97 | }
98 |
99 | //var img_test2=Image.file(Uri.file(path));
100 |
101 | var imgUrl =
102 | "https://upload.jianshu.io/users/upload_avatars/9414344/ed80c0a8-3997-4482-b80e-7c231f3c51bb.png?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240";
103 |
104 | var img_test3 = Image.network(imgUrl, width: 100);
105 |
106 | var imgBox = Wrap(
107 | children: formImgsColorBlendMode(),
108 | );
109 |
110 | var iconBtn = IconButton(
111 | padding: EdgeInsets.only(),
112 | onPressed: () {
113 | print("clicked");
114 | },
115 | icon: Icon(Icons.android, size: 40, color: Colors.deepPurpleAccent),
116 | tooltip: "android",
117 | highlightColor: Colors.red,
118 | //点击时间稍长的时候背景渐变到这个颜色
119 | splashColor: Colors.blue,
120 | //点击时一闪而过的颜色
121 | disabledColor: Colors.blueGrey,
122 | );
123 |
124 | var btnBar = ButtonBar(
125 | alignment: MainAxisAlignment.center,
126 | children: [iconBtn, iconBtn, iconBtn, iconBtn],
127 | );
128 | var raisedButton = RaisedButton(
129 | onPressed: () {},
130 | child: Text("Toly"),
131 | color: Color(0xffF88B0A),
132 | highlightColor: Colors.blue,
133 | );
134 |
135 | var flatButton = FlatButton(
136 | onPressed: () {},
137 | child: Text("Toly"),
138 | color: Color(0xffF88B0A),
139 | highlightColor: Colors.blue,
140 | textColor: Color(0xffFfffff),
141 | );
142 |
143 | var outLineButton = OutlineButton(
144 | onPressed: () {},
145 | child: Text("Toly"),
146 | color: Color(0xffF88B0A),
147 | highlightColor: Colors.blue,
148 | textColor: Color(0xff000000),
149 | borderSide: BorderSide(color: Color(0xff0A66F8), width: 2),
150 | );
151 |
152 | //---------------------------BottomNavigationBar--------------------------------
153 | var iconInfoMap = {
154 | "首页": Icon(Icons.home),
155 | "消息": Icon(Icons.comment),
156 | "动态": Icon(Icons.toys),
157 | "联系人": Icon(Icons.contacts),
158 | };
159 |
160 | var bottomNavigationBar = BottomNavigationBar(
161 | items: () {
162 | var items = [];
163 | iconInfoMap.forEach((k, v) {
164 | items.add(BottomNavigationBarItem(
165 | title: Text(k), icon: v, backgroundColor: Color(0xff49B1FB)));
166 | });
167 | return items;
168 | }(),
169 | currentIndex: 1,
170 | onTap: (position) {
171 | print(position);
172 | },
173 | );
174 | //-----------------------------------------------------------
175 |
176 | //---------------------------TabBar+tabBarView--------------------------------
177 | var chartLi = ["About", "Ball", "Card", "Dog"];
178 |
179 | var tabBarView = new TabBarView(
180 | children: chartLi.map((text) {
181 | return Center(
182 | child: Text(
183 | text,
184 | style: TextStyle(fontSize: 20),
185 | ));
186 | }).toList(),
187 | );
188 |
189 | var tabBar = TabBar(
190 | labelStyle: TextStyle(fontSize: 20),
191 | labelColor: Color(0xffF64C19),
192 | unselectedLabelColor: Colors.white,
193 | tabs: chartLi.map((item) {
194 | return Container(
195 | alignment: AlignmentDirectional.center,
196 | child: Text(item),
197 | height: 40,
198 | );
199 | }).toList(),
200 | );
201 |
202 | //---------------Drawer------------
203 | var draw = Drawer(
204 | elevation: 5,
205 | child: Container(
206 | alignment: AlignmentDirectional.center,
207 | color: Color(0xff99C6F9),
208 | child: Text(
209 | "张风捷特烈",
210 | style: TextStyle(fontSize: 30),
211 | ),
212 | ));
213 |
214 | //-----------------SnackBar-----------
215 | var snackBar = SnackBar(
216 | backgroundColor: Color(0xffFB6431),
217 | content: Text('Hello!'),
218 | duration: Duration(seconds: 1),
219 | action: SnackBarAction(
220 | label: '确定',
221 | onPressed: () {
222 | print("张风捷特烈");
223 | }));
224 |
225 | //-----------------BottomSheet-----------
226 | var bottomSheet = BottomSheet(
227 | onClosing: () {},
228 | builder: (context) => (Container(
229 | color: Color(0xffABF5E0),
230 | child: Wrap(
231 | children: [
232 | Center(child: Text('绝域从军计惘然,')),
233 | Center(child: Text('东南幽恨满词笺。')),
234 | Center(child: Text('一箫一剑平生意,')),
235 | Center(child: Text('负尽狂名十五年。')),
236 | ],
237 | ))));
238 |
239 | //-----------------控制控件-------------
240 |
241 | var textField = TextField(
242 | keyboardType: TextInputType.number,
243 | textAlign: TextAlign.center,
244 | maxLines: 1,
245 | cursorColor: Colors.black,
246 | cursorWidth: 10,
247 | style: TextStyle(fontSize: 20, color: Colors.lightBlue),
248 | onChanged: (str) {
249 | print(str);
250 | },
251 | onEditingComplete: () {
252 | print("onEditingComplete");
253 | },
254 | onSubmitted: (str) {
255 | print("onSubmitted:" + str);
256 | },
257 | onTap: () {
258 | print("onTap");
259 | },
260 | );
261 |
262 | var checkbox = Checkbox(
263 | value: true,
264 | activeColor: Colors.blue,
265 | onChanged: (value) {
266 | print(value);
267 | },
268 | );
269 | var slider = Slider(
270 | min: 100,
271 | max: 200,
272 | value: 180,
273 | activeColor: Colors.green,
274 | inactiveColor: Colors.grey,
275 | onChanged: (value) {
276 | print(value);
277 | },
278 | onChangeStart: (v) {},
279 | onChangeEnd: (v) {},
280 | );
281 | var switch_ = Switch(
282 | value: true,
283 | activeColor: Colors.greenAccent,
284 | activeTrackColor: Colors.black,
285 | activeThumbImage: AssetImage("images/icon_90.png"),
286 | onChanged: (bool value) {
287 | print(value);
288 | },
289 | );
290 |
291 | var numLi = [1, 2, 3, 4, 5, 6, 7];
292 | var radios = Wrap(
293 | children: numLi.map((i) {
294 | return Radio(
295 | value: i,
296 | groupValue: 5,
297 | onChanged: (int value) {},
298 | );
299 | }).toList());
300 |
301 | var chip = Chip(
302 | backgroundColor: Color(0xffE5E5E5),
303 | padding: EdgeInsets.all(3),
304 | avatar: CircleAvatar(
305 | backgroundColor: Colors.lightBlue.shade400,
306 | child: new Text(
307 | 'Toly',
308 | style: TextStyle(fontSize: 10.0, color: Colors.white),
309 | )),
310 | label: Text('张风捷特烈'),
311 | );
312 |
313 | var contrl_widgit = Wrap(
314 | children: [
315 | textField, checkbox, slider, chip, switch_, radios,juejin_item
316 | // Center(child: Text('东南幽恨满词笺。')),
317 | // Center(child: Text('一箫一剑平生意,')),
318 | // Center(child: Text('负尽狂名十五年。')),
319 | ],
320 | );
321 |
--------------------------------------------------------------------------------
/lib/pager/day5/canvas_pager.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:toly/helper/color_utils.dart';
6 | import 'package:toly/helper/help_view.dart';
7 | import 'package:toly/pager/day2/clock_pager.dart';
8 |
9 | class Draw {
10 | double x;
11 | double y;
12 | Color color;
13 |
14 | Draw(this.x, this.y, this.color);
15 | }
16 |
17 | var balls = []; //小球合集
18 |
19 | class CanvasPage extends StatefulWidget {
20 | CanvasPage({Key key, this.title}) : super(key: key);
21 |
22 | final String title;
23 |
24 | @override
25 | _CanvasPageState createState() => _CanvasPageState();
26 | }
27 |
28 | class _CanvasPageState extends State {
29 | var _downX;
30 | var _downY;
31 | var _upX;
32 | var _upY;
33 |
34 | @override
35 | Widget build(BuildContext context) {
36 | var appBar = AppBar(
37 | title: Text("张风捷特烈"),
38 | );
39 | var barTopHeight = MediaQueryData.fromWindow(window).padding.top;
40 |
41 | var scf = Scaffold(
42 | appBar: appBar,
43 | body: CustomPaint(
44 | painter: CanvasView(context, _downX, _downY, _upX, _upY),
45 | ));
46 |
47 | return GestureDetector(
48 | child: scf,
49 | onTapDown: (d) {
50 |
51 | var pos = d.globalPosition;
52 | balls.add(new Draw(pos.dx,
53 | pos.dy - appBar.preferredSize.height - barTopHeight, randomRGB()));
54 | setState(() {});
55 | // Navigator.of(context).pushNamed('/clock');
56 | Navigator.push(
57 | context,
58 | MaterialPageRoute(builder: (bu) => ClockPage())
59 | );
60 | },
61 | onPanDown: (d) {
62 | _downX = d.globalPosition.dx;
63 | _downY =
64 | d.globalPosition.dy - appBar.preferredSize.height - barTopHeight;
65 | },
66 | onPanUpdate: (d) {
67 | var pos = d.globalPosition;
68 | balls.add(new Draw(pos.dx,
69 | pos.dy - appBar.preferredSize.height - barTopHeight, randomARGB()));
70 |
71 |
72 | _upX = d.globalPosition.dx;
73 | _upY = d.globalPosition.dy - appBar.preferredSize.height - barTopHeight;
74 | setState(() {});
75 | },
76 | onPanEnd: (d) {
77 | _downX = -10.0;
78 | _downY = -10.0;
79 | _upX = -10.0;
80 | _upY = -10.0;
81 | setState(() {});
82 | },
83 | );
84 | }
85 | }
86 |
87 | //Canvas绘版
88 | class CanvasView extends CustomPainter {
89 | BuildContext context;
90 | Paint mPaint;
91 | double _downX;
92 | double _downY;
93 | double _upX;
94 | double _upY;
95 |
96 | CanvasView(this.context, this._downX, this._downY, this._upX, this._upY) {
97 | mPaint = new Paint()
98 | ..strokeWidth = 10
99 | ..strokeCap = StrokeCap.round;
100 | }
101 |
102 | @override
103 | void paint(Canvas canvas, Size size) {
104 | balls.forEach((ball) {
105 | drawBall(canvas, ball);
106 | });
107 | var winSize = MediaQuery.of(context).size;
108 | drawGrid(canvas, winSize);
109 | // print("_downX:$_downX,_downY:$_downY");
110 | // canvas.drawLine(Offset(_downX, _downY), Offset(_upX, _upY), mPaint);
111 | }
112 |
113 | @override
114 | bool shouldRepaint(CustomPainter oldDelegate) {
115 | // TODO: implement shouldRepaint
116 | return true;
117 | }
118 |
119 | void drawBall(Canvas canvas, Draw ball) {
120 | mPaint.color = ball.color;
121 | canvas.drawCircle(Offset(ball.x, ball.y), 10, mPaint);
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/lib/pager/day5/layout_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/helper/layout_utils.dart';
3 |
4 | ////////////////////////-----------------测试1--------------------------------
5 | var rowLine = Row(
6 | children: [
7 | Icon(
8 | Icons.extension,
9 | color: Colors.blue,
10 | ),
11 | Expanded(
12 | child: Padding(
13 | padding: EdgeInsets.only(left: 20),
14 | child: Text(
15 | "好友微视",
16 | style: TextStyle(fontSize: 18),
17 | ),
18 | )),
19 | Icon(Icons.arrow_forward)
20 | ],
21 | );
22 |
23 | var test1 =
24 | Container(color: Colors.white, padding: EdgeInsets.all(15), child: rowLine);
25 |
26 | ////////////////////////-----------------测试2--------------------------------
27 |
28 | //左边头像
29 | var headImg = Image.asset(
30 | "images/icon_gql.jpg",
31 | width: 45,
32 | height: 45,
33 | );
34 |
35 | //中间的信息
36 | var center2 = Column(
37 | mainAxisAlignment: MainAxisAlignment.center,
38 | crossAxisAlignment: CrossAxisAlignment.start,
39 | children: [
40 | Text(
41 | "心如止水",
42 | style: commonStyle,
43 | ),
44 | Text(
45 | "《应龙》--张风捷特烈 一游小池两岁月,洗却凡世几闲尘。时逢雷霆风会雨,应乘扶摇化入云。",
46 | maxLines: 1,
47 | overflow: TextOverflow.ellipsis,
48 | style: infoStyle,
49 | textAlign: TextAlign.start,
50 | )
51 | ],
52 | );
53 |
54 | //尾部的时间+图标
55 | var end2 = Column(
56 | mainAxisAlignment: MainAxisAlignment.center,
57 | children: [
58 | Text(
59 | "06:45",
60 | style: infoStyle,
61 | ),
62 | Icon(
63 | Icons.visibility_off,
64 | size: 20,
65 | color: Color(0xff999999),
66 | )
67 | ],
68 | );
69 | //
70 |
71 | var rowLine2 = Row(
72 | children: [
73 | Padding(
74 | child: headImg,
75 | padding: EdgeInsets.all(5),
76 | ),
77 | Expanded(child: Padding(padding: EdgeInsets.all(5), child: center2)),
78 | end2
79 | ],
80 | );
81 |
82 | var test2 = Container(
83 | height: 70,
84 | color: Colors.white,
85 | padding: EdgeInsets.all(5),
86 | child: rowLine2);
87 |
88 | ////////////////////////-----------------测试3--------------------------------
89 | //左边头像
90 | var headImg3 = Image.asset(
91 | "images/icon_90.png",
92 | width: 50,
93 | height: 50,
94 | );
95 |
96 | //中间的信息
97 | var center3 = Column(
98 | mainAxisAlignment: MainAxisAlignment.center,
99 | crossAxisAlignment: CrossAxisAlignment.start,
100 | children: [
101 | Text(
102 | "张风捷特烈",
103 | style: bigStyle,
104 | ),
105 | Row(
106 | children: [
107 | Icon(Icons.next_week, size: 15),
108 | pd(Text("创世神 | 无"), l: 5)
109 | ],
110 | ),
111 | Row(
112 | children: [
113 | Icon(Icons.keyboard, size: 15),
114 | pd(Text("海的彼岸有我未曾见证的风采"), l: 5)
115 | ],
116 | ),
117 | ],
118 | );
119 |
120 | //尾部的
121 | var end3 = Column(
122 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
123 | crossAxisAlignment: CrossAxisAlignment.end,
124 | children: [
125 | Row(
126 | children: [
127 | Icon(
128 | Icons.language,
129 | size: 15,
130 | ),
131 | Icon(Icons.local_pharmacy, size: 15),
132 | Icon(Icons.person_pin_circle, size: 15)
133 | ],
134 | ),
135 | bg(
136 | pdhv(
137 | Text(
138 | "编辑",
139 | style: btnStyle,
140 | ),
141 | h: 10,
142 | v: 3),
143 | Colors.blueAccent),
144 | ],
145 | );
146 | //
147 |
148 | var rowLine3 = Row(
149 | children: [
150 | pda(headImg3, 5),
151 | Expanded(child: pda(center3, 5)),
152 | pda(end3, 10),
153 | ],
154 | );
155 |
156 | var test3 = Card(
157 | child: Container(
158 | height: 95,
159 | color: Colors.white,
160 | padding: EdgeInsets.all(5),
161 | child: rowLine3));
162 |
163 | ////////////////////////-----------------测试4--------------------------------
164 | var line1_4 = Row(
165 | children: [
166 | Image.asset("images/icon_90.png", width: 20, height: 20),
167 | Expanded(
168 | child: pd(Text("张风捷特烈"), l: 5),
169 | ),
170 | Text(
171 | "Flutter/Dart",
172 | style: infoStyle,
173 | )
174 | ],
175 | );
176 |
177 | var center_right = Column(
178 | mainAxisSize: MainAxisSize.min,
179 | children: [
180 | Text(
181 | "Flutter第4天--基础控件(下)+Flex布局详解",
182 | style: littelStyle,
183 | maxLines: 2,
184 | ),
185 | pd(
186 | Text(
187 | "1.2:优雅地查看:图片的适应模式--BoxFit1.3:优雅地查看:颜色混合模式--colorBlendMode",
188 | style: infoStyle,
189 | maxLines: 2,
190 | overflow: TextOverflow.ellipsis,
191 | ),
192 | t: 5),
193 | ],
194 | );
195 |
196 | //中间的信息
197 | var center4 = Row(
198 | children: [
199 | Expanded(child: pda(center_right, 5)),
200 | Image.asset(
201 | "images/wy_300x200.jpg",
202 | width: 80,
203 | height: 80,
204 | fit: BoxFit.fitHeight,
205 | )
206 | ],
207 | );
208 |
209 | var end4 = Row(
210 | children: [
211 | Icon(
212 | Icons.grade,
213 | color: Colors.green,
214 | size: 20,
215 | ),
216 | Text(
217 | "1000W",
218 | style: infoStyle,
219 | ),
220 | pd(Icon(Icons.tag_faces, color: Colors.lightBlueAccent, size: 20),
221 | l: 15, r: 5),
222 | Text("2000W", style: infoStyle),
223 | ],
224 | );
225 |
226 | var item4 = Column(
227 | children: [line1_4, Expanded(child: center4), end4],
228 | );
229 |
230 | var test4 = Card(
231 | child: Container(
232 | height: 160,
233 | color: Colors.white,
234 | padding: EdgeInsets.all(10),
235 | child: item4));
236 |
237 | //--------------------------------------------------------------------------
238 | //竖直
239 |
240 | var test5 = ListView.builder(
241 | itemCount: 30,
242 | itemBuilder: (context, index) {
243 | return Column(
244 | children: [test4],
245 | );
246 | },
247 | );
248 |
249 | var test6 = ListView.separated(
250 | itemBuilder: (ctx, i) {
251 | return Column(
252 | children: [test4],
253 | );
254 | },
255 | separatorBuilder: (ctx, i) {
256 | return Column(
257 | children: [(i + 1) % 2 == 0 ? test2 : Container()],
258 | );
259 | },
260 | itemCount: 5);
261 |
--------------------------------------------------------------------------------
/lib/pager/day5/op.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:toly/helper/layout_utils.dart';
4 |
5 | var line1_4 = Row(
6 | children: [
7 | Image.asset("images/icon_90.png", width: 20, height: 20),
8 | Expanded(
9 | child: pd(Text("张风捷特烈"), l: 5),
10 | ),
11 | Text(
12 | "Flutter/Dart",
13 | style: infoStyle,
14 | )
15 | ],
16 | );
17 |
18 | var center_right = Column(
19 | mainAxisSize: MainAxisSize.min,
20 | children: [
21 | Text(
22 | "Flutter第4天--基础控件(下)+Flex布局详解",
23 | style: littelStyle,
24 | maxLines: 2,
25 | ),
26 | pd(
27 | Text(
28 | "1.2:优雅地查看:图片的适应模式--BoxFit1.3:优雅地查看:颜色混合模式--colorBlendMode",
29 | style: infoStyle,
30 | maxLines: 2,
31 | overflow: TextOverflow.ellipsis,
32 | ),
33 | t: 5),
34 | ],
35 | );
36 |
37 | //中间的信息
38 | var center4 = Row(
39 | children: [
40 | Expanded(child: pda(center_right, 5)),
41 | Image.asset(
42 | "images/wy_300x200.jpg",
43 | width: 80,
44 | height: 80,
45 | fit: BoxFit.fitHeight,
46 | )
47 | ],
48 | );
49 |
50 | var end4 = Row(
51 | children: [
52 | Icon(
53 | Icons.grade,
54 | color: Colors.green,
55 | size: 20,
56 | ),
57 | Text(
58 | "1000W",
59 | style: infoStyle,
60 | ),
61 | pd(Icon(Icons.tag_faces, color: Colors.lightBlueAccent, size: 20),
62 | l: 15, r: 5),
63 | Text("2000W", style: infoStyle),
64 | ],
65 | );
66 |
67 | var item4 = Column(
68 | children: [line1_4, Expanded(child: center4), end4],
69 | );
70 |
71 | var test4 = Card(
72 | child: Container(
73 | height: 160,
74 | color: Colors.white,
75 | padding: EdgeInsets.all(10),
76 | child: item4));
77 |
78 | ///////////////////////////////////////////////////////////////////
79 | var box = Center(
80 | child: Container(
81 | width: 100,
82 | height: 100,
83 | color: Colors.lightBlueAccent,
84 | ));
85 |
86 | var ctrl_test = GestureDetector(
87 | child: box,
88 | onTap: () {
89 | print("onTap");
90 | },
91 | onTapDown: (d) {
92 | print("onPanDown" + d.globalPosition.toString());
93 | },
94 | onTapUp: (d) {
95 | print("onTapUp" + d.globalPosition.toString());
96 | },
97 | onTapCancel: () {
98 | print("onTapUp");
99 | },
100 | );
101 |
102 | var ctrl_test2 = GestureDetector(
103 | child: box,
104 | onDoubleTap: () {
105 | print("onDoubleTap");
106 | },
107 | onLongPress: () {
108 | print("onLongPress");
109 | },
110 | onLongPressUp: () {
111 | print("onLongPressUp");
112 | });
113 |
114 | var ctrl_test3 = GestureDetector(
115 | child: box,
116 | onVerticalDragDown: (d) {
117 | print("onVerticalDragDown---" + d.globalPosition.toString());
118 | },
119 | onVerticalDragStart: (d) {
120 | print("onVerticalDragStart---" + d.globalPosition.toString());
121 | },
122 | onVerticalDragUpdate: (d) {
123 | print("onVerticalDragUpdate---" + d.globalPosition.toString());
124 | },
125 | onVerticalDragCancel: () {
126 | print("onVerticalDragCancel---");
127 | });
128 |
--------------------------------------------------------------------------------
/lib/pager/day6/io_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:path_provider/path_provider.dart';
3 | import 'package:simple_permissions/simple_permissions.dart';
4 | import 'package:toly/helper/io_utils.dart';
5 |
6 | var box = Center(
7 | child: Container(
8 | width: 300,
9 | height: 300,
10 | color: Colors.lightBlueAccent,
11 | ));
12 |
13 | var io_test = GestureDetector(
14 | child: box,
15 | onTap: () {
16 | print("onTap");
17 | localPath();
18 | },
19 | onTapDown: (d) {
20 | print("onPanDown" + d.globalPosition.toString());
21 | },
22 | onTapUp: (d) {
23 | print("onTapUp" + d.globalPosition.toString());
24 | },
25 | onTapCancel: () {
26 | print("onTapUp");
27 | },
28 | );
29 |
30 | localPath() async {
31 | try {
32 | var perm =
33 | SimplePermissions.requestPermission(Permission.ReadExternalStorage);
34 | var sdPath = getExternalStorageDirectory();
35 | sdPath.then((file) {
36 | perm.then((v) async {
37 | var res = await readFile(file.path + "/应龙.txt");
38 | print(res);
39 | });
40 | });
41 | } catch (err) {
42 | print(err);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/lib/pager/day6/list_file_pager.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:path_provider/path_provider.dart';
4 | import 'package:simple_permissions/simple_permissions.dart';
5 |
6 | class ListFilePage extends StatefulWidget {
7 | @override
8 | _ListFilePageState createState() => _ListFilePageState();
9 | }
10 |
11 | class _ListFilePageState extends State
12 | with SingleTickerProviderStateMixin {
13 | List _files = [];
14 |
15 | @override
16 | void initState() {
17 | super.initState();
18 | localPath();
19 | }
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | //生成listView
24 | var listview = ListView.builder(
25 | itemCount: _files.length,
26 | itemBuilder: (BuildContext context, int index) {
27 | return Column(
28 | children: [
29 | Container(
30 | color: Colors.white,
31 | padding: EdgeInsets.all(15),
32 | child: renderItem(index))
33 | ],
34 | );
35 | },
36 | );
37 |
38 | return Scaffold(
39 | appBar: AppBar(
40 | title: Text("张风捷特烈"),
41 | ),
42 | body: listview,
43 | );
44 | }
45 |
46 | // 添加所有SD卡文件名称
47 | localPath() {
48 | try {
49 | var perm =
50 | SimplePermissions.requestPermission(Permission.ReadExternalStorage);
51 | var sdPath = getExternalStorageDirectory();
52 | sdPath.then((file) {
53 | perm.then((v) {
54 | file.list().forEach((i) {
55 | _files.add(i.path);
56 | });
57 | setState(() {});
58 | });
59 | });
60 | } catch (err) {
61 | print(err);
62 | }
63 | }
64 |
65 | //渲染单条目
66 | renderItem(index) {
67 | return Row(
68 | children: [
69 | Icon(
70 | Icons.extension,
71 | color: Colors.blue,
72 | ),
73 | Expanded(
74 | child: Padding(
75 | padding: EdgeInsets.only(left: 20),
76 | child: Text(
77 | _files[index],
78 | style: TextStyle(fontSize: 18),
79 | ),
80 | )),
81 | Icon(Icons.arrow_forward),
82 | Divider(height: 1)
83 | ],
84 | );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/lib/pager/day7/android_stack.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/helper/layout_utils.dart';
3 | import 'package:toly/pager/day7/bean.dart';
4 | import 'package:toly/pager/day7/cons.dart';
5 | import 'package:toly/pager/day7/data_fetcher.dart';
6 | import 'package:toly/pager/day7/home_list.dart';
7 | import 'package:toly/pager/day7/left_draw.dart';
8 |
9 | class AndroidPage extends StatefulWidget {
10 | @override
11 | _AndroidPageState createState() => _AndroidPageState();
12 | }
13 |
14 | class _AndroidPageState extends State {
15 | int _curIndex = 0;
16 | List _notes = [];
17 | String style = "area/A";
18 |
19 | @override
20 | void initState() {
21 | super.initState();
22 |
23 | get(style: style, num: 1000).then((beanLi) {
24 | _notes = beanLi;
25 | setState(() {});
26 | });
27 | }
28 |
29 | @override
30 | void dispose() {
31 | super.dispose();
32 | }
33 |
34 | @override
35 | Widget build(BuildContext context) {
36 |
37 | var searchSheet = BottomSheet(
38 | onClosing: () {},
39 | builder: (context) => (Card(
40 | color: Color.fromARGB(255, 214, 242, 251),
41 | child: Wrap(
42 | children: [
43 | Center(
44 | child: pdhv(TextField(
45 | onChanged: (v) {
46 | style = "name/" + v;
47 | },
48 | ), h: 60)),
49 | Center(
50 | child: pdhv(
51 | GestureDetector(
52 | child: Image.asset(
53 | "images/icon_90.png",
54 | width: 50,
55 | height: 50,
56 | ),
57 | onTap: () {
58 | get(style: style, num: 1000).then((beanLi) {
59 | _notes = beanLi;
60 | setState(() {});
61 | });
62 | },
63 | ),
64 | v: 10)),
65 | ],
66 | ))));
67 |
68 |
69 | //底部栏
70 | var bottomNavigationBar = BottomNavigationBar(
71 | items: iconLi.map((item) {
72 | return BottomNavigationBarItem(
73 | title: Text(
74 | item.info,
75 | style: TextStyle(fontSize: 12, color: Colors.black),
76 | ),
77 | icon: Icon(
78 | item.iconId,
79 | color: item.color,
80 | ),
81 | backgroundColor: Color(0xffffffff));
82 | }).toList(),
83 | currentIndex: _curIndex,
84 | onTap: _onTapBNB,
85 | );
86 |
87 | var scContext; //先声明一下Scaffold的context
88 | var scaffold = Scaffold(
89 | appBar: AppBar(
90 | title: Text("张风捷特烈"),
91 | ),
92 | body: Builder(builder: (context) {
93 | scContext = context;
94 | return HomeListPage(_notes);
95 | }),
96 | floatingActionButton: FloatingActionButton(
97 | onPressed: () {
98 | Scaffold.of(scContext).showBottomSheet(searchSheet.builder);
99 | },
100 | tooltip: 'Increment',
101 | child: Icon(Icons.add),
102 | ),
103 | bottomNavigationBar: bottomNavigationBar,
104 | drawer: LeftDrawPage());
105 | return scaffold;
106 | }
107 |
108 | //底部栏点击监听
109 | void _onTapBNB(int position) {
110 | switch (position) {
111 | case 0:
112 | style = "area/A";
113 | break;
114 | case 1:
115 | style = "area/SB";
116 | break;
117 | case 2:
118 | style = "area/Re";
119 | break;
120 | case 3:
121 | style = "area/Note";
122 | break;
123 | case 4:
124 | style = "area/A";
125 | break;
126 | }
127 | _curIndex = position;
128 | get(style: style, num: 1000).then((beanLi) {
129 | _notes = beanLi;
130 | setState(() {});
131 | });
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/lib/pager/day7/bean.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ItemBean {
4 | Color color;
5 | IconData iconId;
6 | String info;
7 | ItemBean(this.color, this.iconId, this.info);
8 | }
9 |
10 |
11 | class ResultBean {
12 | String msg;
13 | int code;
14 | var data;
15 |
16 | ResultBean.fromJson(Map map)
17 | : msg = map['msg'],
18 | code = map['code'],
19 | data = map['data'];
20 | }
21 |
22 | class NoteBean {
23 | int id;
24 | String type;
25 | String name;
26 | String localPath;
27 | String jianshuUrl;
28 | String juejinUrl;
29 | String imgUrl;
30 | String createTime;
31 | String info;
32 | String area;
33 |
34 | NoteBean.fromJson(Map map)
35 | : id = map['id'],
36 | name = map['name'],
37 | type = map['type'],
38 | localPath = map['localPath'],
39 | jianshuUrl = map['jianshuUrl'],
40 | juejinUrl = map['juejinUrl'],
41 | imgUrl = map['imgUrl'],
42 | createTime = map['createTime'],
43 | info = map['info'],
44 | area = map['area'];
45 | }
--------------------------------------------------------------------------------
/lib/pager/day7/cons.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/iconfont.dart';
3 | import 'package:toly/pager/day7/bean.dart';
4 |
5 | //底部栏图标信息
6 | var iconLi=[
7 | ItemBean(Color(0xff8FC552),TolyIcon.android,"Android"),
8 | ItemBean(Color(0xff6BFB00),TolyIcon.icon_spring_boot,"SpringBoot"),
9 | ItemBean(Color(0xff63DAFF),TolyIcon.react,"React"),
10 | ItemBean(Color(0xffF3D861),TolyIcon.biji,"编程随笔"),
11 | ItemBean(Color(0xff5CEBF2),TolyIcon.daima,"系列文章")
12 | ];
13 |
14 |
--------------------------------------------------------------------------------
/lib/pager/day7/data_fetcher.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:http/http.dart' as client;
4 | import 'package:toly/pager/day7/bean.dart';
5 |
6 | const BASE_URL = 'http://192.168.43.60:8089';
7 | const API = '/api/android/note/';
8 |
9 | Future> get({style = '', offset = 0, num = 1}) async {
10 | var dataLi = [];
11 | var url = BASE_URL + API + style + "/" + "$offset" + "/" + "$num";
12 | print(url);
13 | try {
14 | final response = await client.get(url);
15 | if (response.statusCode == 200) {
16 | var result = ResultBean.fromJson(json.decode(response.body));
17 | List data = result.data;
18 | print(NoteBean.fromJson(data[0]).type);
19 | for (int i = 0; i < data.length; i++) {
20 | dataLi.add(NoteBean.fromJson(data[i]));
21 | }
22 | return dataLi;
23 | }
24 | } catch (e) {
25 | print(e);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/lib/pager/day7/home_list.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/helper/layout_utils.dart';
3 | import 'package:toly/pager/day7/bean.dart';
4 |
5 | class HomeListPage extends StatefulWidget {
6 | List _notes;
7 |
8 | HomeListPage(List notes) {
9 | _notes = notes;
10 | }
11 |
12 | @override
13 | _HomeListPageState createState() => _HomeListPageState();
14 | }
15 |
16 | class _HomeListPageState extends State {
17 | @override
18 | void initState() {
19 | super.initState();
20 | }
21 |
22 | @override
23 | void dispose() {
24 | super.dispose();
25 | }
26 |
27 | @override
28 | Widget build(BuildContext context) {
29 | var notes = widget._notes;
30 |
31 | return ListView.builder(
32 | itemCount: notes.length,
33 | itemBuilder: (BuildContext context, int index) {
34 | return renderItem(notes[index]);
35 | },
36 | );
37 | }
38 |
39 | renderItem(NoteBean note) {
40 | ////////////////////////-----------------测试4--------------------------------
41 | var line1_4 = Row(
42 | children: [
43 | Image.asset("images/icon_90.png", width: 20, height: 20),
44 | Expanded(
45 | child: pd(Text("张风捷特烈"), l: 5),
46 | ),
47 | Text(
48 | note.type,
49 | style: infoStyle,
50 | )
51 | ],
52 | );
53 |
54 | var center_right = Column(
55 | mainAxisSize: MainAxisSize.min,
56 | children: [
57 | Text(
58 | note.name,
59 | style: littelStyle,
60 | maxLines: 2,
61 | ),
62 | pd(
63 | Text(
64 | note.info,
65 | style: infoStyle,
66 | maxLines: 2,
67 | overflow: TextOverflow.ellipsis,
68 | ),
69 | t: 5),
70 | ],
71 | );
72 |
73 | //中间的信息
74 | var center4 = Row(
75 | children: [
76 | Expanded(child: pda(center_right, 5)),
77 | Image.network(
78 | note.imgUrl,
79 | width: 80,
80 | height: 80,
81 | fit: BoxFit.fitHeight,
82 | )
83 | ],
84 | );
85 |
86 | var end4 = Row(
87 | children: [
88 | Icon(
89 | Icons.grade,
90 | color: Colors.green,
91 | size: 20,
92 | ),
93 | Text(
94 | "1000W",
95 | style: infoStyle,
96 | ),
97 | pd(Icon(Icons.tag_faces, color: Colors.lightBlueAccent, size: 20),
98 | l: 15, r: 5),
99 | Text("2000W", style: infoStyle),
100 | ],
101 | );
102 |
103 | var item4 = Column(
104 | children: [line1_4, Expanded(child: center4), end4],
105 | );
106 |
107 | var aCard = Card(
108 | child: Container(
109 | height: 160,
110 | color: Colors.white,
111 | padding: EdgeInsets.all(10),
112 | child: item4));
113 |
114 | return aCard;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/lib/pager/day7/left_draw.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:toly/helper/layout_utils.dart';
3 |
4 | class LeftDrawPage extends StatefulWidget {
5 | @override
6 | _LeftDrawPageState createState() => _LeftDrawPageState();
7 | }
8 |
9 | class _LeftDrawPageState extends State
10 | with SingleTickerProviderStateMixin {
11 | @override
12 | Widget build(BuildContext context) {
13 | //左边头像
14 | var headImg3 = Image.asset(
15 | "images/icon_90.png",
16 | width: 50,
17 | height: 50,
18 | );
19 |
20 | //中间的信息
21 | var center3 = Column(
22 | mainAxisAlignment: MainAxisAlignment.center,
23 | crossAxisAlignment: CrossAxisAlignment.start,
24 | children: [
25 | Text(
26 | "张风捷特烈",
27 | style: bigStyle,
28 | ),
29 | Row(
30 | children: [
31 | Icon(Icons.next_week, size: 15),
32 | pd(Text("创世神 | 无"), l: 5)
33 | ],
34 | ),
35 | Row(
36 | children: [
37 | Icon(Icons.keyboard, size: 15),
38 | pd(Text("海的彼岸有我未曾见证的风采"), l: 5)
39 | ],
40 | ),
41 | ],
42 | );
43 |
44 | var rowLine3 = Row(
45 | children: [
46 | pda(headImg3, 5),
47 | Expanded(child: pda(center3, 5)),
48 | ],
49 | );
50 |
51 | var test3 = Card(
52 | child: Container(
53 | height: 95,
54 | color: Colors.white,
55 | padding: EdgeInsets.all(5),
56 | child: rowLine3));
57 |
58 | return Drawer(
59 | elevation: 5,
60 | child: Container(
61 | padding: EdgeInsets.only(top: 50),
62 | alignment: AlignmentDirectional.topCenter,
63 | color: Color(0xff99C6F9),
64 | child: test3));
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/lib/pager/day7/plg/shape.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:toly/helper/common_path.dart';
5 |
6 | var card_shape = Card(
7 | shape: StarBorder(),
8 | // shape: CircleBorder(side: BorderSide(width: 15,color: Color(0xffF9DFA7))),
9 | // shape: RoundedRectangleBorder(
10 | // side:BorderSide(color: Color(0xffD516F5),width: 5) ,
11 | // borderRadius: BorderRadius.all(Radius.circular(20))),
12 | clipBehavior: Clip.hardEdge,
13 | child: Container(
14 | width: 100,
15 | height: 100,
16 | color: Color(0xffCDECF6),
17 | child: Center(
18 | child: Text(
19 | "捷",
20 | style: TextStyle(color: Colors.black, fontSize: 40),
21 | ),
22 | ),
23 | ));
24 |
25 | class StarBorder extends ShapeBorder {
26 | @override
27 | // TODO: implement dimensions
28 | EdgeInsetsGeometry get dimensions => null;
29 |
30 | @override
31 | Path getInnerPath(Rect rect, {TextDirection textDirection}) {
32 | // TODO: implement getInnerPath
33 | return null;
34 | }
35 |
36 | @override
37 | Path getOuterPath(Rect rect, {TextDirection textDirection}) {
38 | print(rect.right);
39 | return regularPolygonPath(10, 50,x: rect.height/2,y: rect.width/2);
40 | }
41 |
42 | @override
43 | void paint(Canvas canvas, Rect rect, {TextDirection textDirection}) {
44 | canvas.translate(50, 50);
45 | // canvas.drawPath(nStarPath(5, 40, 20), new Paint());
46 | }
47 |
48 | @override
49 | ShapeBorder scale(double t) {
50 | // TODO: implement scale
51 | return null;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/pager/day7/plg/test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | const platform = const MethodChannel("www.toly1994.com/test.名字随意起");
5 |
6 | var toastTest = Center(
7 | child: RaisedButton(
8 | onPressed: () {
9 |
10 | var result= platform.invokeMethod("getMD5",{"arg":"https://www.jianshu.com/p/9bac0072d1a0"});
11 | result.then((str){
12 | platform.invokeMethod("showToast",{"msg":str});
13 | });
14 |
15 | },
16 | child: new Text("点击弹吐司"),
17 | ),
18 | );
19 |
--------------------------------------------------------------------------------
/lib/view/day1/star_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:toly/helper/common_path.dart';
6 | import 'package:toly/helper/help_view.dart';
7 |
8 | class StarView extends CustomPainter {
9 | Paint mPaint;
10 | BuildContext context;
11 |
12 | StarView(this.context,Color color) {
13 | print(color);
14 | mPaint = new Paint();
15 | mPaint.color = color;
16 | }
17 |
18 | @override
19 | void paint(Canvas canvas, Size size) {
20 | var winSize = MediaQuery.of(context).size;
21 | drawGrid(canvas, winSize);
22 | drawCoo(canvas, new Size(160, 320), winSize);
23 |
24 | canvas.translate(0, 320);
25 |
26 | canvas.save();
27 | for (int i = 5; i < 10; i++) {
28 | canvas.translate(64, 0);
29 |
30 |
31 | canvas.drawPath(nStarPath(i, 30, 15), mPaint);
32 | }
33 | canvas.restore();
34 |
35 | canvas.translate(0, 70);
36 | canvas.save();
37 | for (int i = 5; i < 10; i++) {
38 | canvas.translate(64, 0);
39 | canvas.drawPath(regularStarPath(i, 30), mPaint);
40 | }
41 | canvas.restore();
42 |
43 | canvas.translate(0, 70);
44 | canvas.save();
45 | for (int i = 5; i < 10; i++) {
46 | canvas.translate(64, 0);
47 | canvas.drawPath(regularPolygonPath(i, 30), mPaint);
48 | }
49 | canvas.restore();
50 | }
51 |
52 | @override
53 | bool shouldRepaint(CustomPainter oldDelegate) {
54 | return true;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/view/day2/anima_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:toly/helper/common_path.dart';
5 | import 'package:toly/helper/help_view.dart';
6 |
7 | class AnimaView extends CustomPainter {
8 | Paint mPaint;
9 | BuildContext context;
10 | double _R;
11 | int _num;
12 |
13 | AnimaView(this.context, {double R, int num, Color color}) {
14 | mPaint = new Paint();
15 | mPaint.color = color;
16 | _R = R;
17 | _num = num;
18 | }
19 |
20 | @override
21 | void paint(Canvas canvas, Size size) {
22 | var winSize = MediaQuery.of(context).size;
23 | drawGrid(canvas, winSize);
24 | drawCoo(canvas, new Size(160, 320), winSize);
25 |
26 | canvas.translate(160, 320);
27 |
28 | canvas.drawPath(nStarPath(_num, _R, 50), mPaint);
29 | }
30 |
31 | @override
32 | bool shouldRepaint(CustomPainter oldDelegate) {
33 | return true;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/view/day2/clock_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 | import 'dart:ui';
3 |
4 | import 'package:flutter/material.dart';
5 | import 'package:toly/helper/color_utils.dart';
6 | import 'package:toly/helper/common_path.dart';
7 | import 'package:toly/helper/day2/cons.dart';
8 | import 'package:toly/helper/help_view.dart';
9 |
10 | var currTime = new DateTime.now();
11 | var tagOfBall = new DateTime.now().millisecondsSinceEpoch;
12 | var _balls = new List();
13 |
14 | class Ball {
15 | double aX; //加速度
16 | double aY; //加速度Y
17 | double vX; //速度X
18 | double vY; //速度Y
19 | double x; //点位X
20 | double y; //点位Y
21 | Color color; //颜色
22 | double r; //小球半径
23 |
24 | Ball(
25 | {this.x, this.y, this.color, this.r, this.aX, this.aY, this.vX, this.vY});
26 |
27 | //复制一个小球
28 | Ball.fromBall(Ball ball) {
29 | this.x = ball.x;
30 | this.y = ball.y;
31 | this.color = ball.color;
32 | this.r = ball.r;
33 | this.aX = ball.aX;
34 | this.aY = ball.aY;
35 | this.vX = ball.vX;
36 | this.vY = ball.vY;
37 | }
38 | }
39 |
40 | class ClockView extends CustomPainter {
41 | Paint mPaint;
42 | BuildContext context;
43 |
44 | double _radius = 4;
45 | DateTime _now;
46 | Path mStarPath; //半径
47 |
48 | ClockView(this.context) {
49 | mPaint = new Paint();
50 | mStarPath = nStarPath(5, _radius, _radius / 2);
51 | _now = new DateTime.now();
52 | addBallsChanged();
53 | updateBalls();
54 | }
55 |
56 | /**
57 | * 添加倒计时中改动的点---变动加球
58 | */
59 | void addBallsChanged() {
60 | var now = new DateTime.now();
61 | if (currTime.second != now.second) {
62 | //判断当前时间是否改变,再将点位放到集合中
63 | if ((currTime.hour ~/ 10) != (now.hour ~/ 10)) {
64 | addBalls((-17 * 5 - 11 * 2) * _radius.toInt(), currTime.hour ~/ 10);
65 | }
66 | if ((currTime.hour % 10) != (now.hour % 10)) {
67 | addBalls((-17 * 4 - 11 * 2) * _radius.toInt(), currTime.hour % 10);
68 | }
69 | if ((currTime.minute ~/ 10) != (now.minute ~/ 10)) {
70 | addBalls((-18 * 3 - 11) * _radius.toInt(), currTime.minute ~/ 10);
71 | }
72 | if ((currTime.minute % 10) != (now.minute % 10)) {
73 | addBalls((-18 * 2 - 11) * _radius.toInt(), currTime.minute % 10);
74 | }
75 | if ((currTime.second ~/ 10) != (now.second ~/ 10)) {
76 | addBalls(-18 * _radius.toInt(), currTime.second ~/ 10);
77 | }
78 | if ((currTime.second % 10) != (now.second % 10)) {
79 | addBalls(0, currTime.second % 10);
80 | currTime = now;
81 | }
82 | }
83 | }
84 |
85 | //添加小球
86 | addBalls(int offsetX, int num) {
87 | Random random = new Random();
88 | for (int i = 0; i < digit[num].length; i++) {
89 | for (int j = 0; j < digit[num][i].length; j++) {
90 | if (digit[num][i][j] == 1) {
91 | Ball ball = new Ball();
92 | ball.aY = 0.1;
93 | ball.vX = pow(-1, random.nextInt(1000)) * 6 * random.nextDouble();
94 | ball.vY = 4 * random.nextDouble();
95 | ball.x =
96 | offsetX + j * 2 * (_radius + 1) + (_radius + 1); //第(i,j)个点圆心横坐标
97 | ball.y = i * 2 * (_radius + 1) + (_radius + 1); //第(i,j)个点圆心纵坐标
98 | ball.color = randomRGB();
99 | ball.r = _radius;
100 | _balls.add(ball);
101 | }
102 | }
103 | }
104 | }
105 |
106 | /**
107 | * 更新所有球的位置---让球运动
108 | * 并且越界移除
109 | */
110 | void updateBalls() {
111 | double maxX = 400; //限定x范围大值
112 |
113 | for (Ball ball in _balls) {
114 | ball.x += ball.vX; //x=xo+v*t-----t=1
115 | ball.y += ball.vY;
116 | ball.y += ball.aY; //v=vo+a*t-----t=1
117 |
118 | if (ball.y >= 160) {
119 | //超过Y底线,反弹
120 | ball.y = 160;
121 | ball.vY = -ball.vY * 0.99;
122 | }
123 |
124 | if (ball.x > maxX) {
125 | //超过X最大值,反弹
126 | ball.x = maxX;
127 | ball.vX = -ball.vX * 0.99;
128 | }
129 | }
130 |
131 | //5秒清一次屏
132 | if (new DateTime.now().millisecondsSinceEpoch - tagOfBall > 5000) {
133 | _balls.clear();
134 | tagOfBall = new DateTime.now().millisecondsSinceEpoch;
135 | }
136 | }
137 |
138 | @override
139 | void paint(Canvas canvas, Size size) {
140 | var winSize = MediaQuery.of(context).size;
141 | drawGrid(canvas, winSize);
142 | drawCoo(canvas, new Size(100, 60), winSize);
143 | canvas.translate(100, 60);
144 |
145 | mPaint.color = Color.fromARGB(148, 198, 246, 248);
146 | // canvas.drawRect(_limit, mPaint);
147 |
148 | canvas.save();
149 |
150 | renderDigit(_now.hour ~/ 10, canvas);
151 | canvas.translate(19 * _radius, 0);
152 | renderDigit(_now.hour % 10, canvas);
153 |
154 | canvas.translate(19 * _radius, 0);
155 | renderDigit(10, canvas);
156 |
157 | canvas.translate(11 * _radius, 0);
158 | renderDigit(_now.minute ~/ 10, canvas);
159 | canvas.translate(19 * _radius, 0);
160 | renderDigit(_now.minute % 10, canvas);
161 |
162 | canvas.translate(18 * _radius, 0);
163 | renderDigit(10, canvas);
164 |
165 | canvas.translate(11 * _radius, 0);
166 | renderDigit(_now.second ~/ 10, canvas);
167 | canvas.translate(19 * _radius, 0);
168 | renderDigit(_now.second % 10, canvas);
169 |
170 | //绘制小球
171 | _balls.forEach((ball) {
172 | drawBall(canvas, ball);
173 | });
174 | canvas.restore();
175 | }
176 |
177 | @override
178 | bool shouldRepaint(CustomPainter oldDelegate) {
179 | return true;
180 | }
181 |
182 | /**
183 | * 渲染数字
184 | * @param num 要显示的数字
185 | * @param canvas 画布
186 | */
187 | void renderDigit(int num, Canvas canvas) {
188 | if (num > 10) {
189 | return;
190 | }
191 | for (int i = 0; i < digit[num].length; i++) {
192 | for (int j = 0; j < digit[num][j].length; j++) {
193 | if (digit[num][i][j] == 1) {
194 | canvas.save();
195 | double rX = j * 2 * (_radius + 1) + (_radius + 1); //第(i,j)个点圆心横坐标
196 | double rY = i * 2 * (_radius + 1) + (_radius + 1); //第(i,j)个点圆心纵坐标
197 | canvas.translate(rX, rY);
198 |
199 | mPaint.color = Colors.blue;
200 | canvas.drawPath(mStarPath, mPaint);
201 | canvas.restore();
202 | }
203 | }
204 | }
205 | }
206 |
207 | void drawBall(Canvas canvas, Ball ball) {
208 | mPaint.color = ball.color;
209 | canvas.drawCircle(Offset(ball.x, ball.y), ball.r, mPaint);
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/lib/view/day2/run_ball_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | class Ball {
6 | double aX; //加速度
7 | double aY; //加速度Y
8 | double vX; //速度X
9 | double vY; //速度Y
10 | double x; //点位X
11 | double y; //点位Y
12 | Color color; //颜色
13 | double r; //小球半径
14 |
15 | Ball(
16 | {this.x, this.y, this.color, this.r, this.aX, this.aY, this.vX, this.vY});
17 |
18 | //复制一个小球
19 | Ball.fromBall(Ball ball) {
20 | this.x = ball.x;
21 | this.y = ball.y;
22 | this.color = ball.color;
23 | this.r = ball.r;
24 | this.aX = ball.aX;
25 | this.aY = ball.aY;
26 | this.vX = ball.vX;
27 | this.vY = ball.vY;
28 | }
29 | }
30 |
31 | class RunBallView extends CustomPainter {
32 | Paint mPaint;
33 | BuildContext context;
34 | List _balls;
35 | Rect _limit;
36 |
37 | RunBallView(this.context, List balls, Rect limit) {
38 | mPaint = new Paint();
39 | _balls = balls;
40 | _limit = limit;
41 | }
42 |
43 | @override
44 | void paint(Canvas canvas, Size size) {
45 | var winSize = MediaQuery.of(context).size;
46 | // drawGrid(canvas, winSize);
47 | // drawCoo(canvas, new Size(160, 320), winSize);
48 | canvas.translate(160, 320);
49 |
50 | mPaint.color = Color.fromARGB(148, 198, 246, 248);
51 | // canvas.drawRect(_limit, mPaint);
52 |
53 | canvas.save();
54 | _balls.forEach((ball) {
55 | drawBall(canvas, ball);
56 | });
57 |
58 | canvas.restore();
59 | }
60 |
61 | @override
62 | bool shouldRepaint(CustomPainter oldDelegate) {
63 | return true;
64 | }
65 |
66 | void drawBall(Canvas canvas, Ball ball) {
67 | mPaint.color = ball.color;
68 | canvas.drawCircle(Offset(ball.x, ball.y), ball.r, mPaint);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/view/day5/canvas_draw.dart:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toly1994328/Flutter_Seven_Day/ad3de28672f94df5089b6e5e70a40b9f4ac30b64/lib/view/day5/canvas_draw.dart
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: toly
2 | description: A new Flutter application.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # Read more about versioning at semver.org.
10 | version: 1.0.0+1
11 |
12 | environment:
13 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
14 |
15 | dependencies:
16 | flutter:
17 | sdk: flutter
18 |
19 | # The following adds the Cupertino Icons font to your application.
20 | # Use with the CupertinoIcons class for iOS style icons.
21 | cupertino_icons: ^0.1.2
22 |
23 | path_provider: ^0.4.1
24 | http: ^0.11.3+17
25 | simple_permissions: ^0.1.9
26 |
27 | dev_dependencies:
28 | flutter_test:
29 | sdk: flutter
30 |
31 |
32 | # For information on the generic Dart part of this file, see the
33 | # following page: https://www.dartlang.org/tools/pub/pubspec
34 |
35 | # The following section is specific to Flutter.
36 | flutter:
37 |
38 | # The following line ensures that the Material Icons font is
39 | # included with your application, so that you can use the icons in
40 | # the material Icons class.
41 | uses-material-design: true
42 |
43 | # To add assets to your application, add an assets section, like this:
44 | # assets:
45 | # - images/a_dot_burr.jpeg
46 | # - images/a_dot_ham.jpeg
47 | assets:
48 | - icon_90.png
49 | - wy_300x200.jpg
50 | - wy_200x300.jpg
51 | - compass.png
52 | - icon_gql.jpg
53 | # An image asset can refer to one or more resolution-specific "variants", see
54 | # https://flutter.io/assets-and-images/#resolution-aware.
55 |
56 | # For details regarding adding assets from package dependencies, see
57 | # https://flutter.io/assets-and-images/#from-packages
58 |
59 | # To add custom fonts to your application, add a fonts section here,
60 | # in this "flutter" section. Each entry in this list should have a
61 | # "family" key with the font family name, and a "fonts" key with a
62 | # list giving the asset and other descriptors for the font. For
63 | # example:
64 | # fonts:
65 | # - family: Schyler
66 | # fonts:
67 | # - asset: fonts/Schyler-Regular.ttf
68 | # - asset: fonts/Schyler-Italic.ttf
69 | # style: italic
70 | # - family: Trajan Pro
71 | # fonts:
72 | # - asset: fonts/TrajanPro.ttf
73 | # - asset: fonts/TrajanPro_Bold.ttf
74 | # weight: 700
75 | #
76 | # For details regarding fonts from package dependencies,
77 | # see https://flutter.io/custom-fonts/#from-packages
78 | fonts:
79 | - family: TolyIcon
80 | fonts:
81 | - asset: iconfont/iconfont.ttf
--------------------------------------------------------------------------------
/test/base/1_圆周长.dart:
--------------------------------------------------------------------------------
1 | //const就像英雄天生天赋,final就像等级到了,选择英雄职业(不能转职)
2 | const PI = 3.141592654; //const:编译时就是常量
3 | //const double PI = 3.141592654;
4 |
5 | final x = 50; //final修饰的变量只能被赋值一次(运行时)
6 | //final int x = 100;
7 |
8 | main() {
9 | // int radius = 10;
10 | var radius = 10;
11 | //radius = 10.0;//Error--A value of type 'double' can't be assigned to a variable of type 'int'.
12 | double c = getC(radius);
13 | //支持三目运算符
14 | bool isBig = c > x;
15 | print(isBig ? "圆的周长大于${x}" : r"圆的周长\n小于${x}"*2);
16 | //x=100 圆的周长\n小于${x}圆的周长\n小于${x}
17 | //x=50 圆的周长大于50
18 | }
19 |
20 | // 获取圆的周长 radius : 半径
21 | double getC(int radius) {
22 | var c = 2 * PI * radius;
23 | return c;
24 | }
25 |
--------------------------------------------------------------------------------
/test/base/2_列表.dart:
--------------------------------------------------------------------------------
1 | main() {
2 | baseUse(); //基本使用
3 |
4 | op();
5 | }
6 |
7 | void op() {
8 | var numList = [3, 2, 1, 4, 5];
9 | numList.sort();
10 | print(numList); //排序--[1, 2, 3, 4, 5]
11 |
12 | for (var value in numList) {
13 | //遍历list
14 | print(value); //1,2,3,4,5
15 | }
16 |
17 | numList.forEach(addOne); //2,3,4,5,6
18 | numList.forEach((num) => print(num + 1)); //同上
19 |
20 | var any = numList.any((num) => num > 3);
21 | print(any); //只要有>3的任何元素,返回true
22 |
23 | var every = numList.every((num) => num < 6);
24 | print(every); //全部元素<6,返回true
25 |
26 | var listX5 = numList.map((e) => e*=5);
27 | print(listX5);//(5, 10, 15, 20, 25)
28 |
29 | }
30 |
31 | int addOne(int num) {
32 | print(num + 1);
33 | }
34 |
35 | void baseUse() {
36 | var list = [1, "a", "b", "c", true]; //支持多种类型
37 | // var list=const[1,"a","b","c",true];
38 | // var list =new List();
39 |
40 | list[0] = "10"; //数组元素可修改成不同类型
41 | var el = list[list.length - 1]; //获取--true
42 | list.add("toly"); //尾增--[10, a, b, c, true, toly]
43 | list.insert(1, true); //定点增--[10, true, a, b, c, true, toly]
44 | list.remove("10"); //删除元素--[true, a, b, c, true, toly]
45 | list.indexOf(true); //首出索引--1
46 | list.lastIndexOf(true); //尾出索引--4
47 | list.removeLast(); //移除尾--[true, a, b, c, true]
48 | print(list.sublist(2)); //截取--[b, c, true]
49 | print(list.sublist(2, 4)); //截取--[b, c]
50 | print(list);
51 | print(list.join("!")); //true!a!b!c!true
52 | }
53 |
--------------------------------------------------------------------------------
/test/base/3_映射表.dart:
--------------------------------------------------------------------------------
1 | main() {
2 | baseUse(); //基本使用
3 |
4 | op();
5 | }
6 |
7 | void op() {
8 | var dict = {"a": "page1", "b": "page30", "c": "page70", "price": 40};
9 | dict.keys.forEach(print); //a,b,c,price
10 | dict.values.forEach(print); //a,b,c,price
11 | dict.forEach((k, v) => (print("$k=$v"))); //这里用括号包着,好想吐槽...
12 | }
13 |
14 | int addOne(int num) {
15 | print(num + 1);
16 | }
17 |
18 | void baseUse() {
19 | //创建映射表
20 | var dict = {"a": "page1", "b": "page30", "c": "page70", "price": 40};
21 | // var dict = new Map();
22 | print(dict); //{a: page1, b: page30, c: page70, price: 40}
23 | print(dict["price"]); //40
24 | dict["a"] = "page2";
25 | print(dict); //{a: page2, b: page30, c: page70, price: 40}
26 | print(dict.containsKey("price")); //true
27 | print(dict.containsValue("price")); //false
28 | print(dict.isEmpty); //false
29 | print(dict.isNotEmpty); //true
30 | print(dict.length); //4
31 | dict.remove("c");
32 | print(dict);//{a: page2, b: page30, price: 40}
33 | }
34 |
--------------------------------------------------------------------------------
/test/base/4_dynamic.dart:
--------------------------------------------------------------------------------
1 | main() {
2 | baseUse(); //基本使用
3 |
4 | op();
5 | }
6 |
7 | void op() {
8 | var dict = {"a": "page1", "b": "page30", "c": "page70", "price": 40};
9 | dict.keys.forEach(print); //a,b,c,price
10 | dict.values.forEach(print); //a,b,c,price
11 | dict.forEach((k, v) => (print("$k=$v"))); //这里用括号包着,好想吐槽...
12 | }
13 |
14 | int addOne(int num) {
15 | print(num + 1);
16 | }
17 |
18 | void baseUse() {
19 | dynamic d = 20;
20 | d = "toly";
21 |
22 | var list = new List();
23 | list.add("1");
24 | list.add(3);
25 |
26 | var list2 = new List();
27 | //list2.add("toly");//ERROR:The argument type 'String' can't be assigned to the parameter type 'int'.
28 | }
29 |
--------------------------------------------------------------------------------
/test/base/5_other.dart:
--------------------------------------------------------------------------------
1 | main() {
2 | baseUse(); //基本使用
3 | }
4 |
5 | void baseUse() {
6 | int a = 10;
7 |
8 | print(a / 3); //3.3333333333333335
9 | print(a ~/ 3); //3
10 |
11 | int b = 9;
12 | b = 5;
13 | b ??= a; //----如果b空的则赋值
14 | print(b); //5
15 |
16 | int c = 10;
17 | int d = 8;
18 | var add10 = c = null ?? d + 10; //取两边不为空的表达式
19 | print(add10); //18
20 |
21 |
22 | }
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/base/6_fun.dart:
--------------------------------------------------------------------------------
1 | main() {
2 | fun("toly"); //toly,24,null
3 | fun("toly", age: 24, sex: "男"); //toly,24,男
4 |
5 | fun2("toly", 24); //toly,24,null
6 |
7 | var power = (i) {
8 | return i * i;
9 | };
10 |
11 | print(power(6)); //36
12 |
13 | var li = [1, 2, 3, 4, 5];
14 | li.forEach((i) => print((i) {
15 | return i * i;
16 | }(i))); //1,4,9,16,25
17 |
18 | var funA = a();
19 | funA(); //0
20 | funA(); //1
21 | funA(); //2
22 | funA(); //3
23 | funA(); //4
24 | }
25 |
26 | fun(String name, {int age = 24, String sex}) {
27 | print("$name,$age,$sex");
28 | }
29 |
30 | fun2(String name, [int age, String sex = "男"]) {
31 | print("$name,$age,$sex");
32 | }
33 |
34 | a() {
35 | int a = 0;
36 |
37 | return () {
38 | print(a++);
39 | };
40 | }
41 |
--------------------------------------------------------------------------------
/test/base/7_class/person.dart:
--------------------------------------------------------------------------------
1 | class PerSon {
2 | String name;
3 | int age;
4 |
5 | PerSon(this.name, this.age);
6 |
7 | say(String name) {
8 | print("are you ok $name");
9 | }
10 | }
11 |
12 | class Student extends PerSon {
13 | String school;
14 |
15 | Student(String name, int age, this.school) : super(name, age);
16 | }
17 |
18 | main() {
19 | var toly = new PerSon("toly", 24);
20 | toly.say("ls"); //are you ok ls
21 |
22 | new Student("ls", 23, "星龙学院").say("toly");//are you ok toly
23 | }
24 |
--------------------------------------------------------------------------------
/test/base/8_io.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | main() async {
4 | wirte(r"C:\Users\Administrator\Desktop\dart\应龙.txt");
5 | // await judgeDirOrCreate();
6 | }
7 |
8 | wirte(name) async{
9 | var file = File(name);
10 | // file.writeAsString("海的彼岸有我未曾见证的风采",mode: FileMode.append);
11 |
12 | file.watch().listen((d){
13 |
14 | });
15 | }
16 |
17 | //根据名称读取文件
18 | readFile(name) async {
19 | //创建文件对象
20 | var file = File(name);
21 | try {
22 | //判断是否存在
23 | bool exists = await file.exists();
24 | if (exists) {
25 | //如果存在
26 | print(await file.length()); //文件大小(字节)---137
27 | print(await file.lastModified()); //最后修改时间---2018-12-21 13:49:35.000
28 | print(file.parent.path); //获取父文件夹的路径---C:\Users\Administrator\Desktop\dart
29 | return await file.readAsString(); //读取文件并返回
30 | } else {
31 | await file.create(recursive: true); //不存在则创建文件
32 | return "未发现文件,已为您创建!Dart机器人:2333";
33 | }
34 | } catch (e) {
35 | //异常处理
36 | print(e);
37 | }
38 | }
39 |
40 | judgeDirOrCreate(String dirPath) async {
41 | var targetDir = Directory(dirPath);
42 | if (!await targetDir.exists()) {
43 | targetDir.parent.create();
44 | }
45 | }
46 |
47 | readOk() async {
48 | var result = await readFile(r"C:\Users\Administrator\Desktop\dart\应龙.txt");
49 | print(result);
50 | }
51 |
--------------------------------------------------------------------------------
/test/base/9_net.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:http/http.dart' as client;
4 |
5 | class ResultBean {
6 | String msg;
7 | int code;
8 | var data;
9 |
10 | ResultBean.fromJson(Map map)
11 | : msg = map['msg'],
12 | code = map['code'],
13 | data = map['data'];
14 | }
15 |
16 | class NoteBean {
17 | int id;
18 | String type;
19 | String name;
20 | String localPath;
21 | String jianshuUrl;
22 | String juejinUrl;
23 | String imgUrl;
24 | String createTime;
25 | String info;
26 | String area;
27 |
28 | NoteBean.fromJson(Map map)
29 | : id = map['id'],
30 | name = map['name'],
31 | localPath = map['localPath'],
32 | jianshuUrl = map['jianshuUrl'],
33 | juejinUrl = map['juejinUrl'],
34 | imgUrl = map['imgUrl'],
35 | createTime = map['createTime'],
36 | info = map['info'],
37 | area = map['area'];
38 | }
39 |
40 | main() {
41 | var j ='{"code":200,"msg":"操作成功","data":[{"id":198,"type":"绘图相关","name":"","localPath":"---","jianshuUrl":"","juejinUrl":"---","imgUrl":"http://toly1994.com:8089/imgs/android/8a11d27d58f4c1fa4488cf39fdf68e76.png","createTime":"2021-02-18","info":"hh","area":"A"},{"id":200,"type":"绘图相关","name":"","localPath":"---","jianshuUrl":"","juejinUrl":"---","imgUrl":"http://toly1994.com:8089/imgs/android/8a11d27d58f4c1fa4488cf39fdf68e76.png","createTime":"2018-12-21","info":"hh","area":"A"}]}';
42 | var result = ResultBean.fromJson(json.decode(j));
43 | // print(NoteBean.fromJson(result.data[1]).imgUrl);//http://toly1994.com:8089/imgs/android/8a11d27d58f4c1fa4488cf39fdf68e76.png
44 |
45 |
46 | // getData((data) {
47 | //// print(data);
48 | //
49 | //
50 | ////
51 | //// var resultBean = ResultBean.fromJson(json.decode(data));
52 | //// print(resultBean);
53 | // });
54 |
55 | ////一个JSON格式的用户列表字符串
56 | // String jsonStr = '[{"name":"Jack"},{"name":"Rose"}]';
57 | ////将JSON字符串转为Dart对象(此处是List)
58 | // List items = json.decode(jsonStr);
59 | ////输出第一个用户的姓名
60 | // print(items[0]["name"]);
61 |
62 | // getData2().then((data) {
63 | // print(data);
64 | // });
65 |
66 | // add((data) {
67 | // print(data);
68 | // });
69 |
70 | // set((data) {
71 | // print(data);
72 | // });
73 | // delete((data) {
74 | // print(data);
75 | // });
76 | }
77 |
78 | getData(cbk) async {
79 | var api = 'http://www.toly1994.com:8089/api/android/note/100';
80 | try {
81 | final response = await client.get(api);
82 | if (response.statusCode == 200) {
83 | cbk(response.body);
84 | }
85 | } catch (e) {
86 | print(e);
87 | }
88 | }
89 |
90 | add(cbk) async {
91 | var api = 'http://192.168.43.60:8089/api/android/note';
92 | var item = {
93 | "type": "C",
94 | "name": "插入测试",
95 | "localPath": "null",
96 | "jianshuUrl": "https://www.jianshu.com/p/12f8ab32591a",
97 | "juejinUrl": "null",
98 | "imgUrl":
99 | "http://toly1994.com:8089/imgs/android/c3af376135a7abe0655c908195b271db.png",
100 | "createTime": "2018-09-06",
101 | "info": "null",
102 | "area": "A"
103 | };
104 |
105 | try {
106 | final response = await client.post(api, body: item);
107 |
108 | if (response.statusCode == 200) {
109 | cbk(response.body);
110 | }
111 | } catch (e) {
112 | print(e);
113 | }
114 | }
115 |
116 | set(cbk) async {
117 | var api = 'http://192.168.43.60:8089/api/android/note/199';
118 | var item = {
119 | "type": "C",
120 | "name": "修改测试",
121 | "localPath": "null",
122 | "jianshuUrl": "https://www.jianshu.com/p/12f8ab32591a",
123 | "juejinUrl": "null",
124 | "imgUrl":
125 | "http://toly1994.com:8089/imgs/android/c3af376135a7abe0655c908195b271db.png",
126 | "createTime": "2018-09-06",
127 | "info": "null",
128 | "area": "A"
129 | };
130 |
131 | try {
132 | final response = await client.put(api, body: item);
133 |
134 | if (response.statusCode == 200) {
135 | cbk(response.body);
136 | }
137 | } catch (e) {
138 | print(e);
139 | }
140 | }
141 |
142 | delete(cbk) async {
143 | var api = 'http://192.168.43.60:8089/api/android/note/199';
144 |
145 | try {
146 | final response = await client.delete(api);
147 |
148 | if (response.statusCode == 200) {
149 | cbk(response.body);
150 | }
151 | } catch (e) {
152 | print(e);
153 | }
154 | }
155 |
156 | Future getData2() async {
157 | try {
158 | final response =
159 | await client.get('http://www.toly1994.com:8089/api/android/note/100');
160 | if (response.statusCode == 200) {
161 | return response.body;
162 | }
163 | } catch (e) {
164 | print(e);
165 | }
166 | return null;
167 | }
168 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:toly/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/tran.py:
--------------------------------------------------------------------------------
1 | # coding: u8
2 |
3 | import re
4 | from pathlib import Path
5 |
6 |
7 | ROOT = Path(__file__).resolve().parent
8 | MAIN = ROOT
9 |
10 |
11 | # 将 iconfont 的 css 自动转换为 dart 代码
12 |
13 | def translate():
14 | print('Begin translate...')
15 |
16 | code = """
17 | import 'package:flutter/widgets.dart';
18 |
19 |
20 | // 代码由程序自动生成。
21 | // 请不要对此文件做任何修改。详细说明见本文件末尾
22 |
23 |
24 | class MyIconFont {
25 |
26 | MyIconFont._();
27 |
28 | static const font_name = 'MyIconFont';
29 |
30 | {icon_codes}
31 |
32 | /*
33 | 如果你有新的图标需要导入到字体中:
34 |
35 | 1. 联系我,将你加入到 iconfont(http://www.iconfont.cn) 的 xxx 项目中
36 | 2. 在 iconfont 中选择需要的图标,加入购物车
37 | 3. 然后点击顶部的购物车,弹出右边栏,选择“添加到项目”,选择 xxx,点击“确定”
38 | 4. 最好修改一下每个新增图标的名称,然后下载至本地
39 | 5. 将压缩包内所有文件拷贝到 iconfont 目录下,形如:
40 | iconfont
41 | ├── demo.css
42 | ├── demo_fontclass.html
43 | ├── demo_symbol.html
44 | ├── demo_unicode.html
45 | ├── iconfont.css
46 | ├── iconfont.eot
47 | ├── iconfont.js
48 | ├── iconfont.svg
49 | ├── iconfont.ttf
50 | └── iconfont.woff
51 |
52 | 6. 拷贝完成后通过以下命令完成转换:
53 | $ python3 ./translate_icon_font_from_css_to_dart.py
54 | 7. 其中转换时需要 iconfont.ttf 和 iconfont.css 文件;实际项目运行时只需要 iconfont.ttf 文件。其余文件不需要。
55 | 8. 开发时,通过右键 demo_fontclass.html 使用 Chrome 打开来查看图标对应的 unicode 码,使用时,将中划线“-”替换为下划线“_”。
56 | */
57 | }
58 | """.strip()
59 |
60 | strings = []
61 |
62 | tmp = []
63 | p = re.compile(r'.icon-(.*?):.*?"\\(.*?)";')
64 | for line in open(MAIN / 'iconfont/iconfont.css'):
65 | line = line.strip()
66 | if line:
67 | res = p.findall(line)
68 | if res:
69 | name, value = res[0]
70 | name = name.replace('-', '_')
71 | tmp.append((name.lower(), value))
72 |
73 | tmp.sort()
74 | for name, value in tmp:
75 | string = f' static const IconData {name} = const IconData(0x{value}, fontFamily: font_name);'
76 | strings.append(string)
77 |
78 | strings = '\n'.join(strings)
79 | code = code.replace('{icon_codes}', strings)
80 |
81 | open(MAIN / 'lib/iconfont.dart', 'w').write(code)
82 |
83 | print('Finish translate...')
84 |
85 |
86 | if __name__ == "__main__":
87 | translate()
--------------------------------------------------------------------------------