├── .gitignore
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── best_architecture_challenge
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── 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-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── doc_img
├── clean_architecture_all.png
├── clean_circle.jpeg
├── clean_circle.png
├── cover.jpg
├── data_flow.png
├── data_layer.png
├── device-2021-07-11-214737.png
├── device-2021-07-11-214813.png
├── domain_layer.png
├── get_page.png
├── presentation_layer.png
└── screenshot.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── 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
│ └── Runner-Bridging-Header.h
├── lib
├── core
│ ├── core_injection.dart
│ ├── domain
│ │ ├── base_usecase.dart
│ │ └── fetch_post_usecase.dart
│ ├── model
│ │ └── post.dart
│ ├── provider
│ │ ├── post_api.dart
│ │ └── post_api.g.dart
│ └── repository
│ │ ├── post_repository.dart
│ │ └── post_repository_impl.dart
├── main.dart
├── res
│ ├── colors.dart
│ ├── dimens.dart
│ ├── gaps.dart
│ └── styles.dart
├── routes
│ ├── app_pages.dart
│ └── app_routes.dart
└── screens
│ ├── components
│ └── post_tile.dart
│ └── home
│ ├── bindings
│ └── home_bindings.dart
│ ├── controllers
│ └── home_controller.dart
│ └── views
│ └── home_view.dart
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ └── Flutter-Release.xcconfig
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── app_icon_1024.png
│ │ ├── app_icon_128.png
│ │ ├── app_icon_16.png
│ │ ├── app_icon_256.png
│ │ ├── app_icon_32.png
│ │ ├── app_icon_512.png
│ │ └── app_icon_64.png
│ ├── Base.lproj
│ └── MainMenu.xib
│ ├── Configs
│ ├── AppInfo.xcconfig
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
├── pubspec.yaml
└── test
├── post_api_test.dart
├── presentation_test.dart
├── presentation_test.mocks.dart
├── raw.dart
├── repository_test.dart
├── repository_test.mocks.dart
├── usecase_test.dart
└── usecase_test.mocks.dart
/.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 | .classpath
21 | .project
22 | .settings/
23 | .vscode/
24 |
25 | # Flutter repo-specific
26 | /bin/cache/
27 | /bin/internal/bootstrap.bat
28 | /bin/internal/bootstrap.sh
29 | /bin/mingit/
30 | /dev/benchmarks/mega_gallery/
31 | /dev/bots/.recipe_deps
32 | /dev/bots/android_tools/
33 | /dev/devicelab/ABresults*.json
34 | /dev/docs/doc/
35 | /dev/docs/flutter.docs.zip
36 | /dev/docs/lib/
37 | /dev/docs/pubspec.yaml
38 | /dev/integration_tests/**/xcuserdata
39 | /dev/integration_tests/**/Pods
40 | /packages/flutter/coverage/
41 | version
42 | analysis_benchmark.json
43 |
44 | # packages file containing multi-root paths
45 | .packages.generated
46 |
47 | # Flutter/Dart/Pub related
48 | **/doc/api/
49 | .dart_tool/
50 | .flutter-plugins
51 | .flutter-plugins-dependencies
52 | **/generated_plugin_registrant.dart
53 | .packages
54 | .pub-cache/
55 | .pub/
56 | build/
57 | flutter_*.png
58 | linked_*.ds
59 | unlinked.ds
60 | unlinked_spec.ds
61 |
62 | # Android related
63 | **/android/**/gradle-wrapper.jar
64 | **/android/.gradle
65 | **/android/captures/
66 | **/android/gradlew
67 | **/android/gradlew.bat
68 | **/android/local.properties
69 | **/android/**/GeneratedPluginRegistrant.java
70 | **/android/key.properties
71 | *.jks
72 |
73 | # iOS/XCode related
74 | **/ios/**/*.mode1v3
75 | **/ios/**/*.mode2v3
76 | **/ios/**/*.moved-aside
77 | **/ios/**/*.pbxuser
78 | **/ios/**/*.perspectivev3
79 | **/ios/**/*sync/
80 | **/ios/**/.sconsign.dblite
81 | **/ios/**/.tags*
82 | **/ios/**/.vagrant/
83 | **/ios/**/DerivedData/
84 | **/ios/**/Icon?
85 | **/ios/**/Pods/
86 | **/ios/**/.symlinks/
87 | **/ios/**/profile
88 | **/ios/**/xcuserdata
89 | **/ios/.generated/
90 | **/ios/Flutter/.last_build_id
91 | **/ios/Flutter/App.framework
92 | **/ios/Flutter/Flutter.framework
93 | **/ios/Flutter/Flutter.podspec
94 | **/ios/Flutter/Generated.xcconfig
95 | **/ios/Flutter/ephemeral
96 | **/ios/Flutter/app.flx
97 | **/ios/Flutter/app.zip
98 | **/ios/Flutter/flutter_assets/
99 | **/ios/Flutter/flutter_export_environment.sh
100 | **/ios/ServiceDefinitions.json
101 | **/ios/Runner/GeneratedPluginRegistrant.*
102 |
103 | # macOS
104 | **/macos/Flutter/GeneratedPluginRegistrant.swift
105 |
106 | # Coverage
107 | coverage/
108 |
109 | # Symbols
110 | app.*.symbols
111 |
112 | # Exceptions to above rules.
113 | !**/ios/**/default.mode1v3
114 | !**/ios/**/default.mode2v3
115 | !**/ios/**/default.pbxuser
116 | !**/ios/**/default.perspectivev3
117 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
118 | !/dev/ci/**/Gemfile.lock
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
5 | # 📢📢📢 Flutter Best Architecture Challenge 📢📢📢
6 |
7 | **「此為參加 Flutter Best Architecture Challenge 活動的專案」**
8 |
9 | **聯絡方式:clementlin321@gmail.com**
10 |
11 | Hi, This is Clement
12 |
13 | 感謝Flutter Taipei舉辦這個活動解救WFH到快悶死的我XD
14 |
15 | 本次我採用的是經典Clean Architecture架構,雖然對這項目來說跟用光劍殺螞蟻沒兩樣,
16 | 但是專案規模越大,你越能感受Clean Architecture的優勢,畫面、業務邏輯、資料…職責明確的分層,
17 | 高複用性、以及高測試性,會節省你許多維護時間。
18 |
19 |
20 |

21 |
22 |
23 | 上圖是`Clean Architecture`的概念圖,架構中有四個角色,以及一條`Dependecy Rule`,線的方向代表依賴關係,外層依賴內層,每一層除了內層成員外,不知道外層發生的任何事,例如:`UseCases`能使用`Entities`提供的對外接口,本身也提供對外接口。
24 |
25 | 四個角色分別是:
26 |
27 | * **Entities**:也能理解為Model。
28 |
29 | * **UseCases**:usecase持有Entities,負責操作Entities資料存取以及管理商業邏輯,本身提供Presenter層使用。
30 |
31 | * **Presenters**:提供接口給UI呼叫,使用UseCase操作商業邏輯。
32 |
33 | * **UI**:UI、tools、framework都是屬於這塊。
34 |
35 | ## Project Structure
36 |
37 | ```yaml
38 | - /lib
39 | - /core
40 | # Core包含usecase,repository、remote/local data,必要時可以獨立一個module
41 | - /domain # UseCase
42 | - /model # json bean
43 | - /provider
44 | - /post_api.dart # api, db...etc
45 | - /repository
46 | - core_injection.dart # core的整體di
47 | - /res
48 | # 顏色、SizeBox、TextStyle…等列舉
49 | - /colors.dart
50 | - /gaps.dart
51 | - /styles.dart
52 | - /routes # 路由導航宣告
53 | - /app_pages.dart
54 | - /app_routes.dart
55 | - /screens
56 | - /components # 共同custom widget
57 | - /home # 主頁
58 | - /bindings
59 | - /home_bindins.dart
60 | - /controller
61 | - /home_controller.dart
62 | - /views
63 | - /home_view
64 | - main.dart
65 |
66 | ```
67 |
68 | ## Clean Architecture in Flutter
69 |
70 |
71 |

72 |
73 |
74 | Clean Architecture在Flutter實作上可以理解成MVVM + Repository pattern的組合(同Android主流架構),有一點很重要Domain Layer及Data Layer內是純Dart Code不能有Widget元素在其中。
75 |
76 | 假設我們從上帝視角來看一個專案可以分成三個部份:
77 |
78 | * Presentation Layer:View、Controller(ViewModel)
79 |
80 | * Domain Layer:UseCase,封裝業務邏輯來提高複用性
81 |
82 | * Data Layer:實作Repository pattern,處理資料(Remote、Local)
83 |
84 | ### Data Layer
85 |
86 |
87 |

