├── .gitignore
├── .metadata
├── LICENSE.md
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── rlight
│ │ │ │ └── domic
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-hdpi
│ │ │ ├── android12splash.png
│ │ │ └── branding.png
│ │ │ ├── drawable-mdpi
│ │ │ ├── android12splash.png
│ │ │ └── branding.png
│ │ │ ├── drawable-v21
│ │ │ ├── background.png
│ │ │ └── launch_background.xml
│ │ │ ├── drawable-xhdpi
│ │ │ ├── android12splash.png
│ │ │ └── branding.png
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── android12splash.png
│ │ │ └── branding.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ ├── android12splash.png
│ │ │ └── branding.png
│ │ │ ├── drawable
│ │ │ ├── background.png
│ │ │ └── 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-v31
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
└── icon
│ └── domic
│ ├── 1024.png
│ ├── doraemon_1024.png
│ ├── play_store_512.png
│ └── res
│ ├── mipmap-anydpi-v26
│ └── domic.xml
│ ├── mipmap-hdpi
│ ├── domic.png
│ ├── domic_adaptive_back.png
│ └── domic_adaptive_fore.png
│ ├── mipmap-mdpi
│ ├── domic.png
│ ├── domic_adaptive_back.png
│ └── domic_adaptive_fore.png
│ ├── mipmap-xhdpi
│ ├── domic.png
│ ├── domic_adaptive_back.png
│ └── domic_adaptive_fore.png
│ ├── mipmap-xxhdpi
│ ├── domic.png
│ ├── domic_adaptive_back.png
│ └── domic_adaptive_fore.png
│ └── mipmap-xxxhdpi
│ ├── domic.png
│ ├── domic_adaptive_back.png
│ └── domic_adaptive_fore.png
├── flutter_native_splash.yaml
├── images
├── screenshot1.png
└── screenshot2.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── 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
│ ├── BrandingImage.imageset
│ │ ├── BrandingImage.png
│ │ ├── BrandingImage@2x.png
│ │ ├── BrandingImage@3x.png
│ │ └── Contents.json
│ ├── LaunchBackground.imageset
│ │ ├── Contents.json
│ │ └── background.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
├── comic
│ ├── api.dart
│ └── extractors
│ │ ├── bainian.dart
│ │ ├── baozi.dart
│ │ ├── dio.dart
│ │ ├── dto.dart
│ │ ├── dto.g.dart
│ │ ├── gufeng.dart
│ │ ├── jmtt.dart
│ │ ├── kuman.dart
│ │ ├── maofly.dart
│ │ ├── parser_entity.dart
│ │ ├── pufei.dart
│ │ ├── qiman.dart
│ │ ├── qimiao.dart
│ │ ├── utils.dart
│ │ └── wnacg.dart
├── common
│ ├── common.dart
│ ├── global.dart
│ └── hive.dart
├── main.dart
└── widgets
│ ├── components
│ ├── my_comic_card.dart
│ ├── my_comic_comment18.dart
│ ├── my_comic_home.dart
│ ├── my_comic_image.dart
│ ├── my_comic_tag.dart
│ ├── my_download_page.dart
│ ├── my_drawer.dart
│ ├── my_grid_gesture_detector.dart
│ ├── my_setting_action.dart
│ ├── my_status.dart
│ └── my_version.dart
│ ├── my_about_me.dart
│ ├── my_comic_info.dart
│ ├── my_comic_page.dart
│ ├── my_comic_reader.dart
│ ├── my_comic_source.dart
│ ├── my_search_page.dart
│ └── my_search_result.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Podfile.lock
├── 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.lock
├── pubspec.yaml
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
├── manifest.json
└── splash
│ ├── splash.js
│ └── style.css
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
49 | scripts/
50 | .vscode/
51 | test*.*
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
17 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
18 | - platform: android
19 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
20 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
21 | - platform: ios
22 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
23 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
24 | - platform: linux
25 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
26 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
27 | - platform: macos
28 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
29 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
30 | - platform: web
31 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
32 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
33 | - platform: windows
34 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
35 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 r-light
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
9 |
10 | # domic
11 |
12 | [](https://opensource.org/licenses/MIT)
13 | 
14 |
15 | 一个简单的漫画客户端,使用 flutter 开发。
16 |
17 | ## 实现功能
18 |
19 | - [x] 搜索
20 | - [x] 收藏
21 | - [x] 历史
22 | - [x] 下载
23 | - [x] 多种图源
24 | - [x] 浏览部分主页
25 | - [x] 多种阅读方向(:arrow_down:, :arrow_right:, :arrow_left:)
26 | - [x] 多种阅读模式(卷轴、相册)
27 |
28 | ## 支持图源
29 |
30 | - [x] 古风漫画
31 | - [x] 奇漫屋
32 | - [x] 酷漫屋
33 | - [x] 包子漫画
34 |
35 | ## 界面
36 |
37 |
38 |
39 |
40 |
41 |
42 | ## 致谢
43 |
44 | 开发过程中遇到了很多问题,同时也发现了一些比较流行的第三方包,特此鸣谢。
45 |
46 | - [Provider](https://pub.dev/packages/provider)
47 | - [cached_network_image](https://pub.dev/packages/cached_network_image)
48 | - [dio](https://pub.dev/packages/dio)
49 | - [hive](https://pub.dev/packages/hive)
50 | - [reorderable_grid_view](https://pub.dev/packages/reorderable_grid_view)
51 |
52 | - [How to change Android minSdkVersion in flutter project](https://stackoverflow.com/questions/52060516/how-to-change-android-minsdkversion-in-flutter-project)
53 | - [Flutter build Runtime JAR files in the classpath should have the same version](https://stackoverflow.com/questions/71347054/flutter-build-runtime-jar-files-in-the-classpath-should-have-the-same-version-t)
54 | - [Networking in Flutter using Dio](https://www.lmlphp.com/user/16515/article/item/492232/)
55 | - [M1 设备的 Xcode 编译问题深究](https://www.jianshu.com/p/7e9acc13cbbd)
56 | - [ListView disposes and recreates the State & RenderObject of all children (identified by ValueKey) when the item order changes](https://github.com/flutter/flutter/issues/21023)
57 | - [Sqflite guide](https://github.com/tekartik/sqflite/blob/master/sqflite/doc/how_to.md)
58 | - [Dartlang wait more than one future](https://stackoverflow.com/questions/42176092/dartlang-wait-more-than-one-future)
59 | - [Flutter 中的异步](https://juejin.cn/post/6987637272375984165#heading-6)
60 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/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 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/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 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 flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.rlight.domic"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion 22
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/rlight/domic/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.rlight.domic
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-hdpi/android12splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-hdpi/android12splash.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-hdpi/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-hdpi/branding.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-mdpi/android12splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-mdpi/android12splash.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-mdpi/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-mdpi/branding.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-v21/background.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 | -
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xhdpi/android12splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xhdpi/android12splash.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xhdpi/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xhdpi/branding.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xxhdpi/android12splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xxhdpi/android12splash.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xxhdpi/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xxhdpi/branding.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xxxhdpi/android12splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xxxhdpi/android12splash.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-xxxhdpi/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable-xxxhdpi/branding.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/drawable/background.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 | -
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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-v31/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
17 |
20 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
17 |
20 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.8.0'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/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-7.4-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 |
--------------------------------------------------------------------------------
/assets/icon/domic/1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/1024.png
--------------------------------------------------------------------------------
/assets/icon/domic/doraemon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/doraemon_1024.png
--------------------------------------------------------------------------------
/assets/icon/domic/play_store_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/play_store_512.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-anydpi-v26/domic.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-hdpi/domic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-hdpi/domic.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-hdpi/domic_adaptive_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-hdpi/domic_adaptive_back.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-hdpi/domic_adaptive_fore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-hdpi/domic_adaptive_fore.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-mdpi/domic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-mdpi/domic.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-mdpi/domic_adaptive_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-mdpi/domic_adaptive_back.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-mdpi/domic_adaptive_fore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-mdpi/domic_adaptive_fore.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xhdpi/domic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xhdpi/domic.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xhdpi/domic_adaptive_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xhdpi/domic_adaptive_back.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xhdpi/domic_adaptive_fore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xhdpi/domic_adaptive_fore.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxhdpi/domic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxhdpi/domic.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxhdpi/domic_adaptive_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxhdpi/domic_adaptive_back.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxhdpi/domic_adaptive_fore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxhdpi/domic_adaptive_fore.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxxhdpi/domic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxxhdpi/domic.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxxhdpi/domic_adaptive_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxxhdpi/domic_adaptive_back.png
--------------------------------------------------------------------------------
/assets/icon/domic/res/mipmap-xxxhdpi/domic_adaptive_fore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/assets/icon/domic/res/mipmap-xxxhdpi/domic_adaptive_fore.png
--------------------------------------------------------------------------------
/flutter_native_splash.yaml:
--------------------------------------------------------------------------------
1 | flutter_native_splash:
2 | # This package generates native code to customize Flutter's default white native splash screen
3 | # with background color and splash image.
4 | # Customize the parameters below, and run the following command in the terminal:
5 | # flutter pub run flutter_native_splash:create
6 | # To restore Flutter's default white splash screen, run the following command in the terminal:
7 | # flutter pub run flutter_native_splash:remove
8 |
9 | # color or background_image is the only required parameter. Use color to set the background
10 | # of your splash screen to a solid color. Use background_image to set the background of your
11 | # splash screen to a png image. This is useful for gradients. The image will be stretch to the
12 | # size of the app. Only one parameter can be used, color and background_image cannot both be set.
13 | color: "#42a5f5"
14 | #background_image: "assets/background.png"
15 |
16 | # Optional parameters are listed below. To enable a parameter, uncomment the line by removing
17 | # the leading # character.
18 |
19 | # The image parameter allows you to specify an image used in the splash screen. It must be a
20 | # png file and should be sized for 4x pixel density.
21 | #image: assets/splash.png
22 |
23 | # The branding property allows you to specify an image used as branding in the splash screen.
24 | # It must be a png file. Currently, it is only supported for Android < v12 and iOS.
25 | branding: assets/icon/domic/play_store_512.png
26 |
27 | # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
28 | # and bottomLeft. The default values is bottom if not specified or specified something else.
29 | # branding_mode: bottom
30 |
31 | # The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background
32 | # and image when the device is in dark mode. If they are not specified, the app will use the
33 | # parameters from above. If the image_dark parameter is specified, color_dark or
34 | # background_image_dark must be specified. color_dark and background_image_dark cannot both be
35 | # set.
36 | #color_dark: "#042a49"
37 | #background_image_dark: "assets/dark-background.png"
38 | #image_dark: assets/splash-invert.png
39 | #branding_dark: assets/dart_dark.png
40 |
41 | # Android 12 handles the splash screen differently than previous versions. Please visit
42 | # https://developer.android.com/guide/topics/ui/splash-screen
43 | # Following are Android 12 specific parameter.
44 | android_12:
45 | # The image parameter sets the splash screen icon image. If this parameter is not specified,
46 | # the app's launcher icon will be used instead.
47 | # Please note that the splash screen will be clipped to a circle on the center of the screen.
48 | # App icon with an icon background: This should be 960×960 pixels, and fit within a circle
49 | # 640 pixels in diameter.
50 | # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
51 | # 768 pixels in diameter.
52 | image: assets/icon/domic/doraemon_1024.png
53 |
54 | # Splash screen background color.
55 | #color: "#42a5f5"
56 |
57 | # App icon background color.
58 | #icon_background_color: "#111111"
59 |
60 | # The image_dark parameter and icon_background_color_dark set the image and icon background
61 | # color when the device is in dark mode. If they are not specified, the app will use the
62 | # parameters from above.
63 | #image_dark: assets/android12splash-invert.png
64 | #color_dark: "#042a49"
65 | #icon_background_color_dark: "#eeeeee"
66 |
67 | # The android, ios and web parameters can be used to disable generating a splash screen on a given
68 | # platform.
69 | #android: false
70 | #ios: false
71 | #web: false
72 |
73 | # The position of the splash image can be set with android_gravity, ios_content_mode, and
74 | # web_image_mode parameters. All default to center.
75 | #
76 | # android_gravity can be one of the following Android Gravity (see
77 | # https://developer.android.com/reference/android/view/Gravity): bottom, center,
78 | # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
79 | # fill_vertical, left, right, start, or top.
80 | #android_gravity: center
81 | #
82 | # ios_content_mode can be one of the following iOS UIView.ContentMode (see
83 | # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
84 | # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
85 | # bottomLeft, or bottomRight.
86 | #ios_content_mode: center
87 | #
88 | # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
89 | #web_image_mode: center
90 |
91 | # The screen orientation can be set in Android with the android_screen_orientation parameter.
92 | # Valid parameters can be found here:
93 | # https://developer.android.com/guide/topics/manifest/activity-element#screen
94 | #android_screen_orientation: sensorLandscape
95 |
96 | # To hide the notification bar, use the fullscreen parameter. Has no effect in web since web
97 | # has no notification bar. Defaults to false.
98 | # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
99 | # To show the notification bar, add the following code to your Flutter app:
100 | # WidgetsFlutterBinding.ensureInitialized();
101 | # SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
102 | #fullscreen: true
103 |
104 | # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
105 | # with the info_plist_files parameter. Remove only the # characters in the three lines below,
106 | # do not remove any spaces:
107 | #info_plist_files:
108 | # - 'ios/Runner/Info-Debug.plist'
109 | # - 'ios/Runner/Info-Release.plist'
110 |
--------------------------------------------------------------------------------
/images/screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/images/screenshot1.png
--------------------------------------------------------------------------------
/images/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/images/screenshot2.png
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/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 | 12.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, '12.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/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_native_splash (0.0.1):
4 | - Flutter
5 | - package_info_plus (0.4.5):
6 | - Flutter
7 | - path_provider_foundation (0.0.1):
8 | - Flutter
9 | - FlutterMacOS
10 | - sqflite (0.0.3):
11 | - Flutter
12 | - FlutterMacOS
13 | - url_launcher_ios (0.0.1):
14 | - Flutter
15 |
16 | DEPENDENCIES:
17 | - Flutter (from `Flutter`)
18 | - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
19 | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
20 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
21 | - sqflite (from `.symlinks/plugins/sqflite/darwin`)
22 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
23 |
24 | EXTERNAL SOURCES:
25 | Flutter:
26 | :path: Flutter
27 | flutter_native_splash:
28 | :path: ".symlinks/plugins/flutter_native_splash/ios"
29 | package_info_plus:
30 | :path: ".symlinks/plugins/package_info_plus/ios"
31 | path_provider_foundation:
32 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
33 | sqflite:
34 | :path: ".symlinks/plugins/sqflite/darwin"
35 | url_launcher_ios:
36 | :path: ".symlinks/plugins/url_launcher_ios/ios"
37 |
38 | SPEC CHECKSUMS:
39 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
40 | flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
41 | package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
42 | path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
43 | sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
44 | url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
45 |
46 | PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011
47 |
48 | COCOAPODS: 1.15.2
49 |
--------------------------------------------------------------------------------
/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 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/BrandingImage.imageset/BrandingImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/BrandingImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "BrandingImage.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "filename" : "BrandingImage@2x.png",
10 | "idiom" : "universal",
11 | "scale" : "2x"
12 | },
13 | {
14 | "filename" : "BrandingImage@3x.png",
15 | "idiom" : "universal",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "author" : "xcode",
21 | "version" : 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "background.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "author" : "xcode",
19 | "version" : 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "LaunchImage.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "filename" : "LaunchImage@2x.png",
10 | "idiom" : "universal",
11 | "scale" : "2x"
12 | },
13 | {
14 | "filename" : "LaunchImage@3x.png",
15 | "idiom" : "universal",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "author" : "xcode",
21 | "version" : 1
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/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 | CFBundleDisplayName
8 | Domic
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | domic
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIStatusBarHidden
49 |
50 | UIApplicationSupportsIndirectInputEvents
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/comic/api.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/comic/extractors/baozi.dart';
2 | import 'package:domic/comic/extractors/gufeng.dart';
3 | import 'package:domic/comic/extractors/parser_entity.dart';
4 | import 'package:domic/comic/extractors/wnacg.dart';
5 |
6 | final Map comicMethod = {
7 | // "pufei": Pufei(),
8 | "gufeng": Gufeng(),
9 | // "bainian": Bainian(),
10 | // "qimiao": Qimiao(),
11 | // "qiman": Qiman(),
12 | // "maofly": MaoFly(),
13 | // "kuman": Kuman(),
14 | "baozi": Baozi(),
15 | };
16 |
17 | final Map comic18Method = {
18 | "wnacg": Wnacg()
19 | // "jmtt": Jmtt(),
20 | };
21 |
--------------------------------------------------------------------------------
/lib/comic/extractors/bainian.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:domic/comic/extractors/dio.dart';
5 | import 'package:domic/comic/extractors/dto.dart';
6 | import 'package:domic/comic/extractors/parser_entity.dart';
7 | import 'package:domic/comic/extractors/utils.dart';
8 | import 'package:html/parser.dart';
9 |
10 | class Bainian extends Parser {
11 | static Bainian? _instance;
12 | String domainBase = "https://bnman.net/";
13 | String searchBase = "https://bnman.net/search/";
14 |
15 | Bainian._internal() {
16 | _instance = this;
17 | }
18 |
19 | factory Bainian() => _instance ?? Bainian._internal();
20 |
21 | @override
22 | comicByChapter(ComicInfo comicInfo, {int idx = 0}) async {
23 | if (idx >= comicInfo.chapters.length) return;
24 | var chapter = comicInfo.chapters[idx];
25 | var resp = await MyDio().getHtml(RequestOptions(
26 | path: chapter.url,
27 | baseUrl: domainBase,
28 | method: "GET",
29 | ));
30 |
31 | var content = resp.value?.data.toString() ?? "";
32 | // parse chapterImages
33 | RegExp reg = RegExp(r"z_img\s*=\s*([\s\S]*?);");
34 | var match = reg.firstMatch(content);
35 | List chapterImages = [];
36 | if (match != null) {
37 | var tmp = match.group(1)!;
38 | chapterImages = tmp.substring(2, tmp.length - 2).split(",");
39 | for (int i = 0; i < chapterImages.length; i++) {
40 | tmp = trimAllLF(chapterImages[i]);
41 | chapterImages[i] = tmp.substring(1, tmp.length - 1);
42 | chapterImages[i] = chapterImages[i].replaceAll('\\/', '/');
43 | }
44 | }
45 | chapter.len = chapterImages.length;
46 | chapter.images = [];
47 | for (int i = 0; i < chapterImages.length; i++) {
48 | if (chapterImages[i].startsWith("https")) {
49 | chapter.images.add(ImageInfo(chapterImages[i]));
50 | } else {
51 | chapter.images
52 | .add(ImageInfo('https://img.hngxgt.net/${chapterImages[i]}'));
53 | }
54 | }
55 | }
56 |
57 | @override
58 | Future comicById(String id) async {
59 | var resp = await MyDio().getHtml(RequestOptions(
60 | path: id,
61 | method: "GET",
62 | baseUrl: domainBase,
63 | ));
64 | var content = resp.value?.data.toString();
65 | var doc = parse(content);
66 | var detailList = doc.querySelector(".info.l>ul")?.children ?? [];
67 | var title = detailList.isNotEmpty ? detailList[0].text : "";
68 | title = trimAllLF(title);
69 | var state = ComicState.unknown;
70 |
71 | var author = "";
72 | if (detailList.length >= 4) {
73 | author = detailList[3].querySelector("p")?.text ?? "";
74 | }
75 | var thumb = doc.querySelector(".bpic.l>img")?.attributes["src"] ?? "";
76 | var updateDate = detailList.last.querySelector("p")?.text ?? "";
77 | var uploadDate = updateDate;
78 |
79 | var description = doc.querySelector(".box01.l>.mt10")?.text ?? "";
80 | List chapters = [];
81 | int idx = 0;
82 | // parse chapter
83 | doc.querySelector(".box01>.jslist01")?.querySelectorAll("li").forEach((e) {
84 | if (idx++ == 0) return;
85 | var title = e.text;
86 | title = trimAllLF(title);
87 | var url = e.children[0].attributes["href"] ?? "";
88 | chapters.add(Chapter(title, url, 0, []));
89 | });
90 | var res = ComicInfo(id, title, thumb, updateDate, uploadDate, description,
91 | chapters, author);
92 | res.state = state;
93 | return res;
94 | }
95 |
96 | @override
97 | Future comicByName(String name, int page) async {
98 | var resp = await MyDio().getHtml(RequestOptions(
99 | path: "$searchBase$name/$page.html",
100 | method: "GET",
101 | ));
102 | return parsePageHelper(resp);
103 | }
104 |
105 | ComicPageData parsePageHelper(MapEntry?> resp) {
106 | var content = resp.value?.data.toString() ?? "";
107 | var doc = parse(content);
108 | // parse page
109 | var pageCount = 1;
110 | doc.querySelector(".pagination")?.querySelectorAll("li").forEach((element) {
111 | pageCount = max(pageCount, int.tryParse(trimAllLF(element.text)) ?? 1);
112 | });
113 | List list = [];
114 | doc.querySelector("#list_img")?.querySelectorAll("li").forEach((e) {
115 | var title = e.querySelector("p")?.text ?? "";
116 | title = trimAllLF(title);
117 | var thumb = e.querySelector("img")?.attributes["src"] ?? "";
118 | var id = e.querySelector("a")?.attributes["href"] ?? "";
119 |
120 | var updateDate = e.querySelector("em")?.text ?? "";
121 | updateDate = trimAllLF(updateDate);
122 |
123 | var source = "bainian";
124 | var sourceName = sourcesName["bainian"] ?? "";
125 | var author = "";
126 | list.add(ComicSimple(
127 | id, title, thumb, author, updateDate, source, sourceName));
128 | });
129 | return ComicPageData(pageCount, list);
130 | }
131 |
132 | Future>> getComicTabs() async {
133 | var resp = await MyDio().getHtml(
134 | RequestOptions(path: domainBase, method: "GET"),
135 | );
136 | var content = resp.value?.data.toString();
137 | var doc = parse(content);
138 | List> res = [];
139 | doc.querySelectorAll(".warp>ul>li").forEach((element) {
140 | var href = element.firstChild?.attributes["href"] ?? "";
141 | var text = trimAllLF(element.text);
142 | res.add(MapEntry(text, href));
143 | });
144 |
145 | return res.sublist(1);
146 | }
147 |
148 | Future comicByTab(String path, int page) async {
149 | var resp = await MyDio().getHtml(
150 | RequestOptions(path: path, baseUrl: domainBase, method: "GET"),
151 | );
152 | return parsePageHelper(resp);
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/lib/comic/extractors/dio.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 |
3 | class MyDio {
4 | static MyDio? _instance;
5 | late Dio dio;
6 |
7 | MyDio._internal() {
8 | dio = Dio();
9 | dio.options.connectTimeout = 5000;
10 | dio.options.receiveTimeout = 10000;
11 | _instance = this;
12 | }
13 |
14 | factory MyDio() => _instance ?? MyDio._internal();
15 |
16 | Future> getHtml(
17 | RequestOptions requestOptions) async {
18 | try {
19 | var resp = await MyDio().dio.fetch(requestOptions);
20 | return MapEntry(resp.statusCode ?? 0, resp);
21 | } catch (e) {
22 | return const MapEntry(-1, null);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/comic/extractors/maofly.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:domic/comic/extractors/dio.dart';
5 | import 'package:domic/comic/extractors/dto.dart';
6 | import 'package:domic/comic/extractors/parser_entity.dart';
7 | import 'package:domic/comic/extractors/utils.dart';
8 | import 'package:html/parser.dart';
9 | import 'package:lzstring/lzstring.dart';
10 |
11 | class MaoFly extends Parser {
12 | static MaoFly? _instance;
13 | String domainBase = "https://www.maofly.com/";
14 | String searchBase = "https://www.maofly.com/search.html";
15 | String imgBase = "https://mao.mhtupian.com/uploads/";
16 |
17 | MaoFly._internal() {
18 | _instance = this;
19 | }
20 |
21 | factory MaoFly() => _instance ?? MaoFly._internal();
22 |
23 | @override
24 | comicByChapter(ComicInfo comicInfo, {int idx = 0}) async {
25 | if (idx >= comicInfo.chapters.length) return;
26 | var chapter = comicInfo.chapters[idx];
27 | var resp = await MyDio().getHtml(RequestOptions(
28 | path: chapter.url,
29 | method: "GET",
30 | ));
31 |
32 | var content = resp.value?.data.toString() ?? "";
33 | // parse chapterImages
34 | RegExp reg = RegExp(r'let img_data = "(.*?)"');
35 | var match = reg.firstMatch(content);
36 | if (match != null) {
37 | var tmp = match.group(1)!;
38 | LZString.decompressFromBase64Sync(tmp)?.split(",").forEach((element) {
39 | chapter.images.add(ImageInfo(imgBase + element));
40 | });
41 | }
42 | chapter.len = chapter.images.length;
43 | }
44 |
45 | @override
46 | Future comicById(String id) async {
47 | var resp = await MyDio().getHtml(RequestOptions(
48 | path: id,
49 | method: "GET",
50 | ));
51 | var content = resp.value?.data.toString();
52 | var doc = parse(content);
53 |
54 | var detailList =
55 | doc.querySelector(".comic-meta-data-table")?.querySelectorAll("tr") ??
56 | [];
57 | var state = ComicState.unknown;
58 | var title = "", author = "", thumb = "", updateDate = "";
59 |
60 | if (detailList.isNotEmpty) {
61 | title = detailList[0].querySelector(".comic-titles")?.text ?? "";
62 | title = trimAllLF(title);
63 | state = ComicState.unknown;
64 | if (detailList[3].children.last.text.contains("连载")) {
65 | state = ComicState.ongoing;
66 | }
67 | if (detailList[3].children.last.text.contains("完结")) {
68 | state = ComicState.completed;
69 | }
70 |
71 | author = trimAllLF(detailList[detailList.length - 2].children.last.text);
72 | thumb = detailList[2].querySelector("img")?.attributes["src"] ?? "";
73 | updateDate = detailList.last.children.last.text;
74 | var list = updateDate.split(" ");
75 | if (list.length > 2) {
76 | updateDate = list[1];
77 | } else {
78 | updateDate = list[0];
79 | }
80 | }
81 | var uploadDate = updateDate;
82 |
83 | var description = doc.querySelector(".comic_story")?.text ?? "";
84 | description = trimAllLF(description);
85 |
86 | List chapters = [];
87 | // parse chapter
88 | doc.querySelector("#comic-book-list")?.children.forEach((panel) {
89 | panel.querySelectorAll("li").forEach((chapter) {
90 | var title = chapter.text;
91 | title = trimAllLF(title);
92 | var url = chapter.querySelector("a")?.attributes["href"] ?? "";
93 | chapters.add(Chapter(title, url, 0, []));
94 | });
95 | });
96 | var res = ComicInfo(id, title, thumb, updateDate, uploadDate, description,
97 | chapters, author);
98 | res.state = state;
99 | return res;
100 | }
101 |
102 | @override
103 | Future comicByName(String name, int page) async {
104 | var resp = await MyDio().getHtml(RequestOptions(
105 | path: searchBase,
106 | method: "GET",
107 | queryParameters: {"q": name, "page": page}));
108 | return parsePageHelper(resp);
109 | }
110 |
111 | ComicPageData parsePageHelper(MapEntry?> resp) {
112 | var content = resp.value?.data.toString() ?? "";
113 | var doc = parse(content);
114 | // parse page
115 | var pageCount = 1;
116 | doc.querySelector(".pagination")?.querySelectorAll("a").forEach((element) {
117 | pageCount = max(pageCount, int.tryParse(trimAllLF(element.text)) ?? 1);
118 | });
119 |
120 | List list = [];
121 | doc.querySelectorAll(".comicbook-index").forEach((e) {
122 | var title = e.querySelector(".one-line")?.text ?? "";
123 | title = trimAllLF(title);
124 | var thumb = e.querySelector("img")?.attributes["data-original"] ??
125 | e.querySelector("img")?.attributes["src"] ??
126 | "";
127 | var id = e.querySelector("a")?.attributes["href"] ?? "";
128 |
129 | var updateDate = "";
130 | var source = "maofly";
131 | var sourceName = sourcesName["maofly"] ?? "";
132 | var author = trimAllLF(e.querySelector(".comic-author")?.text ?? "");
133 |
134 | list.add(ComicSimple(
135 | id, title, thumb, author, updateDate, source, sourceName));
136 | });
137 | int? maxNum;
138 | doc.querySelector(".text-muted")?.text.split(" ").forEach(
139 | (element) {
140 | maxNum ??= int.tryParse(element);
141 | },
142 | );
143 | return ComicPageData(pageCount, list, maxNum: maxNum);
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/lib/comic/extractors/parser_entity.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/comic/extractors/dto.dart';
2 |
3 | abstract class Parser {
4 | Future comicByName(String name, int page);
5 | Future comicById(String id);
6 | comicByChapter(ComicInfo comicInfo, {int idx = 0});
7 | }
8 |
--------------------------------------------------------------------------------
/lib/comic/extractors/qimiao.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:domic/comic/extractors/dio.dart';
5 | import 'package:domic/comic/extractors/dto.dart';
6 | import 'package:domic/comic/extractors/parser_entity.dart';
7 | import 'package:domic/comic/extractors/utils.dart';
8 | import 'package:html/parser.dart';
9 |
10 | class Qimiao extends Parser {
11 | static Qimiao? _instance;
12 | String domainBase = "https://www.qimiaomh.com/";
13 | String searchBase = "https://www.qimiaomh.com/search/";
14 |
15 | Qimiao._internal() {
16 | _instance = this;
17 | }
18 |
19 | factory Qimiao() => _instance ?? Qimiao._internal();
20 |
21 | @override
22 | comicByChapter(ComicInfo comicInfo, {int idx = 0}) async {
23 | if (idx >= comicInfo.chapters.length) return;
24 | var chapter = comicInfo.chapters[idx];
25 | var resp = await MyDio().getHtml(RequestOptions(
26 | path: chapter.url,
27 | baseUrl: domainBase,
28 | method: "GET",
29 | ));
30 |
31 | var content = resp.value?.data.toString() ?? "";
32 | // parse chapterImages
33 | RegExp reg = RegExp(r"z_img\s*=\s*([\s\S]*?);");
34 | var match = reg.firstMatch(content);
35 | List chapterImages = [];
36 | if (match != null) {
37 | var tmp = match.group(1)!;
38 | chapterImages = tmp.substring(2, tmp.length - 2).split(",");
39 | for (int i = 0; i < chapterImages.length; i++) {
40 | tmp = trimAllLF(chapterImages[i]);
41 | chapterImages[i] = tmp.substring(1, tmp.length - 1);
42 | }
43 | }
44 | chapter.len = chapterImages.length;
45 | chapter.images = [];
46 | for (int i = 0; i < chapterImages.length; i++) {
47 | if (chapterImages[i].contains("mh1.88bada.com")) {
48 | chapterImages[i]
49 | .replaceAll("mh1.88bada.com", "mh1.xinxiongyuehardware.com");
50 | }
51 | if (chapterImages[i].contains("mh2.88bada.com")) {
52 | chapterImages[i]
53 | .replaceAll("mh2.88bada.com", "mh2.xinxiongyuehardware.com");
54 | }
55 | if (chapterImages[i].contains("i.ougannike.com")) {
56 | chapterImages[i].replaceAll("i.ougannike.com", "i.ywzqzx.com");
57 | }
58 | if (chapterImages[i].contains("res.img.yzrbhb.com")) {
59 | chapterImages[i].replaceAll("res.img.yzrbhb.com", "res.img.djk123.net");
60 | }
61 | chapter.images.add(ImageInfo(chapterImages[i]));
62 | }
63 | }
64 |
65 | @override
66 | Future comicById(String id) async {
67 | var resp = await MyDio().getHtml(RequestOptions(
68 | path: id,
69 | method: "GET",
70 | baseUrl: domainBase,
71 | ));
72 | var content = resp.value?.data.toString();
73 | var doc = parse(content);
74 |
75 | var detailList = doc.querySelector(".ctdbRight>.ctdbRightInner");
76 |
77 | var clone = detailList?.querySelector(".title")?.clone(true);
78 | clone?.querySelector("span")?.remove();
79 | var title = clone?.text ?? "";
80 | title = trimAllLF(title);
81 | var state = ComicState.unknown;
82 | if (detailList?.querySelector(".updeteStatus")?.text.contains("连载") ??
83 | false) {
84 | state = ComicState.ongoing;
85 | } else if (detailList
86 | ?.querySelector(".updeteStatus")
87 | ?.text
88 | .contains("完结") ??
89 | false) {
90 | state = ComicState.completed;
91 | }
92 |
93 | clone = detailList?.querySelector(".author")?.clone(true);
94 | clone?.querySelector("span")?.remove();
95 | var author = clone?.text ?? "";
96 | author = trimAllLF(author);
97 |
98 | var thumb =
99 | doc.querySelector("inner")?.querySelector("img")?.attributes["src"] ??
100 | "";
101 | var updateDate = detailList?.querySelector(".date")?.text ?? "";
102 | int i = 0;
103 | while (i < updateDate.length &&
104 | !(updateDate[i].codeUnitAt(0) >= '0'.codeUnitAt(0) &&
105 | updateDate[i].codeUnitAt(0) <= '9'.codeUnitAt(0))) {
106 | i++;
107 | }
108 | updateDate = updateDate.substring(i);
109 | var uploadDate = updateDate;
110 |
111 | var description = doc.querySelector("#worksDesc")?.text ?? "";
112 | description = trimAllLF(description);
113 | List chapters = [];
114 | // parse chapter
115 | doc
116 | .querySelector(".comic-content-list")
117 | ?.querySelectorAll("ul")
118 | .forEach((e) {
119 | var title = e.querySelector(".tit")?.text ?? "";
120 | title = trimAllLF(title);
121 | var url = e.querySelector(".tit>a")?.attributes["href"] ?? "";
122 | chapters.add(Chapter(title, url, 0, []));
123 | });
124 | var res = ComicInfo(id, title, thumb, updateDate, uploadDate, description,
125 | chapters, author);
126 | res.state = state;
127 | return res;
128 | }
129 |
130 | @override
131 | Future comicByName(String name, int page) async {
132 | var resp = await MyDio().getHtml(RequestOptions(
133 | path: "$searchBase$name/$page.html",
134 | method: "GET",
135 | ));
136 | return parsePageHelper(resp);
137 | }
138 |
139 | ComicPageData parsePageHelper(MapEntry?> resp) {
140 | var content = resp.value?.data.toString() ?? "";
141 | var doc = parse(content);
142 | // parse page
143 | var pageCount = 1;
144 | doc.querySelector(".pagination")?.querySelectorAll("li").forEach((element) {
145 | pageCount = max(pageCount, int.tryParse(trimAllLF(element.text)) ?? 1);
146 | });
147 |
148 | List list = [];
149 | doc
150 | .querySelector(".wrapper.clearfix.mt20>.mt20")
151 | ?.querySelectorAll(".classification")
152 | .forEach((e) {
153 | var title = e.querySelector("h2")?.text ?? "";
154 | title = trimAllLF(title);
155 | var thumb = e.querySelector("img")?.attributes["data-src"] ??
156 | e.querySelector("img")?.attributes["src"] ??
157 | "";
158 | var id = e.querySelector("a")?.attributes["href"] ?? "";
159 |
160 | var updateDate = "";
161 |
162 | var source = "qimiao";
163 | var sourceName = sourcesName["qimiao"] ?? "";
164 | var author = "";
165 | list.add(ComicSimple(
166 | id, title, thumb, author, updateDate, source, sourceName));
167 | });
168 | return ComicPageData(pageCount, list);
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/lib/comic/extractors/utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:gbk_codec/gbk_codec.dart';
3 |
4 | String gbkUrlLenEncode(String input, {String sep = "%"}) {
5 | List gbk = gbk_bytes.encode(input);
6 | var hex = '';
7 | for (var i in gbk) {
8 | hex += sep + i.toRadixString(16).toUpperCase();
9 | }
10 | return hex;
11 | }
12 |
13 | String gbkDecoder(List responseBytes, RequestOptions options,
14 | ResponseBody responseBody) {
15 | return gbk_bytes.decode(responseBytes);
16 | }
17 |
18 | String trimAllLF(String s) {
19 | return s.replaceAll('\n', " ").trim();
20 | }
21 |
--------------------------------------------------------------------------------
/lib/common/common.dart:
--------------------------------------------------------------------------------
1 | class ConstantString {
2 | static const appName = "domic";
3 | static const favorite = "收藏";
4 | static const favorite18 = "收藏";
5 | static const history = "历史";
6 | static const source = "图源";
7 | static const setting = "设置";
8 | static const about = "关于";
9 | static const chapters = "章节";
10 | static const comments = "评论";
11 | static const recommendations = "推荐";
12 | static const comicPageTitle = "漫画";
13 | static const searchPageTitle = "搜索";
14 |
15 | static const comicDefaultSearchContent = "请输入您的内容...";
16 |
17 | static const pufei = "pufei";
18 | static const jmtt = "jmtt";
19 | static const gufeng = "gufeng";
20 | static const bainian = "bainian";
21 | static const qimiao = "qimiao";
22 | static const qiman = "qiman";
23 | static const maofly = "maofly";
24 | static const kuman = "kuman";
25 | static const baozi = "baozi";
26 | static const wnacg = "wnacg";
27 |
28 | static const pufeiCacheBox = "pufeiCacheLazy";
29 | static const jmttCacheBox = "jmttCacheLazy";
30 | static const gufengCacheBox = "gufengCacheLazy";
31 | static const bainianCacheBox = "bainianCacheLazy";
32 | static const qimiaoCacheBox = "qimiaoCacheLazy";
33 | static const qimanCacheBox = "qimanCacheLazy";
34 | static const maoflyCacheBox = "maoflyCacheLazy";
35 | static const kumanCacheBox = "kumanCacheLazy";
36 | static const baoziCacheBox = "baoziCacheLazy";
37 | static const wnacgCacheBox = "wnacgCacheLazy";
38 |
39 | static const comic18DownloadBox = "comic18DownloadLazy";
40 |
41 | static const comicBox = "comic";
42 | static const propertyBox = "property";
43 | static const timeBox = "cacheTimeStamp";
44 |
45 | static const boxName = [propertyBox, comicBox, timeBox];
46 | static const downloadBox = [comic18DownloadBox];
47 |
48 | static const lazyBoxName = [
49 | pufeiCacheBox,
50 | jmttCacheBox,
51 | gufengCacheBox,
52 | bainianCacheBox,
53 | qimiaoCacheBox,
54 | qimanCacheBox,
55 | maoflyCacheBox,
56 | kumanCacheBox,
57 | baoziCacheBox,
58 | wnacgCacheBox
59 | ];
60 |
61 | static const sourceToLazyBox = {
62 | pufei: pufeiCacheBox,
63 | jmtt: jmttCacheBox,
64 | gufeng: gufengCacheBox,
65 | bainian: bainianCacheBox,
66 | qimiao: qimiaoCacheBox,
67 | qiman: qimanCacheBox,
68 | maofly: maoflyCacheBox,
69 | kuman: kumanCacheBox,
70 | baozi: baoziCacheBox,
71 | wnacg: wnacgCacheBox
72 | };
73 |
74 | static const readerDirectionName = ["从上到下", "从左到右", "从右到左"];
75 | static const readerTypeName = ["卷轴模式", "相册模式"];
76 |
77 | static const defaultCoverUrl =
78 | "https://manhua.acimg.cn/vertical/0/18_17_39_ea5671977fc690a42459210737b4c67a_1592473175770.jpg/420";
79 | static const versionUrl =
80 | "https://api.github.com/repos/r-light/domic/releases/latest";
81 | static const releaseUrl = "https://github.com/r-light/domic/releases/";
82 | }
83 |
84 | class Routes {
85 | // static const String myComicPageRoute = "MyComicPage";
86 | static const String myComicSearchPageRoute = "MyComicSearchPage";
87 | static const String myComicSourceRoute = "MyComicSource";
88 | static const String myComicSearchResultRoute = "MyComicSearchResult";
89 | static const String mySettingRoute = "MySettingsAction";
90 | static const String myComicInfoRoute = "MyComicInfo";
91 | static const String myComicReaderRoute = "MyComicReader";
92 | static const String myAboutMeRoute = "MyAboutMe";
93 | static const String myComicHomeRoute = "MyComicHome";
94 | static const String myComicTagRoute = "MyComicTag";
95 | static const String myDownloadRoute = "MyDownload";
96 | static const routes = {
97 | // ConstantString.pufei: myComicTagRoute,
98 | ConstantString.gufeng: myComicTagRoute,
99 | // ConstantString.bainian: myComicTagRoute,
100 | // ConstantString.qiman: myComicTagRoute,
101 | // ConstantString.kuman: myComicTagRoute,
102 | ConstantString.baozi: myComicTagRoute,
103 | // ConstantString.jmtt: myComicTagRoute,
104 | ConstantString.wnacg: myComicTagRoute,
105 | };
106 | }
107 |
--------------------------------------------------------------------------------
/lib/common/hive.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/common/common.dart';
2 | import 'package:hive_flutter/hive_flutter.dart';
3 |
4 | class MyHive {
5 | static final MyHive _myHive = MyHive._internal();
6 |
7 | factory MyHive() {
8 | return _myHive;
9 | }
10 |
11 | MyHive._internal();
12 |
13 | init() async {
14 | await Hive.initFlutter();
15 | for (var name in ConstantString.boxName) {
16 | await Hive.openBox(name);
17 | }
18 | for (var name in ConstantString.lazyBoxName) {
19 | await Hive.openLazyBox(name);
20 | }
21 | for (var name in ConstantString.downloadBox) {
22 | await Hive.openLazyBox(name);
23 | }
24 | }
25 |
26 | bool isInHive(String lazyBoxName, String key,
27 | {Duration dur = const Duration(days: 1)}) {
28 | var box = Hive.lazyBox(lazyBoxName);
29 | var timeBox = Hive.box(ConstantString.timeBox);
30 | var timeKey = timeStampKey(key);
31 | if (timeBox.containsKey(timeKey)) {
32 | var before = timeBox.get(timeKey);
33 | var diff = DateTime.now().difference(before).inSeconds;
34 | if (diff <= dur.inSeconds) {
35 | return box.containsKey(key);
36 | }
37 | }
38 | return false;
39 | }
40 |
41 | Future getInHive(String lazyBoxName, String key) {
42 | return Hive.lazyBox(lazyBoxName).get(key);
43 | }
44 |
45 | void putInHive(String lazyBoxName, String key, dynamic value) async {
46 | await Hive.lazyBox(lazyBoxName).put(key, value);
47 | Hive.box(ConstantString.timeBox).put(timeStampKey(key), DateTime.now());
48 | }
49 |
50 | String timeStampKey(String key) {
51 | return "${key}DateTime";
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/comic/extractors/dto.dart';
2 | import 'package:domic/common/common.dart';
3 | import 'package:domic/common/global.dart';
4 | import 'package:domic/common/hive.dart';
5 | import 'package:domic/widgets/components/my_comic_home.dart';
6 | import 'package:domic/widgets/components/my_comic_tag.dart';
7 | import 'package:domic/widgets/components/my_download_page.dart';
8 | import 'package:domic/widgets/components/my_setting_action.dart';
9 | import 'package:domic/widgets/components/my_version.dart';
10 | import 'package:domic/widgets/my_about_me.dart';
11 | import 'package:domic/widgets/my_comic_info.dart';
12 | import 'package:domic/widgets/my_comic_reader.dart';
13 | import 'package:domic/widgets/my_comic_source.dart';
14 | import 'package:domic/widgets/my_search_page.dart';
15 | import 'package:domic/widgets/my_comic_page.dart';
16 | import 'package:domic/widgets/my_search_result.dart';
17 | import 'package:flutter/material.dart';
18 | import 'package:flutter_easyloading/flutter_easyloading.dart';
19 | import 'package:hive/hive.dart';
20 | import 'package:provider/provider.dart';
21 |
22 | void main() async {
23 | WidgetsFlutterBinding.ensureInitialized();
24 |
25 | Hive.registerAdapter(PageDataAdapter());
26 | Hive.registerAdapter(ComicSimpleAdapter());
27 | Hive.registerAdapter(ComicPageDataAdapter());
28 | Hive.registerAdapter(ImageInfoAdapter());
29 | Hive.registerAdapter(ChapterAdapter());
30 | Hive.registerAdapter(ComicInfoAdapter());
31 | Hive.registerAdapter(ComicStateAdapter());
32 | Hive.registerAdapter(ReaderDirectionAdapter());
33 | Hive.registerAdapter(ReaderTypeAdapter());
34 | await MyHive().init();
35 |
36 | Global.defaultCover = ConstantString.defaultCoverUrl;
37 | await initVersion();
38 |
39 | runApp(MultiProvider(
40 | providers: [
41 | ChangeNotifierProvider(
42 | create: (_) => ComicLocal(),
43 | lazy: false,
44 | ),
45 | ChangeNotifierProvider(
46 | create: (_) => Configs(),
47 | lazy: false,
48 | ),
49 | ChangeNotifierProvider(
50 | create: (_) => ComicSource(),
51 | lazy: false,
52 | ),
53 | ],
54 | child: const MyApp(),
55 | ));
56 | }
57 |
58 | class MyApp extends StatelessWidget {
59 | const MyApp({Key? key}) : super(key: key);
60 |
61 | // This widget is the root of the application.
62 | @override
63 | Widget build(BuildContext context) {
64 | return MaterialApp(
65 | title: ConstantString.appName,
66 | initialRoute: "/",
67 | locale: const Locale('zh', 'CN'),
68 | onGenerateRoute: (RouteSettings settings) {
69 | var routes = {
70 | Routes.myComicSearchResultRoute: (ctx) =>
71 | MyComicSearchResult(content: settings.arguments),
72 | Routes.myComicInfoRoute: (ctx) =>
73 | MyComicInfoPage(content: settings.arguments),
74 | Routes.myComicReaderRoute: (ctx) =>
75 | MyComicReader(content: settings.arguments),
76 | Routes.myComicHomeRoute: (ctx) =>
77 | MyComicHome(content: settings.arguments),
78 | Routes.myComicTagRoute: (ctx) =>
79 | MyComicTag(content: settings.arguments),
80 | Routes.myDownloadRoute: (ctx) =>
81 | MyDownloadPage(content: settings.arguments)
82 | };
83 | WidgetBuilder builder = routes[settings.name]!;
84 | return MaterialPageRoute(builder: (ctx) => builder(ctx));
85 | },
86 | routes: {
87 | Routes.myComicSearchPageRoute: (context) => const MyComicSearchPage(),
88 | Routes.myComicSourceRoute: (context) => const MyComicSource(),
89 | Routes.mySettingRoute: (context) => const MySetting(),
90 | Routes.myAboutMeRoute: (context) => const MyAboutMe(),
91 | },
92 | theme: ThemeData(
93 | useMaterial3: false,
94 | brightness: Brightness.light,
95 | colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue)
96 | .copyWith(surface: Colors.white),
97 | ),
98 | darkTheme: ThemeData(
99 | brightness: Brightness.dark,
100 | /* dark theme settings */
101 | ),
102 | themeMode: ThemeMode.system,
103 | home: const MyComicPage(),
104 | builder: EasyLoading.init(),
105 | );
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_comic_card.dart:
--------------------------------------------------------------------------------
1 | import 'package:cached_network_image/cached_network_image.dart';
2 | import 'package:domic/comic/extractors/dto.dart';
3 | import 'package:domic/common/global.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:provider/provider.dart';
6 |
7 | class ComicSimpleItem extends StatelessWidget {
8 | const ComicSimpleItem({
9 | Key? key,
10 | required this.isList,
11 | required this.comicSimple,
12 | }) : super(key: key);
13 |
14 | static final Color lightColor = Colors.grey.shade700;
15 | final ComicSimple comicSimple;
16 | final bool isList;
17 | static const double fontSize = 12;
18 |
19 | Widget listItem(BuildContext context) {
20 | return Row(
21 | crossAxisAlignment: CrossAxisAlignment.start,
22 | children: [
23 | Expanded(
24 | flex: 2,
25 | child: cacheImg(comicSimple.thumb),
26 | ),
27 | Expanded(
28 | flex: 2,
29 | child: Padding(
30 | padding: const EdgeInsets.only(left: 10.0),
31 | child: Column(
32 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
33 | crossAxisAlignment: CrossAxisAlignment.start,
34 | children: [
35 | Text(
36 | comicSimple.title,
37 | style: const TextStyle(
38 | fontSize: fontSize,
39 | ),
40 | maxLines: 5,
41 | ),
42 | Text(
43 | comicSimple.author,
44 | style: TextStyle(fontSize: fontSize, color: lightColor),
45 | ),
46 | Text(
47 | comicSimple.star == null ? "" : "${comicSimple.star}喜欢",
48 | style: TextStyle(fontSize: fontSize, color: lightColor),
49 | ),
50 | ],
51 | ),
52 | )),
53 | Expanded(
54 | flex: 2,
55 | child: Column(
56 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
57 | crossAxisAlignment: CrossAxisAlignment.end,
58 | children: [
59 | Text(
60 | comicSimple.sourceName,
61 | style: TextStyle(
62 | color: lightColor,
63 | fontSize: fontSize,
64 | ),
65 | ),
66 | Text(
67 | comicSimple.updateDate,
68 | style: TextStyle(
69 | color: lightColor,
70 | fontSize: fontSize,
71 | ),
72 | ),
73 | ],
74 | )),
75 | ],
76 | );
77 | }
78 |
79 | Widget gridItem(BuildContext context) {
80 | return GridTile(
81 | footer: context.select((Configs config) => config.showFooterInGridView)
82 | ? Container(
83 | color: Colors.white54,
84 | child: Column(children: [
85 | Text(
86 | comicSimple.title,
87 | style:
88 | const TextStyle(color: Colors.black, fontSize: fontSize),
89 | textAlign: TextAlign.center,
90 | maxLines: 1,
91 | // overflow: TextOverflow.ellipsis,
92 | ),
93 | Text(
94 | comicSimple.author,
95 | style: TextStyle(color: Colors.grey[800], fontSize: fontSize),
96 | textAlign: TextAlign.center,
97 | maxLines: 1,
98 | ),
99 | Text(
100 | comicSimple.sourceName,
101 | style: TextStyle(color: Colors.grey[800], fontSize: fontSize),
102 | textAlign: TextAlign.center,
103 | maxLines: 1,
104 | ),
105 | ]),
106 | )
107 | : Container(),
108 | child: cacheImg(comicSimple.thumb),
109 | );
110 | }
111 |
112 | @override
113 | Widget build(BuildContext context) {
114 | return isList ? listItem(context) : gridItem(context);
115 | }
116 |
117 | Widget cacheImg(String url) {
118 | return CachedNetworkImage(
119 | imageUrl: url,
120 | fit: BoxFit.cover,
121 | fadeInDuration: Duration.zero,
122 | fadeOutDuration: Duration.zero,
123 | errorWidget: (context, url, error) => const Center(
124 | child: Icon(
125 | Icons.error,
126 | color: Colors.red,
127 | ),
128 | ),
129 | );
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_comic_comment18.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:cached_network_image/cached_network_image.dart';
4 | import 'package:domic/comic/extractors/dto.dart';
5 | import 'package:domic/comic/extractors/jmtt.dart';
6 | import 'package:domic/widgets/components/my_status.dart';
7 | import 'package:flutter/material.dart';
8 |
9 | class MyComicComment18 extends StatefulWidget {
10 | final String id;
11 |
12 | const MyComicComment18({
13 | required this.id,
14 | Key? key,
15 | }) : super(key: key);
16 |
17 | @override
18 | State createState() => MyComicComment18State();
19 | }
20 |
21 | class MyComicComment18State extends State
22 | with AutomaticKeepAliveClientMixin {
23 | bool isLoading = true;
24 | bool hasMore = true;
25 | int currentPage = 1;
26 | List comments = [];
27 | late Color fontColor =
28 | MediaQuery.of(context).platformBrightness == Brightness.dark
29 | ? Colors.white
30 | : Colors.grey.shade800;
31 | late Color iconColor =
32 | MediaQuery.of(context).platformBrightness == Brightness.dark
33 | ? Colors.white
34 | : Colors.grey;
35 | void loadMoreComments() async {
36 | isLoading = true;
37 | var id = widget.id;
38 | var entry = await Jmtt().commentById(id, page: currentPage);
39 | comments.addAll(entry.key);
40 | setState(() {
41 | isLoading = false;
42 | currentPage++;
43 | hasMore = entry.value;
44 | });
45 | }
46 |
47 | @override
48 | void initState() {
49 | super.initState();
50 | loadMoreComments();
51 | }
52 |
53 | @override
54 | Widget build(BuildContext context) {
55 | super.build(context);
56 | if (isLoading && comments.isEmpty) {
57 | return const MyWaiting();
58 | }
59 |
60 | return ListView.separated(
61 | padding: const EdgeInsets.all(5.0),
62 | itemBuilder: (context, index) {
63 | if (index >= comments.length) {
64 | if (!isLoading) {
65 | loadMoreComments();
66 | }
67 | return const MyWaiting();
68 | }
69 | var comment = comments[index];
70 | return commentListTile(comment);
71 | },
72 | separatorBuilder: (context, index) => const Divider(
73 | thickness: 4,
74 | ),
75 | itemCount: hasMore ? comments.length + 1 : comments.length);
76 | }
77 |
78 | Widget cacheImg(String url) {
79 | return ClipRRect(
80 | borderRadius: BorderRadius.circular(10000.0),
81 | child: CachedNetworkImage(
82 | width: 60,
83 | imageUrl: url,
84 | fit: BoxFit.cover,
85 | fadeInDuration: Duration.zero,
86 | fadeOutDuration: Duration.zero,
87 | errorWidget: (context, url, error) => const Center(
88 | child: Icon(
89 | Icons.error,
90 | color: Colors.red,
91 | ),
92 | ),
93 | ));
94 | }
95 |
96 | @override
97 | bool get wantKeepAlive => true;
98 |
99 | Widget commentListTile(CommentInfo comment) {
100 | return ListTile(
101 | leading: cacheImg(comment.avatar),
102 | title: Padding(
103 | padding: const EdgeInsets.only(bottom: 20.0),
104 | child: Row(
105 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
106 | children: [
107 | Text(
108 | comment.name.substring(0, min(comment.name.length, 10)),
109 | style: TextStyle(color: fontColor, fontSize: 14),
110 | ),
111 | Text(comment.date, style: TextStyle(color: fontColor, fontSize: 12))
112 | ],
113 | ),
114 | ),
115 | trailing: SizedBox(
116 | width: 50,
117 | child: comment.reply.isEmpty
118 | ? TextButton.icon(
119 | icon: Icon(Icons.comment, color: iconColor),
120 | label: Text(
121 | comment.reply.length.toString(),
122 | style: TextStyle(color: iconColor),
123 | ),
124 | onPressed: () {},
125 | )
126 | : TextButton.icon(
127 | icon: const Icon(
128 | Icons.comment,
129 | ),
130 | label: Text(
131 | comment.reply.length.toString(),
132 | style: TextStyle(color: iconColor),
133 | ),
134 | onPressed: () {
135 | if (comment.reply.isEmpty) return;
136 | Navigator.of(context).push(
137 | MaterialPageRoute(builder: (context) {
138 | return Scaffold(
139 | appBar: AppBar(),
140 | body: innerCommentListTile(comment));
141 | }),
142 | );
143 | },
144 | ),
145 | ),
146 | subtitle: Text(
147 | comment.content,
148 | style: TextStyle(color: fontColor),
149 | ),
150 | );
151 | }
152 |
153 | Widget innerCommentListTile(CommentInfo root) {
154 | // ignore: prefer_function_declarations_over_variables
155 | var tile = (CommentInfo comment) {
156 | return ListTile(
157 | leading: cacheImg(comment.avatar),
158 | title: Padding(
159 | padding: const EdgeInsets.only(bottom: 20.0),
160 | child: Row(
161 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
162 | children: [
163 | Text(
164 | comment.name.substring(0, min(comment.name.length, 10)),
165 | style: TextStyle(color: fontColor, fontSize: 14),
166 | ),
167 | Text(comment.date,
168 | style: TextStyle(color: fontColor, fontSize: 12))
169 | ],
170 | ),
171 | ),
172 | subtitle: Text(
173 | comment.content,
174 | style: TextStyle(color: fontColor),
175 | ),
176 | );
177 | };
178 |
179 | return ListView.separated(
180 | padding: const EdgeInsets.all(5.0),
181 | itemBuilder: (context, index) {
182 | if (index == 0) {
183 | return tile(root);
184 | }
185 | return tile(root.reply[index - 1]);
186 | },
187 | separatorBuilder: (context, index) => const Divider(
188 | thickness: 4,
189 | ),
190 | itemCount: root.reply.length + 1);
191 | }
192 | }
193 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_comic_home.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:domic/comic/api.dart';
4 | import 'package:domic/comic/extractors/dto.dart';
5 | import 'package:domic/common/common.dart';
6 | import 'package:domic/common/hive.dart';
7 | import 'package:domic/widgets/components/my_comic_card.dart';
8 | import 'package:domic/widgets/components/my_grid_gesture_detector.dart';
9 | import 'package:domic/widgets/components/my_setting_action.dart';
10 | import 'package:domic/widgets/components/my_status.dart';
11 | import 'package:flutter/material.dart';
12 |
13 | /*
14 | "source"
15 | */
16 | class MyComicHome extends StatefulWidget {
17 | const MyComicHome({Key? key, this.content}) : super(key: key);
18 | final dynamic content;
19 |
20 | @override
21 | createState() => _MyComicHomeState();
22 | }
23 |
24 | class _MyComicHomeState extends State {
25 | late Future tabsUrlFuture;
26 | List tabs = [];
27 |
28 | Widget comicPage(BuildContext context, Widget body) {
29 | return DefaultTabController(
30 | length: tabs.length,
31 | child: Scaffold(
32 | appBar: AppBar(
33 | elevation: 0.0,
34 | centerTitle: false,
35 | title: Text(sourcesName[widget.content["source"]]!),
36 | actions: [
37 | IconButton(
38 | onPressed: () =>
39 | Navigator.pushNamed(context, Routes.myComicSearchPageRoute),
40 | icon: const Icon(Icons.search),
41 | ),
42 | ...alwaysInActions(),
43 | ],
44 | bottom: TabBar(
45 | isScrollable: true,
46 | tabs: tabs.map((name) => Tab(text: name)).toList(),
47 | ),
48 | ),
49 | body: body,
50 | ),
51 | );
52 | }
53 |
54 | @override
55 | void initState() {
56 | super.initState();
57 | var lazyBoxName = ConstantString.sourceToLazyBox[widget.content["source"]]!;
58 | var key = widget.content["source"] + "homeTabs";
59 | if (MyHive().isInHive(lazyBoxName, key, dur: Duration.zero)) {
60 | tabsUrlFuture = MyHive().getInHive(lazyBoxName, key);
61 | } else {
62 | var parser = (comicMethod[widget.content["source"]] ??
63 | comic18Method[widget.content["source"]]!) as dynamic;
64 | tabsUrlFuture = parser.getComicTabs().then((res) {
65 | var map = {for (var v in res) v.key: v.value};
66 | MyHive().putInHive(lazyBoxName, key, map);
67 | return map;
68 | });
69 | }
70 | }
71 |
72 | @override
73 | Widget build(BuildContext context) {
74 | return FutureBuilder(
75 | future: tabsUrlFuture,
76 | builder: (context, snapshot) {
77 | if (snapshot.hasError) {
78 | return comicPage(
79 | context,
80 | const Center(
81 | child: Text("失败了呜呜呜..."),
82 | ));
83 | }
84 | if (!snapshot.hasData) {
85 | return comicPage(context, const MyWaiting());
86 | }
87 | var tabsUrl = [];
88 | var map = snapshot.requireData as Map;
89 | map.forEach((k, v) => tabsUrl.add(MapEntry(k, v)));
90 | if (tabs.isEmpty) {
91 | for (var e in tabsUrl) {
92 | tabs.add(e.key);
93 | }
94 | }
95 | return comicPage(
96 | context,
97 | TabBarView(
98 | children: tabs
99 | .asMap()
100 | .map((index, key) {
101 | return MapEntry(
102 | index,
103 | MyComicHomeLayout(index, key, tabsUrl[index].value,
104 | widget.content["source"]!),
105 | );
106 | })
107 | .values
108 | .toList()));
109 | },
110 | );
111 | }
112 | }
113 |
114 | class MyComicHomeLayout extends StatefulWidget {
115 | final int index;
116 | final String tab;
117 | final String path;
118 | final String source;
119 |
120 | const MyComicHomeLayout(
121 | this.index,
122 | this.tab,
123 | this.path,
124 | this.source, {
125 | Key? key,
126 | }) : super(key: key);
127 |
128 | @override
129 | State createState() => _MyComicHomeLayoutState();
130 | }
131 |
132 | class _MyComicHomeLayoutState extends State {
133 | bool isLoading = true;
134 | bool hasMore = true;
135 | int maxPage = 1;
136 | int currentPage = 1;
137 | int totalNum = 0;
138 | List records = [];
139 |
140 | void loadMoreComicSimple() async {
141 | isLoading = true;
142 | String path = widget.path;
143 |
144 | Future future;
145 | var lazyBoxName = ConstantString.sourceToLazyBox[widget.source]!;
146 | var key = "${widget.source}${path}_$currentPage";
147 | if (MyHive().isInHive(lazyBoxName, key, dur: Duration.zero)) {
148 | future = MyHive().getInHive(lazyBoxName, key);
149 | } else {
150 | var parser = (comicMethod[widget.source] ?? comic18Method[widget.source]!)
151 | as dynamic;
152 | future = parser.comicByTab(widget.path, currentPage).then((pager) {
153 | MyHive().putInHive(lazyBoxName, key, pager);
154 | return pager;
155 | });
156 | }
157 |
158 | var page = (await future) as ComicPageData;
159 | maxPage = max(page.pageCount, maxPage);
160 | records.addAll(page.records);
161 | if (currentPage == 1) {
162 | if (page.maxNum == null) {
163 | totalNum += maxPage * page.records.length;
164 | } else {
165 | totalNum += page.maxNum!;
166 | }
167 | }
168 | setState(() {
169 | isLoading = false;
170 | currentPage++;
171 | if (currentPage > maxPage) {
172 | hasMore = false;
173 | totalNum = records.length;
174 | }
175 | });
176 | }
177 |
178 | @override
179 | void initState() {
180 | super.initState();
181 | loadMoreComicSimple();
182 | }
183 |
184 | @override
185 | Widget build(BuildContext context) {
186 | return Column(
187 | children: [
188 | Row(
189 | crossAxisAlignment: CrossAxisAlignment.center,
190 | mainAxisAlignment: MainAxisAlignment.end,
191 | children: [
192 | Text(
193 | "已加载${records.length}/$totalNum项结果",
194 | style: const TextStyle(fontSize: 13),
195 | maxLines: 1,
196 | ),
197 | ]),
198 | Expanded(
199 | child: getComicCard(context),
200 | ),
201 | ],
202 | );
203 | }
204 |
205 | Widget getComicCard(BuildContext context) {
206 | if (records.isEmpty) {
207 | return const MyWaiting();
208 | }
209 | return GridView.builder(
210 | gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
211 | crossAxisCount: 3,
212 | childAspectRatio: 4 / 5,
213 | crossAxisSpacing: 5.0,
214 | mainAxisSpacing: 5.0,
215 | ),
216 | padding: const EdgeInsets.all(5.0),
217 | itemCount: hasMore ? records.length + 1 : records.length,
218 | itemBuilder: (context, index) {
219 | if (index >= records.length) {
220 | if (!isLoading) {
221 | loadMoreComicSimple();
222 | }
223 | return const MyWaiting();
224 | }
225 | ComicSimple record = records[index];
226 | return MyGridGestureDetector(
227 | record: record,
228 | child: ComicSimpleItem(
229 | comicSimple: record,
230 | isList: false,
231 | ),
232 | );
233 | },
234 | );
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_comic_tag.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:domic/comic/api.dart';
4 | import 'package:domic/comic/extractors/dto.dart';
5 | import 'package:domic/common/common.dart';
6 | import 'package:domic/common/global.dart';
7 | import 'package:domic/common/hive.dart';
8 | import 'package:domic/widgets/components/my_comic_card.dart';
9 | import 'package:domic/widgets/components/my_grid_gesture_detector.dart';
10 | import 'package:domic/widgets/components/my_setting_action.dart';
11 | import 'package:domic/widgets/components/my_status.dart';
12 | import 'package:flutter/material.dart';
13 | import 'package:provider/provider.dart';
14 |
15 | class MyComicTag extends StatefulWidget {
16 | const MyComicTag({Key? key, required this.content}) : super(key: key);
17 |
18 | final dynamic content;
19 |
20 | @override
21 | State createState() => _MyComicTagState();
22 | }
23 |
24 | class _MyComicTagState extends State {
25 | bool isLoading = true;
26 | bool hasMore = true;
27 | int maxPage = 1;
28 | int currentPage = 1;
29 | int totalNum = 0;
30 | List records = [];
31 | int type = 0;
32 |
33 | String comicTagKey(String source, String tag, int currentPage, int type) {
34 | return "$source${tag}_${type}_$currentPage";
35 | }
36 |
37 | // load more comicSimple
38 | void loadMoreComicSimple() async {
39 | isLoading = true;
40 | String source = widget.content["source"];
41 | String path = widget.content["path"];
42 | Future future;
43 | var lazyBoxName = ConstantString.sourceToLazyBox[source]!;
44 | var key = comicTagKey(source, path, type, currentPage);
45 | if (MyHive().isInHive(lazyBoxName, key, dur: const Duration(hours: 1))) {
46 | future = MyHive().getInHive(lazyBoxName, key);
47 | } else {
48 | var parser = (comicMethod[source] ?? comic18Method[source]!) as dynamic;
49 | future = parser.comicByTag(path, currentPage, type: type).then((pager) {
50 | MyHive().putInHive(lazyBoxName, key, pager);
51 | return pager;
52 | });
53 | }
54 |
55 | var page = (await future) as ComicPageData;
56 | records.addAll(page.records);
57 | maxPage = max(maxPage, page.pageCount);
58 | if (currentPage == 1) {
59 | if (page.maxNum == null) {
60 | totalNum += maxPage * page.records.length;
61 | } else {
62 | totalNum += page.maxNum!;
63 | }
64 | }
65 | setState(() {
66 | isLoading = false;
67 | currentPage++;
68 | if (currentPage > maxPage) {
69 | hasMore = false;
70 | totalNum = records.length;
71 | }
72 | });
73 | }
74 |
75 | @override
76 | void initState() {
77 | super.initState();
78 | loadMoreComicSimple();
79 | }
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return Scaffold(
84 | appBar: AppBar(
85 | elevation: 0.0,
86 | title: Text(widget.content["name"], textAlign: TextAlign.left),
87 | centerTitle: false,
88 | actions: [
89 | context.select((Configs configs) => configs.listViewInTagResult)
90 | ? IconButton(
91 | onPressed: () => changeView(context),
92 | icon: const Icon(Icons.grid_view),
93 | )
94 | : IconButton(
95 | onPressed: () => changeView(context),
96 | icon: const Icon(Icons.list),
97 | ),
98 | viewTypeWidget(),
99 | ...alwaysInActions(),
100 | ],
101 | ),
102 | body: Column(
103 | children: [
104 | Row(
105 | crossAxisAlignment: CrossAxisAlignment.center,
106 | mainAxisAlignment: MainAxisAlignment.end,
107 | children: [
108 | Text(
109 | "已加载${records.length}/$totalNum项结果",
110 | style: const TextStyle(fontSize: 13),
111 | maxLines: 1,
112 | ),
113 | ]),
114 | Expanded(
115 | child: getComicWidget(context),
116 | )
117 | ],
118 | ));
119 | }
120 |
121 | void changeView(BuildContext context) {
122 | Provider.of(context, listen: false).listViewInTagResult =
123 | !Provider.of(context, listen: false).listViewInTagResult;
124 | }
125 |
126 | Widget getComicWidget(BuildContext context) {
127 | if (isLoading && records.isEmpty) {
128 | return const MyWaiting();
129 | }
130 | if (context.select((Configs configs) => configs.listViewInTagResult)) {
131 | return ListView.separated(
132 | padding: const EdgeInsets.all(5.0),
133 | itemBuilder: (context, index) {
134 | if (index >= records.length) {
135 | if (!isLoading) {
136 | loadMoreComicSimple();
137 | }
138 | return const MyWaiting();
139 | }
140 | ComicSimple record = records[index];
141 | return MyGridGestureDetector(
142 | record: record,
143 | child: SizedBox(
144 | height: MediaQuery.of(context).size.height / 6,
145 | child: ComicSimpleItem(
146 | comicSimple: record,
147 | isList: true,
148 | )),
149 | );
150 | },
151 | separatorBuilder: (context, index) => const Divider(
152 | thickness: 4,
153 | ),
154 | itemCount: hasMore ? records.length + 1 : records.length);
155 | } else {
156 | return GridView.builder(
157 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
158 | crossAxisCount: context.select(
159 | (Configs configs) => configs.crossAxisCountInSearchAndTag),
160 | crossAxisSpacing: 5.0,
161 | mainAxisSpacing: 5.0,
162 | childAspectRatio: 4 / 5,
163 | ),
164 | padding: const EdgeInsets.all(5.0),
165 | itemCount: hasMore ? records.length + 1 : records.length,
166 | itemBuilder: (context, index) {
167 | if (index >= records.length) {
168 | if (!isLoading) {
169 | loadMoreComicSimple();
170 | }
171 | return const MyWaiting();
172 | }
173 | ComicSimple record = records[index];
174 | return MyGridGestureDetector(
175 | record: record,
176 | child: ComicSimpleItem(
177 | comicSimple: record,
178 | isList: false,
179 | ),
180 | );
181 | },
182 | );
183 | }
184 | }
185 |
186 | Widget viewTypeWidget() {
187 | return PopupMenuButton(
188 | onSelected: (int index) {
189 | setState(() {
190 | type = index;
191 | isLoading = true;
192 | hasMore = true;
193 | maxPage = 1;
194 | currentPage = 1;
195 | totalNum = 0;
196 | records.clear();
197 | loadMoreComicSimple();
198 | });
199 | },
200 | itemBuilder: (BuildContext context) => >[
201 | const PopupMenuItem(
202 | value: 0,
203 | child: Text("最新"),
204 | ),
205 | const PopupMenuItem(
206 | value: 1,
207 | child: Text("最多浏览"),
208 | ),
209 | const PopupMenuItem(
210 | value: 2,
211 | child: Text("最多图片"),
212 | ),
213 | const PopupMenuItem(
214 | value: 3,
215 | child: Text("最多爱心"),
216 | ),
217 | ]);
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_drawer.dart:
--------------------------------------------------------------------------------
1 | import 'package:cached_network_image/cached_network_image.dart';
2 | import 'package:domic/comic/api.dart';
3 | import 'package:domic/comic/extractors/dto.dart';
4 | import 'package:domic/common/common.dart';
5 | import 'package:domic/common/global.dart';
6 | import 'package:flutter/material.dart';
7 | import 'package:provider/provider.dart';
8 |
9 | class MyDrawer extends StatelessWidget {
10 | const MyDrawer({
11 | Key? key,
12 | }) : super(key: key);
13 |
14 | static const topPadding = 38.0;
15 | static const leftPadding = 10.0;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return Drawer(
20 | child: MediaQuery.removePadding(
21 | context: context,
22 | // removeTop: true,
23 | child: SafeArea(
24 | child: Column(
25 | crossAxisAlignment: CrossAxisAlignment.start,
26 | mainAxisAlignment: MainAxisAlignment.center,
27 | children: [
28 | const MyCover(),
29 | ListTile(
30 | leading: const Icon(
31 | Icons.import_contacts,
32 | ),
33 | title: const Text(ConstantString.comicPageTitle),
34 | onTap: () => Navigator.pop(context),
35 | ),
36 | ListTile(
37 | leading: const Icon(
38 | Icons.source,
39 | ),
40 | title: const Text(ConstantString.source),
41 | onTap: () =>
42 | Navigator.pushNamed(context, Routes.myComicSourceRoute),
43 | ),
44 | ListTile(
45 | leading: const Icon(
46 | Icons.settings,
47 | ),
48 | title: const Text(ConstantString.setting),
49 | onTap: () =>
50 | Navigator.pushNamed(context, Routes.mySettingRoute),
51 | ),
52 | ListTile(
53 | leading: const Icon(
54 | Icons.info_outline,
55 | ),
56 | title: const Text(ConstantString.about),
57 | onTap: () =>
58 | Navigator.pushNamed(context, Routes.myAboutMeRoute),
59 | ),
60 | Expanded(
61 | child: ListView(
62 | children: getComicSource(context),
63 | ),
64 | ),
65 | ],
66 | ),
67 | )),
68 | );
69 | }
70 |
71 | List getComicSource(BuildContext context) {
72 | List res = [];
73 | for (var source in Routes.routes.keys) {
74 | res.add(
75 | ListTile(
76 | leading: comicMethod.containsKey(source)
77 | ? const Icon(
78 | Icons.import_contacts,
79 | )
80 | : const Icon(
81 | Icons.eighteen_up_rating,
82 | ),
83 | title: Text(sourcesName[source]!),
84 | onTap: () =>
85 | Navigator.pushNamed(context, Routes.myComicHomeRoute, arguments: {
86 | "source": source,
87 | }),
88 | ),
89 | );
90 | }
91 | return res;
92 | }
93 | }
94 |
95 | class MyCover extends StatefulWidget {
96 | const MyCover({
97 | Key? key,
98 | }) : super(key: key);
99 |
100 | @override
101 | State createState() => _MyCoverState();
102 | }
103 |
104 | class _MyCoverState extends State {
105 | @override
106 | Widget build(BuildContext context) {
107 | var favorite = Provider.of(context, listen: true).favorite;
108 | var history = Provider.of(context, listen: true).history;
109 | return SizedBox(
110 | height: MediaQuery.of(context).size.height / 3,
111 | child: CachedNetworkImage(
112 | imageUrl: favorite.isNotEmpty
113 | ? favorite.values.last.thumb
114 | : (history.isNotEmpty
115 | ? history.values.last.thumb
116 | : Global.defaultCover),
117 | fit: BoxFit.cover,
118 | width: double.infinity,
119 | ),
120 | );
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_grid_gesture_detector.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/comic/extractors/dto.dart';
2 | import 'package:domic/common/common.dart';
3 | import 'package:domic/common/global.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:provider/provider.dart';
6 |
7 | class MyGridGestureDetector extends StatelessWidget {
8 | const MyGridGestureDetector(
9 | {Key? key, required this.child, required this.record, this.setterLatest})
10 | : super(key: key);
11 | final Widget? child;
12 | final ComicSimple record;
13 | final dynamic setterLatest;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return GestureDetector(
18 | behavior: HitTestBehavior.opaque,
19 | onTap: () {
20 | if (setterLatest != null) {
21 | setterLatest(record, value: true);
22 | }
23 | Navigator.pushNamed(context, Routes.myComicInfoRoute, arguments: {
24 | "record": record,
25 | });
26 | Provider.of(context, listen: false)
27 | .saveHistory(record)
28 | .whenComplete(() => Provider.of(context, listen: false)
29 | .removeHistory());
30 | },
31 | child: child,
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_status.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class MyWaiting extends StatelessWidget {
4 | const MyWaiting({Key? key}) : super(key: key);
5 |
6 | @override
7 | Widget build(BuildContext context) {
8 | return const Center(
9 | child: CircularProgressIndicator(),
10 | );
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/lib/widgets/components/my_version.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/comic/extractors/dio.dart';
2 | import 'package:domic/common/common.dart';
3 | import 'package:domic/common/global.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:package_info_plus/package_info_plus.dart';
6 |
7 | String _version = "";
8 | MapEntry _latestVersionInfo = const MapEntry("", "");
9 |
10 | Future initVersion() async {
11 | PackageInfo packageInfo = await PackageInfo.fromPlatform();
12 | _version = packageInfo.version;
13 | }
14 |
15 | Future checkVersion() async {
16 | var resp = await MyDio().dio.get(ConstantString.versionUrl);
17 | if (resp.statusCode != 200) return false;
18 | _latestVersionInfo =
19 | MapEntry(resp.data["name"] ?? "", resp.data["body"] ?? "");
20 | if (_latestVersionInfo.key.isNotEmpty) {
21 | var latest = _latestVersionInfo.key;
22 | int i = 0, j = latest.length - 1;
23 | while (latest[i].codeUnitAt(0) < '0'.codeUnitAt(0) ||
24 | latest[i].codeUnitAt(0) > '9'.codeUnitAt(0)) {
25 | i++;
26 | }
27 | while (latest[j].codeUnitAt(0) < '0'.codeUnitAt(0) ||
28 | latest[j].codeUnitAt(0) > '9'.codeUnitAt(0)) {
29 | j--;
30 | }
31 | _latestVersionInfo =
32 | MapEntry(latest.substring(i), _latestVersionInfo.value);
33 | return latest.substring(i, j + 1) != _version;
34 | }
35 | return false;
36 | }
37 |
38 | class MyVersionInfo extends StatelessWidget {
39 | const MyVersionInfo({Key? key}) : super(key: key);
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | return Container(
44 | padding: const EdgeInsets.only(left: 20, right: 20),
45 | child: Column(
46 | crossAxisAlignment: CrossAxisAlignment.start,
47 | children: [
48 | ListTile(
49 | title: Text(
50 | '软件版本 : $_version',
51 | ),
52 | ),
53 | ],
54 | ),
55 | );
56 | }
57 | }
58 |
59 | class MyProjectInfo extends StatefulWidget {
60 | const MyProjectInfo({Key? key}) : super(key: key);
61 |
62 | @override
63 | State createState() => _MyProjectInfoState();
64 | }
65 |
66 | class _MyProjectInfoState extends State {
67 | @override
68 | void initState() {
69 | super.initState();
70 | checkVersion().then((shouldUpdate) {
71 | if (shouldUpdate) setState(() {});
72 | });
73 | }
74 |
75 | @override
76 | Widget build(BuildContext context) {
77 | return Container(
78 | padding: const EdgeInsets.only(left: 20, right: 20),
79 | child: Column(
80 | crossAxisAlignment: CrossAxisAlignment.start,
81 | children: [
82 | ListTile(
83 | title: GestureDetector(
84 | child: const Text(
85 | "项目地址",
86 | style: TextStyle(color: Colors.blue),
87 | ),
88 | onTap: () {
89 | Global.openUrl(ConstantString.releaseUrl);
90 | },
91 | ),
92 | subtitle: Row(
93 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
94 | children: [
95 | Text("最新版本: ${_latestVersionInfo.key}"),
96 | GestureDetector(
97 | child: const Text(
98 | "检查更新",
99 | style: TextStyle(color: Colors.blue),
100 | ),
101 | onTap: () {
102 | Global.showSnackBar("正在检查最新版本");
103 | checkVersion().then((shouldUpdate) {
104 | if (shouldUpdate) setState(() {});
105 | });
106 | Global.showSnackBar("检查完成");
107 | })
108 | ]),
109 | ),
110 | ListTile(
111 | title: const Text("更新内容"),
112 | subtitle: Text(_latestVersionInfo.value),
113 | ),
114 | ],
115 | ),
116 | );
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/lib/widgets/my_about_me.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/widgets/components/my_version.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class MyAboutMe extends StatelessWidget {
5 | const MyAboutMe({Key? key}) : super(key: key);
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | appBar: AppBar(
11 | title: const Text("关于"),
12 | ),
13 | body: const SafeArea(
14 | child: Column(
15 | children: [
16 | // version
17 | MyVersionInfo(),
18 | Divider(),
19 | MyProjectInfo(),
20 | Divider(),
21 | ],
22 | )));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/widgets/my_search_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:domic/common/common.dart';
2 | import 'package:domic/widgets/components/my_setting_action.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | /// MyComicSearchPage : search page
6 | class MyComicSearchPage extends StatefulWidget {
7 | const MyComicSearchPage({Key? key}) : super(key: key);
8 |
9 | @override
10 | State createState() => MyComicSearchPageState();
11 | }
12 |
13 | class MyComicSearchPageState extends State {
14 | var _searchInfo = "";
15 | final _textEditingController = TextEditingController();
16 | final _searchContentFocusNode = FocusNode();
17 | final double height = 15;
18 | final double padding = 15;
19 | late Decoration? dec =
20 | MediaQuery.of(context).platformBrightness == Brightness.dark
21 | ? null
22 | : BoxDecoration(color: Theme.of(context).colorScheme.primary);
23 |
24 | @override
25 | void initState() {
26 | super.initState();
27 | _textEditingController.text = _searchInfo;
28 | }
29 |
30 | @override
31 | void dispose() {
32 | _textEditingController.dispose();
33 | _searchContentFocusNode.dispose();
34 | super.dispose();
35 | }
36 |
37 | @override
38 | Widget build(BuildContext context) {
39 | return Scaffold(
40 | appBar: AppBar(
41 | elevation: 0.0,
42 | title: const Text(ConstantString.searchPageTitle,
43 | textAlign: TextAlign.left),
44 | centerTitle: false,
45 | actions: [
46 | IconButton(
47 | icon: const Icon(
48 | Icons.source,
49 | ),
50 | onPressed: () =>
51 | Navigator.pushNamed(context, Routes.myComicSourceRoute),
52 | ),
53 | ...alwaysInActions()
54 | ],
55 | ),
56 | body: LimitedBox(
57 | maxHeight: MediaQuery.of(context).size.height,
58 | child: Column(
59 | children: [
60 | Container(
61 | height: height,
62 | decoration: dec,
63 | ),
64 | Container(
65 | decoration: dec,
66 | padding: EdgeInsets.all(padding),
67 | child: TextField(
68 | cursorColor: Colors.white,
69 | scrollPadding: EdgeInsets.all(padding),
70 | textAlignVertical: TextAlignVertical.bottom,
71 | contextMenuBuilder: (context, editableTextState) {
72 | return AdaptiveTextSelectionToolbar.buttonItems(
73 | anchors: editableTextState.contextMenuAnchors,
74 | buttonItems: editableTextState.contextMenuButtonItems,
75 | );
76 | },
77 | autofocus: true,
78 | textInputAction: TextInputAction.search,
79 | controller: _textEditingController,
80 | onChanged: (value) => _searchInfo = value,
81 | focusNode: _searchContentFocusNode,
82 | style: const TextStyle(
83 | color: Colors.white,
84 | ),
85 | decoration: const InputDecoration(
86 | // contentPadding: EdgeInsets.only(top: 0, bottom: 0),
87 | hintText: ConstantString.comicDefaultSearchContent,
88 | hintStyle: TextStyle(
89 | color: Colors.white,
90 | ),
91 | focusedBorder: UnderlineInputBorder(
92 | borderSide: BorderSide(color: Colors.white),
93 | ),
94 | ),
95 | keyboardType: TextInputType.text,
96 | onSubmitted: (String value) => Navigator.of(context)
97 | .pushNamed(Routes.myComicSearchResultRoute,
98 | arguments: {"title": value})),
99 | ),
100 | Container(
101 | padding: const EdgeInsets.fromLTRB(0, 0, 10, 5),
102 | decoration: dec,
103 | alignment: Alignment.centerRight,
104 | child: FloatingActionButton(
105 | onPressed: () {
106 | Navigator.of(context).pushNamed(
107 | Routes.myComicSearchResultRoute,
108 | arguments: {"title": _searchInfo});
109 | },
110 | child: const Icon(
111 | Icons.search,
112 | color: Colors.white,
113 | ),
114 | ),
115 | ),
116 | ],
117 | ),
118 | ));
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.10)
3 | project(runner LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "domic")
8 | # The unique GTK application identifier for this application. See:
9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID
10 | set(APPLICATION_ID "com.rlight.domic")
11 |
12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13 | # versions of CMake.
14 | cmake_policy(SET CMP0063 NEW)
15 |
16 | # Load bundled libraries from the lib/ directory relative to the binary.
17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18 |
19 | # Root filesystem for cross-building.
20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27 | endif()
28 |
29 | # Define build configuration options.
30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31 | set(CMAKE_BUILD_TYPE "Debug" CACHE
32 | STRING "Flutter build mode" FORCE)
33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34 | "Debug" "Profile" "Release")
35 | endif()
36 |
37 | # Compilation settings that should be applied to most targets.
38 | #
39 | # Be cautious about adding new options here, as plugins use this function by
40 | # default. In most cases, you should add new options to specific targets instead
41 | # of modifying this function.
42 | function(APPLY_STANDARD_SETTINGS TARGET)
43 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
47 | endfunction()
48 |
49 | # Flutter library and tool build rules.
50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51 | add_subdirectory(${FLUTTER_MANAGED_DIR})
52 |
53 | # System-level dependencies.
54 | find_package(PkgConfig REQUIRED)
55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56 |
57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58 |
59 | # Define the application target. To change its name, change BINARY_NAME above,
60 | # not the value here, or `flutter run` will no longer work.
61 | #
62 | # Any new source files that you add to the application should be added here.
63 | add_executable(${BINARY_NAME}
64 | "main.cc"
65 | "my_application.cc"
66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67 | )
68 |
69 | # Apply the standard set of build settings. This can be removed for applications
70 | # that need different build settings.
71 | apply_standard_settings(${BINARY_NAME})
72 |
73 | # Add dependency libraries. Add any application-specific dependencies here.
74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76 |
77 | # Run the Flutter tool portions of the build. This must not be removed.
78 | add_dependencies(${BINARY_NAME} flutter_assemble)
79 |
80 | # Only the install-generated bundle's copy of the executable will launch
81 | # correctly, since the resources must in the right relative locations. To avoid
82 | # people trying to run the unbundled copy, put it in a subdirectory instead of
83 | # the default top-level location.
84 | set_target_properties(${BINARY_NAME}
85 | PROPERTIES
86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87 | )
88 |
89 | # Generated plugin build rules, which manage building the plugins and adding
90 | # them to the application.
91 | include(flutter/generated_plugins.cmake)
92 |
93 |
94 | # === Installation ===
95 | # By default, "installing" just makes a relocatable bundle in the build
96 | # directory.
97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
100 | endif()
101 |
102 | # Start with a clean build bundle directory every time.
103 | install(CODE "
104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
105 | " COMPONENT Runtime)
106 |
107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
109 |
110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
111 | COMPONENT Runtime)
112 |
113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
114 | COMPONENT Runtime)
115 |
116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
117 | COMPONENT Runtime)
118 |
119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
120 | install(FILES "${bundled_library}"
121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
122 | COMPONENT Runtime)
123 | endforeach(bundled_library)
124 |
125 | # Fully re-copy the assets directory on each build to avoid having stale files
126 | # from a previous install.
127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
128 | install(CODE "
129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
130 | " COMPONENT Runtime)
131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
133 |
134 | # Install the AOT library on non-Debug builds only.
135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
137 | COMPONENT Runtime)
138 | endif()
139 |
--------------------------------------------------------------------------------
/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 |
11 | void fl_register_plugins(FlPluginRegistry* registry) {
12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
15 | }
16 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | url_launcher_linux
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "domic");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "domic");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/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/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import package_info_plus
9 | import path_provider_foundation
10 | import sqflite
11 | import url_launcher_macos
12 |
13 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
14 | FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
15 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
16 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
17 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
18 | }
19 |
--------------------------------------------------------------------------------
/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.14'
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/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - FlutterMacOS (1.0.0)
3 | - FMDB (2.7.5):
4 | - FMDB/standard (= 2.7.5)
5 | - FMDB/standard (2.7.5)
6 | - package_info_plus_macos (0.0.1):
7 | - FlutterMacOS
8 | - path_provider_foundation (0.0.1):
9 | - Flutter
10 | - FlutterMacOS
11 | - sqflite (0.0.2):
12 | - FlutterMacOS
13 | - FMDB (>= 2.7.5)
14 | - url_launcher_macos (0.0.1):
15 | - FlutterMacOS
16 |
17 | DEPENDENCIES:
18 | - FlutterMacOS (from `Flutter/ephemeral`)
19 | - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`)
20 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`)
21 | - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
22 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
23 |
24 | SPEC REPOS:
25 | trunk:
26 | - FMDB
27 |
28 | EXTERNAL SOURCES:
29 | FlutterMacOS:
30 | :path: Flutter/ephemeral
31 | package_info_plus_macos:
32 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos
33 | path_provider_foundation:
34 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos
35 | sqflite:
36 | :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
37 | url_launcher_macos:
38 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
39 |
40 | SPEC CHECKSUMS:
41 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
42 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
43 | package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c
44 | path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
45 | sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
46 | url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451
47 |
48 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
49 |
50 | COCOAPODS: 1.12.1
51 |
--------------------------------------------------------------------------------
/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 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/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/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/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 = domic
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.rlight.domic
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.rlight. 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: domic
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 0.6.8+1
19 |
20 | environment:
21 | sdk: ">=2.17.1 <3.0.0"
22 |
23 | # Dependencies specify other packages that your package needs in order to work.
24 | # To automatically upgrade your package dependencies to the latest versions
25 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 | # dependencies can be manually updated by changing the version numbers below to
27 | # the latest version available on pub.dev. To see which dependencies have newer
28 | # versions available, run `flutter pub outdated`.
29 | dependencies:
30 | flutter:
31 | sdk: flutter
32 |
33 | # The following adds the Cupertino Icons font to your application.
34 | # Use with the CupertinoIcons class for iOS style icons.
35 | cupertino_icons: ^1.0.2
36 | dio: ^4.0.6
37 | gbk_codec: ^0.4.0
38 | provider: ^6.0.3
39 | html: ^0.15.0
40 | path: ^1.8.1
41 | cached_network_image: ^3.2.1
42 | hive: ^2.2.2
43 | hive_flutter: ^1.1.0
44 | flutter_cache_manager: ^3.3.0
45 | crypto: ^3.0.2
46 | image: ^3.2.0
47 | path_provider: ^2.0.11
48 | package_info_plus: ^4.1.0
49 | intl: ^0.17.0
50 | url_launcher: ^6.1.3
51 | flutter_native_splash: ^2.2.3+1
52 | reorderable_grid_view: ^2.2.2
53 | extended_image: ^8.1.0
54 | flutter_easyloading: ^3.0.5
55 | percent_indicator: ^4.2.2
56 | lzstring: ^2.0.0
57 |
58 | dev_dependencies:
59 | flutter_test:
60 | sdk: flutter
61 |
62 | # The "flutter_lints" package below contains a set of recommended lints to
63 | # encourage good coding practices. The lint set provided by the package is
64 | # activated in the `analysis_options.yaml` file located at the root of your
65 | # package. See that file for information about deactivating specific lint
66 | # rules and activating additional ones.
67 | flutter_lints: ^2.0.0
68 | hive_generator: ^1.1.3
69 | build_runner: ^2.1.11
70 | flutter_launcher_icons: ^0.9.3
71 |
72 | flutter_icons:
73 | android: true
74 | ios: true
75 | image_path: "assets/icon/domic/play_store_512.png"
76 |
77 | # For information on the generic Dart part of this file, see the
78 | # following page: https://dart.dev/tools/pub/pubspec
79 |
80 | # The following section is specific to Flutter packages.
81 | flutter:
82 | # The following line ensures that the Material Icons font is
83 | # included with your application, so that you can use the icons in
84 | # the material Icons class.
85 | uses-material-design: true
86 |
87 | # To add assets to your application, add an assets section, like this:
88 | # assets:
89 | # - images/a_dot_burr.jpeg
90 | # - images/a_dot_ham.jpeg
91 |
92 | # An image asset can refer to one or more resolution-specific "variants", see
93 | # https://flutter.dev/assets-and-images/#resolution-aware
94 |
95 | # For details regarding adding assets from package dependencies, see
96 | # https://flutter.dev/assets-and-images/#from-packages
97 |
98 | # To add custom fonts to your application, add a fonts section here,
99 | # in this "flutter" section. Each entry in this list should have a
100 | # "family" key with the font family name, and a "fonts" key with a
101 | # list giving the asset and other descriptors for the font. For
102 | # example:
103 | # fonts:
104 | # - family: Schyler
105 | # fonts:
106 | # - asset: fonts/Schyler-Regular.ttf
107 | # - asset: fonts/Schyler-Italic.ttf
108 | # style: italic
109 | # - family: Trajan Pro
110 | # fonts:
111 | # - asset: fonts/TrajanPro.ttf
112 | # - asset: fonts/TrajanPro_Bold.ttf
113 | # weight: 700
114 | #
115 | # For details regarding fonts from package dependencies,
116 | # see https://flutter.dev/custom-fonts/#from-packages
117 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:domic/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/web/favicon.png
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | domic
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
60 |
61 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "domic",
3 | "short_name": "domic",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/web/splash/splash.js:
--------------------------------------------------------------------------------
1 | function removeSplashFromWeb() {
2 | const elem = document.getElementById("splash");
3 | if (elem) {
4 | elem.remove();
5 | }
6 | document.body.style.background = "transparent";
7 | }
8 |
--------------------------------------------------------------------------------
/web/splash/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin:0;
3 | height:100%;
4 | background: #42a5f5;
5 |
6 | background-size: 100% 100%;
7 | }
8 |
9 | .center {
10 | margin: 0;
11 | position: absolute;
12 | top: 50%;
13 | left: 50%;
14 | -ms-transform: translate(-50%, -50%);
15 | transform: translate(-50%, -50%);
16 | }
17 |
18 | .contain {
19 | display:block;
20 | width:100%; height:100%;
21 | object-fit: contain;
22 | }
23 |
24 | .stretch {
25 | display:block;
26 | width:100%; height:100%;
27 | }
28 |
29 | .cover {
30 | display:block;
31 | width:100%; height:100%;
32 | object-fit: cover;
33 | }
34 |
35 | @media (prefers-color-scheme: dark) {
36 | body {
37 | margin:0;
38 | height:100%;
39 | background: #42a5f5;
40 |
41 | background-size: 100% 100%;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(domic LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "domic")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 |
11 | void RegisterPlugins(flutter::PluginRegistry* registry) {
12 | UrlLauncherWindowsRegisterWithRegistrar(
13 | registry->GetRegistrarForPlugin("UrlLauncherWindows"));
14 | }
15 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | url_launcher_windows
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Disable Windows macros that collide with C++ standard library functions.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
25 |
26 | # Add dependency libraries and include directories. Add any application-specific
27 | # dependencies here.
28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
30 |
31 | # Run the Flutter tool portions of the build. This must not be removed.
32 | add_dependencies(${BINARY_NAME} flutter_assemble)
33 |
--------------------------------------------------------------------------------
/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.rlight" "\0"
93 | VALUE "FileDescription", "domic" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "domic" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.rlight. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "domic.exe" "\0"
98 | VALUE "ProductName", "domic" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"domic", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/r-light/domic/a415a3b56c2c8f20f633d45c46a9ea7dfd2f350b/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------