88 |
89 |
90 | 我們用[Dio](https://pub.dev/packages/dio)來處理http request取得Remote Data,接著為了方便我們建立api,使用[retrofit](https://pub.dev/packages/retrofit)來快速産生api class(Android的同學對retrofit應該很熟悉)。
91 |
92 | ```dart
93 | part 'post_api.g.dart';
94 |
95 | @RestApi(baseUrl: "https://jsonplaceholder.typicode.com")
96 | abstract class PostApi {
97 | factory PostApi(Dio dio, {String baseUrl}) = _PostApi;
98 |
99 | @GET("/posts")
100 | @NoBody()
101 | Future> getPosts();
102 | }
103 | ```
104 |
105 | Dio建立搭配[dio_log](https://pub.dev/packages/dio_log)方便debug,視覺化的log紀錄,對request, response一目了指。
106 |
107 | Model層實作Repository Pattern只專注於資料存取,Repository是倉庫的意思,它掌管所有資料的入口,UseCase一律透過Repository來存取資料。Call Api和存取本地儲存(資料庫/Shared Preferences)都在Repository內執行。
108 |
109 | ```dart
110 | abstract class PostRepository {
111 |
112 | Future> fetchPosts();
113 | }
114 | ```
115 |
116 | ```dart
117 | class PostRepositoryImpl implements PostRepository {
118 |
119 | final PostApi _postApi;
120 |
121 | PostRepositoryImpl(this._postApi);
122 |
123 | @override
124 | Future> fetchPosts() {
125 | return _postApi.getPosts();
126 | }
127 | }
128 | ```
129 | ### Domain Layer
130 |
131 |
132 |

133 |
134 |
135 | `UseCase` 封裝商業邏輯,目的是提高其複用性。
136 |
137 | UseCase跟其它class命名不同,因為`UseCase`使用上跟function相同,所以要用`動詞+名詞`組成如`GetUserInfoUseCase`。
138 |
139 | ```dart
140 | class FetchPostUseCase extends UseCase {
141 | FetchPostUseCase(PostRepository repository) : super(repository);
142 |
143 | @override
144 | void dispose() {}
145 |
146 | @override
147 | Future> execute(FetchPostUseCaseParams param) {
148 | return repository.fetchPosts();
149 | }
150 | }
151 |
152 | class FetchPostUseCaseParams {
153 | FetchPostUseCaseParams();
154 | }
155 | ```
156 |
157 | ### Presentation Layer
158 |
159 | View、ViewModel(or Controller)都是Presentation Layer的一員,同MVVM架構的精神,View與ViewModel兩者間屬綁定關係,View顯示的資料由ViewModel提供,View並不會主動更新而是根據資料改變才刷新。使用者互動由ViewModel還提供function處理,ViewModel擁有Domain Layer的UseCase來處理商業邏輯。
160 |
161 | 實作上使用[GetX](https://pub.dev/packages/get)建構整個App,GetX是Flutter目前最具野心的lib,除了三大主要功能:State Manager、Navigation Manager、Dependencies Manager之外,你也可以透過GetX管理Theme、多國語系、No-SQL storage。
162 |
163 |
164 |

165 |
166 |
167 | 一個base GetX的UI結構有三個角色,View、Bindings、Controller(ViewModel),View毫無反應就是個Widget,Controller繼承GetxController並提供UI需要的資料或事件,再來透過Bindings綁定View與Controller,你就能在Controller中得到View生命周期的callback
168 |
169 | #### Controller
170 |
171 | 在GetX你可以簡單用`.obs`宣告一個同`Stream`的效果,而不需要建立許多StreamContoller
172 |
173 | ```dart
174 | class HomeController extends GetxController {
175 | ...
176 | //提供UI綁定的資料
177 | final postList = [].obs;
178 | final _isSortByTitle = false.obs;
179 | ...
180 | }
181 | ```
182 |
183 | View生命周期的callback
184 |
185 | ```dart
186 | class HomeController extends GetxController {
187 | ...
188 | @override
189 | void onReady() {
190 | _fetchPosts();
191 | ever(_isSortByTitle, (value) => doSortBy(value));
192 | super.onReady();
193 | }
194 |
195 | @override
196 | void onClose() {
197 | postList.close();
198 | _isSortByTitle.close();
199 | super.onClose();
200 | }
201 |
202 | ...
203 | }
204 | ```
205 |
206 | 這段用到GetX的[Worker](https://github.com/jonataslaw/getx/blob/master/documentation/en_US/state_management.md#workers),意思是每當`_isSortByTitle`的值有變化,都是進後方callback。
207 |
208 | ```dart
209 | ever(_isSortByTitle, (value) => doSortBy(value));
210 | ```
211 |
212 | View上互動經由Controller提供的func呼叫usecase
213 |
214 | ```dart
215 | class HomeController extends GetxController {
216 | final FetchPostUseCase _fetchPostUseCase;
217 |
218 | HomeController(this._fetchPostUseCase);
219 |
220 | ...
221 |
222 | void _fetchPosts() {
223 | _fetchPostUseCase.execute(FetchPostUseCaseParams()).then((value) {
224 | postList.clear();
225 | postList.addAll(value);
226 | update();
227 | }).catchError((ex) {
228 | print(ex);
229 | });
230 | }
231 |
232 | doSortBy(bool isSortByTitle) {
233 | if (postList.isEmpty) return;
234 |
235 | postList.sort((a, b) {
236 | if (isSortByTitle)
237 | return a.title.compareTo(b.title);
238 | else
239 | return a.id.compareTo(b.id);
240 | });
241 | update();
242 | }
243 | }
244 | ```
245 |
246 | Controller的[完整Code](https://github.com/clementlinnn/BestArchitectureChallenge/blob/main/lib/screens/home/controllers/home_controller.dart)
247 |
248 | Bindings綁定View與Controller,不僅做Dependency Injection也綁定二者,讓Controller能觀察View的生命周期。
249 |
250 | ```dart
251 | class HomeBindings extends Bindings {
252 |
253 | @override
254 | void dependencies() {
255 | Get.lazyPut(() => HomeController(Get.find()));
256 | }
257 | }
258 | ```
259 |
260 | GetX DI可參考[這裡](https://github.com/jonataslaw/getx/blob/master/documentation/en_US/dependency_management.md)
261 |
262 | #### View
263 |
264 | View 建議用`GetView`,內建一個Controller方便使用
265 |
266 | ```dart
267 | class HomeView extends GetView {}
268 | ```
269 |
270 | 畫面更新對應Controller提供的`.obs`事件
271 |
272 | ```dart
273 | Obx(() => Text('Posts: ${controller.postList.length}', style: TextStyles.textBold22,))
274 | ```
275 |
276 | 當controller.postList有所變化`Obx`內的Widget便會刷新,對於ListView可以用GetBuilder建構
277 |
278 | ```dart
279 | GetBuilder(
280 | builder: (_controller) {
281 | return ListView.separated(
282 | itemCount: _controller.postList.length,
283 | itemBuilder: (context, index) {
284 | return PostTile(
285 | item: _controller.postList[index]);
286 | },
287 | separatorBuilder: (context, index) {
288 | return Divider();
289 | },
290 | );
291 | },
292 | ),
293 | ```
294 |
295 |
296 | ### GetMaterialApp
297 |
298 | 要使用GetX,首先要把MaterialApp換成GetMaterialApp即可。你可以設定路由、語系…等功能。
299 |
300 | ```dart
301 | GetMaterialApp(
302 | theme: ThemeData(
303 | primarySwatch: Colors.deepPurple,
304 | ),
305 | translations: Messages(), //你的翻譯
306 | locale: Locale('en', 'US'), //當前語系
307 | fallbackLocale: Locale('en', 'UK'), //預設語系,如當前語系無資料
308 | initialRoute: AppPages.INITIAL, //首頁
309 | getPages: AppPages.routes, //路由宣告
310 | );
311 | ```
312 |
313 | ```dart
314 | class AppPages {
315 | static const INITIAL = Routes.HOME;
316 |
317 | static final routes = [
318 | GetPage(name: '/', page: () => HomeView(), binding: HomeBindings()),
319 | ];
320 | }
321 |
322 | abstract class Routes {
323 | static const HOME ='/';
324 | }
325 | ```
326 |
327 | 更多多國語系看[這裡](https://github.com/jonataslaw/getx#internationalization)
328 |
329 | 更多路由導航看[這裡](https://github.com/jonataslaw/getx/blob/master/documentation/en_US/route_management.md)
330 |
331 | ## Testing
332 |
333 | Clean Architecture由於職責分層在測試上很有優勢,基本上針對每層寫測試即可,比較有難度大概就是UI上的測試。Flutter的測試我還在學習當中,如果有觀念有誤或有更好的寫法歡迎指教!!
334 |
335 | ### Testing http request
336 |
337 | 使用[http_mock_adapter](https://pub.dev/packages/http_mock_adapter)mock server提供資料回傳
338 |
339 | ```dart
340 | late PostApi postApi;
341 |
342 | setUp(() {
343 | Dio dio = Dio();
344 | postApi = PostApi(dio, baseUrl: BaseUrl);
345 | DioAdapter dioAdapter = DioAdapter();
346 |
347 | dio.httpClientAdapter = dioAdapter;
348 | dioAdapter.onGet('/posts', (request) => request.reply(200, testPosts));
349 | });
350 |
351 | test('request posts', () async {
352 | final response = await postApi.getPosts();
353 |
354 | expect(testPosts.length, response.length);
355 | expect(testPosts[0].userId, response[0].userId);
356 | expect(testPosts[0].id, response[0].id);
357 | expect(testPosts[0].title, response[0].title);
358 | expect(testPosts[0].body, response[0].body);
359 | });
360 | ```
361 |
362 | ### Testing Repository/UseCase
363 |
364 | repository及usecase皆有di,所以用[mockito](https://pub.dev/packages/mockito) mock注入。
365 |
366 | 並用`when`設定相對應回傳。
367 |
368 | ```dart
369 | //Repository Test
370 | //設定要mock的類別,再跑build_runner建立
371 | @GenerateMocks([PostApi])
372 | void main() async {
373 | late PostRepository postRepository;
374 |
375 | group('repository test', () {
376 |
377 | PostApi postApi = MockPostApi();
378 | setUp(() {
379 | postRepository = PostRepositoryImpl(postApi);
380 | when(postApi.getPosts()).thenAnswer((_) async => Future.value(testPosts));
381 | });
382 | ...
383 | });
384 | }
385 | ```
386 |
387 | ```dart
388 | // UseCase Test
389 | //mock PostRepositoryImpl
390 | @GenerateMocks([PostRepositoryImpl])
391 | void main() async {
392 |
393 | group('repository test', () {
394 | late FetchPostUseCase fetchPostUseCase;
395 |
396 | setUp(() {
397 | final mockRepo = MockPostRepositoryImpl();
398 | fetchPostUseCase = FetchPostUseCase(mockRepo);
399 | when(mockRepo.fetchPosts()).thenAnswer((_) async => Future.value(testPosts));
400 | });
401 | ...
402 | });
403 | }
404 | ```
405 |
406 | ### Testing View/Controller
407 |
408 | 由於View與Controller資料是綁定關係,所以我們一起測試。
409 |
410 | 在`setUp()`先準備好Mock的UseCase的行為及Controller的DI。
411 |
412 | ```dart
413 | setUp(() {
414 | final fetchPostUseCase = MockFetchPostUseCase();
415 | Get.put(fetchPostUseCase);
416 | controller =
417 | Get.put(HomeController(fetchPostUseCase));
418 |
419 | when(fetchPostUseCase.execute(any))
420 | .thenAnswer((_) => Future.value(testPosts));
421 | });
422 | ```
423 |
424 | 接著pump一個GetMaterialApp環境,對`HomeView`進行測試,分別驗證post count,與兩種排序是否正確。
425 |
426 | ```dart
427 | testWidgets('Home test', (tester) async {
428 | await tester.pumpWidget(GetMaterialApp(
429 | theme: ThemeData(
430 | primarySwatch: Colors.deepPurple,
431 | ),
432 | initialRoute: '/',
433 | getPages: [GetPage(name: '/', page: () => HomeView())],
434 | ));
435 |
436 | expect(find.text('Posts: 2'), findsOneWidget);
437 |
438 | //找出widget
439 | await tester.tap(find.byIcon(Icons.sort));
440 | await tester.pump();
441 |
442 | //delay 1秒讓畫面反應
443 | await tester.pump(const Duration(seconds: 1));
444 |
445 | //點擊title排序
446 | await tester.tap(find.text('使用title排序'));
447 | await tester.pump();
448 |
449 | //delay 2秒
450 | await tester.pump(const Duration(seconds: 2));
451 |
452 | //驗證是否正確依title排序
453 | expect(testPosts[1].title, controller.postList[0].title);
454 |
455 | //同樣步驟驗證id排序
456 | await tester.tap(find.byIcon(Icons.sort));
457 | await tester.pump();
458 | await tester.pump(const Duration(seconds: 1));
459 | await tester.tap(find.text('使用id排序'));
460 | await tester.pump();
461 | await tester.pump(const Duration(seconds: 2));
462 | expect(testPosts[0].title, controller.postList[0].title);
463 | });
464 | ```
465 |
466 | ### Ref.
467 |
468 | https://medium.com/stepstone-tech/clean-architecture-with-reactive-use-cases-c943d7a8f69c
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/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 plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 30
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | defaultConfig {
36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37 | applicationId "com.example.best_architecture_challenge"
38 | minSdkVersion 16
39 | targetSdkVersion 30
40 | versionCode flutterVersionCode.toInteger()
41 | versionName flutterVersionName
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 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59 | }
60 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
21 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/best_architecture_challenge/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.best_architecture_challenge
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
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.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/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-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/doc_img/clean_architecture_all.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/clean_architecture_all.png
--------------------------------------------------------------------------------
/doc_img/clean_circle.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/clean_circle.jpeg
--------------------------------------------------------------------------------
/doc_img/clean_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/clean_circle.png
--------------------------------------------------------------------------------
/doc_img/cover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/cover.jpg
--------------------------------------------------------------------------------
/doc_img/data_flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/data_flow.png
--------------------------------------------------------------------------------
/doc_img/data_layer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/data_layer.png
--------------------------------------------------------------------------------
/doc_img/device-2021-07-11-214737.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/device-2021-07-11-214737.png
--------------------------------------------------------------------------------
/doc_img/device-2021-07-11-214813.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/device-2021-07-11-214813.png
--------------------------------------------------------------------------------
/doc_img/domain_layer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/domain_layer.png
--------------------------------------------------------------------------------
/doc_img/get_page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/get_page.png
--------------------------------------------------------------------------------
/doc_img/presentation_layer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/presentation_layer.png
--------------------------------------------------------------------------------
/doc_img/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/doc_img/screenshot.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
--------------------------------------------------------------------------------
/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? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/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 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXCopyFilesBuildPhase section */
19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
20 | isa = PBXCopyFilesBuildPhase;
21 | buildActionMask = 2147483647;
22 | dstPath = "";
23 | dstSubfolderSpec = 10;
24 | files = (
25 | );
26 | name = "Embed Frameworks";
27 | runOnlyForDeploymentPostprocessing = 0;
28 | };
29 | /* End PBXCopyFilesBuildPhase section */
30 |
31 | /* Begin PBXFileReference section */
32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | );
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXFrameworksBuildPhase section */
56 |
57 | /* Begin PBXGroup section */
58 | 9740EEB11CF90186004384FC /* Flutter */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
65 | );
66 | name = Flutter;
67 | sourceTree = "";
68 | };
69 | 97C146E51CF9000F007C117D = {
70 | isa = PBXGroup;
71 | children = (
72 | 9740EEB11CF90186004384FC /* Flutter */,
73 | 97C146F01CF9000F007C117D /* Runner */,
74 | 97C146EF1CF9000F007C117D /* Products */,
75 | );
76 | sourceTree = "";
77 | };
78 | 97C146EF1CF9000F007C117D /* Products */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 97C146EE1CF9000F007C117D /* Runner.app */,
82 | );
83 | name = Products;
84 | sourceTree = "";
85 | };
86 | 97C146F01CF9000F007C117D /* Runner */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
92 | 97C147021CF9000F007C117D /* Info.plist */,
93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
97 | );
98 | path = Runner;
99 | sourceTree = "";
100 | };
101 | /* End PBXGroup section */
102 |
103 | /* Begin PBXNativeTarget section */
104 | 97C146ED1CF9000F007C117D /* Runner */ = {
105 | isa = PBXNativeTarget;
106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107 | buildPhases = (
108 | 9740EEB61CF901F6004384FC /* Run Script */,
109 | 97C146EA1CF9000F007C117D /* Sources */,
110 | 97C146EB1CF9000F007C117D /* Frameworks */,
111 | 97C146EC1CF9000F007C117D /* Resources */,
112 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
114 | );
115 | buildRules = (
116 | );
117 | dependencies = (
118 | );
119 | name = Runner;
120 | productName = Runner;
121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
122 | productType = "com.apple.product-type.application";
123 | };
124 | /* End PBXNativeTarget section */
125 |
126 | /* Begin PBXProject section */
127 | 97C146E61CF9000F007C117D /* Project object */ = {
128 | isa = PBXProject;
129 | attributes = {
130 | LastUpgradeCheck = 1020;
131 | ORGANIZATIONNAME = "";
132 | TargetAttributes = {
133 | 97C146ED1CF9000F007C117D = {
134 | CreatedOnToolsVersion = 7.3.1;
135 | LastSwiftMigration = 1100;
136 | };
137 | };
138 | };
139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
140 | compatibilityVersion = "Xcode 9.3";
141 | developmentRegion = en;
142 | hasScannedForEncodings = 0;
143 | knownRegions = (
144 | en,
145 | Base,
146 | );
147 | mainGroup = 97C146E51CF9000F007C117D;
148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
149 | projectDirPath = "";
150 | projectRoot = "";
151 | targets = (
152 | 97C146ED1CF9000F007C117D /* Runner */,
153 | );
154 | };
155 | /* End PBXProject section */
156 |
157 | /* Begin PBXResourcesBuildPhase section */
158 | 97C146EC1CF9000F007C117D /* Resources */ = {
159 | isa = PBXResourcesBuildPhase;
160 | buildActionMask = 2147483647;
161 | files = (
162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
166 | );
167 | runOnlyForDeploymentPostprocessing = 0;
168 | };
169 | /* End PBXResourcesBuildPhase section */
170 |
171 | /* Begin PBXShellScriptBuildPhase section */
172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173 | isa = PBXShellScriptBuildPhase;
174 | buildActionMask = 2147483647;
175 | files = (
176 | );
177 | inputPaths = (
178 | );
179 | name = "Thin Binary";
180 | outputPaths = (
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | shellPath = /bin/sh;
184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185 | };
186 | 9740EEB61CF901F6004384FC /* Run Script */ = {
187 | isa = PBXShellScriptBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | );
191 | inputPaths = (
192 | );
193 | name = "Run Script";
194 | outputPaths = (
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | shellPath = /bin/sh;
198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199 | };
200 | /* End PBXShellScriptBuildPhase section */
201 |
202 | /* Begin PBXSourcesBuildPhase section */
203 | 97C146EA1CF9000F007C117D /* Sources */ = {
204 | isa = PBXSourcesBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
209 | );
210 | runOnlyForDeploymentPostprocessing = 0;
211 | };
212 | /* End PBXSourcesBuildPhase section */
213 |
214 | /* Begin PBXVariantGroup section */
215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
216 | isa = PBXVariantGroup;
217 | children = (
218 | 97C146FB1CF9000F007C117D /* Base */,
219 | );
220 | name = Main.storyboard;
221 | sourceTree = "";
222 | };
223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
224 | isa = PBXVariantGroup;
225 | children = (
226 | 97C147001CF9000F007C117D /* Base */,
227 | );
228 | name = LaunchScreen.storyboard;
229 | sourceTree = "";
230 | };
231 | /* End PBXVariantGroup section */
232 |
233 | /* Begin XCBuildConfiguration section */
234 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
235 | isa = XCBuildConfiguration;
236 | buildSettings = {
237 | ALWAYS_SEARCH_USER_PATHS = NO;
238 | CLANG_ANALYZER_NONNULL = YES;
239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
240 | CLANG_CXX_LIBRARY = "libc++";
241 | CLANG_ENABLE_MODULES = YES;
242 | CLANG_ENABLE_OBJC_ARC = YES;
243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
244 | CLANG_WARN_BOOL_CONVERSION = YES;
245 | CLANG_WARN_COMMA = YES;
246 | CLANG_WARN_CONSTANT_CONVERSION = YES;
247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
249 | CLANG_WARN_EMPTY_BODY = YES;
250 | CLANG_WARN_ENUM_CONVERSION = YES;
251 | CLANG_WARN_INFINITE_RECURSION = YES;
252 | CLANG_WARN_INT_CONVERSION = YES;
253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
258 | CLANG_WARN_STRICT_PROTOTYPES = YES;
259 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
260 | CLANG_WARN_UNREACHABLE_CODE = YES;
261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
263 | COPY_PHASE_STRIP = NO;
264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
265 | ENABLE_NS_ASSERTIONS = NO;
266 | ENABLE_STRICT_OBJC_MSGSEND = YES;
267 | GCC_C_LANGUAGE_STANDARD = gnu99;
268 | GCC_NO_COMMON_BLOCKS = YES;
269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
271 | GCC_WARN_UNDECLARED_SELECTOR = YES;
272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273 | GCC_WARN_UNUSED_FUNCTION = YES;
274 | GCC_WARN_UNUSED_VARIABLE = YES;
275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
276 | MTL_ENABLE_DEBUG_INFO = NO;
277 | SDKROOT = iphoneos;
278 | SUPPORTED_PLATFORMS = iphoneos;
279 | TARGETED_DEVICE_FAMILY = "1,2";
280 | VALIDATE_PRODUCT = YES;
281 | };
282 | name = Profile;
283 | };
284 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
285 | isa = XCBuildConfiguration;
286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
287 | buildSettings = {
288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
289 | CLANG_ENABLE_MODULES = YES;
290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
291 | ENABLE_BITCODE = NO;
292 | INFOPLIST_FILE = Runner/Info.plist;
293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.bestArchitectureChallenge;
295 | PRODUCT_NAME = "$(TARGET_NAME)";
296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
297 | SWIFT_VERSION = 5.0;
298 | VERSIONING_SYSTEM = "apple-generic";
299 | };
300 | name = Profile;
301 | };
302 | 97C147031CF9000F007C117D /* Debug */ = {
303 | isa = XCBuildConfiguration;
304 | buildSettings = {
305 | ALWAYS_SEARCH_USER_PATHS = NO;
306 | CLANG_ANALYZER_NONNULL = YES;
307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
308 | CLANG_CXX_LIBRARY = "libc++";
309 | CLANG_ENABLE_MODULES = YES;
310 | CLANG_ENABLE_OBJC_ARC = YES;
311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
312 | CLANG_WARN_BOOL_CONVERSION = YES;
313 | CLANG_WARN_COMMA = YES;
314 | CLANG_WARN_CONSTANT_CONVERSION = YES;
315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
317 | CLANG_WARN_EMPTY_BODY = YES;
318 | CLANG_WARN_ENUM_CONVERSION = YES;
319 | CLANG_WARN_INFINITE_RECURSION = YES;
320 | CLANG_WARN_INT_CONVERSION = YES;
321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
326 | CLANG_WARN_STRICT_PROTOTYPES = YES;
327 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
328 | CLANG_WARN_UNREACHABLE_CODE = YES;
329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
331 | COPY_PHASE_STRIP = NO;
332 | DEBUG_INFORMATION_FORMAT = dwarf;
333 | ENABLE_STRICT_OBJC_MSGSEND = YES;
334 | ENABLE_TESTABILITY = YES;
335 | GCC_C_LANGUAGE_STANDARD = gnu99;
336 | GCC_DYNAMIC_NO_PIC = NO;
337 | GCC_NO_COMMON_BLOCKS = YES;
338 | GCC_OPTIMIZATION_LEVEL = 0;
339 | GCC_PREPROCESSOR_DEFINITIONS = (
340 | "DEBUG=1",
341 | "$(inherited)",
342 | );
343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
345 | GCC_WARN_UNDECLARED_SELECTOR = YES;
346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347 | GCC_WARN_UNUSED_FUNCTION = YES;
348 | GCC_WARN_UNUSED_VARIABLE = YES;
349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
350 | MTL_ENABLE_DEBUG_INFO = YES;
351 | ONLY_ACTIVE_ARCH = YES;
352 | SDKROOT = iphoneos;
353 | TARGETED_DEVICE_FAMILY = "1,2";
354 | };
355 | name = Debug;
356 | };
357 | 97C147041CF9000F007C117D /* Release */ = {
358 | isa = XCBuildConfiguration;
359 | buildSettings = {
360 | ALWAYS_SEARCH_USER_PATHS = NO;
361 | CLANG_ANALYZER_NONNULL = YES;
362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
363 | CLANG_CXX_LIBRARY = "libc++";
364 | CLANG_ENABLE_MODULES = YES;
365 | CLANG_ENABLE_OBJC_ARC = YES;
366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
367 | CLANG_WARN_BOOL_CONVERSION = YES;
368 | CLANG_WARN_COMMA = YES;
369 | CLANG_WARN_CONSTANT_CONVERSION = YES;
370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
372 | CLANG_WARN_EMPTY_BODY = YES;
373 | CLANG_WARN_ENUM_CONVERSION = YES;
374 | CLANG_WARN_INFINITE_RECURSION = YES;
375 | CLANG_WARN_INT_CONVERSION = YES;
376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
381 | CLANG_WARN_STRICT_PROTOTYPES = YES;
382 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
383 | CLANG_WARN_UNREACHABLE_CODE = YES;
384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
386 | COPY_PHASE_STRIP = NO;
387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
388 | ENABLE_NS_ASSERTIONS = NO;
389 | ENABLE_STRICT_OBJC_MSGSEND = YES;
390 | GCC_C_LANGUAGE_STANDARD = gnu99;
391 | GCC_NO_COMMON_BLOCKS = YES;
392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
394 | GCC_WARN_UNDECLARED_SELECTOR = YES;
395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396 | GCC_WARN_UNUSED_FUNCTION = YES;
397 | GCC_WARN_UNUSED_VARIABLE = YES;
398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
399 | MTL_ENABLE_DEBUG_INFO = NO;
400 | SDKROOT = iphoneos;
401 | SUPPORTED_PLATFORMS = iphoneos;
402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
403 | TARGETED_DEVICE_FAMILY = "1,2";
404 | VALIDATE_PRODUCT = YES;
405 | };
406 | name = Release;
407 | };
408 | 97C147061CF9000F007C117D /* Debug */ = {
409 | isa = XCBuildConfiguration;
410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
411 | buildSettings = {
412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
413 | CLANG_ENABLE_MODULES = YES;
414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
415 | ENABLE_BITCODE = NO;
416 | INFOPLIST_FILE = Runner/Info.plist;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.bestArchitectureChallenge;
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
422 | SWIFT_VERSION = 5.0;
423 | VERSIONING_SYSTEM = "apple-generic";
424 | };
425 | name = Debug;
426 | };
427 | 97C147071CF9000F007C117D /* Release */ = {
428 | isa = XCBuildConfiguration;
429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
430 | buildSettings = {
431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432 | CLANG_ENABLE_MODULES = YES;
433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
434 | ENABLE_BITCODE = NO;
435 | INFOPLIST_FILE = Runner/Info.plist;
436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.bestArchitectureChallenge;
438 | PRODUCT_NAME = "$(TARGET_NAME)";
439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
440 | SWIFT_VERSION = 5.0;
441 | VERSIONING_SYSTEM = "apple-generic";
442 | };
443 | name = Release;
444 | };
445 | /* End XCBuildConfiguration section */
446 |
447 | /* Begin XCConfigurationList section */
448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 97C147031CF9000F007C117D /* Debug */,
452 | 97C147041CF9000F007C117D /* Release */,
453 | 249021D3217E4FDB00AE95B9 /* Profile */,
454 | );
455 | defaultConfigurationIsVisible = 0;
456 | defaultConfigurationName = Release;
457 | };
458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | 97C147061CF9000F007C117D /* Debug */,
462 | 97C147071CF9000F007C117D /* Release */,
463 | 249021D4217E4FDB00AE95B9 /* Profile */,
464 | );
465 | defaultConfigurationIsVisible = 0;
466 | defaultConfigurationName = Release;
467 | };
468 | /* End XCConfigurationList section */
469 | };
470 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
471 | }
472 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/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 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | best_architecture_challenge
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/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/core/core_injection.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:best_architecture_challenge/core/domain/fetch_post_usecase.dart';
3 | import 'package:best_architecture_challenge/core/provider/post_api.dart';
4 | import 'package:best_architecture_challenge/core/repository/post_repository_impl.dart';
5 | import 'package:dio/dio.dart';
6 | import 'package:get/get.dart';
7 |
8 | class CoreInjection {
9 |
10 | static void init() {
11 | final dio = Dio();
12 |
13 | final postApi = PostApi(dio);
14 | final repository = PostRepositoryImpl(postApi);
15 | Get.lazyPut(() => FetchPostUseCase(repository), fenix: true);
16 | }
17 | }
--------------------------------------------------------------------------------
/lib/core/domain/base_usecase.dart:
--------------------------------------------------------------------------------
1 |
2 | abstract class UseCase {
3 | R _repository;
4 |
5 | UseCase(this._repository);
6 |
7 | R get repository => _repository;
8 |
9 | void execute(Params params);
10 |
11 | void dispose();
12 | }
--------------------------------------------------------------------------------
/lib/core/domain/fetch_post_usecase.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/domain/base_usecase.dart';
2 | import 'package:best_architecture_challenge/core/model/post.dart';
3 | import 'package:best_architecture_challenge/core/repository/post_repository.dart';
4 |
5 | //fetch_post_usecase
6 | class FetchPostUseCase extends UseCase {
7 | FetchPostUseCase(PostRepository repository) : super(repository);
8 |
9 | @override
10 | void dispose() {}
11 |
12 | @override
13 | Future> execute(FetchPostUseCaseParams param) {
14 | return repository.fetchPosts();
15 | }
16 | }
17 |
18 | class FetchPostUseCaseParams {
19 | FetchPostUseCaseParams();
20 | }
--------------------------------------------------------------------------------
/lib/core/model/post.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | List postFromJson(String str) => List.from(json.decode(str).map((x) => Post.fromJson(x)));
4 |
5 | String postToJson(List data) => json.encode(List.from(data.map((x) => x.toJson())));
6 |
7 | class Post {
8 | Post({
9 | required this.userId,
10 | required this.id,
11 | required this.title,
12 | required this.body,
13 | });
14 |
15 | int userId;
16 | int id;
17 | String title;
18 | String body;
19 |
20 | factory Post.fromJson(Map json) => Post(
21 | userId: json["userId"],
22 | id: json["id"],
23 | title: json["title"],
24 | body: json["body"],
25 | );
26 |
27 | Map toJson() => {
28 | "userId": userId,
29 | "id": id,
30 | "title": title,
31 | "body": body,
32 | };
33 | }
34 |
--------------------------------------------------------------------------------
/lib/core/provider/post_api.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/model/post.dart';
2 | import 'package:retrofit/retrofit.dart';
3 | import 'package:dio/dio.dart';
4 |
5 | part 'post_api.g.dart';
6 |
7 | @RestApi(baseUrl: "https://jsonplaceholder.typicode.com")
8 | abstract class PostApi {
9 | factory PostApi(Dio dio, {String baseUrl}) = _PostApi;
10 |
11 | @GET("/posts")
12 | @NoBody()
13 | Future> getPosts();
14 | }
--------------------------------------------------------------------------------
/lib/core/provider/post_api.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'post_api.dart';
4 |
5 | // **************************************************************************
6 | // RetrofitGenerator
7 | // **************************************************************************
8 |
9 | class _PostApi implements PostApi {
10 | _PostApi(this._dio, {this.baseUrl}) {
11 | baseUrl ??= 'https://jsonplaceholder.typicode.com';
12 | }
13 |
14 | final Dio _dio;
15 |
16 | String? baseUrl;
17 |
18 | @override
19 | Future> getPosts() async {
20 | const _extra = {};
21 | final queryParameters = {};
22 | final String? _data = null;
23 | final _result = await _dio.fetch>(_setStreamType>(
24 | Options(method: 'GET', headers: {}, extra: _extra)
25 | .compose(_dio.options, '/posts',
26 | queryParameters: queryParameters, data: _data)
27 | .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl)));
28 | var value = _result.data!
29 | .map((dynamic i) => Post.fromJson(i as Map))
30 | .toList();
31 | return value;
32 | }
33 |
34 | RequestOptions _setStreamType(RequestOptions requestOptions) {
35 | if (T != dynamic &&
36 | !(requestOptions.responseType == ResponseType.bytes ||
37 | requestOptions.responseType == ResponseType.stream)) {
38 | if (T == String) {
39 | requestOptions.responseType = ResponseType.plain;
40 | } else {
41 | requestOptions.responseType = ResponseType.json;
42 | }
43 | }
44 | return requestOptions;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/core/repository/post_repository.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:best_architecture_challenge/core/model/post.dart';
3 |
4 | abstract class PostRepository {
5 |
6 | Future> fetchPosts();
7 | }
--------------------------------------------------------------------------------
/lib/core/repository/post_repository_impl.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:best_architecture_challenge/core/model/post.dart';
3 | import 'package:best_architecture_challenge/core/provider/post_api.dart';
4 | import 'package:best_architecture_challenge/core/repository/post_repository.dart';
5 |
6 | class PostRepositoryImpl implements PostRepository {
7 |
8 | final PostApi _postApi;
9 |
10 | PostRepositoryImpl(this._postApi);
11 |
12 | @override
13 | Future> fetchPosts() {
14 | return _postApi.getPosts();
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/core_injection.dart';
2 | import 'package:best_architecture_challenge/routes/app_pages.dart';
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:get/get.dart';
6 |
7 | void main() {
8 | CoreInjection.init();
9 | runApp(MyApp());
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | @override
14 | Widget build(BuildContext context) {
15 | return GetMaterialApp(
16 | theme: ThemeData(
17 | primarySwatch: Colors.deepPurple,
18 | ),
19 | initialRoute: AppPages.INITIAL,
20 | getPages: AppPages.routes,
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/res/colors.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ColorSet {
4 | static const Color default_bg = Color(0xFF3a9ec1);
5 | }
--------------------------------------------------------------------------------
/lib/res/dimens.dart:
--------------------------------------------------------------------------------
1 | class Dimens {
2 | static const double font_sp10 = 10.0;
3 | static const double font_sp12 = 12.0;
4 | static const double font_sp14 = 14.0;
5 | static const double font_sp15 = 15.0;
6 | static const double font_sp16 = 16.0;
7 | static const double font_sp17 = 17.0;
8 | static const double font_sp18 = 18.0;
9 | static const double font_sp20 = 20.0;
10 |
11 | static const double gap_dp0 = 0;
12 | static const double gap_dp4 = 4;
13 | static const double gap_dp5 = 5;
14 | static const double gap_dp8 = 8;
15 | static const double gap_dp9 = 9;
16 | static const double gap_dp10 = 10;
17 | static const double gap_dp12 = 12;
18 | static const double gap_dp15 = 15;
19 | static const double gap_dp16 = 16;
20 | static const double gap_dp21 = 21;
21 | static const double gap_dp24 = 24;
22 | static const double gap_dp32 = 32;
23 | static const double gap_dp36 = 36;
24 | static const double gap_dp40 = 40;
25 | static const double gap_dp47 = 47;
26 | static const double gap_dp50 = 50;
27 | static const double gap_dp126 = 126;
28 | }
--------------------------------------------------------------------------------
/lib/res/gaps.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/widgets.dart';
3 |
4 | import 'dimens.dart';
5 |
6 | class Gaps {
7 | /// 水平
8 | static const Widget hGap0 = SizedBox(width: Dimens.gap_dp0);
9 | static const Widget hGap4 = SizedBox(width: Dimens.gap_dp4);
10 | static const Widget hGap5 = SizedBox(width: Dimens.gap_dp5);
11 | static const Widget hGap8 = SizedBox(width: Dimens.gap_dp8);
12 | static const Widget hGap9 = SizedBox(width: Dimens.gap_dp9);
13 | static const Widget hGap10 = SizedBox(width: Dimens.gap_dp10);
14 | static const Widget hGap12 = SizedBox(width: Dimens.gap_dp12);
15 | static const Widget hGap15 = SizedBox(width: Dimens.gap_dp15);
16 | static const Widget hGap16 = SizedBox(width: Dimens.gap_dp16);
17 | static const Widget hGap21 = SizedBox(width: Dimens.gap_dp21);
18 | static const Widget hGap32 = SizedBox(width: Dimens.gap_dp32);
19 |
20 | // 垂直
21 | static const Widget vGap0 = SizedBox(height: Dimens.gap_dp0);
22 | static const Widget vGap4 = SizedBox(height: Dimens.gap_dp4);
23 | static const Widget vGap5 = SizedBox(height: Dimens.gap_dp5);
24 | static const Widget vGap8 = SizedBox(height: Dimens.gap_dp8);
25 | static const Widget vGap9 = SizedBox(height: Dimens.gap_dp9);
26 | static const Widget vGap10 = SizedBox(height: Dimens.gap_dp10);
27 | static const Widget vGap12 = SizedBox(height: Dimens.gap_dp12);
28 | static const Widget vGap15 = SizedBox(height: Dimens.gap_dp15);
29 | static const Widget vGap16 = SizedBox(height: Dimens.gap_dp16);
30 | static const Widget vGap21 = SizedBox(height: Dimens.gap_dp21);
31 | static const Widget vGap24 = SizedBox(height: Dimens.gap_dp24);
32 | static const Widget vGap32 = SizedBox(height: Dimens.gap_dp32);
33 | static const Widget vGap36 = SizedBox(height: Dimens.gap_dp36);
34 | static const Widget vGap40 = SizedBox(height: Dimens.gap_dp40);
35 | static const Widget vGap47 = SizedBox(height: Dimens.gap_dp47);
36 | static const Widget vGap50 = SizedBox(height: Dimens.gap_dp50);
37 | static const Widget vGap126 = SizedBox(height: Dimens.gap_dp126);
38 | }
39 |
--------------------------------------------------------------------------------
/lib/res/styles.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'dimens.dart';
4 |
5 |
6 | class TextStyles {
7 |
8 | static TextStyle textSize12 = GoogleFonts.openSans(
9 | fontSize: Dimens.font_sp12,
10 | );
11 |
12 | static TextStyle textSize14 = GoogleFonts.openSans(
13 | fontSize: Dimens.font_sp14,
14 | );
15 |
16 | static TextStyle textSize20 = GoogleFonts.openSans(
17 | fontSize: Dimens.font_sp20,
18 | );
19 |
20 | static TextStyle textSize16 = GoogleFonts.openSans(
21 | fontSize: Dimens.font_sp16,
22 | );
23 |
24 | static TextStyle textSize17 = GoogleFonts.openSans(
25 | fontSize: Dimens.font_sp17,
26 | );
27 |
28 | static TextStyle textSize18 = GoogleFonts.openSans(
29 | fontSize: Dimens.font_sp18,
30 | );
31 |
32 | static TextStyle textBold14 = GoogleFonts.openSans(
33 | fontSize: Dimens.font_sp14,
34 | fontWeight: FontWeight.bold
35 | );
36 | static TextStyle textBold16 = GoogleFonts.openSans(
37 | fontSize: Dimens.font_sp16,
38 | fontWeight: FontWeight.bold
39 | );
40 | static TextStyle textBold18 = GoogleFonts.openSans(
41 | fontSize: Dimens.font_sp18,
42 | fontWeight: FontWeight.bold
43 | );
44 | static TextStyle textBold20 = GoogleFonts.openSans(
45 | fontSize: 20.0,
46 | fontWeight: FontWeight.bold
47 | );
48 |
49 | static TextStyle textBold22 = GoogleFonts.openSans(
50 | fontSize: 22.0,
51 | fontWeight: FontWeight.bold
52 | );
53 |
54 | static TextStyle textBold24 = GoogleFonts.openSans(
55 | fontSize: 24.0,
56 | fontWeight: FontWeight.bold
57 | );
58 |
59 | static TextStyle textBold26 = GoogleFonts.openSans(
60 | fontSize: 26.0,
61 | fontWeight: FontWeight.bold
62 | );
63 | }
--------------------------------------------------------------------------------
/lib/routes/app_pages.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/screens/home/bindings/home_bindings.dart';
2 | import 'package:best_architecture_challenge/screens/home/views/home_view.dart';
3 |
4 | import 'app_routes.dart';
5 | import 'package:get/get.dart';
6 |
7 | class AppPages {
8 | static const INITIAL = Routes.HOME;
9 |
10 | static final routes = [
11 | GetPage(name: '/', page: () => HomeView(), binding: HomeBindings()),
12 | ];
13 | }
14 |
--------------------------------------------------------------------------------
/lib/routes/app_routes.dart:
--------------------------------------------------------------------------------
1 |
2 | abstract class Routes {
3 | static const HOME ='/';
4 | }
--------------------------------------------------------------------------------
/lib/screens/components/post_tile.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/model/post.dart';
2 | import 'package:best_architecture_challenge/res/styles.dart';
3 | import 'package:flutter/material.dart';
4 |
5 |
6 | class PostTile extends StatelessWidget {
7 | final Post item;
8 | final ValueChanged? onTap;
9 |
10 | PostTile({required this.item, this.onTap});
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return Container(
15 | padding: EdgeInsets.all(8),
16 | child: RichText(
17 | text: TextSpan(
18 | style: DefaultTextStyle.of(context).style,
19 | children: [
20 | TextSpan(
21 | text: "${item.id}. ${item.title}",
22 | style: TextStyles.textBold18,
23 | ),
24 | TextSpan(
25 | text: '\n' + item.body,
26 | style: TextStyles.textSize14,
27 | ),
28 | ],
29 | ),
30 | ));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib/screens/home/bindings/home_bindings.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:best_architecture_challenge/screens/home/controllers/home_controller.dart';
3 | import 'package:get/get.dart';
4 |
5 | class HomeBindings extends Bindings {
6 |
7 | @override
8 | void dependencies() {
9 | Get.lazyPut(() => HomeController(Get.find()));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/lib/screens/home/controllers/home_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/domain/fetch_post_usecase.dart';
2 | import 'package:best_architecture_challenge/core/model/post.dart';
3 | import 'package:get/get.dart';
4 |
5 | class HomeController extends GetxController {
6 | final FetchPostUseCase _fetchPostUseCase;
7 |
8 | HomeController(this._fetchPostUseCase);
9 |
10 | final postList = [].obs;
11 | final _isSortByTitle = false.obs;
12 |
13 | @override
14 | void onReady() {
15 | _fetchPosts();
16 | ever(_isSortByTitle, (value) => doSortBy(value));
17 | super.onReady();
18 | }
19 |
20 | @override
21 | void onClose() {
22 | postList.close();
23 | _isSortByTitle.close();
24 | super.onClose();
25 | }
26 |
27 | void _fetchPosts() {
28 | _fetchPostUseCase.execute(FetchPostUseCaseParams()).then((value) {
29 | postList.clear();
30 | postList.addAll(value);
31 | update();
32 | }).catchError((ex) {
33 | print(ex);
34 | });
35 | }
36 |
37 | doSortBy(bool isSortByTitle) {
38 | if (postList.isEmpty) return;
39 |
40 | postList.sort((a, b) {
41 | if (isSortByTitle)
42 | return a.title.compareTo(b.title);
43 | else
44 | return a.id.compareTo(b.id);
45 | });
46 | update();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/screens/home/views/home_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/res/colors.dart';
2 | import 'package:best_architecture_challenge/res/gaps.dart';
3 | import 'package:best_architecture_challenge/res/styles.dart';
4 | import 'package:best_architecture_challenge/screens/components/post_tile.dart';
5 | import 'package:best_architecture_challenge/screens/home/controllers/home_controller.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:get/get.dart';
8 |
9 | extension SortExt on int {
10 | bool isSortByTitle() => this == 2;
11 | }
12 |
13 | //home_view
14 | class HomeView extends GetView {
15 | static const int _sortWithId = 1;
16 | static const int _sortWithTitle = 2;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | return Scaffold(
21 | backgroundColor: ColorSet.default_bg,
22 | body: Stack(
23 | alignment: Alignment.topCenter,
24 | children: [
25 | _buildHeader(),
26 | _buildBody(),
27 | ],
28 | ),
29 | );
30 | }
31 |
32 | Positioned _buildBody() {
33 | return Positioned.fill(
34 | top: Get.height * 0.2,
35 | child: Container(
36 | padding: EdgeInsets.only(top: 20, left: 20, right: 20),
37 | decoration: BoxDecoration(
38 | color: Colors.white,
39 | borderRadius: BorderRadius.only(
40 | topLeft: Radius.circular(50),
41 | topRight: Radius.circular(50))),
42 | child: Column(
43 | crossAxisAlignment: CrossAxisAlignment.start,
44 | children: [
45 | Padding(
46 | padding: EdgeInsets.only(left: 8),
47 | child: Obx(() => Text('Posts: ${controller.postList.length}', style: TextStyles.textBold22,))
48 | ),
49 | Gaps.vGap10,
50 | Expanded(
51 | child: GetBuilder(
52 | builder: (_controller) {
53 | return ListView.separated(
54 | itemCount: _controller.postList.length,
55 | itemBuilder: (context, index) {
56 | return PostTile(
57 | item: _controller.postList[index]);
58 | },
59 | separatorBuilder: (context, index) {
60 | return Divider();
61 | },
62 | );
63 | },
64 | ),
65 | ),
66 | ],
67 | ),
68 | ),
69 | );
70 | }
71 |
72 | Positioned _buildHeader() {
73 | return Positioned(
74 | top: Get.height * 0.05,
75 | child: Container(
76 | padding: EdgeInsets.symmetric(horizontal: 20),
77 | width: Get.width,
78 | child: Row(
79 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
80 | crossAxisAlignment: CrossAxisAlignment.center,
81 | children: [
82 | Column(
83 | mainAxisSize: MainAxisSize.min,
84 | crossAxisAlignment: CrossAxisAlignment.start,
85 | children: [
86 | Text(
87 | 'Hello,',
88 | style: TextStyles.textBold26
89 | .copyWith(color: Colors.white),
90 | ),
91 | Text(
92 | 'FlutterTaipei :)',
93 | style: TextStyles.textBold26
94 | .copyWith(color: Colors.white),
95 | ),
96 | ],
97 | ),
98 | PopupMenuButton(
99 | shape: RoundedRectangleBorder(
100 | borderRadius: BorderRadius.circular(8),
101 | ),
102 | icon: Icon(
103 | Icons.sort,
104 | size: 40,
105 | color: Colors.white,
106 | ),
107 | itemBuilder: (context) => [
108 | PopupMenuItem(
109 | child: Text(
110 | '使用id排序',
111 | style: TextStyles.textSize16,
112 | ),
113 | value: _sortWithId,
114 | ),
115 | PopupMenuItem(
116 | child: Text(
117 | '使用title排序',
118 | style: TextStyles.textSize16,
119 | ),
120 | value: _sortWithTitle,
121 | )
122 | ],
123 | onSelected: (int value) {
124 | controller.doSortBy(value.isSortByTitle());
125 | })
126 | ],
127 | ),
128 | ));
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/xcuserdata/
7 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.11'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 51;
7 | objects = {
8 |
9 | /* Begin PBXAggregateTarget section */
10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
11 | isa = PBXAggregateTarget;
12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
13 | buildPhases = (
14 | 33CC111E2044C6BF0003C045 /* ShellScript */,
15 | );
16 | dependencies = (
17 | );
18 | name = "Flutter Assemble";
19 | productName = FLX;
20 | };
21 | /* End PBXAggregateTarget section */
22 |
23 | /* Begin PBXBuildFile section */
24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
29 | /* End PBXBuildFile section */
30 |
31 | /* Begin PBXContainerItemProxy section */
32 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
35 | proxyType = 1;
36 | remoteGlobalIDString = 33CC111A2044C6BA0003C045;
37 | remoteInfo = FLX;
38 | };
39 | /* End PBXContainerItemProxy section */
40 |
41 | /* Begin PBXCopyFilesBuildPhase section */
42 | 33CC110E2044A8840003C045 /* Bundle Framework */ = {
43 | isa = PBXCopyFilesBuildPhase;
44 | buildActionMask = 2147483647;
45 | dstPath = "";
46 | dstSubfolderSpec = 10;
47 | files = (
48 | );
49 | name = "Bundle Framework";
50 | runOnlyForDeploymentPostprocessing = 0;
51 | };
52 | /* End PBXCopyFilesBuildPhase section */
53 |
54 | /* Begin PBXFileReference section */
55 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; };
56 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; };
57 | 33CC10ED2044A3C60003C045 /* best_architecture_challenge.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "best_architecture_challenge.app"; sourceTree = BUILT_PRODUCTS_DIR; };
58 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
59 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; };
60 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
61 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; };
62 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; };
63 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; };
64 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; };
65 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; };
66 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; };
67 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; };
68 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; };
69 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; };
70 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; };
71 | /* End PBXFileReference section */
72 |
73 | /* Begin PBXFrameworksBuildPhase section */
74 | 33CC10EA2044A3C60003C045 /* Frameworks */ = {
75 | isa = PBXFrameworksBuildPhase;
76 | buildActionMask = 2147483647;
77 | files = (
78 | );
79 | runOnlyForDeploymentPostprocessing = 0;
80 | };
81 | /* End PBXFrameworksBuildPhase section */
82 |
83 | /* Begin PBXGroup section */
84 | 33BA886A226E78AF003329D5 /* Configs */ = {
85 | isa = PBXGroup;
86 | children = (
87 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */,
88 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
89 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
90 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
91 | );
92 | path = Configs;
93 | sourceTree = "";
94 | };
95 | 33CC10E42044A3C60003C045 = {
96 | isa = PBXGroup;
97 | children = (
98 | 33FAB671232836740065AC1E /* Runner */,
99 | 33CEB47122A05771004F2AC0 /* Flutter */,
100 | 33CC10EE2044A3C60003C045 /* Products */,
101 | D73912EC22F37F3D000D13A0 /* Frameworks */,
102 | );
103 | sourceTree = "";
104 | };
105 | 33CC10EE2044A3C60003C045 /* Products */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 33CC10ED2044A3C60003C045 /* best_architecture_challenge.app */,
109 | );
110 | name = Products;
111 | sourceTree = "";
112 | };
113 | 33CC11242044D66E0003C045 /* Resources */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 33CC10F22044A3C60003C045 /* Assets.xcassets */,
117 | 33CC10F42044A3C60003C045 /* MainMenu.xib */,
118 | 33CC10F72044A3C60003C045 /* Info.plist */,
119 | );
120 | name = Resources;
121 | path = ..;
122 | sourceTree = "";
123 | };
124 | 33CEB47122A05771004F2AC0 /* Flutter */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
128 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
129 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
130 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
131 | );
132 | path = Flutter;
133 | sourceTree = "";
134 | };
135 | 33FAB671232836740065AC1E /* Runner */ = {
136 | isa = PBXGroup;
137 | children = (
138 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */,
139 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
140 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */,
141 | 33E51914231749380026EE4D /* Release.entitlements */,
142 | 33CC11242044D66E0003C045 /* Resources */,
143 | 33BA886A226E78AF003329D5 /* Configs */,
144 | );
145 | path = Runner;
146 | sourceTree = "";
147 | };
148 | D73912EC22F37F3D000D13A0 /* Frameworks */ = {
149 | isa = PBXGroup;
150 | children = (
151 | );
152 | name = Frameworks;
153 | sourceTree = "";
154 | };
155 | /* End PBXGroup section */
156 |
157 | /* Begin PBXNativeTarget section */
158 | 33CC10EC2044A3C60003C045 /* Runner */ = {
159 | isa = PBXNativeTarget;
160 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
161 | buildPhases = (
162 | 33CC10E92044A3C60003C045 /* Sources */,
163 | 33CC10EA2044A3C60003C045 /* Frameworks */,
164 | 33CC10EB2044A3C60003C045 /* Resources */,
165 | 33CC110E2044A8840003C045 /* Bundle Framework */,
166 | 3399D490228B24CF009A79C7 /* ShellScript */,
167 | );
168 | buildRules = (
169 | );
170 | dependencies = (
171 | 33CC11202044C79F0003C045 /* PBXTargetDependency */,
172 | );
173 | name = Runner;
174 | productName = Runner;
175 | productReference = 33CC10ED2044A3C60003C045 /* best_architecture_challenge.app */;
176 | productType = "com.apple.product-type.application";
177 | };
178 | /* End PBXNativeTarget section */
179 |
180 | /* Begin PBXProject section */
181 | 33CC10E52044A3C60003C045 /* Project object */ = {
182 | isa = PBXProject;
183 | attributes = {
184 | LastSwiftUpdateCheck = 0920;
185 | LastUpgradeCheck = 0930;
186 | ORGANIZATIONNAME = "";
187 | TargetAttributes = {
188 | 33CC10EC2044A3C60003C045 = {
189 | CreatedOnToolsVersion = 9.2;
190 | LastSwiftMigration = 1100;
191 | ProvisioningStyle = Automatic;
192 | SystemCapabilities = {
193 | com.apple.Sandbox = {
194 | enabled = 1;
195 | };
196 | };
197 | };
198 | 33CC111A2044C6BA0003C045 = {
199 | CreatedOnToolsVersion = 9.2;
200 | ProvisioningStyle = Manual;
201 | };
202 | };
203 | };
204 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
205 | compatibilityVersion = "Xcode 9.3";
206 | developmentRegion = en;
207 | hasScannedForEncodings = 0;
208 | knownRegions = (
209 | en,
210 | Base,
211 | );
212 | mainGroup = 33CC10E42044A3C60003C045;
213 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
214 | projectDirPath = "";
215 | projectRoot = "";
216 | targets = (
217 | 33CC10EC2044A3C60003C045 /* Runner */,
218 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */,
219 | );
220 | };
221 | /* End PBXProject section */
222 |
223 | /* Begin PBXResourcesBuildPhase section */
224 | 33CC10EB2044A3C60003C045 /* Resources */ = {
225 | isa = PBXResourcesBuildPhase;
226 | buildActionMask = 2147483647;
227 | files = (
228 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
229 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
230 | );
231 | runOnlyForDeploymentPostprocessing = 0;
232 | };
233 | /* End PBXResourcesBuildPhase section */
234 |
235 | /* Begin PBXShellScriptBuildPhase section */
236 | 3399D490228B24CF009A79C7 /* ShellScript */ = {
237 | isa = PBXShellScriptBuildPhase;
238 | buildActionMask = 2147483647;
239 | files = (
240 | );
241 | inputFileListPaths = (
242 | );
243 | inputPaths = (
244 | );
245 | outputFileListPaths = (
246 | );
247 | outputPaths = (
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | shellPath = /bin/sh;
251 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
252 | };
253 | 33CC111E2044C6BF0003C045 /* ShellScript */ = {
254 | isa = PBXShellScriptBuildPhase;
255 | buildActionMask = 2147483647;
256 | files = (
257 | );
258 | inputFileListPaths = (
259 | Flutter/ephemeral/FlutterInputs.xcfilelist,
260 | );
261 | inputPaths = (
262 | Flutter/ephemeral/tripwire,
263 | );
264 | outputFileListPaths = (
265 | Flutter/ephemeral/FlutterOutputs.xcfilelist,
266 | );
267 | outputPaths = (
268 | );
269 | runOnlyForDeploymentPostprocessing = 0;
270 | shellPath = /bin/sh;
271 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
272 | };
273 | /* End PBXShellScriptBuildPhase section */
274 |
275 | /* Begin PBXSourcesBuildPhase section */
276 | 33CC10E92044A3C60003C045 /* Sources */ = {
277 | isa = PBXSourcesBuildPhase;
278 | buildActionMask = 2147483647;
279 | files = (
280 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
281 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
282 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
283 | );
284 | runOnlyForDeploymentPostprocessing = 0;
285 | };
286 | /* End PBXSourcesBuildPhase section */
287 |
288 | /* Begin PBXTargetDependency section */
289 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
290 | isa = PBXTargetDependency;
291 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
292 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
293 | };
294 | /* End PBXTargetDependency section */
295 |
296 | /* Begin PBXVariantGroup section */
297 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
298 | isa = PBXVariantGroup;
299 | children = (
300 | 33CC10F52044A3C60003C045 /* Base */,
301 | );
302 | name = MainMenu.xib;
303 | path = Runner;
304 | sourceTree = "";
305 | };
306 | /* End PBXVariantGroup section */
307 |
308 | /* Begin XCBuildConfiguration section */
309 | 338D0CE9231458BD00FA5F75 /* Profile */ = {
310 | isa = XCBuildConfiguration;
311 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
312 | buildSettings = {
313 | ALWAYS_SEARCH_USER_PATHS = NO;
314 | CLANG_ANALYZER_NONNULL = YES;
315 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
317 | CLANG_CXX_LIBRARY = "libc++";
318 | CLANG_ENABLE_MODULES = YES;
319 | CLANG_ENABLE_OBJC_ARC = YES;
320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
321 | CLANG_WARN_BOOL_CONVERSION = YES;
322 | CLANG_WARN_CONSTANT_CONVERSION = YES;
323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
326 | CLANG_WARN_EMPTY_BODY = YES;
327 | CLANG_WARN_ENUM_CONVERSION = YES;
328 | CLANG_WARN_INFINITE_RECURSION = YES;
329 | CLANG_WARN_INT_CONVERSION = YES;
330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
334 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
335 | CODE_SIGN_IDENTITY = "-";
336 | COPY_PHASE_STRIP = NO;
337 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
338 | ENABLE_NS_ASSERTIONS = NO;
339 | ENABLE_STRICT_OBJC_MSGSEND = YES;
340 | GCC_C_LANGUAGE_STANDARD = gnu11;
341 | GCC_NO_COMMON_BLOCKS = YES;
342 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
343 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
344 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
345 | GCC_WARN_UNUSED_FUNCTION = YES;
346 | GCC_WARN_UNUSED_VARIABLE = YES;
347 | MACOSX_DEPLOYMENT_TARGET = 10.11;
348 | MTL_ENABLE_DEBUG_INFO = NO;
349 | SDKROOT = macosx;
350 | SWIFT_COMPILATION_MODE = wholemodule;
351 | SWIFT_OPTIMIZATION_LEVEL = "-O";
352 | };
353 | name = Profile;
354 | };
355 | 338D0CEA231458BD00FA5F75 /* Profile */ = {
356 | isa = XCBuildConfiguration;
357 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
358 | buildSettings = {
359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
360 | CLANG_ENABLE_MODULES = YES;
361 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
362 | CODE_SIGN_STYLE = Automatic;
363 | COMBINE_HIDPI_IMAGES = YES;
364 | INFOPLIST_FILE = Runner/Info.plist;
365 | LD_RUNPATH_SEARCH_PATHS = (
366 | "$(inherited)",
367 | "@executable_path/../Frameworks",
368 | );
369 | PROVISIONING_PROFILE_SPECIFIER = "";
370 | SWIFT_VERSION = 5.0;
371 | };
372 | name = Profile;
373 | };
374 | 338D0CEB231458BD00FA5F75 /* Profile */ = {
375 | isa = XCBuildConfiguration;
376 | buildSettings = {
377 | CODE_SIGN_STYLE = Manual;
378 | PRODUCT_NAME = "$(TARGET_NAME)";
379 | };
380 | name = Profile;
381 | };
382 | 33CC10F92044A3C60003C045 /* Debug */ = {
383 | isa = XCBuildConfiguration;
384 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
385 | buildSettings = {
386 | ALWAYS_SEARCH_USER_PATHS = NO;
387 | CLANG_ANALYZER_NONNULL = YES;
388 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
390 | CLANG_CXX_LIBRARY = "libc++";
391 | CLANG_ENABLE_MODULES = YES;
392 | CLANG_ENABLE_OBJC_ARC = YES;
393 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
394 | CLANG_WARN_BOOL_CONVERSION = YES;
395 | CLANG_WARN_CONSTANT_CONVERSION = YES;
396 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
398 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
399 | CLANG_WARN_EMPTY_BODY = YES;
400 | CLANG_WARN_ENUM_CONVERSION = YES;
401 | CLANG_WARN_INFINITE_RECURSION = YES;
402 | CLANG_WARN_INT_CONVERSION = YES;
403 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
404 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
406 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
407 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
408 | CODE_SIGN_IDENTITY = "-";
409 | COPY_PHASE_STRIP = NO;
410 | DEBUG_INFORMATION_FORMAT = dwarf;
411 | ENABLE_STRICT_OBJC_MSGSEND = YES;
412 | ENABLE_TESTABILITY = YES;
413 | GCC_C_LANGUAGE_STANDARD = gnu11;
414 | GCC_DYNAMIC_NO_PIC = NO;
415 | GCC_NO_COMMON_BLOCKS = YES;
416 | GCC_OPTIMIZATION_LEVEL = 0;
417 | GCC_PREPROCESSOR_DEFINITIONS = (
418 | "DEBUG=1",
419 | "$(inherited)",
420 | );
421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
424 | GCC_WARN_UNUSED_FUNCTION = YES;
425 | GCC_WARN_UNUSED_VARIABLE = YES;
426 | MACOSX_DEPLOYMENT_TARGET = 10.11;
427 | MTL_ENABLE_DEBUG_INFO = YES;
428 | ONLY_ACTIVE_ARCH = YES;
429 | SDKROOT = macosx;
430 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
431 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
432 | };
433 | name = Debug;
434 | };
435 | 33CC10FA2044A3C60003C045 /* Release */ = {
436 | isa = XCBuildConfiguration;
437 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
438 | buildSettings = {
439 | ALWAYS_SEARCH_USER_PATHS = NO;
440 | CLANG_ANALYZER_NONNULL = YES;
441 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
442 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
443 | CLANG_CXX_LIBRARY = "libc++";
444 | CLANG_ENABLE_MODULES = YES;
445 | CLANG_ENABLE_OBJC_ARC = YES;
446 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
447 | CLANG_WARN_BOOL_CONVERSION = YES;
448 | CLANG_WARN_CONSTANT_CONVERSION = YES;
449 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
450 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
451 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
452 | CLANG_WARN_EMPTY_BODY = YES;
453 | CLANG_WARN_ENUM_CONVERSION = YES;
454 | CLANG_WARN_INFINITE_RECURSION = YES;
455 | CLANG_WARN_INT_CONVERSION = YES;
456 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
457 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
458 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
459 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
460 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
461 | CODE_SIGN_IDENTITY = "-";
462 | COPY_PHASE_STRIP = NO;
463 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
464 | ENABLE_NS_ASSERTIONS = NO;
465 | ENABLE_STRICT_OBJC_MSGSEND = YES;
466 | GCC_C_LANGUAGE_STANDARD = gnu11;
467 | GCC_NO_COMMON_BLOCKS = YES;
468 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
469 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
470 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
471 | GCC_WARN_UNUSED_FUNCTION = YES;
472 | GCC_WARN_UNUSED_VARIABLE = YES;
473 | MACOSX_DEPLOYMENT_TARGET = 10.11;
474 | MTL_ENABLE_DEBUG_INFO = NO;
475 | SDKROOT = macosx;
476 | SWIFT_COMPILATION_MODE = wholemodule;
477 | SWIFT_OPTIMIZATION_LEVEL = "-O";
478 | };
479 | name = Release;
480 | };
481 | 33CC10FC2044A3C60003C045 /* Debug */ = {
482 | isa = XCBuildConfiguration;
483 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
484 | buildSettings = {
485 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
486 | CLANG_ENABLE_MODULES = YES;
487 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
488 | CODE_SIGN_STYLE = Automatic;
489 | COMBINE_HIDPI_IMAGES = YES;
490 | INFOPLIST_FILE = Runner/Info.plist;
491 | LD_RUNPATH_SEARCH_PATHS = (
492 | "$(inherited)",
493 | "@executable_path/../Frameworks",
494 | );
495 | PROVISIONING_PROFILE_SPECIFIER = "";
496 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
497 | SWIFT_VERSION = 5.0;
498 | };
499 | name = Debug;
500 | };
501 | 33CC10FD2044A3C60003C045 /* Release */ = {
502 | isa = XCBuildConfiguration;
503 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
504 | buildSettings = {
505 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
506 | CLANG_ENABLE_MODULES = YES;
507 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
508 | CODE_SIGN_STYLE = Automatic;
509 | COMBINE_HIDPI_IMAGES = YES;
510 | INFOPLIST_FILE = Runner/Info.plist;
511 | LD_RUNPATH_SEARCH_PATHS = (
512 | "$(inherited)",
513 | "@executable_path/../Frameworks",
514 | );
515 | PROVISIONING_PROFILE_SPECIFIER = "";
516 | SWIFT_VERSION = 5.0;
517 | };
518 | name = Release;
519 | };
520 | 33CC111C2044C6BA0003C045 /* Debug */ = {
521 | isa = XCBuildConfiguration;
522 | buildSettings = {
523 | CODE_SIGN_STYLE = Manual;
524 | PRODUCT_NAME = "$(TARGET_NAME)";
525 | };
526 | name = Debug;
527 | };
528 | 33CC111D2044C6BA0003C045 /* Release */ = {
529 | isa = XCBuildConfiguration;
530 | buildSettings = {
531 | CODE_SIGN_STYLE = Automatic;
532 | PRODUCT_NAME = "$(TARGET_NAME)";
533 | };
534 | name = Release;
535 | };
536 | /* End XCBuildConfiguration section */
537 |
538 | /* Begin XCConfigurationList section */
539 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
540 | isa = XCConfigurationList;
541 | buildConfigurations = (
542 | 33CC10F92044A3C60003C045 /* Debug */,
543 | 33CC10FA2044A3C60003C045 /* Release */,
544 | 338D0CE9231458BD00FA5F75 /* Profile */,
545 | );
546 | defaultConfigurationIsVisible = 0;
547 | defaultConfigurationName = Release;
548 | };
549 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
550 | isa = XCConfigurationList;
551 | buildConfigurations = (
552 | 33CC10FC2044A3C60003C045 /* Debug */,
553 | 33CC10FD2044A3C60003C045 /* Release */,
554 | 338D0CEA231458BD00FA5F75 /* Profile */,
555 | );
556 | defaultConfigurationIsVisible = 0;
557 | defaultConfigurationName = Release;
558 | };
559 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
560 | isa = XCConfigurationList;
561 | buildConfigurations = (
562 | 33CC111C2044C6BA0003C045 /* Debug */,
563 | 33CC111D2044C6BA0003C045 /* Release */,
564 | 338D0CEB231458BD00FA5F75 /* Profile */,
565 | );
566 | defaultConfigurationIsVisible = 0;
567 | defaultConfigurationName = Release;
568 | };
569 | /* End XCConfigurationList section */
570 | };
571 | rootObject = 33CC10E52044A3C60003C045 /* Project object */;
572 | }
573 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clementlinnn/BestArchitectureChallenge/04e5b02e100ab6f735d6ded4fc76ca8f0f62a8d3/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/macos/Runner/Base.lproj/MainMenu.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = best_architecture_challenge
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.bestArchitectureChallenge
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: best_architecture_challenge
2 | description: A new Flutter project.
3 |
4 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
5 |
6 | version: 1.0.0+1
7 |
8 | environment:
9 | sdk: ">=2.12.0 <3.0.0"
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | cupertino_icons: ^1.0.2
16 |
17 | #network
18 | http: ^0.13.3
19 | dio: ^4.0.0
20 | retrofit: ^2.0.0
21 |
22 | google_fonts: 2.1.0
23 | get:
24 |
25 | #for dio testing
26 | http_mock_adapter: ^0.3.1
27 |
28 | dev_dependencies:
29 | flutter_test:
30 | sdk: flutter
31 |
32 | retrofit_generator: ^2.0.0+3
33 | build_runner: ^2.0.5
34 |
35 | mockito: ^5.0.10
36 |
37 | flutter:
38 |
39 | uses-material-design: true
40 |
41 | # To add assets to your application, add an assets section, like this:
42 | assets:
43 | - assets/
44 | # - images/a_dot_ham.jpeg
45 |
46 | # An image asset can refer to one or more resolution-specific "variants", see
47 | # https://flutter.dev/assets-and-images/#resolution-aware.
48 |
49 | # For details regarding adding assets from package dependencies, see
50 | # https://flutter.dev/assets-and-images/#from-packages
51 |
52 | # To add custom fonts to your application, add a fonts section here,
53 | # in this "flutter" section. Each entry in this list should have a
54 | # "family" key with the font family name, and a "fonts" key with a
55 | # list giving the asset and other descriptors for the font. For
56 | # example:
57 | # fonts:
58 | # - family: Schyler
59 | # fonts:
60 | # - asset: fonts/Schyler-Regular.ttf
61 | # - asset: fonts/Schyler-Italic.ttf
62 | # style: italic
63 | # - family: Trajan Pro
64 | # fonts:
65 | # - asset: fonts/TrajanPro.ttf
66 | # - asset: fonts/TrajanPro_Bold.ttf
67 | # weight: 700
68 | #
69 | # For details regarding fonts from package dependencies,
70 | # see https://flutter.dev/custom-fonts/#from-packages
71 |
--------------------------------------------------------------------------------
/test/post_api_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:best_architecture_challenge/core/model/post.dart';
9 | import 'package:best_architecture_challenge/core/provider/post_api.dart';
10 | import 'package:dio/dio.dart';
11 | import 'package:flutter_test/flutter_test.dart';
12 | import 'package:http_mock_adapter/http_mock_adapter.dart';
13 |
14 | import 'raw.dart';
15 |
16 | void main() {
17 | late PostApi postApi;
18 |
19 | group('request post', () {
20 |
21 | setUp(() {
22 | Dio dio = Dio();
23 | postApi = PostApi(dio, baseUrl: BaseUrl);
24 | DioAdapter dioAdapter = DioAdapter();
25 |
26 | dio.httpClientAdapter = dioAdapter;
27 | dioAdapter.onGet('/posts', (request) => request.reply(200, testPosts));
28 | });
29 |
30 | test('request posts', () async {
31 | final response = await postApi.getPosts();
32 |
33 | expect(testPosts.length, response.length);
34 | expect(testPosts[0].userId, response[0].userId);
35 | expect(testPosts[0].id, response[0].id);
36 | expect(testPosts[0].title, response[0].title);
37 | expect(testPosts[0].body, response[0].body);
38 | });
39 | });
40 | }
41 |
--------------------------------------------------------------------------------
/test/presentation_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/core_injection.dart';
2 | import 'package:best_architecture_challenge/core/domain/fetch_post_usecase.dart';
3 | import 'package:best_architecture_challenge/main.dart';
4 | import 'package:best_architecture_challenge/screens/home/controllers/home_controller.dart';
5 | import 'package:best_architecture_challenge/screens/home/views/home_view.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_test/flutter_test.dart';
8 | import 'package:get/get.dart';
9 | import 'package:mockito/annotations.dart';
10 | import 'package:mockito/mockito.dart';
11 |
12 | import 'presentation_test.mocks.dart';
13 | import 'raw.dart';
14 |
15 | @GenerateMocks([FetchPostUseCase], customMocks: [
16 | MockSpec(as: #FetchPostUseCase2, returnNullOnMissingStub: true),
17 | ])
18 | void main() async {
19 | CoreInjection.init();
20 | group(('presentation test'), () {
21 | late HomeController controller;
22 | setUp(() {
23 | final fetchPostUseCase = MockFetchPostUseCase();
24 | Get.put(fetchPostUseCase);
25 | controller =
26 | Get.put(HomeController(fetchPostUseCase));
27 |
28 | when(fetchPostUseCase.execute(any))
29 | .thenAnswer((_) => Future.value(testPosts));
30 | });
31 |
32 | testWidgets('Home test', (tester) async {
33 | await tester.pumpWidget(GetMaterialApp(
34 | theme: ThemeData(
35 | primarySwatch: Colors.deepPurple,
36 | ),
37 | initialRoute: '/',
38 | getPages: [GetPage(name: '/', page: () => HomeView())],
39 | ));
40 |
41 | expect(find.text('Posts: 2'), findsOneWidget);
42 |
43 | await tester.tap(find.byIcon(Icons.sort));
44 |
45 | await tester.pump();
46 | await tester.pump(const Duration(seconds: 1));
47 |
48 | await tester.tap(find.text('使用title排序'));
49 |
50 | await tester.pump();
51 | await tester.pump(const Duration(seconds: 2));
52 |
53 | expect(testPosts[1].title, controller.postList[0].title);
54 |
55 | await tester.tap(find.byIcon(Icons.sort));
56 | await tester.pump();
57 | await tester.pump(const Duration(seconds: 1));
58 | await tester.tap(find.text('使用id排序'));
59 | await tester.pump();
60 | await tester.pump(const Duration(seconds: 2));
61 | expect(testPosts[0].title, controller.postList[0].title);
62 | });
63 | });
64 | }
65 |
--------------------------------------------------------------------------------
/test/presentation_test.mocks.dart:
--------------------------------------------------------------------------------
1 | // Mocks generated by Mockito 5.0.10 from annotations
2 | // in best_architecture_challenge/test/presentation_test.dart.
3 | // Do not manually edit this file.
4 |
5 | import 'dart:async' as _i4;
6 |
7 | import 'package:best_architecture_challenge/core/domain/fetch_post_usecase.dart'
8 | as _i3;
9 | import 'package:best_architecture_challenge/core/model/post.dart' as _i5;
10 | import 'package:best_architecture_challenge/core/repository/post_repository.dart'
11 | as _i2;
12 | import 'package:mockito/mockito.dart' as _i1;
13 |
14 | // ignore_for_file: avoid_redundant_argument_values
15 | // ignore_for_file: comment_references
16 | // ignore_for_file: invalid_use_of_visible_for_testing_member
17 | // ignore_for_file: prefer_const_constructors
18 | // ignore_for_file: unnecessary_parenthesis
19 |
20 | class _FakePostRepository extends _i1.Fake implements _i2.PostRepository {}
21 |
22 | /// A class which mocks [FetchPostUseCase].
23 | ///
24 | /// See the documentation for Mockito's code generation for more information.
25 | class MockFetchPostUseCase extends _i1.Mock implements _i3.FetchPostUseCase {
26 | MockFetchPostUseCase() {
27 | _i1.throwOnMissingStub(this);
28 | }
29 |
30 | @override
31 | _i2.PostRepository get repository =>
32 | (super.noSuchMethod(Invocation.getter(#repository),
33 | returnValue: _FakePostRepository()) as _i2.PostRepository);
34 | @override
35 | void dispose() => super.noSuchMethod(Invocation.method(#dispose, []),
36 | returnValueForMissingStub: null);
37 | @override
38 | _i4.Future> execute(_i3.FetchPostUseCaseParams? param) =>
39 | (super.noSuchMethod(Invocation.method(#execute, [param]),
40 | returnValue: Future>.value(<_i5.Post>[]))
41 | as _i4.Future>);
42 | }
43 |
44 | /// A class which mocks [FetchPostUseCase].
45 | ///
46 | /// See the documentation for Mockito's code generation for more information.
47 | class FetchPostUseCase2 extends _i1.Mock implements _i3.FetchPostUseCase {
48 | @override
49 | _i2.PostRepository get repository =>
50 | (super.noSuchMethod(Invocation.getter(#repository),
51 | returnValue: _FakePostRepository()) as _i2.PostRepository);
52 | @override
53 | void dispose() => super.noSuchMethod(Invocation.method(#dispose, []),
54 | returnValueForMissingStub: null);
55 | @override
56 | _i4.Future> execute(_i3.FetchPostUseCaseParams? param) =>
57 | (super.noSuchMethod(Invocation.method(#execute, [param]),
58 | returnValue: Future>.value(<_i5.Post>[]))
59 | as _i4.Future>);
60 | }
61 |
--------------------------------------------------------------------------------
/test/raw.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/model/post.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | const BaseUrl = 'https://jsonplaceholder.typicode.com';
5 |
6 | List testPosts = [
7 | Post(
8 | userId: 1,
9 | id: 1,
10 | title:
11 | 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',
12 | body:
13 | 'quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto'),
14 | Post(
15 | userId: 3,
16 | id: 30,
17 | title: 'a quo magni similique perferendis',
18 | body:
19 | 'alias dolor cumque\nimpedit blanditiis non eveniet odio maxime\nblanditiis amet eius quis tempora quia autem rem\na provident perspiciatis quia')
20 | ];
--------------------------------------------------------------------------------
/test/repository_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/model/post.dart';
2 | import 'package:best_architecture_challenge/core/provider/post_api.dart';
3 | import 'package:best_architecture_challenge/core/repository/post_repository.dart';
4 | import 'package:best_architecture_challenge/core/repository/post_repository_impl.dart';
5 | import 'package:dio/dio.dart';
6 | import 'package:flutter_test/flutter_test.dart';
7 | import 'package:http_mock_adapter/http_mock_adapter.dart';
8 | import 'package:mockito/annotations.dart';
9 | import 'package:mockito/mockito.dart';
10 |
11 | import 'raw.dart';
12 | import 'repository_test.mocks.dart';
13 |
14 | @GenerateMocks([PostApi])
15 | void main() async {
16 | late PostRepository postRepository;
17 |
18 | group('repository test', () {
19 |
20 | PostApi postApi = MockPostApi();
21 | setUp(() {
22 | postRepository = PostRepositoryImpl(postApi);
23 | });
24 |
25 | test('repository get post', () async {
26 | when(postApi.getPosts()).thenAnswer((_) async => Future.value(testPosts));
27 |
28 | List posts = await postRepository.fetchPosts();
29 | expect(testPosts.length, posts.length);
30 | expect(testPosts[0].userId, posts[0].userId);
31 | expect(testPosts[0].id, posts[0].id);
32 | expect(testPosts[0].title, posts[0].title);
33 | expect(testPosts[0].body, posts[0].body);
34 |
35 | verify(postApi.getPosts());
36 | verifyNoMoreInteractions(postApi);
37 | });
38 | });
39 | }
--------------------------------------------------------------------------------
/test/repository_test.mocks.dart:
--------------------------------------------------------------------------------
1 | // Mocks generated by Mockito 5.0.10 from annotations
2 | // in best_architecture_challenge/test/repository_test.dart.
3 | // Do not manually edit this file.
4 |
5 | import 'dart:async' as _i3;
6 |
7 | import 'package:best_architecture_challenge/core/model/post.dart' as _i4;
8 | import 'package:best_architecture_challenge/core/provider/post_api.dart' as _i2;
9 | import 'package:mockito/mockito.dart' as _i1;
10 |
11 | // ignore_for_file: avoid_redundant_argument_values
12 | // ignore_for_file: comment_references
13 | // ignore_for_file: invalid_use_of_visible_for_testing_member
14 | // ignore_for_file: prefer_const_constructors
15 | // ignore_for_file: unnecessary_parenthesis
16 |
17 | /// A class which mocks [PostApi].
18 | ///
19 | /// See the documentation for Mockito's code generation for more information.
20 | class MockPostApi extends _i1.Mock implements _i2.PostApi {
21 | MockPostApi() {
22 | _i1.throwOnMissingStub(this);
23 | }
24 |
25 | @override
26 | _i3.Future> getPosts() =>
27 | (super.noSuchMethod(Invocation.method(#getPosts, []),
28 | returnValue: Future>.value(<_i4.Post>[]))
29 | as _i3.Future>);
30 | }
31 |
--------------------------------------------------------------------------------
/test/usecase_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:best_architecture_challenge/core/domain/fetch_post_usecase.dart';
2 | import 'package:best_architecture_challenge/core/model/post.dart';
3 | import 'package:best_architecture_challenge/core/repository/post_repository_impl.dart';
4 | import 'package:flutter_test/flutter_test.dart';
5 | import 'package:mockito/annotations.dart';
6 | import 'package:mockito/mockito.dart';
7 | import 'raw.dart';
8 | import 'usecase_test.mocks.dart';
9 |
10 | @GenerateMocks([PostRepositoryImpl])
11 | void main() async {
12 |
13 | group('repository test', () {
14 | late MockPostRepositoryImpl mockRepo;
15 | late FetchPostUseCase fetchPostUseCase;
16 |
17 | setUp(() {
18 | mockRepo = MockPostRepositoryImpl();
19 | fetchPostUseCase = FetchPostUseCase(mockRepo);
20 | when(mockRepo.fetchPosts()).thenAnswer((_) async => Future.value(testPosts));
21 | });
22 |
23 | test('repository get post', () async {
24 | List posts = await fetchPostUseCase.execute(FetchPostUseCaseParams());
25 | expect(testPosts.length, posts.length);
26 | expect(testPosts[0].userId, posts[0].userId);
27 | expect(testPosts[0].id, posts[0].id);
28 | expect(testPosts[0].title, posts[0].title);
29 | expect(testPosts[0].body, posts[0].body);
30 |
31 | verify(mockRepo.fetchPosts());
32 | verifyNoMoreInteractions(mockRepo);
33 | });
34 | });
35 | }
--------------------------------------------------------------------------------
/test/usecase_test.mocks.dart:
--------------------------------------------------------------------------------
1 | // Mocks generated by Mockito 5.0.10 from annotations
2 | // in best_architecture_challenge/test/usecase_test.dart.
3 | // Do not manually edit this file.
4 |
5 | import 'dart:async' as _i3;
6 |
7 | import 'package:best_architecture_challenge/core/model/post.dart' as _i4;
8 | import 'package:best_architecture_challenge/core/repository/post_repository_impl.dart'
9 | as _i2;
10 | import 'package:mockito/mockito.dart' as _i1;
11 |
12 | // ignore_for_file: avoid_redundant_argument_values
13 | // ignore_for_file: comment_references
14 | // ignore_for_file: invalid_use_of_visible_for_testing_member
15 | // ignore_for_file: prefer_const_constructors
16 | // ignore_for_file: unnecessary_parenthesis
17 |
18 | /// A class which mocks [PostRepositoryImpl].
19 | ///
20 | /// See the documentation for Mockito's code generation for more information.
21 | class MockPostRepositoryImpl extends _i1.Mock
22 | implements _i2.PostRepositoryImpl {
23 | MockPostRepositoryImpl() {
24 | _i1.throwOnMissingStub(this);
25 | }
26 |
27 | @override
28 | _i3.Future> fetchPosts() =>
29 | (super.noSuchMethod(Invocation.method(#fetchPosts, []),
30 | returnValue: Future>.value(<_i4.Post>[]))
31 | as _i3.Future>);
32 | }
33 |
--------------------------------------------------------------------------------