This commit is contained in:
Rongjian Zhang 2022-10-17 18:00:43 +08:00
commit da77c3969f
403 changed files with 512391 additions and 166584 deletions

9
.gitignore vendored
View File

@ -8,6 +8,7 @@
.buildlog/ .buildlog/
.history .history
.svn/ .svn/
migrate_working_dir/
# IntelliJ related # IntelliJ related
*.iml *.iml
@ -39,4 +40,10 @@ app.*.symbols
# Obfuscation related # Obfuscation related
app.*.map.json app.*.map.json
lib/generated/
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
packages/*/pubspec.lock

View File

@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project. # This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc. # Used by Flutter tool to assess capabilities and perform upgrades etc.
# #
# This file should be version controlled and should not be manually edited. # This file should be version controlled.
version: version:
revision: d408d302e22179d598f467e11da5dd968dbdc9ec revision: 676cefaaff197f27424942307668886253e1ec35
channel: stable channel: stable
project_type: app project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: android
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: ios
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: linux
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: macos
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: web
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
- platform: windows
create_revision: 676cefaaff197f27424942307668886253e1ec35
base_revision: 676cefaaff197f27424942307668886253e1ec35
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

36
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "all",
"dependsOn": ["root", "gql_github", "gql_gitlab", "github_trending"]
},
{
"label": "root",
"type": "dart",
"command": "dart",
"args": ["run", "build_runner", "watch"]
},
{
"label": "gql_github",
"type": "dart",
"command": "dart",
"cwd": "packages/gql_github",
"args": ["run", "build_runner", "watch"]
},
{
"label": "gql_gitlab",
"type": "dart",
"command": "dart",
"cwd": "packages/gql_gitlab",
"args": ["run", "build_runner", "watch"]
},
{
"label": "github_trending",
"type": "dart",
"command": "dart",
"cwd": "packages/github_trending",
"args": ["run", "build_runner", "watch"]
}
]
}

View File

@ -1,21 +0,0 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
This follows contributing guidelines, as well as the follimg ones.
1. Title the vunerablilty
2. Describe the vunerablity in as much detail as possible
3. Give steps on how to reproduce the vunerablilty
4. Add media on the vunerablity, if possible

View File

@ -1,3 +1,45 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
prefer_single_quotes: true
always_use_package_imports: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
avoid_types_on_closure_parameters: true
omit_local_variable_types: true
prefer_final_in_for_each: true
prefer_final_locals: true
use_super_parameters: true
use_key_in_widget_constructors: false # waiting for auto fix: https://github.com/dart-lang/sdk/issues/50056
avoid_print: false # TODO:
analyzer: analyzer:
errors:
todo: ignore
fixme: ignore
exclude: exclude:
- lib/**/*.g.dart - "**/*.gql.dart"
- "**/*.g.dart"
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

2
android/.gitignore vendored
View File

@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore. # Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties key.properties
**/*.keystore
**/*.jks

View File

@ -26,21 +26,29 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 29 compileSdkVersion 32 // flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
} }
lintOptions {
disable 'InvalidPackage'
}
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.github.pd4d10.gittouch" applicationId "io.github.pd4d10.gittouch"
minSdkVersion 16 // You can update the following values to match your application needs.
targetSdkVersion 29 // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19 // flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.pd4d10.gittouch"> package="io.github.pd4d10.gittouch">
<!-- Flutter needs it to communicate with the running application <!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>

View File

@ -1,18 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.pd4d10.gittouch"> package="io.github.pd4d10.gittouch">
<uses-permission android:name="android.permission.INTERNET"/> <application
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="GitTouch" android:label="GitTouch"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@ -26,15 +20,6 @@
android:name="io.flutter.embedding.android.NormalTheme" android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" android:resource="@style/NormalTheme"
/> />
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Theme applied to the Android Window while the process is starting --> <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when <!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame --> the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item> <item name="android:windowBackground">@drawable/launch_background</item>
</style> </style>
<!-- Theme applied to the Android Window as soon as the process has started. <!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its Flutter UI initializes, as well as behind your Flutter UI while its
running. running.
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item> <item name="android:windowBackground">?android:colorBackground</item>
</style> </style>
</resources> </resources>

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.pd4d10.gittouch"> package="io.github.pd4d10.gittouch">
<!-- Flutter needs it to communicate with the running application <!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>

View File

@ -1,12 +1,12 @@
buildscript { buildscript {
ext.kotlin_version = '1.3.50' ext.kotlin_version = '1.6.10'
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
@ -14,7 +14,7 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

View File

@ -1,56 +0,0 @@
targets:
$default:
builders:
gql_build|ast_builder:
enabled: true
gql_build|schema_builder:
enabled: true
options:
schema: git_touch|lib/graphql/schema.graphql
type_overrides:
DateTime:
name: DateTime
URI:
name: String
GitObjectID:
name: String
gql_build|data_builder:
enabled: true
options:
schema: git_touch|lib/graphql/schema.graphql
type_overrides:
DateTime:
name: DateTime
URI:
name: String
GitObjectID:
name: String
gql_build|var_builder:
enabled: true
options:
schema: git_touch|lib/graphql/schema.graphql
type_overrides:
DateTime:
name: DateTime
URI:
name: String
GitObjectID:
name: String
gql_build|serializer_builder:
enabled: true
options:
schema: git_touch|lib/graphql/schema.graphql
custom_serializers:
- import: package:git_touch/utils/date_time_serializer.dart
name: DateTimeSerializer
ferry_generator|req_builder:
enabled: true
options:
schema: git_touch|lib/graphql/schema.graphql
type_overrides:
DateTime:
name: DateTime
URI:
name: String
GitObjectID:
name: String

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
ios/.gitignore vendored
View File

@ -1,3 +1,4 @@
**/dgph
*.mode1v3 *.mode1v3
*.mode2v3 *.mode2v3
*.moved-aside *.moved-aside
@ -18,6 +19,7 @@ Flutter/App.framework
Flutter/Flutter.framework Flutter/Flutter.framework
Flutter/Flutter.podspec Flutter/Flutter.podspec
Flutter/Generated.xcconfig Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx Flutter/app.flx
Flutter/app.zip Flutter/app.zip
Flutter/flutter_assets/ Flutter/flutter_assets/

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>App</string> <string>App</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -21,6 +21,6 @@
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>9.0</string> <string>11.0</string>
</dict> </dict>
</plist> </plist>

View File

@ -1,2 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1,2 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@ -2,39 +2,42 @@ PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- launch_review (0.0.1): - launch_review (0.0.1):
- Flutter - Flutter
- package_info (0.0.1): - maps_launcher (0.0.1):
- Flutter - Flutter
- package_info_plus (0.4.5): - package_info_plus (0.4.5):
- Flutter - Flutter
- Sentry (7.1.3): - path_provider_ios (0.0.1):
- Sentry/Core (= 7.1.3) - Flutter
- Sentry/Core (7.1.3) - Sentry (7.27.1):
- Sentry/Core (= 7.27.1)
- Sentry/Core (7.27.1)
- sentry_flutter (0.0.1): - sentry_flutter (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- Sentry (~> 7.1.3) - Sentry (~> 7.27.1)
- share (0.0.1): - share_plus (0.0.1):
- Flutter - Flutter
- shared_preferences (0.0.1): - shared_preferences_ios (0.0.1):
- Flutter - Flutter
- uni_links (0.0.1): - uni_links (0.0.1):
- Flutter - Flutter
- url_launcher (0.0.1): - url_launcher_ios (0.0.1):
- Flutter - Flutter
- webview_flutter (0.0.1): - webview_flutter_wkwebview (0.0.1):
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- launch_review (from `.symlinks/plugins/launch_review/ios`) - launch_review (from `.symlinks/plugins/launch_review/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`) - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`) - sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share (from `.symlinks/plugins/share/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
SPEC REPOS: SPEC REPOS:
trunk: trunk:
@ -45,36 +48,39 @@ EXTERNAL SOURCES:
:path: Flutter :path: Flutter
launch_review: launch_review:
:path: ".symlinks/plugins/launch_review/ios" :path: ".symlinks/plugins/launch_review/ios"
package_info: maps_launcher:
:path: ".symlinks/plugins/package_info/ios" :path: ".symlinks/plugins/maps_launcher/ios"
package_info_plus: package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios" :path: ".symlinks/plugins/package_info_plus/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
sentry_flutter: sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios" :path: ".symlinks/plugins/sentry_flutter/ios"
share: share_plus:
:path: ".symlinks/plugins/share/ios" :path: ".symlinks/plugins/share_plus/ios"
shared_preferences: shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences_ios/ios"
uni_links: uni_links:
:path: ".symlinks/plugins/uni_links/ios" :path: ".symlinks/plugins/uni_links/ios"
url_launcher: url_launcher_ios:
:path: ".symlinks/plugins/url_launcher/ios" :path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter: webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter/ios" :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
launch_review: 75d5a956ba8eaa493e9c9d4bf4c05e505e8d5ed0 launch_review: 75d5a956ba8eaa493e9c9d4bf4c05e505e8d5ed0
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 maps_launcher: 2e5b6a2d664ec6c27f82ffa81b74228d770ab203
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
Sentry: 6d963d64804dd06d96e778be729613f481394312 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
sentry_flutter: f20d4f199442900fbdab2b8496f1d2091d8b94d9 Sentry: bc644307e2eb6a4c9c55cf117a80b895bb2a25a7
share: 0b2c3e82132f5888bccca3351c504d0003b3b410 sentry_flutter: 649559f0512e00d3f6fc92cf51f74bc2fe68d1d3
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
COCOAPODS: 1.10.1 COCOAPODS: 1.11.3

View File

@ -3,17 +3,17 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 46; objectVersion = 50;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
37EE18F57BCDEA525EB92F36 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B20C9E04554129631AB8EE78 /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
FA131E1B3A78EEDD359ED551 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75205C87EE834F576A3F9103 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@ -30,14 +30,15 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
03BC239D24FE0B4D9A1D2D83 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
346CC1AE8457DF6B48B85A03 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; 2F67270DBA3C43464E2F44EE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
75205C87EE834F576A3F9103 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9220593D71312B73EFB9B261 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -45,8 +46,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AE6CD52BC7D64064E7B512FF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; B984CAF4E26B4FACF6C11EC5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
B20C9E04554129631AB8EE78 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -54,24 +54,13 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
37EE18F57BCDEA525EB92F36 /* Pods_Runner.framework in Frameworks */, FA131E1B3A78EEDD359ED551 /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
2E2AB605F70DF2344A2B9E92 /* Pods */ = {
isa = PBXGroup;
children = (
AE6CD52BC7D64064E7B512FF /* Pods-Runner.debug.xcconfig */,
346CC1AE8457DF6B48B85A03 /* Pods-Runner.release.xcconfig */,
03BC239D24FE0B4D9A1D2D83 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = { 9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -89,8 +78,8 @@
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
2E2AB605F70DF2344A2B9E92 /* Pods */, A28BA2DF970A8F973E2CD5D0 /* Pods */,
A3B00A29EAF11D6D1B02DEAB /* Frameworks */, B48C5EFD064AE0D1E1B42C23 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -117,10 +106,21 @@
path = Runner; path = Runner;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
A3B00A29EAF11D6D1B02DEAB /* Frameworks */ = { A28BA2DF970A8F973E2CD5D0 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
B20C9E04554129631AB8EE78 /* Pods_Runner.framework */, 2F67270DBA3C43464E2F44EE /* Pods-Runner.debug.xcconfig */,
9220593D71312B73EFB9B261 /* Pods-Runner.release.xcconfig */,
B984CAF4E26B4FACF6C11EC5 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
B48C5EFD064AE0D1E1B42C23 /* Frameworks */ = {
isa = PBXGroup;
children = (
75205C87EE834F576A3F9103 /* Pods_Runner.framework */,
); );
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
@ -132,14 +132,14 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
CB11531C1F26F7678F621EA7 /* [CP] Check Pods Manifest.lock */, 2B6DD7B668196BD9756C3725 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
58A5FDDED951DFF2FCF219F9 /* [CP] Embed Pods Frameworks */, C34908B9EA82FDA61F8BDAA0 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1020; LastUpgradeCheck = 1300;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
@ -198,52 +198,7 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 2B6DD7B668196BD9756C3725 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
58A5FDDED951DFF2FCF219F9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
CB11531C1F26F7678F621EA7 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@ -265,6 +220,51 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
C34908B9EA82FDA61F8BDAA0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@ -340,7 +340,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
@ -357,15 +357,10 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch; PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@ -422,7 +417,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@ -471,11 +466,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
@ -489,15 +485,10 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch; PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@ -516,15 +507,10 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = (
LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch; PRODUCT_BUNDLE_IDENTIFIER = io.github.pd4d10.gitTouch;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "group:Runner.xcodeproj"> location = "self:">
</FileRef> </FileRef>
</Workspace> </Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1020" LastUpgradeVersion = "1300"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
@ -38,8 +36,8 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<AdditionalOptions> <Testables>
</AdditionalOptions> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
@ -61,8 +59,6 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Profile" buildConfiguration = "Profile"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -4,11 +4,6 @@
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>hi</string>
</array>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>GitTouch</string> <string>GitTouch</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@ -63,5 +58,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@ -1,78 +1,77 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:git_touch/home.dart'; import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart'; import 'package:git_touch/router.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:intl/locale.dart' as l; import 'package:intl/locale.dart' as l;
import 'package:provider/provider.dart';
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
final theme = Provider.of<ThemeModel>(context); final theme = Provider.of<ThemeModel>(context);
final LocaleListResolutionCallback localeListResolutionCallback = return AntTheme(
(locales, supportedLocales) {
// 1. user set locale
// 2. system locale
try {
if (theme.locale != null) {
final intlLocale = l.Locale.parse(theme.locale!);
locales = [
Locale.fromSubtags(
languageCode: intlLocale.languageCode,
countryCode: intlLocale.countryCode,
scriptCode: intlLocale.scriptCode,
),
...locales!
];
}
} catch (err) {
print(err);
}
for (final locale in locales!) {
// this is necessary because Flutter only handles zh_Hans -> zh
// and would not handle non-exist language code
if (AppLocalizations.delegate.isSupported(locale)) {
return locale;
}
}
// 3. if none match, use the default
return supportedLocales.firstWhere((l) => l.languageCode == 'en');
};
return Container(
key: auth.rootKey, key: auth.rootKey,
child: theme.theme == AppThemeType.cupertino data: AntThemeData(brightness: theme.brightness),
? CupertinoApp( child: Builder(
theme: CupertinoThemeData(brightness: theme.brightness), builder: (context) {
home: Home(), final antTheme = AntTheme.of(context);
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales, return CupertinoApp.router(
localeListResolutionCallback: localeListResolutionCallback, routeInformationProvider: router.routeInformationProvider,
) routeInformationParser: router.routeInformationParser,
: MaterialApp( routerDelegate: router.routerDelegate,
theme: ThemeData( theme: CupertinoThemeData(
brightness: theme.brightness, brightness: theme.brightness,
primaryColor: primaryColor: antTheme.colorPrimary,
theme.brightness == Brightness.dark ? null : Colors.white, scaffoldBackgroundColor: antTheme.colorBox,
accentColor: theme.palette.primary, textTheme: CupertinoTextThemeData(
scaffoldBackgroundColor: theme.palette.background, textStyle: TextStyle(
pageTransitionsTheme: PageTransitionsTheme( fontSize: antTheme.fontSizeMain,
builders: { color: antTheme.colorText,
TargetPlatform.android: ZoomPageTransitionsBuilder(),
},
), ),
), ),
home: Home(),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
localeListResolutionCallback: localeListResolutionCallback,
), ),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
localeListResolutionCallback: (locales, supportedLocales) {
// 1. user set locale
// 2. system locale
try {
if (theme.locale != null) {
final intlLocale = l.Locale.parse(theme.locale!);
locales = [
Locale.fromSubtags(
languageCode: intlLocale.languageCode,
countryCode: intlLocale.countryCode,
scriptCode: intlLocale.scriptCode,
),
...locales!
];
}
} catch (err) {
print(err);
}
for (final locale in locales!) {
// this is necessary because Flutter only handles zh_Hans -> zh
// and would not handle non-exist language code
if (AppLocalizations.delegate.isSupported(locale)) {
return locale;
}
}
// 3. if none match, use the default
return supportedLocales.firstWhere((l) => l.languageCode == 'en');
},
);
},
),
); );
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,40 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/notification.dart'; import 'package:git_touch/models/notification.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:git_touch/screens/bb_explore.dart'; import 'package:git_touch/screens/bb_explore.dart';
import 'package:git_touch/screens/bb_teams.dart'; import 'package:git_touch/screens/bb_teams.dart';
import 'package:git_touch/screens/bb_user.dart'; import 'package:git_touch/screens/bb_user.dart';
import 'package:git_touch/screens/ge_search.dart';
import 'package:git_touch/screens/ge_user.dart'; import 'package:git_touch/screens/ge_user.dart';
import 'package:git_touch/screens/gh_news.dart';
import 'package:git_touch/screens/gh_notification.dart';
import 'package:git_touch/screens/gh_search.dart';
import 'package:git_touch/screens/gh_trending.dart';
import 'package:git_touch/screens/gh_user.dart';
import 'package:git_touch/screens/gl_explore.dart';
import 'package:git_touch/screens/gl_groups.dart';
import 'package:git_touch/screens/gl_search.dart'; import 'package:git_touch/screens/gl_search.dart';
import 'package:git_touch/screens/gl_user.dart';
import 'package:git_touch/screens/go_search.dart'; import 'package:git_touch/screens/go_search.dart';
import 'package:git_touch/screens/go_user.dart'; import 'package:git_touch/screens/go_user.dart';
import 'package:git_touch/screens/gt_orgs.dart'; import 'package:git_touch/screens/gt_orgs.dart';
import 'package:git_touch/screens/gt_user.dart'; import 'package:git_touch/screens/gt_user.dart';
import 'package:git_touch/screens/gl_explore.dart';
import 'package:git_touch/screens/gl_groups.dart';
import 'package:git_touch/screens/gl_user.dart';
import 'package:git_touch/screens/login.dart'; import 'package:git_touch/screens/login.dart';
import 'package:git_touch/screens/gh_notification.dart';
import 'package:git_touch/screens/gh_user.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:launch_review/launch_review.dart';
import 'package:package_info/package_info.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/screens/gh_news.dart';
import 'package:git_touch/screens/gh_search.dart';
import 'package:git_touch/screens/gh_trending.dart';
import 'package:git_touch/screens/ge_search.dart';
import 'package:github/github.dart'; import 'package:github/github.dart';
import 'package:flutter_gen/gen_l10n/S.dart'; import 'package:launch_review/launch_review.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
import 'package:pub_semver/pub_semver.dart'; import 'package:pub_semver/pub_semver.dart';
import 'package:universal_io/io.dart'; import 'package:universal_io/io.dart';
class Home extends StatefulWidget { class Home extends StatefulWidget {
@override @override
_HomeState createState() => _HomeState(); State<Home> createState() => _HomeState();
} }
class _HomeState extends State<Home> { class _HomeState extends State<Home> {
@ -47,7 +48,7 @@ class _HomeState extends State<Home> {
@override @override
initState() { initState() {
super.initState(); super.initState();
Future.delayed(Duration(seconds: 5), () async { Future.delayed(const Duration(seconds: 5), () async {
final latest = await GitHub() final latest = await GitHub()
.repositories .repositories
.getLatestRelease(RepositorySlug.full('git-touch/git-touch')); .getLatestRelease(RepositorySlug.full('git-touch/git-touch'));
@ -57,13 +58,13 @@ class _HomeState extends State<Home> {
.compareTo(Version.parse(current)) == .compareTo(Version.parse(current)) ==
1) { 1) {
final res = await context.read<ThemeModel>().showConfirm(context, final res = await context.read<ThemeModel>().showConfirm(context,
Text('New version released. Would you like to download it?')); const Text('New version released. Would you like to download it?'));
if (res == true) { if (res == true) {
if (Platform.isIOS) { if (Platform.isIOS) {
// go to app store // go to app store
LaunchReview.launch(writeReview: false); LaunchReview.launch(writeReview: false);
} else { } else {
context.read<ThemeModel>().push(context, latest.htmlUrl!); context.pushUrl(latest.htmlUrl!);
} }
} }
} }
@ -91,7 +92,7 @@ class _HomeState extends State<Home> {
case 3: case 3:
return GhSearchScreen(); return GhSearchScreen();
case 4: case 4:
return GhViewer(); return const GhViewerScreen();
} }
break; break;
case PlatformType.gitlab: case PlatformType.gitlab:
@ -103,7 +104,7 @@ class _HomeState extends State<Home> {
case 2: case 2:
return GlSearchScreen(); return GlSearchScreen();
case 3: case 3:
return GlUserScreen(null); return const GlUserScreen(null);
} }
break; break;
case PlatformType.bitbucket: case PlatformType.bitbucket:
@ -113,13 +114,13 @@ class _HomeState extends State<Home> {
case 1: case 1:
return BbTeamsScreen(); return BbTeamsScreen();
case 2: case 2:
return BbUserScreen(null); return const BbUserScreen(null);
} }
break; break;
case PlatformType.gitea: case PlatformType.gitea:
switch (index) { switch (index) {
case 0: case 0:
return GtOrgsScreen(); return const GtOrgsScreen();
case 1: case 1:
return GtUserScreen(auth.activeAccount!.login, isViewer: true); return GtUserScreen(auth.activeAccount!.login, isViewer: true);
} }
@ -143,8 +144,7 @@ class _HomeState extends State<Home> {
} }
Widget _buildNotificationIcon(BuildContext context, IconData iconData) { Widget _buildNotificationIcon(BuildContext context, IconData iconData) {
final theme = Provider.of<ThemeModel>(context); final count = Provider.of<NotificationModel>(context).count;
int count = Provider.of<NotificationModel>(context).count;
if (count == 0) { if (count == 0) {
return Icon(iconData); return Icon(iconData);
} }
@ -154,10 +154,11 @@ class _HomeState extends State<Home> {
children: <Widget>[ children: <Widget>[
Icon(iconData), Icon(iconData),
Positioned( Positioned(
right: -2, right: -2,
top: -2, top: -2,
child: Icon(Octicons.primitive_dot, child: Icon(Octicons.dot_fill,
color: theme.palette.primary, size: 14)) color: AntTheme.of(context).colorPrimary, size: 14),
)
], ],
); );
} }
@ -180,23 +181,23 @@ class _HomeState extends State<Home> {
List<BottomNavigationBarItem> _buildNavigationItems(String platform) { List<BottomNavigationBarItem> _buildNavigationItems(String platform) {
final search = BottomNavigationBarItem( final search = BottomNavigationBarItem(
icon: Icon(Ionicons.search_outline), icon: const Icon(Ionicons.search_outline),
activeIcon: Icon(Ionicons.search), activeIcon: const Icon(Ionicons.search),
label: AppLocalizations.of(context)!.search, label: AppLocalizations.of(context)!.search,
); );
final group = BottomNavigationBarItem( final group = BottomNavigationBarItem(
icon: Icon(Ionicons.people_outline), icon: const Icon(Ionicons.people_outline),
activeIcon: Icon(Ionicons.people), activeIcon: const Icon(Ionicons.people),
label: AppLocalizations.of(context)!.organizations, label: AppLocalizations.of(context)!.organizations,
); );
final me = BottomNavigationBarItem( final me = BottomNavigationBarItem(
icon: Icon(Ionicons.person_outline), icon: const Icon(Ionicons.person_outline),
activeIcon: Icon(Ionicons.person), activeIcon: const Icon(Ionicons.person),
label: AppLocalizations.of(context)!.me, label: AppLocalizations.of(context)!.me,
); );
final explore = BottomNavigationBarItem( final explore = BottomNavigationBarItem(
icon: Icon(Ionicons.compass_outline), icon: const Icon(Ionicons.compass_outline),
activeIcon: Icon(Ionicons.compass), activeIcon: const Icon(Ionicons.compass),
label: AppLocalizations.of(context)!.explore, label: AppLocalizations.of(context)!.explore,
); );
@ -204,8 +205,8 @@ class _HomeState extends State<Home> {
case PlatformType.github: case PlatformType.github:
return [ return [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Ionicons.newspaper_outline), icon: const Icon(Ionicons.newspaper_outline),
activeIcon: Icon(Ionicons.newspaper), activeIcon: const Icon(Ionicons.newspaper),
label: AppLocalizations.of(context)!.news, label: AppLocalizations.of(context)!.news,
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
@ -215,8 +216,8 @@ class _HomeState extends State<Home> {
label: AppLocalizations.of(context)!.notification, label: AppLocalizations.of(context)!.notification,
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Ionicons.flame_outline), icon: const Icon(Ionicons.flame_outline),
activeIcon: Icon(Ionicons.flame), activeIcon: const Icon(Ionicons.flame),
label: AppLocalizations.of(context)!.trending, label: AppLocalizations.of(context)!.trending,
), ),
search, search,
@ -238,7 +239,6 @@ class _HomeState extends State<Home> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
if (auth.activeAccount == null) { if (auth.activeAccount == null) {
@ -247,56 +247,35 @@ class _HomeState extends State<Home> {
final navigationItems = _buildNavigationItems(auth.activeAccount!.platform); final navigationItems = _buildNavigationItems(auth.activeAccount!.platform);
switch (theme.theme) { return WillPopScope(
case AppThemeType.cupertino: onWillPop: () async {
return WillPopScope( return !(await getNavigatorKey(auth.activeTab)
onWillPop: () async { .currentState
return !(await getNavigatorKey(auth.activeTab) ?.maybePop())!;
.currentState },
?.maybePop())!; child: CupertinoTabScaffold(
}, tabBuilder: (context, index) {
child: CupertinoTabScaffold( return CupertinoTabView(
tabBuilder: (context, index) { navigatorKey: getNavigatorKey(index),
return CupertinoTabView( builder: (context) {
navigatorKey: getNavigatorKey(index), return _buildScreen(index);
builder: (context) {
return _buildScreen(index);
},
);
}, },
tabBar: CupertinoTabBar( );
items: navigationItems, },
currentIndex: auth.activeTab, tabBar: CupertinoTabBar(
onTap: (index) { items: navigationItems,
if (auth.activeTab == index) { currentIndex: auth.activeTab,
getNavigatorKey(index) onTap: (index) {
.currentState if (auth.activeTab == index) {
?.popUntil((route) => route.isFirst); getNavigatorKey(index)
} else { .currentState
auth.setActiveTab(index); ?.popUntil((route) => route.isFirst);
} } else {
},
),
),
);
default:
return Scaffold(
body: IndexedStack(
index: auth.activeTab,
children: [
for (var i = 0; i < navigationItems.length; i++) _buildScreen(i)
],
),
bottomNavigationBar: BottomNavigationBar(
selectedItemColor: theme.palette.primary,
items: navigationItems,
currentIndex: auth.activeTab,
type: BottomNavigationBarType.fixed,
onTap: (int index) {
auth.setActiveTab(index); auth.setActiveTab(index);
}, }
), },
); ),
} ),
);
} }
} }

View File

@ -115,18 +115,6 @@
"@dark": { "@dark": {
"description": "dark mode" "description": "dark mode"
}, },
"scaffoldTheme": "Scaffold Theme",
"@scaffoldTheme": {
"description": "Kind of theme - cupertino or material"
},
"cupertino": "Cupertino",
"@cupertino": {
"description": "Cupertino scaffold theme"
},
"material": "Material",
"@material": {
"description": "Material scaffold theme"
},
"codeTheme": "Code Theme", "codeTheme": "Code Theme",
"@codeTheme": { "@codeTheme": {
"description": "code theme" "description": "code theme"
@ -494,7 +482,7 @@
}, },
"reviewed": "reviewed", "reviewed": "reviewed",
"@reviewed": { "@reviewed": {
"description": "reviewed" "description": "reviewed"
}, },
"mergedEventMessage": "merged commit {commit} into {mergeRefName}", "mergedEventMessage": "merged commit {commit} into {mergeRefName}",
"@mergedEventMessage": { "@mergedEventMessage": {
@ -692,10 +680,10 @@
"description": "example: repo1,repo2 were added to the installation id ID", "description": "example: repo1,repo2 were added to the installation id ID",
"placeholders": { "placeholders": {
"repos": { "repos": {
"type": "String" "type": "String"
}, },
"id": { "id": {
"type": "String" "type": "String"
} }
} }
}, },
@ -707,7 +695,7 @@
"type": "String" "type": "String"
}, },
"id": { "id": {
"type": "String" "type": "String"
} }
} }
}, },
@ -749,7 +737,7 @@
}, },
"was": "was", "was": "was",
"@was": { "@was": {
"description": "was" "description": "was"
}, },
"convertProjectCard": "converted the project card into an issue", "convertProjectCard": "converted the project card into an issue",
"@convertProjectCard": { "@convertProjectCard": {
@ -785,7 +773,7 @@
}, },
"made": "made", "made": "made",
"@made": { "@made": {
"description": "made" "description": "made"
}, },
"public": "public", "public": "public",
"@public": { "@public": {
@ -825,7 +813,7 @@
"type": "String" "type": "String"
}, },
"affectedRange": { "affectedRange": {
"type": "String" "type": "String"
}, },
"action": { "action": {
"type": "String" "type": "String"
@ -840,7 +828,7 @@
"type": "String" "type": "String"
}, },
"action": { "action": {
"type": "String" "type": "String"
} }
} }
}, },

View File

@ -1,14 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:git_touch/app.dart'; import 'package:git_touch/app.dart';
import 'package:git_touch/models/code.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/code.dart';
import 'package:git_touch/router.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/models/notification.dart'; import 'package:git_touch/models/notification.dart';
import 'package:fluro/fluro.dart'; import 'package:git_touch/models/theme.dart';
import 'package:flutter/services.dart'; import 'package:provider/provider.dart';
import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/sentry_flutter.dart';
void main() async { void main() async {
@ -29,39 +25,6 @@ void main() async {
codeModel.init(), codeModel.init(),
]); ]);
CommonRouter.routes.forEach((screen) {
themeModel.router.define(CommonRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
GitlabRouter.routes.forEach((screen) {
themeModel.router.define(GitlabRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
GiteaRouter.routes.forEach((screen) {
themeModel.router.define(GiteaRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
BitbucketRouter.routes.forEach((screen) {
themeModel.router.define(BitbucketRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
GithubRouter.routes.forEach((screen) {
themeModel.router.define(GithubRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
GiteeRouter.routes.forEach((screen) {
themeModel.router.define(GiteeRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
GogsRouter.routes.forEach((screen) {
themeModel.router.define(GogsRouter.prefix + screen.path,
handler: Handler(handlerFunc: screen.handler));
});
// To match status bar color to app bar color
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
));
runApp(MultiProvider( runApp(MultiProvider(
providers: [ providers: [
ChangeNotifierProvider(create: (context) => notificationModel), ChangeNotifierProvider(create: (context) => notificationModel),
@ -69,7 +32,7 @@ void main() async {
ChangeNotifierProvider(create: (context) => authModel), ChangeNotifierProvider(create: (context) => authModel),
ChangeNotifierProvider(create: (context) => codeModel), ChangeNotifierProvider(create: (context) => codeModel),
], ],
child: MyApp(), child: const MyApp(),
)); ));
}, },
); );

View File

@ -4,14 +4,7 @@ part 'account.g.dart';
@JsonSerializable(includeIfNull: false) @JsonSerializable(includeIfNull: false)
class Account { class Account {
String platform; // For Bitbucket
String domain;
String token;
String login;
String avatarUrl;
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId; // For Bitbucket
// equals(Account a) { // equals(Account a) {
// final uri = Uri.parse(domain); // final uri = Uri.parse(domain);
@ -38,6 +31,14 @@ class Account {
factory Account.fromJson(Map<String, dynamic> json) => factory Account.fromJson(Map<String, dynamic> json) =>
_$AccountFromJson(json); _$AccountFromJson(json);
String platform;
String domain;
String token;
String login;
String avatarUrl;
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId;
Map<String, dynamic> toJson() => _$AccountToJson(this); Map<String, dynamic> toJson() => _$AccountToJson(this);
} }

View File

@ -6,18 +6,16 @@ part of 'account.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Account _$AccountFromJson(Map<String, dynamic> json) { Account _$AccountFromJson(Map<String, dynamic> json) => Account(
return Account( platform: json['platform'] as String,
platform: json['platform'] as String, domain: json['domain'] as String,
domain: json['domain'] as String, token: json['token'] as String,
token: json['token'] as String, login: json['login'] as String,
login: json['login'] as String, avatarUrl: json['avatarUrl'] as String,
avatarUrl: json['avatarUrl'] as String, gitlabId: json['gitlabId'] as int?,
gitlabId: json['gitlabId'] as int?, appPassword: json['appPassword'] as String?,
appPassword: json['appPassword'] as String?, accountId: json['accountId'] as String?,
accountId: json['accountId'] as String?, );
);
}
Map<String, dynamic> _$AccountToJson(Account instance) { Map<String, dynamic> _$AccountToJson(Account instance) {
final val = <String, dynamic>{ final val = <String, dynamic>{

View File

@ -1,26 +1,26 @@
import 'dart:convert';
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:ferry/ferry.dart'; import 'package:ferry/ferry.dart';
import 'package:git_touch/utils/nil_store.dart'; import 'package:fimber/fimber.dart';
// import 'package:in_app_review/in_app_review.dart'; import 'package:flutter/cupertino.dart';
import 'package:universal_io/io.dart'; import 'package:flutter/widgets.dart';
import 'package:git_touch/models/account.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/models/gitea.dart'; import 'package:git_touch/models/gitea.dart';
import 'package:git_touch/models/gitee.dart'; import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/models/gitlab.dart';
import 'package:git_touch/models/gogs.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:github/github.dart'; import 'package:github/github.dart';
import 'package:gql_http_link/gql_http_link.dart'; import 'package:gql_http_link/gql_http_link.dart';
import 'package:fimber/fimber.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:uni_links/uni_links.dart';
import 'package:nanoid/nanoid.dart'; import 'package:nanoid/nanoid.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../utils/utils.dart'; import 'package:uni_links/uni_links.dart';
import 'account.dart'; // import 'package:in_app_review/in_app_review.dart';
import 'gitlab.dart'; import 'package:universal_io/io.dart';
import 'gogs.dart'; import 'package:url_launcher/url_launcher.dart';
const clientId = 'df930d7d2e219f26142a'; const clientId = 'df930d7d2e219f26142a';
@ -34,16 +34,16 @@ class PlatformType {
} }
class DataWithPage<T> { class DataWithPage<T> {
T data;
int cursor;
bool hasMore;
int total;
DataWithPage({ DataWithPage({
required this.data, required this.data,
required this.cursor, required this.cursor,
required this.hasMore, required this.hasMore,
required this.total, required this.total,
}); });
T data;
int cursor;
bool hasMore;
int total;
} }
class AuthModel with ChangeNotifier { class AuthModel with ChangeNotifier {
@ -85,7 +85,7 @@ class AuthModel with ChangeNotifier {
// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow // https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow
Future<void> _onSchemeDetected(Uri? uri) async { Future<void> _onSchemeDetected(Uri? uri) async {
await closeWebView(); await closeInAppWebView();
loading = true; loading = true;
notifyListeners(); notifyListeners();
@ -107,7 +107,7 @@ class AuthModel with ChangeNotifier {
await loginWithToken(token); await loginWithToken(token);
} }
Future<void> loginWithToken(String token) async { Future<void> loginWithToken(String t) async {
try { try {
final queryData = await query(''' final queryData = await query('''
{ {
@ -116,12 +116,12 @@ class AuthModel with ChangeNotifier {
avatarUrl avatarUrl
} }
} }
''', token); ''', t);
await _addAccount(Account( await _addAccount(Account(
platform: PlatformType.github, platform: PlatformType.github,
domain: 'https://github.com', domain: 'https://github.com',
token: token, token: t,
login: queryData['viewer']['login'] as String, login: queryData['viewer']['login'] as String,
avatarUrl: queryData['viewer']['avatarUrl'] as String, avatarUrl: queryData['viewer']['avatarUrl'] as String,
)); ));
@ -144,11 +144,7 @@ class AuthModel with ChangeNotifier {
throw info['message']; throw info['message'];
} }
if (info['error'] != null) { if (info['error'] != null) {
throw info['error'] + throw info['error'] + '. ' + (info['error_description'] ?? '');
'. ' +
(info['error_description'] != null
? info['error_description']
: '');
} }
final user = GitlabUser.fromJson(info); final user = GitlabUser.fromJson(info);
await _addAccount(Account( await _addAccount(Account(
@ -204,7 +200,7 @@ class AuthModel with ChangeNotifier {
hasMore: next != null, hasMore: next != null,
total: int.tryParse( total: int.tryParse(
res.headers['X-Total'] ?? res.headers['x-total'] ?? '') ?? res.headers['X-Total'] ?? res.headers['x-total'] ?? '') ??
TOTAL_COUNT_FALLBACK, kTotalCountFallback,
); );
} }
@ -241,7 +237,7 @@ class AuthModel with ChangeNotifier {
Map<String, dynamic> body = const {}, Map<String, dynamic> body = const {},
}) async { }) async {
late http.Response res; late http.Response res;
Map<String, String> headers = { final headers = <String, String>{
'Authorization': 'token $token', 'Authorization': 'token $token',
HttpHeaders.contentTypeHeader: 'application/json' HttpHeaders.contentTypeHeader: 'application/json'
}; };
@ -289,7 +285,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGiteaWithPage(String path, Future<DataWithPage> fetchGiteaWithPage(String path,
{int? page, int? limit}) async { {int? page, int? limit}) async {
page = page ?? 1; page = page ?? 1;
limit = limit ?? PAGE_SIZE; limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path'); var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace( uri = uri.replace(
@ -305,9 +301,9 @@ class AuthModel with ChangeNotifier {
return DataWithPage( return DataWithPage(
data: info, data: info,
cursor: page + 1, cursor: page + 1,
hasMore: info is List && info.length > 0, hasMore: info is List && info.isNotEmpty,
total: int.tryParse(res.headers['x-total-count'] ?? '') ?? total: int.tryParse(res.headers['x-total-count'] ?? '') ??
TOTAL_COUNT_FALLBACK, kTotalCountFallback,
); );
} }
@ -345,7 +341,7 @@ class AuthModel with ChangeNotifier {
Map<String, dynamic> body = const {}, Map<String, dynamic> body = const {},
}) async { }) async {
late http.Response res; late http.Response res;
Map<String, String> headers = { final headers = <String, String>{
'Authorization': 'token $token', 'Authorization': 'token $token',
HttpHeaders.contentTypeHeader: 'application/json' HttpHeaders.contentTypeHeader: 'application/json'
}; };
@ -393,7 +389,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGogsWithPage(String path, Future<DataWithPage> fetchGogsWithPage(String path,
{int? page, int? limit}) async { {int? page, int? limit}) async {
page = page ?? 1; page = page ?? 1;
limit = limit ?? PAGE_SIZE; limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path'); var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace( uri = uri.replace(
@ -409,9 +405,9 @@ class AuthModel with ChangeNotifier {
return DataWithPage( return DataWithPage(
data: info, data: info,
cursor: page + 1, cursor: page + 1,
hasMore: info is List && info.length > 0, hasMore: info is List && info.isNotEmpty,
total: int.tryParse(res.headers['x-total-count'] ?? '') ?? total: int.tryParse(res.headers['x-total-count'] ?? '') ??
TOTAL_COUNT_FALLBACK, kTotalCountFallback,
); );
} }
@ -421,7 +417,7 @@ class AuthModel with ChangeNotifier {
Map<String, dynamic> body = const {}, Map<String, dynamic> body = const {},
}) async { }) async {
http.Response res; http.Response res;
Map<String, String> headers = { final headers = <String, String>{
'Authorization': 'token $token', 'Authorization': 'token $token',
HttpHeaders.contentTypeHeader: 'application/json' HttpHeaders.contentTypeHeader: 'application/json'
}; };
@ -480,7 +476,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGiteeWithPage(String path, Future<DataWithPage> fetchGiteeWithPage(String path,
{int? page, int? limit}) async { {int? page, int? limit}) async {
page = page ?? 1; page = page ?? 1;
limit = limit ?? PAGE_SIZE; limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v5$path'); var uri = Uri.parse('${activeAccount!.domain}/api/v5$path');
uri = uri.replace( uri = uri.replace(
@ -495,7 +491,7 @@ class AuthModel with ChangeNotifier {
final totalPage = int.tryParse(res.headers['total_page'] ?? ''); final totalPage = int.tryParse(res.headers['total_page'] ?? '');
final totalCount = final totalCount =
int.tryParse(res.headers['total_count'] ?? '') ?? TOTAL_COUNT_FALLBACK; int.tryParse(res.headers['total_count'] ?? '') ?? kTotalCountFallback;
return DataWithPage( return DataWithPage(
data: info, data: info,
@ -546,7 +542,7 @@ class AuthModel with ChangeNotifier {
userInfo: '${activeAccount!.login}:${activeAccount!.appPassword}', userInfo: '${activeAccount!.login}:${activeAccount!.appPassword}',
path: input.path, path: input.path,
queryParameters: { queryParameters: {
'pagelen': PAGE_SIZE.toString(), 'pagelen': kPageSize.toString(),
...input.queryParameters ...input.queryParameters
}, },
); );
@ -615,11 +611,11 @@ class AuthModel with ChangeNotifier {
Fimber.e('getUriLinksStream failed', ex: err); Fimber.e('getUriLinksStream failed', ex: err);
}); });
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
// Read accounts // Read accounts
try { try {
String? str = prefs.getString(StorageKeys.accounts); final str = prefs.getString(StorageKeys.accounts);
// Fimber.d('read accounts: $str'); // Fimber.d('read accounts: $str');
_accounts = (json.decode(str ?? '[]') as List) _accounts = (json.decode(str ?? '[]') as List)
.map((item) => Account.fromJson(item)) .map((item) => Account.fromJson(item))
@ -668,7 +664,8 @@ class AuthModel with ChangeNotifier {
StorageKeys.getDefaultStartTabKey(activeAccount!.platform)) ?? StorageKeys.getDefaultStartTabKey(activeAccount!.platform)) ??
0; 0;
_ghClient = null; _ghClient = null;
_gqlClient = null; _ghGqlClient = null;
_glGqlClient = null;
notifyListeners(); notifyListeners();
// TODO: strategy // TODO: strategy
@ -684,41 +681,48 @@ class AuthModel with ChangeNotifier {
} }
// http timeout // http timeout
var _timeoutDuration = Duration(seconds: 10); final _timeoutDuration = const Duration(seconds: 10);
// var _timeoutDuration = Duration(seconds: 1); // var _timeoutDuration = Duration(seconds: 1);
GitHub? _ghClient; GitHub? _ghClient;
GitHub get ghClient { GitHub get ghClient {
if (_ghClient == null) { _ghClient ??= GitHub(auth: Authentication.withToken(token));
_ghClient = GitHub(auth: Authentication.withToken(token));
}
return _ghClient!; return _ghClient!;
} }
Client? _gqlClient; Client? _ghGqlClient;
Client get gqlClient { Client get ghGqlClient {
if (_gqlClient == null) { return _ghGqlClient ??= Client(
_gqlClient = Client( link: HttpLink(
link: HttpLink( '$_apiPrefix/graphql',
_apiPrefix + '/graphql', defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'},
defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'}, ),
), // https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
cache: Cache(store: NilStore()), defaultFetchPolicies: {OperationType.query: FetchPolicy.NetworkOnly},
); );
}
return _gqlClient!;
} }
Future<dynamic> query(String query, [String? _token]) async { Client? _glGqlClient;
if (_token == null) { Client get glGqlClient {
_token = token; return _glGqlClient ??= Client(
} link: HttpLink(
Uri.parse(activeAccount!.domain)
.replace(path: '/api/graphql')
.toString(),
defaultHeaders: {'Private-Token': token},
),
// https://ferrygraphql.com/docs/fetch-policies#default-fetchpolicies
defaultFetchPolicies: {OperationType.query: FetchPolicy.NetworkOnly},
);
}
Future<dynamic> query(String query, [String? t]) async {
t ??= token;
final res = await http final res = await http
.post(Uri.parse(_apiPrefix + '/graphql'), .post(Uri.parse('$_apiPrefix/graphql'),
headers: { headers: {
HttpHeaders.authorizationHeader: 'token $_token', HttpHeaders.authorizationHeader: 'token $t',
HttpHeaders.contentTypeHeader: 'application/json' HttpHeaders.contentTypeHeader: 'application/json'
}, },
body: json.encode({'query': query})) body: json.encode({'query': query}))
@ -740,7 +744,7 @@ class AuthModel with ChangeNotifier {
final repoScope = publicOnly ? 'public_repo' : 'repo'; final repoScope = publicOnly ? 'public_repo' : 'repo';
final scope = Uri.encodeComponent( final scope = Uri.encodeComponent(
['user', repoScope, 'read:org', 'notifications'].join(',')); ['user', repoScope, 'read:org', 'notifications'].join(','));
launchUrl( launchStringUrl(
'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=$scope&state=$_oauthState', 'https://github.com/login/oauth/authorize?client_id=$clientId&redirect_uri=gittouch://login&scope=$scope&state=$_oauthState',
); );
} }

View File

@ -1,39 +1,42 @@
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
part 'bitbucket.g.dart'; part 'bitbucket.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbPagination { class BbPagination {
String? next;
List values;
BbPagination({required this.values}); BbPagination({required this.values});
factory BbPagination.fromJson(Map<String, dynamic> json) => factory BbPagination.fromJson(Map<String, dynamic> json) =>
_$BbPaginationFromJson(json); _$BbPaginationFromJson(json);
String? next;
List values;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoOwner { class BbRepoOwner {
BbRepoOwner();
factory BbRepoOwner.fromJson(Map<String, dynamic> json) =>
_$BbRepoOwnerFromJson(json);
String? nickname; String? nickname;
String? displayName; String? displayName;
String? type; // user, team String? type; // user, team
Map<String, dynamic>? links; Map<String, dynamic>? links;
String? get avatarUrl => links!['avatar']['href']; String? get avatarUrl => links!['avatar']['href'];
BbRepoOwner();
factory BbRepoOwner.fromJson(Map<String, dynamic> json) =>
_$BbRepoOwnerFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbUser extends BbRepoOwner { class BbUser extends BbRepoOwner {
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
String? username; String? username;
bool? isStaff; bool? isStaff;
DateTime? createdOn; DateTime? createdOn;
String? accountId; String? accountId;
BbUser();
factory BbUser.fromJson(Map<String, dynamic> json) => _$BbUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbRepo { class BbRepo {
BbRepo();
factory BbRepo.fromJson(Map<String, dynamic> json) => _$BbRepoFromJson(json);
String? name; String? name;
BbRepoOwner? owner; BbRepoOwner? owner;
String? website; String? website;
@ -50,51 +53,52 @@ class BbRepo {
Map<String, dynamic>? links; Map<String, dynamic>? links;
String get ownerLogin => fullName!.split('/')[0]; // owner has no username String get ownerLogin => fullName!.split('/')[0]; // owner has no username
String? get avatarUrl => links!['avatar']['href']; String? get avatarUrl => links!['avatar']['href'];
BbRepo();
factory BbRepo.fromJson(Map<String, dynamic> json) => _$BbRepoFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbRepoMainbranch { class BbRepoMainbranch {
String? type;
String? name;
BbRepoMainbranch(); BbRepoMainbranch();
factory BbRepoMainbranch.fromJson(Map<String, dynamic> json) => factory BbRepoMainbranch.fromJson(Map<String, dynamic> json) =>
_$BbRepoMainbranchFromJson(json); _$BbRepoMainbranchFromJson(json);
String? type;
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbTree { class BbTree {
BbTree({required this.type, required this.path});
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
String type; String type;
String path; String path;
int? size; int? size;
Map<String, dynamic>? links; Map<String, dynamic>? links;
BbTree({required this.type, required this.path});
factory BbTree.fromJson(Map<String, dynamic> json) => _$BbTreeFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbCommit { class BbCommit {
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
String? message; String? message;
DateTime? date; DateTime? date;
String? hash; String? hash;
BbCommitAuthor? author; BbCommitAuthor? author;
BbCommit();
factory BbCommit.fromJson(Map<String, dynamic> json) =>
_$BbCommitFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbCommitAuthor { class BbCommitAuthor {
String? raw;
BbRepoOwner? user;
BbCommitAuthor(); BbCommitAuthor();
factory BbCommitAuthor.fromJson(Map<String, dynamic> json) => factory BbCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$BbCommitAuthorFromJson(json); _$BbCommitAuthorFromJson(json);
String? raw;
BbRepoOwner? user;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbIssues { class BbIssues {
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
String? priority; String? priority;
String? state; String? state;
BbRepo? repository; BbRepo? repository;
@ -103,50 +107,47 @@ class BbIssues {
DateTime? createdOn; DateTime? createdOn;
Map<String, dynamic>? links; Map<String, dynamic>? links;
String? get issueLink => links!['self']['href']; String? get issueLink => links!['self']['href'];
BbIssues();
factory BbIssues.fromJson(Map<String, dynamic> json) =>
_$BbIssuesFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbPulls { class BbPulls {
BbPulls();
factory BbPulls.fromJson(Map<String, dynamic> json) =>
_$BbPullsFromJson(json);
String? description; String? description;
BbRepoOwner? author; BbRepoOwner? author;
String? title; String? title;
Map<String, dynamic>? links; Map<String, dynamic>? links;
String? get pullRequestLink => links!['self']['href']; String? get pullRequestLink => links!['self']['href'];
DateTime? createdOn; DateTime? createdOn;
BbPulls();
factory BbPulls.fromJson(Map<String, dynamic> json) =>
_$BbPullsFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbCommentContent { class BbCommentContent {
String? raw;
String? markup;
String? html;
BbCommentContent(); BbCommentContent();
factory BbCommentContent.fromJson(Map<String, dynamic> json) => factory BbCommentContent.fromJson(Map<String, dynamic> json) =>
_$BbCommentContentFromJson(json); _$BbCommentContentFromJson(json);
String? raw;
String? markup;
String? html;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbComment { class BbComment {
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
String? createdOn; String? createdOn;
String? updatedOn; String? updatedOn;
BbCommentContent? content; BbCommentContent? content;
BbRepoOwner? user; BbRepoOwner? user;
BbComment();
factory BbComment.fromJson(Map<String, dynamic> json) =>
_$BbCommentFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class BbBranch { class BbBranch {
String? name;
String? type;
BbBranch(); BbBranch();
factory BbBranch.fromJson(Map<String, dynamic> json) => factory BbBranch.fromJson(Map<String, dynamic> json) =>
_$BbBranchFromJson(json); _$BbBranchFromJson(json);
String? name;
String? type;
} }

View File

@ -6,11 +6,9 @@ part of 'bitbucket.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
BbPagination _$BbPaginationFromJson(Map<String, dynamic> json) { BbPagination _$BbPaginationFromJson(Map<String, dynamic> json) => BbPagination(
return BbPagination( values: json['values'] as List<dynamic>,
values: json['values'] as List<dynamic>, )..next = json['next'] as String?;
)..next = json['next'] as String?;
}
Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) => Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
<String, dynamic>{ <String, dynamic>{
@ -18,13 +16,11 @@ Map<String, dynamic> _$BbPaginationToJson(BbPagination instance) =>
'values': instance.values, 'values': instance.values,
}; };
BbRepoOwner _$BbRepoOwnerFromJson(Map<String, dynamic> json) { BbRepoOwner _$BbRepoOwnerFromJson(Map<String, dynamic> json) => BbRepoOwner()
return BbRepoOwner() ..nickname = json['nickname'] as String?
..nickname = json['nickname'] as String? ..displayName = json['display_name'] as String?
..displayName = json['display_name'] as String? ..type = json['type'] as String?
..type = json['type'] as String? ..links = json['links'] as Map<String, dynamic>?;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) => Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
<String, dynamic>{ <String, dynamic>{
@ -34,19 +30,17 @@ Map<String, dynamic> _$BbRepoOwnerToJson(BbRepoOwner instance) =>
'links': instance.links, 'links': instance.links,
}; };
BbUser _$BbUserFromJson(Map<String, dynamic> json) { BbUser _$BbUserFromJson(Map<String, dynamic> json) => BbUser()
return BbUser() ..nickname = json['nickname'] as String?
..nickname = json['nickname'] as String? ..displayName = json['display_name'] as String?
..displayName = json['display_name'] as String? ..type = json['type'] as String?
..type = json['type'] as String? ..links = json['links'] as Map<String, dynamic>?
..links = json['links'] as Map<String, dynamic>? ..username = json['username'] as String?
..username = json['username'] as String? ..isStaff = json['is_staff'] as bool?
..isStaff = json['is_staff'] as bool? ..createdOn = json['created_on'] == null
..createdOn = json['created_on'] == null ? null
? null : DateTime.parse(json['created_on'] as String)
: DateTime.parse(json['created_on'] as String) ..accountId = json['account_id'] as String?;
..accountId = json['account_id'] as String?;
}
Map<String, dynamic> _$BbUserToJson(BbUser instance) => <String, dynamic>{ Map<String, dynamic> _$BbUserToJson(BbUser instance) => <String, dynamic>{
'nickname': instance.nickname, 'nickname': instance.nickname,
@ -59,31 +53,29 @@ Map<String, dynamic> _$BbUserToJson(BbUser instance) => <String, dynamic>{
'account_id': instance.accountId, 'account_id': instance.accountId,
}; };
BbRepo _$BbRepoFromJson(Map<String, dynamic> json) { BbRepo _$BbRepoFromJson(Map<String, dynamic> json) => BbRepo()
return BbRepo() ..name = json['name'] as String?
..name = json['name'] as String? ..owner = json['owner'] == null
..owner = json['owner'] == null ? null
? null : BbRepoOwner.fromJson(json['owner'] as Map<String, dynamic>)
: BbRepoOwner.fromJson(json['owner'] as Map<String, dynamic>) ..website = json['website'] as String?
..website = json['website'] as String? ..language = json['language'] as String?
..language = json['language'] as String? ..size = json['size'] as int?
..size = json['size'] as int? ..type = json['type'] as String?
..type = json['type'] as String? ..isPrivate = json['is_private'] as bool?
..isPrivate = json['is_private'] as bool? ..createdOn = json['created_on'] == null
..createdOn = json['created_on'] == null ? null
? null : DateTime.parse(json['created_on'] as String)
: DateTime.parse(json['created_on'] as String) ..updatedOn = json['updated_on'] == null
..updatedOn = json['updated_on'] == null ? null
? null : DateTime.parse(json['updated_on'] as String)
: DateTime.parse(json['updated_on'] as String) ..description = json['description'] as String?
..description = json['description'] as String? ..fullName = json['full_name'] as String?
..fullName = json['full_name'] as String? ..slug = json['slug'] as String?
..slug = json['slug'] as String? ..mainbranch = json['mainbranch'] == null
..mainbranch = json['mainbranch'] == null ? null
? null : BbRepoMainbranch.fromJson(json['mainbranch'] as Map<String, dynamic>)
: BbRepoMainbranch.fromJson(json['mainbranch'] as Map<String, dynamic>) ..links = json['links'] as Map<String, dynamic>?;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbRepoToJson(BbRepo instance) => <String, dynamic>{ Map<String, dynamic> _$BbRepoToJson(BbRepo instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,
@ -102,11 +94,10 @@ Map<String, dynamic> _$BbRepoToJson(BbRepo instance) => <String, dynamic>{
'links': instance.links, 'links': instance.links,
}; };
BbRepoMainbranch _$BbRepoMainbranchFromJson(Map<String, dynamic> json) { BbRepoMainbranch _$BbRepoMainbranchFromJson(Map<String, dynamic> json) =>
return BbRepoMainbranch() BbRepoMainbranch()
..type = json['type'] as String? ..type = json['type'] as String?
..name = json['name'] as String?; ..name = json['name'] as String?;
}
Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) => Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
<String, dynamic>{ <String, dynamic>{
@ -114,14 +105,12 @@ Map<String, dynamic> _$BbRepoMainbranchToJson(BbRepoMainbranch instance) =>
'name': instance.name, 'name': instance.name,
}; };
BbTree _$BbTreeFromJson(Map<String, dynamic> json) { BbTree _$BbTreeFromJson(Map<String, dynamic> json) => BbTree(
return BbTree( type: json['type'] as String,
type: json['type'] as String, path: json['path'] as String,
path: json['path'] as String, )
) ..size = json['size'] as int?
..size = json['size'] as int? ..links = json['links'] as Map<String, dynamic>?;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{ Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@ -130,16 +119,13 @@ Map<String, dynamic> _$BbTreeToJson(BbTree instance) => <String, dynamic>{
'links': instance.links, 'links': instance.links,
}; };
BbCommit _$BbCommitFromJson(Map<String, dynamic> json) { BbCommit _$BbCommitFromJson(Map<String, dynamic> json) => BbCommit()
return BbCommit() ..message = json['message'] as String?
..message = json['message'] as String? ..date = json['date'] == null ? null : DateTime.parse(json['date'] as String)
..date = ..hash = json['hash'] as String?
json['date'] == null ? null : DateTime.parse(json['date'] as String) ..author = json['author'] == null
..hash = json['hash'] as String? ? null
..author = json['author'] == null : BbCommitAuthor.fromJson(json['author'] as Map<String, dynamic>);
? null
: BbCommitAuthor.fromJson(json['author'] as Map<String, dynamic>);
}
Map<String, dynamic> _$BbCommitToJson(BbCommit instance) => <String, dynamic>{ Map<String, dynamic> _$BbCommitToJson(BbCommit instance) => <String, dynamic>{
'message': instance.message, 'message': instance.message,
@ -148,13 +134,12 @@ Map<String, dynamic> _$BbCommitToJson(BbCommit instance) => <String, dynamic>{
'author': instance.author, 'author': instance.author,
}; };
BbCommitAuthor _$BbCommitAuthorFromJson(Map<String, dynamic> json) { BbCommitAuthor _$BbCommitAuthorFromJson(Map<String, dynamic> json) =>
return BbCommitAuthor() BbCommitAuthor()
..raw = json['raw'] as String? ..raw = json['raw'] as String?
..user = json['user'] == null ..user = json['user'] == null
? null ? null
: BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>); : BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$BbCommitAuthorToJson(BbCommitAuthor instance) => Map<String, dynamic> _$BbCommitAuthorToJson(BbCommitAuthor instance) =>
<String, dynamic>{ <String, dynamic>{
@ -162,22 +147,20 @@ Map<String, dynamic> _$BbCommitAuthorToJson(BbCommitAuthor instance) =>
'user': instance.user, 'user': instance.user,
}; };
BbIssues _$BbIssuesFromJson(Map<String, dynamic> json) { BbIssues _$BbIssuesFromJson(Map<String, dynamic> json) => BbIssues()
return BbIssues() ..priority = json['priority'] as String?
..priority = json['priority'] as String? ..state = json['state'] as String?
..state = json['state'] as String? ..repository = json['repository'] == null
..repository = json['repository'] == null ? null
? null : BbRepo.fromJson(json['repository'] as Map<String, dynamic>)
: BbRepo.fromJson(json['repository'] as Map<String, dynamic>) ..title = json['title'] as String?
..title = json['title'] as String? ..reporter = json['reporter'] == null
..reporter = json['reporter'] == null ? null
? null : BbRepoOwner.fromJson(json['reporter'] as Map<String, dynamic>)
: BbRepoOwner.fromJson(json['reporter'] as Map<String, dynamic>) ..createdOn = json['created_on'] == null
..createdOn = json['created_on'] == null ? null
? null : DateTime.parse(json['created_on'] as String)
: DateTime.parse(json['created_on'] as String) ..links = json['links'] as Map<String, dynamic>?;
..links = json['links'] as Map<String, dynamic>?;
}
Map<String, dynamic> _$BbIssuesToJson(BbIssues instance) => <String, dynamic>{ Map<String, dynamic> _$BbIssuesToJson(BbIssues instance) => <String, dynamic>{
'priority': instance.priority, 'priority': instance.priority,
@ -189,18 +172,16 @@ Map<String, dynamic> _$BbIssuesToJson(BbIssues instance) => <String, dynamic>{
'links': instance.links, 'links': instance.links,
}; };
BbPulls _$BbPullsFromJson(Map<String, dynamic> json) { BbPulls _$BbPullsFromJson(Map<String, dynamic> json) => BbPulls()
return BbPulls() ..description = json['description'] as String?
..description = json['description'] as String? ..author = json['author'] == null
..author = json['author'] == null ? null
? null : BbRepoOwner.fromJson(json['author'] as Map<String, dynamic>)
: BbRepoOwner.fromJson(json['author'] as Map<String, dynamic>) ..title = json['title'] as String?
..title = json['title'] as String? ..links = json['links'] as Map<String, dynamic>?
..links = json['links'] as Map<String, dynamic>? ..createdOn = json['created_on'] == null
..createdOn = json['created_on'] == null ? null
? null : DateTime.parse(json['created_on'] as String);
: DateTime.parse(json['created_on'] as String);
}
Map<String, dynamic> _$BbPullsToJson(BbPulls instance) => <String, dynamic>{ Map<String, dynamic> _$BbPullsToJson(BbPulls instance) => <String, dynamic>{
'description': instance.description, 'description': instance.description,
@ -210,12 +191,11 @@ Map<String, dynamic> _$BbPullsToJson(BbPulls instance) => <String, dynamic>{
'created_on': instance.createdOn?.toIso8601String(), 'created_on': instance.createdOn?.toIso8601String(),
}; };
BbCommentContent _$BbCommentContentFromJson(Map<String, dynamic> json) { BbCommentContent _$BbCommentContentFromJson(Map<String, dynamic> json) =>
return BbCommentContent() BbCommentContent()
..raw = json['raw'] as String? ..raw = json['raw'] as String?
..markup = json['markup'] as String? ..markup = json['markup'] as String?
..html = json['html'] as String?; ..html = json['html'] as String?;
}
Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) => Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
<String, dynamic>{ <String, dynamic>{
@ -224,17 +204,15 @@ Map<String, dynamic> _$BbCommentContentToJson(BbCommentContent instance) =>
'html': instance.html, 'html': instance.html,
}; };
BbComment _$BbCommentFromJson(Map<String, dynamic> json) { BbComment _$BbCommentFromJson(Map<String, dynamic> json) => BbComment()
return BbComment() ..createdOn = json['created_on'] as String?
..createdOn = json['created_on'] as String? ..updatedOn = json['updated_on'] as String?
..updatedOn = json['updated_on'] as String? ..content = json['content'] == null
..content = json['content'] == null ? null
? null : BbCommentContent.fromJson(json['content'] as Map<String, dynamic>)
: BbCommentContent.fromJson(json['content'] as Map<String, dynamic>) ..user = json['user'] == null
..user = json['user'] == null ? null
? null : BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
: BbRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$BbCommentToJson(BbComment instance) => <String, dynamic>{ Map<String, dynamic> _$BbCommentToJson(BbComment instance) => <String, dynamic>{
'created_on': instance.createdOn, 'created_on': instance.createdOn,
@ -243,11 +221,9 @@ Map<String, dynamic> _$BbCommentToJson(BbComment instance) => <String, dynamic>{
'user': instance.user, 'user': instance.user,
}; };
BbBranch _$BbBranchFromJson(Map<String, dynamic> json) { BbBranch _$BbBranchFromJson(Map<String, dynamic> json) => BbBranch()
return BbBranch() ..name = json['name'] as String?
..name = json['name'] as String? ..type = json['type'] as String?;
..type = json['type'] as String?;
}
Map<String, dynamic> _$BbBranchToJson(BbBranch instance) => <String, dynamic>{ Map<String, dynamic> _$BbBranchToJson(BbBranch instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,

View File

@ -1,41 +1,56 @@
import 'package:fimber/fimber.dart'; import 'package:fimber/fimber.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_highlight/theme_map.dart'; import 'package:flutter_highlight/theme_map.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class CodeModel with ChangeNotifier { class CodeModel with ChangeNotifier {
static var themes = themeMap.keys.toList(); static var themes = themeMap.keys.toList();
static const fontSizes = [12, 13, 14, 15, 16, 17, 18, 19, 20]; static const fontSizes = [12, 13, 14, 15, 16, 17, 18, 19, 20];
static const fontFamilies = [ static final fontFamilies = [
'System', 'System',
'JetBrains Mono',
'Fira Code', // https://fonts.google.com/?category=Monospace
'Inconsolata', ...GoogleFonts.asMap().keys.where((element) =>
'PT Mono', element.endsWith('Mono') ||
'Source Code Pro', [
'Ubuntu Mono', 'Inconsolata',
'Cascadia Code', 'Source Code Pro',
'Nanum Gothic Coding',
'Cousine',
'Anonymous Pro',
'Courier Prime',
'VT323',
'Fira Code'
].contains(element)),
]; ];
String _theme = 'vs'; String _theme = 'vs';
String _themeDark = 'vs2015'; String _themeDark = 'vs2015';
int _fontSize = 14; int _fontSize = 14;
String _fontFamily = 'JetBrains Mono'; String _fontFamily = 'System';
String get theme => _theme; String get theme => _theme;
String get themeDark => _themeDark; String get themeDark => _themeDark;
int get fontSize => _fontSize; int get fontSize => _fontSize;
String get fontFamily => _fontFamily; String get fontFamily => _fontFamily;
String get fontFamilyUsed => TextStyle get fontStyle {
_fontFamily == 'System' ? CommonStyle.monospace : _fontFamily; if (_fontFamily == 'System') {
return TextStyle(
fontFamily: CommonStyle.monospace, fontSize: fontSize.toDouble());
} else {
return GoogleFonts.getFont(_fontFamily, fontSize: fontSize.toDouble());
}
}
Future<void> init() async { Future<void> init() async {
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
var vh = prefs.getString(StorageKeys.codeTheme); final vh = prefs.getString(StorageKeys.codeTheme);
var vdh = prefs.getString(StorageKeys.codeThemeDark); final vdh = prefs.getString(StorageKeys.codeThemeDark);
var vs = prefs.getInt(StorageKeys.iCodeFontSize); final vs = prefs.getInt(StorageKeys.iCodeFontSize);
var vf = prefs.getString(StorageKeys.codeFontFamily); final vf = prefs.getString(StorageKeys.codeFontFamily);
Fimber.d('read code: $vh, $vs, $vf'); Fimber.d('read code: $vh, $vs, $vf');
if (themeMap.keys.contains(vh)) { if (themeMap.keys.contains(vh)) {
@ -55,7 +70,7 @@ class CodeModel with ChangeNotifier {
} }
setTheme(String v) async { setTheme(String v) async {
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.setString(StorageKeys.codeTheme, v); await prefs.setString(StorageKeys.codeTheme, v);
Fimber.d('write code theme: $v'); Fimber.d('write code theme: $v');
@ -65,7 +80,7 @@ class CodeModel with ChangeNotifier {
} }
setThemeDark(String v) async { setThemeDark(String v) async {
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.setString(StorageKeys.codeThemeDark, v); await prefs.setString(StorageKeys.codeThemeDark, v);
Fimber.d('write code theme dark: $v'); Fimber.d('write code theme dark: $v');
@ -75,7 +90,7 @@ class CodeModel with ChangeNotifier {
} }
setFontSize(int v) async { setFontSize(int v) async {
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.setInt(StorageKeys.iCodeFontSize, v); await prefs.setInt(StorageKeys.iCodeFontSize, v);
Fimber.d('write code font size: $v'); Fimber.d('write code font size: $v');
@ -85,7 +100,7 @@ class CodeModel with ChangeNotifier {
} }
setFontFamily(String v) async { setFontFamily(String v) async {
var prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.setString(StorageKeys.codeFontFamily, v); await prefs.setString(StorageKeys.codeFontFamily, v);
Fimber.d('write code font family: $v'); Fimber.d('write code font family: $v');

View File

@ -4,18 +4,21 @@ part 'gitea.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaUser { class GiteaUser {
GiteaUser();
factory GiteaUser.fromJson(Map<String, dynamic> json) =>
_$GiteaUserFromJson(json);
int? id; int? id;
String? login; String? login;
String? fullName; String? fullName;
String? avatarUrl; String? avatarUrl;
DateTime? created; DateTime? created;
GiteaUser();
factory GiteaUser.fromJson(Map<String, dynamic> json) =>
_$GiteaUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaOrg { class GiteaOrg {
GiteaOrg();
factory GiteaOrg.fromJson(Map<String, dynamic> json) =>
_$GiteaOrgFromJson(json);
int? id; int? id;
String? username; String? username;
String? fullName; String? fullName;
@ -23,13 +26,13 @@ class GiteaOrg {
String? description; String? description;
String? website; String? website;
String? location; String? location;
GiteaOrg();
factory GiteaOrg.fromJson(Map<String, dynamic> json) =>
_$GiteaOrgFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaRepository { class GiteaRepository {
GiteaRepository();
factory GiteaRepository.fromJson(Map<String, dynamic> json) =>
_$GiteaRepositoryFromJson(json);
int? id; int? id;
GiteaUser? owner; GiteaUser? owner;
String? name; String? name;
@ -41,34 +44,33 @@ class GiteaRepository {
int? size; int? size;
int? openIssuesCount; int? openIssuesCount;
int? openPrCounter; int? openPrCounter;
GiteaRepository();
factory GiteaRepository.fromJson(Map<String, dynamic> json) =>
_$GiteaRepositoryFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaTree { class GiteaTree {
GiteaTree({required this.type, required this.name});
factory GiteaTree.fromJson(Map<String, dynamic> json) =>
_$GiteaTreeFromJson(json);
String type; String type;
String name; String name;
String? path; String? path;
int? size; int? size;
String? downloadUrl; String? downloadUrl;
GiteaTree({required this.type, required this.name});
factory GiteaTree.fromJson(Map<String, dynamic> json) =>
_$GiteaTreeFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaBlob extends GiteaTree { class GiteaBlob extends GiteaTree {
String? content; GiteaBlob({required super.type, required super.name});
GiteaBlob({required String type, required String name})
: super(name: name, type: type);
factory GiteaBlob.fromJson(Map<String, dynamic> json) => factory GiteaBlob.fromJson(Map<String, dynamic> json) =>
_$GiteaBlobFromJson(json); _$GiteaBlobFromJson(json);
String? content;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommit { class GiteaCommit {
GiteaCommit();
factory GiteaCommit.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitFromJson(json);
int? number; int? number;
GiteaUser? author; GiteaUser? author;
String? title; String? title;
@ -76,33 +78,33 @@ class GiteaCommit {
GiteaCommitDetail? commit; GiteaCommitDetail? commit;
String? sha; String? sha;
String? htmlUrl; String? htmlUrl;
GiteaCommit();
factory GiteaCommit.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitDetail { class GiteaCommitDetail {
String? message;
GiteaCommitAuthor? author;
GiteaCommitAuthor? committer;
GiteaCommitDetail(); GiteaCommitDetail();
factory GiteaCommitDetail.fromJson(Map<String, dynamic> json) => factory GiteaCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitDetailFromJson(json); _$GiteaCommitDetailFromJson(json);
String? message;
GiteaCommitAuthor? author;
GiteaCommitAuthor? committer;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaCommitAuthor { class GiteaCommitAuthor {
String? name;
String? email;
DateTime? date;
GiteaCommitAuthor(); GiteaCommitAuthor();
factory GiteaCommitAuthor.fromJson(Map<String, dynamic> json) => factory GiteaCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteaCommitAuthorFromJson(json); _$GiteaCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaIssue { class GiteaIssue {
GiteaIssue();
factory GiteaIssue.fromJson(Map<String, dynamic> json) =>
_$GiteaIssueFromJson(json);
String? title; String? title;
String? body; String? body;
int? number; int? number;
@ -112,31 +114,31 @@ class GiteaIssue {
String? state; String? state;
String? htmlUrl; String? htmlUrl;
List<GiteaLabel>? labels; List<GiteaLabel>? labels;
GiteaIssue();
factory GiteaIssue.fromJson(Map<String, dynamic> json) =>
_$GiteaIssueFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaLabel { class GiteaLabel {
String? color;
String? name;
GiteaLabel(); GiteaLabel();
factory GiteaLabel.fromJson(Map<String, dynamic> json) => factory GiteaLabel.fromJson(Map<String, dynamic> json) =>
_$GiteaLabelFromJson(json); _$GiteaLabelFromJson(json);
String? color;
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaHeatmapItem { class GiteaHeatmapItem {
int? timestamp;
int? contributions;
GiteaHeatmapItem(); GiteaHeatmapItem();
factory GiteaHeatmapItem.fromJson(Map<String, dynamic> json) => factory GiteaHeatmapItem.fromJson(Map<String, dynamic> json) =>
_$GiteaHeatmapItemFromJson(json); _$GiteaHeatmapItemFromJson(json);
int? timestamp;
int? contributions;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteaComment { class GiteaComment {
GiteaComment();
factory GiteaComment.fromJson(Map<String, dynamic> json) =>
_$GiteaCommentFromJson(json);
String? body; String? body;
DateTime? createdAt; DateTime? createdAt;
String? htmlUrl; String? htmlUrl;
@ -144,7 +146,4 @@ class GiteaComment {
DateTime? updatedAt; DateTime? updatedAt;
int? id; int? id;
GiteaUser? user; GiteaUser? user;
GiteaComment();
factory GiteaComment.fromJson(Map<String, dynamic> json) =>
_$GiteaCommentFromJson(json);
} }

View File

@ -6,16 +6,14 @@ part of 'gitea.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
GiteaUser _$GiteaUserFromJson(Map<String, dynamic> json) { GiteaUser _$GiteaUserFromJson(Map<String, dynamic> json) => GiteaUser()
return GiteaUser() ..id = json['id'] as int?
..id = json['id'] as int? ..login = json['login'] as String?
..login = json['login'] as String? ..fullName = json['full_name'] as String?
..fullName = json['full_name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..created = json['created'] == null
..created = json['created'] == null ? null
? null : DateTime.parse(json['created'] as String);
: DateTime.parse(json['created'] as String);
}
Map<String, dynamic> _$GiteaUserToJson(GiteaUser instance) => <String, dynamic>{ Map<String, dynamic> _$GiteaUserToJson(GiteaUser instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
@ -25,16 +23,14 @@ Map<String, dynamic> _$GiteaUserToJson(GiteaUser instance) => <String, dynamic>{
'created': instance.created?.toIso8601String(), 'created': instance.created?.toIso8601String(),
}; };
GiteaOrg _$GiteaOrgFromJson(Map<String, dynamic> json) { GiteaOrg _$GiteaOrgFromJson(Map<String, dynamic> json) => GiteaOrg()
return GiteaOrg() ..id = json['id'] as int?
..id = json['id'] as int? ..username = json['username'] as String?
..username = json['username'] as String? ..fullName = json['full_name'] as String?
..fullName = json['full_name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..description = json['description'] as String?
..description = json['description'] as String? ..website = json['website'] as String?
..website = json['website'] as String? ..location = json['location'] as String?;
..location = json['location'] as String?;
}
Map<String, dynamic> _$GiteaOrgToJson(GiteaOrg instance) => <String, dynamic>{ Map<String, dynamic> _$GiteaOrgToJson(GiteaOrg instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
@ -46,24 +42,23 @@ Map<String, dynamic> _$GiteaOrgToJson(GiteaOrg instance) => <String, dynamic>{
'location': instance.location, 'location': instance.location,
}; };
GiteaRepository _$GiteaRepositoryFromJson(Map<String, dynamic> json) { GiteaRepository _$GiteaRepositoryFromJson(Map<String, dynamic> json) =>
return GiteaRepository() GiteaRepository()
..id = json['id'] as int? ..id = json['id'] as int?
..owner = json['owner'] == null ..owner = json['owner'] == null
? null ? null
: GiteaUser.fromJson(json['owner'] as Map<String, dynamic>) : GiteaUser.fromJson(json['owner'] as Map<String, dynamic>)
..name = json['name'] as String? ..name = json['name'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..starsCount = json['stars_count'] as int? ..starsCount = json['stars_count'] as int?
..forksCount = json['forks_count'] as int? ..forksCount = json['forks_count'] as int?
..updatedAt = json['updated_at'] == null ..updatedAt = json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String) : DateTime.parse(json['updated_at'] as String)
..website = json['website'] as String? ..website = json['website'] as String?
..size = json['size'] as int? ..size = json['size'] as int?
..openIssuesCount = json['open_issues_count'] as int? ..openIssuesCount = json['open_issues_count'] as int?
..openPrCounter = json['open_pr_counter'] as int?; ..openPrCounter = json['open_pr_counter'] as int?;
}
Map<String, dynamic> _$GiteaRepositoryToJson(GiteaRepository instance) => Map<String, dynamic> _$GiteaRepositoryToJson(GiteaRepository instance) =>
<String, dynamic>{ <String, dynamic>{
@ -80,15 +75,13 @@ Map<String, dynamic> _$GiteaRepositoryToJson(GiteaRepository instance) =>
'open_pr_counter': instance.openPrCounter, 'open_pr_counter': instance.openPrCounter,
}; };
GiteaTree _$GiteaTreeFromJson(Map<String, dynamic> json) { GiteaTree _$GiteaTreeFromJson(Map<String, dynamic> json) => GiteaTree(
return GiteaTree( type: json['type'] as String,
type: json['type'] as String, name: json['name'] as String,
name: json['name'] as String, )
) ..path = json['path'] as String?
..path = json['path'] as String? ..size = json['size'] as int?
..size = json['size'] as int? ..downloadUrl = json['download_url'] as String?;
..downloadUrl = json['download_url'] as String?;
}
Map<String, dynamic> _$GiteaTreeToJson(GiteaTree instance) => <String, dynamic>{ Map<String, dynamic> _$GiteaTreeToJson(GiteaTree instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@ -98,16 +91,14 @@ Map<String, dynamic> _$GiteaTreeToJson(GiteaTree instance) => <String, dynamic>{
'download_url': instance.downloadUrl, 'download_url': instance.downloadUrl,
}; };
GiteaBlob _$GiteaBlobFromJson(Map<String, dynamic> json) { GiteaBlob _$GiteaBlobFromJson(Map<String, dynamic> json) => GiteaBlob(
return GiteaBlob( type: json['type'] as String,
type: json['type'] as String, name: json['name'] as String,
name: json['name'] as String, )
) ..path = json['path'] as String?
..path = json['path'] as String? ..size = json['size'] as int?
..size = json['size'] as int? ..downloadUrl = json['download_url'] as String?
..downloadUrl = json['download_url'] as String? ..content = json['content'] as String?;
..content = json['content'] as String?;
}
Map<String, dynamic> _$GiteaBlobToJson(GiteaBlob instance) => <String, dynamic>{ Map<String, dynamic> _$GiteaBlobToJson(GiteaBlob instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@ -118,20 +109,18 @@ Map<String, dynamic> _$GiteaBlobToJson(GiteaBlob instance) => <String, dynamic>{
'content': instance.content, 'content': instance.content,
}; };
GiteaCommit _$GiteaCommitFromJson(Map<String, dynamic> json) { GiteaCommit _$GiteaCommitFromJson(Map<String, dynamic> json) => GiteaCommit()
return GiteaCommit() ..number = json['number'] as int?
..number = json['number'] as int? ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GiteaUser.fromJson(json['author'] as Map<String, dynamic>)
: GiteaUser.fromJson(json['author'] as Map<String, dynamic>) ..title = json['title'] as String?
..title = json['title'] as String? ..body = json['body'] as String?
..body = json['body'] as String? ..commit = json['commit'] == null
..commit = json['commit'] == null ? null
? null : GiteaCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
: GiteaCommitDetail.fromJson(json['commit'] as Map<String, dynamic>) ..sha = json['sha'] as String?
..sha = json['sha'] as String? ..htmlUrl = json['html_url'] as String?;
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GiteaCommitToJson(GiteaCommit instance) => Map<String, dynamic> _$GiteaCommitToJson(GiteaCommit instance) =>
<String, dynamic>{ <String, dynamic>{
@ -144,16 +133,16 @@ Map<String, dynamic> _$GiteaCommitToJson(GiteaCommit instance) =>
'html_url': instance.htmlUrl, 'html_url': instance.htmlUrl,
}; };
GiteaCommitDetail _$GiteaCommitDetailFromJson(Map<String, dynamic> json) { GiteaCommitDetail _$GiteaCommitDetailFromJson(Map<String, dynamic> json) =>
return GiteaCommitDetail() GiteaCommitDetail()
..message = json['message'] as String? ..message = json['message'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: GiteaCommitAuthor.fromJson(json['author'] as Map<String, dynamic>) : GiteaCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
..committer = json['committer'] == null ..committer = json['committer'] == null
? null ? null
: GiteaCommitAuthor.fromJson(json['committer'] as Map<String, dynamic>); : GiteaCommitAuthor.fromJson(
} json['committer'] as Map<String, dynamic>);
Map<String, dynamic> _$GiteaCommitDetailToJson(GiteaCommitDetail instance) => Map<String, dynamic> _$GiteaCommitDetailToJson(GiteaCommitDetail instance) =>
<String, dynamic>{ <String, dynamic>{
@ -162,13 +151,12 @@ Map<String, dynamic> _$GiteaCommitDetailToJson(GiteaCommitDetail instance) =>
'committer': instance.committer, 'committer': instance.committer,
}; };
GiteaCommitAuthor _$GiteaCommitAuthorFromJson(Map<String, dynamic> json) { GiteaCommitAuthor _$GiteaCommitAuthorFromJson(Map<String, dynamic> json) =>
return GiteaCommitAuthor() GiteaCommitAuthor()
..name = json['name'] as String? ..name = json['name'] as String?
..email = json['email'] as String? ..email = json['email'] as String?
..date = ..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String); json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
Map<String, dynamic> _$GiteaCommitAuthorToJson(GiteaCommitAuthor instance) => Map<String, dynamic> _$GiteaCommitAuthorToJson(GiteaCommitAuthor instance) =>
<String, dynamic>{ <String, dynamic>{
@ -177,24 +165,22 @@ Map<String, dynamic> _$GiteaCommitAuthorToJson(GiteaCommitAuthor instance) =>
'date': instance.date?.toIso8601String(), 'date': instance.date?.toIso8601String(),
}; };
GiteaIssue _$GiteaIssueFromJson(Map<String, dynamic> json) { GiteaIssue _$GiteaIssueFromJson(Map<String, dynamic> json) => GiteaIssue()
return GiteaIssue() ..title = json['title'] as String?
..title = json['title'] as String? ..body = json['body'] as String?
..body = json['body'] as String? ..number = json['number'] as int?
..number = json['number'] as int? ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GiteaUser.fromJson(json['user'] as Map<String, dynamic>)
: GiteaUser.fromJson(json['user'] as Map<String, dynamic>) ..comments = json['comments'] as int?
..comments = json['comments'] as int? ..updatedAt = json['updated_at'] == null
..updatedAt = json['updated_at'] == null ? null
? null : DateTime.parse(json['updated_at'] as String)
: DateTime.parse(json['updated_at'] as String) ..state = json['state'] as String?
..state = json['state'] as String? ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..labels = (json['labels'] as List<dynamic>?)
..labels = (json['labels'] as List<dynamic>?) ?.map((e) => GiteaLabel.fromJson(e as Map<String, dynamic>))
?.map((e) => GiteaLabel.fromJson(e as Map<String, dynamic>)) .toList();
.toList();
}
Map<String, dynamic> _$GiteaIssueToJson(GiteaIssue instance) => Map<String, dynamic> _$GiteaIssueToJson(GiteaIssue instance) =>
<String, dynamic>{ <String, dynamic>{
@ -209,11 +195,9 @@ Map<String, dynamic> _$GiteaIssueToJson(GiteaIssue instance) =>
'labels': instance.labels, 'labels': instance.labels,
}; };
GiteaLabel _$GiteaLabelFromJson(Map<String, dynamic> json) { GiteaLabel _$GiteaLabelFromJson(Map<String, dynamic> json) => GiteaLabel()
return GiteaLabel() ..color = json['color'] as String?
..color = json['color'] as String? ..name = json['name'] as String?;
..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteaLabelToJson(GiteaLabel instance) => Map<String, dynamic> _$GiteaLabelToJson(GiteaLabel instance) =>
<String, dynamic>{ <String, dynamic>{
@ -221,11 +205,10 @@ Map<String, dynamic> _$GiteaLabelToJson(GiteaLabel instance) =>
'name': instance.name, 'name': instance.name,
}; };
GiteaHeatmapItem _$GiteaHeatmapItemFromJson(Map<String, dynamic> json) { GiteaHeatmapItem _$GiteaHeatmapItemFromJson(Map<String, dynamic> json) =>
return GiteaHeatmapItem() GiteaHeatmapItem()
..timestamp = json['timestamp'] as int? ..timestamp = json['timestamp'] as int?
..contributions = json['contributions'] as int?; ..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GiteaHeatmapItemToJson(GiteaHeatmapItem instance) => Map<String, dynamic> _$GiteaHeatmapItemToJson(GiteaHeatmapItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -233,22 +216,20 @@ Map<String, dynamic> _$GiteaHeatmapItemToJson(GiteaHeatmapItem instance) =>
'contributions': instance.contributions, 'contributions': instance.contributions,
}; };
GiteaComment _$GiteaCommentFromJson(Map<String, dynamic> json) { GiteaComment _$GiteaCommentFromJson(Map<String, dynamic> json) => GiteaComment()
return GiteaComment() ..body = json['body'] as String?
..body = json['body'] as String? ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String)
: DateTime.parse(json['created_at'] as String) ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..originalAuthor = json['original_author'] as String?
..originalAuthor = json['original_author'] as String? ..updatedAt = json['updated_at'] == null
..updatedAt = json['updated_at'] == null ? null
? null : DateTime.parse(json['updated_at'] as String)
: DateTime.parse(json['updated_at'] as String) ..id = json['id'] as int?
..id = json['id'] as int? ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GiteaUser.fromJson(json['user'] as Map<String, dynamic>);
: GiteaUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GiteaCommentToJson(GiteaComment instance) => Map<String, dynamic> _$GiteaCommentToJson(GiteaComment instance) =>
<String, dynamic>{ <String, dynamic>{

View File

@ -4,6 +4,9 @@ part 'gitee.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeUser { class GiteeUser {
GiteeUser();
factory GiteeUser.fromJson(Map<String, dynamic> json) =>
_$GiteeUserFromJson(json);
String? login; String? login;
String? avatarUrl; String? avatarUrl;
String? name; String? name;
@ -16,24 +19,24 @@ class GiteeUser {
int? stared; int? stared;
int? watched; int? watched;
DateTime? createdAt; DateTime? createdAt;
GiteeUser();
factory GiteeUser.fromJson(Map<String, dynamic> json) =>
_$GiteeUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeListUser { class GiteeListUser {
GiteeListUser();
factory GiteeListUser.fromJson(Map<String, dynamic> json) =>
_$GiteeListUserFromJson(json);
String? login; String? login;
String? avatarUrl; String? avatarUrl;
String? name; String? name;
String? htmlUrl; String? htmlUrl;
GiteeListUser();
factory GiteeListUser.fromJson(Map<String, dynamic> json) =>
_$GiteeListUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepo { class GiteeRepo {
GiteeRepo();
factory GiteeRepo.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoFromJson(json);
GiteeRepoNamespace? namespace; GiteeRepoNamespace? namespace;
GiteeRepoOwner? owner; GiteeRepoOwner? owner;
String? path; String? path;
@ -51,90 +54,90 @@ class GiteeRepo {
int? openIssuesCount; int? openIssuesCount;
bool? pullRequestsEnabled; bool? pullRequestsEnabled;
String? defaultBranch; String? defaultBranch;
GiteeRepo();
factory GiteeRepo.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoOwner { class GiteeRepoOwner {
String? login;
String? avatarUrl;
GiteeRepoOwner(); GiteeRepoOwner();
factory GiteeRepoOwner.fromJson(Map<String, dynamic> json) => factory GiteeRepoOwner.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoOwnerFromJson(json); _$GiteeRepoOwnerFromJson(json);
String? login;
String? avatarUrl;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeRepoNamespace { class GiteeRepoNamespace {
String? path;
GiteeRepoNamespace(); GiteeRepoNamespace();
factory GiteeRepoNamespace.fromJson(Map<String, dynamic> json) => factory GiteeRepoNamespace.fromJson(Map<String, dynamic> json) =>
_$GiteeRepoNamespaceFromJson(json); _$GiteeRepoNamespaceFromJson(json);
String? path;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommit { class GiteeCommit {
GiteeCommit();
factory GiteeCommit.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFromJson(json);
GiteeUser? author; GiteeUser? author;
GiteeCommitDetail? commit; GiteeCommitDetail? commit;
String? sha; String? sha;
String? htmlUrl; String? htmlUrl;
List<GiteeCommitFile>? files; List<GiteeCommitFile>? files;
GiteeCommit();
factory GiteeCommit.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitDetail { class GiteeCommitDetail {
String? message;
GiteeCommitAuthor? author;
GiteeCommitAuthor? committer;
GiteeCommitDetail(); GiteeCommitDetail();
factory GiteeCommitDetail.fromJson(Map<String, dynamic> json) => factory GiteeCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitDetailFromJson(json); _$GiteeCommitDetailFromJson(json);
String? message;
GiteeCommitAuthor? author;
GiteeCommitAuthor? committer;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitAuthor { class GiteeCommitAuthor {
String? name;
String? email;
DateTime? date;
GiteeCommitAuthor(); GiteeCommitAuthor();
factory GiteeCommitAuthor.fromJson(Map<String, dynamic> json) => factory GiteeCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitAuthorFromJson(json); _$GiteeCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeTreeItem { class GiteeTreeItem {
GiteeTreeItem({required this.path, required this.type});
factory GiteeTreeItem.fromJson(Map<String, dynamic> json) =>
_$GiteeTreeItemFromJson(json);
String path; String path;
String type; String type;
String? sha; String? sha;
int? size; int? size;
GiteeTreeItem({required this.path, required this.type});
factory GiteeTreeItem.fromJson(Map<String, dynamic> json) =>
_$GiteeTreeItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBlob { class GiteeBlob {
String? content;
GiteeBlob(); GiteeBlob();
factory GiteeBlob.fromJson(Map<String, dynamic> json) => factory GiteeBlob.fromJson(Map<String, dynamic> json) =>
_$GiteeBlobFromJson(json); _$GiteeBlobFromJson(json);
String? content;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeLabel { class GiteeLabel {
String? color;
String? name;
GiteeLabel(); GiteeLabel();
factory GiteeLabel.fromJson(Map<String, dynamic> json) => factory GiteeLabel.fromJson(Map<String, dynamic> json) =>
_$GiteeLabelFromJson(json); _$GiteeLabelFromJson(json);
String? color;
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeIssue { class GiteeIssue {
GiteeIssue();
factory GiteeIssue.fromJson(Map<String, dynamic> json) =>
_$GiteeIssueFromJson(json);
int? comments; int? comments;
String? commentsUrl; String? commentsUrl;
String? createdAt; String? createdAt;
@ -149,13 +152,13 @@ class GiteeIssue {
String? number; String? number;
List<GiteeLabel>? labels; List<GiteeLabel>? labels;
int? id; int? id;
GiteeIssue();
factory GiteeIssue.fromJson(Map<String, dynamic> json) =>
_$GiteeIssueFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteePull { class GiteePull {
GiteePull();
factory GiteePull.fromJson(Map<String, dynamic> json) =>
_$GiteePullFromJson(json);
String? commentsUrl; String? commentsUrl;
String? createdAt; String? createdAt;
String? htmlUrl; String? htmlUrl;
@ -168,34 +171,34 @@ class GiteePull {
List<GiteeLabel>? labels; List<GiteeLabel>? labels;
int? number; int? number;
int? id; int? id;
GiteePull();
factory GiteePull.fromJson(Map<String, dynamic> json) =>
_$GiteePullFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeComment { class GiteeComment {
GiteeComment();
factory GiteeComment.fromJson(Map<String, dynamic> json) =>
_$GiteeCommentFromJson(json);
int? id; int? id;
String? body; String? body;
String? createdAt; String? createdAt;
GiteeRepoOwner? user; GiteeRepoOwner? user;
GiteeComment();
factory GiteeComment.fromJson(Map<String, dynamic> json) =>
_$GiteeCommentFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteePatch { class GiteePatch {
String? diff;
GiteePatch(); GiteePatch();
factory GiteePatch.fromJson(Map<String, dynamic> json) => factory GiteePatch.fromJson(Map<String, dynamic> json) =>
_$GiteePatchFromJson(json); _$GiteePatchFromJson(json);
String? diff;
} }
// Two different classes because of variable type mismatch // Two different classes because of variable type mismatch
// for additions, deletions, patch // for additions, deletions, patch
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteePullFile { class GiteePullFile {
GiteePullFile();
factory GiteePullFile.fromJson(Map<String, dynamic> json) =>
_$GiteePullFileFromJson(json);
String? additions; String? additions;
String? deletions; String? deletions;
String? blobUrl; String? blobUrl;
@ -203,13 +206,13 @@ class GiteePullFile {
String? sha; String? sha;
String? status; String? status;
GiteePatch? patch; GiteePatch? patch;
GiteePullFile();
factory GiteePullFile.fromJson(Map<String, dynamic> json) =>
_$GiteePullFileFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeCommitFile { class GiteeCommitFile {
GiteeCommitFile();
factory GiteeCommitFile.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFileFromJson(json);
int? additions; int? additions;
int? deletions; int? deletions;
int? changes; int? changes;
@ -218,24 +221,21 @@ class GiteeCommitFile {
String? sha; String? sha;
String? status; String? status;
String? patch; String? patch;
GiteeCommitFile();
factory GiteeCommitFile.fromJson(Map<String, dynamic> json) =>
_$GiteeCommitFileFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeContributor { class GiteeContributor {
String? name;
int? contributions;
GiteeContributor(); GiteeContributor();
factory GiteeContributor.fromJson(Map<String, dynamic> json) => factory GiteeContributor.fromJson(Map<String, dynamic> json) =>
_$GiteeContributorFromJson(json); _$GiteeContributorFromJson(json);
String? name;
int? contributions;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GiteeBranch { class GiteeBranch {
String? name;
GiteeBranch(); GiteeBranch();
factory GiteeBranch.fromJson(Map<String, dynamic> json) => factory GiteeBranch.fromJson(Map<String, dynamic> json) =>
_$GiteeBranchFromJson(json); _$GiteeBranchFromJson(json);
String? name;
} }

View File

@ -6,23 +6,21 @@ part of 'gitee.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
GiteeUser _$GiteeUserFromJson(Map<String, dynamic> json) { GiteeUser _$GiteeUserFromJson(Map<String, dynamic> json) => GiteeUser()
return GiteeUser() ..login = json['login'] as String?
..login = json['login'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..name = json['name'] as String?
..name = json['name'] as String? ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..bio = json['bio'] as String?
..bio = json['bio'] as String? ..blog = json['blog'] as String?
..blog = json['blog'] as String? ..publicRepos = json['public_repos'] as int?
..publicRepos = json['public_repos'] as int? ..followers = json['followers'] as int?
..followers = json['followers'] as int? ..following = json['following'] as int?
..following = json['following'] as int? ..stared = json['stared'] as int?
..stared = json['stared'] as int? ..watched = json['watched'] as int?
..watched = json['watched'] as int? ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String);
: DateTime.parse(json['created_at'] as String);
}
Map<String, dynamic> _$GiteeUserToJson(GiteeUser instance) => <String, dynamic>{ Map<String, dynamic> _$GiteeUserToJson(GiteeUser instance) => <String, dynamic>{
'login': instance.login, 'login': instance.login,
@ -39,13 +37,12 @@ Map<String, dynamic> _$GiteeUserToJson(GiteeUser instance) => <String, dynamic>{
'created_at': instance.createdAt?.toIso8601String(), 'created_at': instance.createdAt?.toIso8601String(),
}; };
GiteeListUser _$GiteeListUserFromJson(Map<String, dynamic> json) { GiteeListUser _$GiteeListUserFromJson(Map<String, dynamic> json) =>
return GiteeListUser() GiteeListUser()
..login = json['login'] as String? ..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String? ..avatarUrl = json['avatar_url'] as String?
..name = json['name'] as String? ..name = json['name'] as String?
..htmlUrl = json['html_url'] as String?; ..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GiteeListUserToJson(GiteeListUser instance) => Map<String, dynamic> _$GiteeListUserToJson(GiteeListUser instance) =>
<String, dynamic>{ <String, dynamic>{
@ -55,32 +52,30 @@ Map<String, dynamic> _$GiteeListUserToJson(GiteeListUser instance) =>
'html_url': instance.htmlUrl, 'html_url': instance.htmlUrl,
}; };
GiteeRepo _$GiteeRepoFromJson(Map<String, dynamic> json) { GiteeRepo _$GiteeRepoFromJson(Map<String, dynamic> json) => GiteeRepo()
return GiteeRepo() ..namespace = json['namespace'] == null
..namespace = json['namespace'] == null ? null
? null : GiteeRepoNamespace.fromJson(json['namespace'] as Map<String, dynamic>)
: GiteeRepoNamespace.fromJson(json['namespace'] as Map<String, dynamic>) ..owner = json['owner'] == null
..owner = json['owner'] == null ? null
? null : GiteeRepoOwner.fromJson(json['owner'] as Map<String, dynamic>)
: GiteeRepoOwner.fromJson(json['owner'] as Map<String, dynamic>) ..path = json['path'] as String?
..path = json['path'] as String? ..description = json['description'] as String?
..description = json['description'] as String? ..private = json['private'] as bool?
..private = json['private'] as bool? ..public = json['public'] as bool?
..public = json['public'] as bool? ..internal = json['internal'] as bool?
..internal = json['internal'] as bool? ..fork = json['fork'] as bool?
..fork = json['fork'] as bool? ..forksCount = json['forks_count'] as int?
..forksCount = json['forks_count'] as int? ..stargazersCount = json['stargazers_count'] as int?
..stargazersCount = json['stargazers_count'] as int? ..watchersCount = json['watchers_count'] as int?
..watchersCount = json['watchers_count'] as int? ..updatedAt = json['updated_at'] == null
..updatedAt = json['updated_at'] == null ? null
? null : DateTime.parse(json['updated_at'] as String)
: DateTime.parse(json['updated_at'] as String) ..license = json['license'] as String?
..license = json['license'] as String? ..homepage = json['homepage'] as String?
..homepage = json['homepage'] as String? ..openIssuesCount = json['open_issues_count'] as int?
..openIssuesCount = json['open_issues_count'] as int? ..pullRequestsEnabled = json['pull_requests_enabled'] as bool?
..pullRequestsEnabled = json['pull_requests_enabled'] as bool? ..defaultBranch = json['default_branch'] as String?;
..defaultBranch = json['default_branch'] as String?;
}
Map<String, dynamic> _$GiteeRepoToJson(GiteeRepo instance) => <String, dynamic>{ Map<String, dynamic> _$GiteeRepoToJson(GiteeRepo instance) => <String, dynamic>{
'namespace': instance.namespace, 'namespace': instance.namespace,
@ -102,11 +97,10 @@ Map<String, dynamic> _$GiteeRepoToJson(GiteeRepo instance) => <String, dynamic>{
'default_branch': instance.defaultBranch, 'default_branch': instance.defaultBranch,
}; };
GiteeRepoOwner _$GiteeRepoOwnerFromJson(Map<String, dynamic> json) { GiteeRepoOwner _$GiteeRepoOwnerFromJson(Map<String, dynamic> json) =>
return GiteeRepoOwner() GiteeRepoOwner()
..login = json['login'] as String? ..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?; ..avatarUrl = json['avatar_url'] as String?;
}
Map<String, dynamic> _$GiteeRepoOwnerToJson(GiteeRepoOwner instance) => Map<String, dynamic> _$GiteeRepoOwnerToJson(GiteeRepoOwner instance) =>
<String, dynamic>{ <String, dynamic>{
@ -114,29 +108,26 @@ Map<String, dynamic> _$GiteeRepoOwnerToJson(GiteeRepoOwner instance) =>
'avatar_url': instance.avatarUrl, 'avatar_url': instance.avatarUrl,
}; };
GiteeRepoNamespace _$GiteeRepoNamespaceFromJson(Map<String, dynamic> json) { GiteeRepoNamespace _$GiteeRepoNamespaceFromJson(Map<String, dynamic> json) =>
return GiteeRepoNamespace()..path = json['path'] as String?; GiteeRepoNamespace()..path = json['path'] as String?;
}
Map<String, dynamic> _$GiteeRepoNamespaceToJson(GiteeRepoNamespace instance) => Map<String, dynamic> _$GiteeRepoNamespaceToJson(GiteeRepoNamespace instance) =>
<String, dynamic>{ <String, dynamic>{
'path': instance.path, 'path': instance.path,
}; };
GiteeCommit _$GiteeCommitFromJson(Map<String, dynamic> json) { GiteeCommit _$GiteeCommitFromJson(Map<String, dynamic> json) => GiteeCommit()
return GiteeCommit() ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GiteeUser.fromJson(json['author'] as Map<String, dynamic>)
: GiteeUser.fromJson(json['author'] as Map<String, dynamic>) ..commit = json['commit'] == null
..commit = json['commit'] == null ? null
? null : GiteeCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
: GiteeCommitDetail.fromJson(json['commit'] as Map<String, dynamic>) ..sha = json['sha'] as String?
..sha = json['sha'] as String? ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..files = (json['files'] as List<dynamic>?)
..files = (json['files'] as List<dynamic>?) ?.map((e) => GiteeCommitFile.fromJson(e as Map<String, dynamic>))
?.map((e) => GiteeCommitFile.fromJson(e as Map<String, dynamic>)) .toList();
.toList();
}
Map<String, dynamic> _$GiteeCommitToJson(GiteeCommit instance) => Map<String, dynamic> _$GiteeCommitToJson(GiteeCommit instance) =>
<String, dynamic>{ <String, dynamic>{
@ -147,16 +138,16 @@ Map<String, dynamic> _$GiteeCommitToJson(GiteeCommit instance) =>
'files': instance.files, 'files': instance.files,
}; };
GiteeCommitDetail _$GiteeCommitDetailFromJson(Map<String, dynamic> json) { GiteeCommitDetail _$GiteeCommitDetailFromJson(Map<String, dynamic> json) =>
return GiteeCommitDetail() GiteeCommitDetail()
..message = json['message'] as String? ..message = json['message'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: GiteeCommitAuthor.fromJson(json['author'] as Map<String, dynamic>) : GiteeCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
..committer = json['committer'] == null ..committer = json['committer'] == null
? null ? null
: GiteeCommitAuthor.fromJson(json['committer'] as Map<String, dynamic>); : GiteeCommitAuthor.fromJson(
} json['committer'] as Map<String, dynamic>);
Map<String, dynamic> _$GiteeCommitDetailToJson(GiteeCommitDetail instance) => Map<String, dynamic> _$GiteeCommitDetailToJson(GiteeCommitDetail instance) =>
<String, dynamic>{ <String, dynamic>{
@ -165,13 +156,12 @@ Map<String, dynamic> _$GiteeCommitDetailToJson(GiteeCommitDetail instance) =>
'committer': instance.committer, 'committer': instance.committer,
}; };
GiteeCommitAuthor _$GiteeCommitAuthorFromJson(Map<String, dynamic> json) { GiteeCommitAuthor _$GiteeCommitAuthorFromJson(Map<String, dynamic> json) =>
return GiteeCommitAuthor() GiteeCommitAuthor()
..name = json['name'] as String? ..name = json['name'] as String?
..email = json['email'] as String? ..email = json['email'] as String?
..date = ..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String); json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
Map<String, dynamic> _$GiteeCommitAuthorToJson(GiteeCommitAuthor instance) => Map<String, dynamic> _$GiteeCommitAuthorToJson(GiteeCommitAuthor instance) =>
<String, dynamic>{ <String, dynamic>{
@ -180,14 +170,13 @@ Map<String, dynamic> _$GiteeCommitAuthorToJson(GiteeCommitAuthor instance) =>
'date': instance.date?.toIso8601String(), 'date': instance.date?.toIso8601String(),
}; };
GiteeTreeItem _$GiteeTreeItemFromJson(Map<String, dynamic> json) { GiteeTreeItem _$GiteeTreeItemFromJson(Map<String, dynamic> json) =>
return GiteeTreeItem( GiteeTreeItem(
path: json['path'] as String, path: json['path'] as String,
type: json['type'] as String, type: json['type'] as String,
) )
..sha = json['sha'] as String? ..sha = json['sha'] as String?
..size = json['size'] as int?; ..size = json['size'] as int?;
}
Map<String, dynamic> _$GiteeTreeItemToJson(GiteeTreeItem instance) => Map<String, dynamic> _$GiteeTreeItemToJson(GiteeTreeItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -197,19 +186,16 @@ Map<String, dynamic> _$GiteeTreeItemToJson(GiteeTreeItem instance) =>
'size': instance.size, 'size': instance.size,
}; };
GiteeBlob _$GiteeBlobFromJson(Map<String, dynamic> json) { GiteeBlob _$GiteeBlobFromJson(Map<String, dynamic> json) =>
return GiteeBlob()..content = json['content'] as String?; GiteeBlob()..content = json['content'] as String?;
}
Map<String, dynamic> _$GiteeBlobToJson(GiteeBlob instance) => <String, dynamic>{ Map<String, dynamic> _$GiteeBlobToJson(GiteeBlob instance) => <String, dynamic>{
'content': instance.content, 'content': instance.content,
}; };
GiteeLabel _$GiteeLabelFromJson(Map<String, dynamic> json) { GiteeLabel _$GiteeLabelFromJson(Map<String, dynamic> json) => GiteeLabel()
return GiteeLabel() ..color = json['color'] as String?
..color = json['color'] as String? ..name = json['name'] as String?;
..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteeLabelToJson(GiteeLabel instance) => Map<String, dynamic> _$GiteeLabelToJson(GiteeLabel instance) =>
<String, dynamic>{ <String, dynamic>{
@ -217,29 +203,27 @@ Map<String, dynamic> _$GiteeLabelToJson(GiteeLabel instance) =>
'name': instance.name, 'name': instance.name,
}; };
GiteeIssue _$GiteeIssueFromJson(Map<String, dynamic> json) { GiteeIssue _$GiteeIssueFromJson(Map<String, dynamic> json) => GiteeIssue()
return GiteeIssue() ..comments = json['comments'] as int?
..comments = json['comments'] as int? ..commentsUrl = json['comments_url'] as String?
..commentsUrl = json['comments_url'] as String? ..createdAt = json['created_at'] as String?
..createdAt = json['created_at'] as String? ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..updatedAt = json['updated_at'] as String?
..updatedAt = json['updated_at'] as String? ..body = json['body'] as String?
..body = json['body'] as String? ..bodyHtml = json['body_html'] as String?
..bodyHtml = json['body_html'] as String? ..title = json['title'] as String?
..title = json['title'] as String? ..state = json['state'] as String?
..state = json['state'] as String? ..repository = json['repository'] == null
..repository = json['repository'] == null ? null
? null : GiteeRepo.fromJson(json['repository'] as Map<String, dynamic>)
: GiteeRepo.fromJson(json['repository'] as Map<String, dynamic>) ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>)
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>) ..number = json['number'] as String?
..number = json['number'] as String? ..labels = (json['labels'] as List<dynamic>?)
..labels = (json['labels'] as List<dynamic>?) ?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>))
?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>)) .toList()
.toList() ..id = json['id'] as int?;
..id = json['id'] as int?;
}
Map<String, dynamic> _$GiteeIssueToJson(GiteeIssue instance) => Map<String, dynamic> _$GiteeIssueToJson(GiteeIssue instance) =>
<String, dynamic>{ <String, dynamic>{
@ -259,25 +243,23 @@ Map<String, dynamic> _$GiteeIssueToJson(GiteeIssue instance) =>
'id': instance.id, 'id': instance.id,
}; };
GiteePull _$GiteePullFromJson(Map<String, dynamic> json) { GiteePull _$GiteePullFromJson(Map<String, dynamic> json) => GiteePull()
return GiteePull() ..commentsUrl = json['comments_url'] as String?
..commentsUrl = json['comments_url'] as String? ..createdAt = json['created_at'] as String?
..createdAt = json['created_at'] as String? ..htmlUrl = json['html_url'] as String?
..htmlUrl = json['html_url'] as String? ..updatedAt = json['updated_at'] as String?
..updatedAt = json['updated_at'] as String? ..body = json['body'] as String?
..body = json['body'] as String? ..bodyHtml = json['body_html'] as String?
..bodyHtml = json['body_html'] as String? ..title = json['title'] as String?
..title = json['title'] as String? ..state = json['state'] as String?
..state = json['state'] as String? ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>)
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>) ..labels = (json['labels'] as List<dynamic>?)
..labels = (json['labels'] as List<dynamic>?) ?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>))
?.map((e) => GiteeLabel.fromJson(e as Map<String, dynamic>)) .toList()
.toList() ..number = json['number'] as int?
..number = json['number'] as int? ..id = json['id'] as int?;
..id = json['id'] as int?;
}
Map<String, dynamic> _$GiteePullToJson(GiteePull instance) => <String, dynamic>{ Map<String, dynamic> _$GiteePullToJson(GiteePull instance) => <String, dynamic>{
'comments_url': instance.commentsUrl, 'comments_url': instance.commentsUrl,
@ -294,15 +276,13 @@ Map<String, dynamic> _$GiteePullToJson(GiteePull instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
}; };
GiteeComment _$GiteeCommentFromJson(Map<String, dynamic> json) { GiteeComment _$GiteeCommentFromJson(Map<String, dynamic> json) => GiteeComment()
return GiteeComment() ..id = json['id'] as int?
..id = json['id'] as int? ..body = json['body'] as String?
..body = json['body'] as String? ..createdAt = json['created_at'] as String?
..createdAt = json['created_at'] as String? ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
: GiteeRepoOwner.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GiteeCommentToJson(GiteeComment instance) => Map<String, dynamic> _$GiteeCommentToJson(GiteeComment instance) =>
<String, dynamic>{ <String, dynamic>{
@ -312,27 +292,25 @@ Map<String, dynamic> _$GiteeCommentToJson(GiteeComment instance) =>
'user': instance.user, 'user': instance.user,
}; };
GiteePatch _$GiteePatchFromJson(Map<String, dynamic> json) { GiteePatch _$GiteePatchFromJson(Map<String, dynamic> json) =>
return GiteePatch()..diff = json['diff'] as String?; GiteePatch()..diff = json['diff'] as String?;
}
Map<String, dynamic> _$GiteePatchToJson(GiteePatch instance) => Map<String, dynamic> _$GiteePatchToJson(GiteePatch instance) =>
<String, dynamic>{ <String, dynamic>{
'diff': instance.diff, 'diff': instance.diff,
}; };
GiteePullFile _$GiteePullFileFromJson(Map<String, dynamic> json) { GiteePullFile _$GiteePullFileFromJson(Map<String, dynamic> json) =>
return GiteePullFile() GiteePullFile()
..additions = json['additions'] as String? ..additions = json['additions'] as String?
..deletions = json['deletions'] as String? ..deletions = json['deletions'] as String?
..blobUrl = json['blob_url'] as String? ..blobUrl = json['blob_url'] as String?
..filename = json['filename'] as String? ..filename = json['filename'] as String?
..sha = json['sha'] as String? ..sha = json['sha'] as String?
..status = json['status'] as String? ..status = json['status'] as String?
..patch = json['patch'] == null ..patch = json['patch'] == null
? null ? null
: GiteePatch.fromJson(json['patch'] as Map<String, dynamic>); : GiteePatch.fromJson(json['patch'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GiteePullFileToJson(GiteePullFile instance) => Map<String, dynamic> _$GiteePullFileToJson(GiteePullFile instance) =>
<String, dynamic>{ <String, dynamic>{
@ -345,17 +323,16 @@ Map<String, dynamic> _$GiteePullFileToJson(GiteePullFile instance) =>
'patch': instance.patch, 'patch': instance.patch,
}; };
GiteeCommitFile _$GiteeCommitFileFromJson(Map<String, dynamic> json) { GiteeCommitFile _$GiteeCommitFileFromJson(Map<String, dynamic> json) =>
return GiteeCommitFile() GiteeCommitFile()
..additions = json['additions'] as int? ..additions = json['additions'] as int?
..deletions = json['deletions'] as int? ..deletions = json['deletions'] as int?
..changes = json['changes'] as int? ..changes = json['changes'] as int?
..blobUrl = json['blob_url'] as String? ..blobUrl = json['blob_url'] as String?
..filename = json['filename'] as String? ..filename = json['filename'] as String?
..sha = json['sha'] as String? ..sha = json['sha'] as String?
..status = json['status'] as String? ..status = json['status'] as String?
..patch = json['patch'] as String?; ..patch = json['patch'] as String?;
}
Map<String, dynamic> _$GiteeCommitFileToJson(GiteeCommitFile instance) => Map<String, dynamic> _$GiteeCommitFileToJson(GiteeCommitFile instance) =>
<String, dynamic>{ <String, dynamic>{
@ -369,11 +346,10 @@ Map<String, dynamic> _$GiteeCommitFileToJson(GiteeCommitFile instance) =>
'patch': instance.patch, 'patch': instance.patch,
}; };
GiteeContributor _$GiteeContributorFromJson(Map<String, dynamic> json) { GiteeContributor _$GiteeContributorFromJson(Map<String, dynamic> json) =>
return GiteeContributor() GiteeContributor()
..name = json['name'] as String? ..name = json['name'] as String?
..contributions = json['contributions'] as int?; ..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GiteeContributorToJson(GiteeContributor instance) => Map<String, dynamic> _$GiteeContributorToJson(GiteeContributor instance) =>
<String, dynamic>{ <String, dynamic>{
@ -381,9 +357,8 @@ Map<String, dynamic> _$GiteeContributorToJson(GiteeContributor instance) =>
'contributions': instance.contributions, 'contributions': instance.contributions,
}; };
GiteeBranch _$GiteeBranchFromJson(Map<String, dynamic> json) { GiteeBranch _$GiteeBranchFromJson(Map<String, dynamic> json) =>
return GiteeBranch()..name = json['name'] as String?; GiteeBranch()..name = json['name'] as String?;
}
Map<String, dynamic> _$GiteeBranchToJson(GiteeBranch instance) => Map<String, dynamic> _$GiteeBranchToJson(GiteeBranch instance) =>
<String, dynamic>{ <String, dynamic>{

View File

@ -6,6 +6,10 @@ part 'github.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEvent { class GithubEvent {
GithubEvent();
factory GithubEvent.fromJson(Map<String, dynamic> json) =>
_$GithubEventFromJson(json);
GithubEventUser? actor; GithubEventUser? actor;
String? type; String? type;
GithubEventRepo? repo; GithubEventRepo? repo;
@ -14,48 +18,41 @@ class GithubEvent {
Tuple2<String, String>? _repo; Tuple2<String, String>? _repo;
String get repoOwner { String get repoOwner {
if (_repo == null) { _repo ??= parseRepositoryFullName(repo!.name!);
_repo = parseRepositoryFullName(repo!.name!);
}
return _repo!.item1; return _repo!.item1;
} }
String get repoName { String get repoName {
if (_repo == null) { _repo ??= parseRepositoryFullName(repo!.name!);
_repo = parseRepositoryFullName(repo!.name!);
}
return _repo!.item2; return _repo!.item2;
} }
GithubEvent();
factory GithubEvent.fromJson(Map<String, dynamic> json) =>
_$GithubEventFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventUser { class GithubEventUser {
String? login;
String? avatarUrl;
GithubEventUser(); GithubEventUser();
factory GithubEventUser.fromJson(Map<String, dynamic> json) => factory GithubEventUser.fromJson(Map<String, dynamic> json) =>
_$GithubEventUserFromJson(json); _$GithubEventUserFromJson(json);
String? login;
String? avatarUrl;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRepo { class GithubEventRepo {
String? name;
GithubEventRepo(); GithubEventRepo();
factory GithubEventRepo.fromJson(Map<String, dynamic> json) => factory GithubEventRepo.fromJson(Map<String, dynamic> json) =>
_$GithubEventRepoFromJson(json); _$GithubEventRepoFromJson(json);
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventPayload { class GithubEventPayload {
GithubEventPayload();
factory GithubEventPayload.fromJson(Map<String, dynamic> json) =>
_$GithubEventPayloadFromJson(json);
GithubEventIssue? issue; GithubEventIssue? issue;
GithubEventIssue? pullRequest; GithubEventIssue? pullRequest;
GithubEventComment? comment; GithubEventComment? comment;
@ -76,14 +73,14 @@ class GithubEventPayload {
GithubCheckrunItem? checkRun; GithubCheckrunItem? checkRun;
GithubCheckSuiteItem? checkSuite; GithubCheckSuiteItem? checkSuite;
GithubContentReferenceItem? contentReference; GithubContentReferenceItem? contentReference;
GithubEventPayload();
factory GithubEventPayload.fromJson(Map<String, dynamic> json) =>
_$GithubEventPayloadFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventIssue { class GithubEventIssue {
GithubEventIssue();
factory GithubEventIssue.fromJson(Map<String, dynamic> json) =>
_$GithubEventIssueFromJson(json);
String? title; String? title;
GithubEventUser? user; GithubEventUser? user;
int? number; int? number;
@ -95,51 +92,47 @@ class GithubEventIssue {
DateTime? createdAt; DateTime? createdAt;
bool get isPullRequestComment => pullRequest != null; bool get isPullRequestComment => pullRequest != null;
GithubEventIssue();
factory GithubEventIssue.fromJson(Map<String, dynamic> json) =>
_$GithubEventIssueFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventComment { class GithubEventComment {
String? body;
GithubEventUser? user;
String? commitId;
String? htmlUrl;
GithubEventComment(); GithubEventComment();
factory GithubEventComment.fromJson(Map<String, dynamic> json) => factory GithubEventComment.fromJson(Map<String, dynamic> json) =>
_$GithubEventCommentFromJson(json); _$GithubEventCommentFromJson(json);
String? body;
GithubEventUser? user;
String? commitId;
String? htmlUrl;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventCommit { class GithubEventCommit {
String? sha;
String? message;
GithubEventCommit(); GithubEventCommit();
factory GithubEventCommit.fromJson(Map<String, dynamic> json) => factory GithubEventCommit.fromJson(Map<String, dynamic> json) =>
_$GithubEventCommitFromJson(json); _$GithubEventCommitFromJson(json);
String? sha;
String? message;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubEventRelease { class GithubEventRelease {
String? htmlUrl;
String? tagName;
GithubEventRelease(); GithubEventRelease();
factory GithubEventRelease.fromJson(Map<String, dynamic> json) => factory GithubEventRelease.fromJson(Map<String, dynamic> json) =>
_$GithubEventReleaseFromJson(json); _$GithubEventReleaseFromJson(json);
String? htmlUrl;
String? tagName;
} }
// Notification // Notification
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItem { class GithubNotificationItem {
GithubNotificationItem();
factory GithubNotificationItem.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemFromJson(json);
String? id; String? id;
GithubNotificationItemSubject? subject; GithubNotificationItemSubject? subject;
DateTime? updatedAt; DateTime? updatedAt;
@ -150,182 +143,169 @@ class GithubNotificationItem {
String? state; String? state;
String get key => '_$hashCode'; String get key => '_$hashCode';
GithubNotificationItem();
factory GithubNotificationItem.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemSubject { class GithubNotificationItemSubject {
GithubNotificationItemSubject();
factory GithubNotificationItemSubject.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemSubjectFromJson(json);
String? title; String? title;
String? type; String? type;
String? url; String? url;
int? _number; int? _number;
int? get number { int? get number {
if (_number == null) { _number ??= int.parse(url?.split('/').last ?? '0');
_number = int.parse(url?.split('/').last ?? '0');
}
return _number; return _number;
} }
GithubNotificationItemSubject();
factory GithubNotificationItemSubject.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemSubjectFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubNotificationItemRepo { class GithubNotificationItemRepo {
String? fullName;
Tuple2<String, String>? _repo;
String get owner {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName!);
}
return _repo!.item1;
}
String get name {
if (_repo == null) {
_repo = parseRepositoryFullName(fullName!);
}
return _repo!.item2;
}
GithubNotificationItemRepo(); GithubNotificationItemRepo();
factory GithubNotificationItemRepo.fromJson(Map<String, dynamic> json) => factory GithubNotificationItemRepo.fromJson(Map<String, dynamic> json) =>
_$GithubNotificationItemRepoFromJson(json); _$GithubNotificationItemRepoFromJson(json);
String? fullName;
Tuple2<String, String>? _repo;
String get owner {
_repo ??= parseRepositoryFullName(fullName!);
return _repo!.item1;
}
String get name {
_repo ??= parseRepositoryFullName(fullName!);
return _repo!.item2;
}
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubTreeItem { class GithubTreeItem {
GithubTreeItem();
factory GithubTreeItem.fromJson(Map<String, dynamic> json) =>
_$GithubTreeItemFromJson(json);
String? name; String? name;
String? path; String? path;
int? size; int? size;
String? type; String? type;
String? downloadUrl; String? downloadUrl;
String? content; String? content;
GithubTreeItem();
factory GithubTreeItem.fromJson(Map<String, dynamic> json) =>
_$GithubTreeItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubPagesItem { class GithubPagesItem {
String? pageName;
String? title;
String? action;
GithubPagesItem(); GithubPagesItem();
factory GithubPagesItem.fromJson(Map<String, dynamic> json) => factory GithubPagesItem.fromJson(Map<String, dynamic> json) =>
_$GithubPagesItemFromJson(json); _$GithubPagesItemFromJson(json);
String? pageName;
String? title;
String? action;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubSecurityItem { class GithubSecurityItem {
String? summary;
String? description;
String? severity;
GithubSecurityItem(); GithubSecurityItem();
factory GithubSecurityItem.fromJson(Map<String, dynamic> json) => factory GithubSecurityItem.fromJson(Map<String, dynamic> json) =>
_$GithubSecurityItemFromJson(json); _$GithubSecurityItemFromJson(json);
String? summary;
String? description;
String? severity;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubAlertItem { class GithubAlertItem {
String? affectedPackageName;
String? affectedRange;
GithubAlertItem(); GithubAlertItem();
factory GithubAlertItem.fromJson(Map<String, dynamic> json) => factory GithubAlertItem.fromJson(Map<String, dynamic> json) =>
_$GithubAlertItemFromJson(json); _$GithubAlertItemFromJson(json);
String? affectedPackageName;
String? affectedRange;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectItem { class GithubProjectItem {
GithubProjectItem();
factory GithubProjectItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectItemFromJson(json);
String? name; String? name;
String? state; String? state;
String? body; String? body;
String? htmlUrl; String? htmlUrl;
GithubProjectItem();
factory GithubProjectItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubProjectColumnItem { class GithubProjectColumnItem {
String? htmlUrl;
String? columnsUrl;
String? name;
GithubProjectColumnItem(); GithubProjectColumnItem();
factory GithubProjectColumnItem.fromJson(Map<String, dynamic> json) => factory GithubProjectColumnItem.fromJson(Map<String, dynamic> json) =>
_$GithubProjectColumnItemFromJson(json); _$GithubProjectColumnItemFromJson(json);
String? htmlUrl;
String? columnsUrl;
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubInstallationRepositoriesItem { class GithubInstallationRepositoriesItem {
List<GithubNotificationItemRepo>? repositoriesAdded, repositoriesRemoved;
String? repositoriesSelection;
int? id;
GithubInstallationRepositoriesItem(); GithubInstallationRepositoriesItem();
factory GithubInstallationRepositoriesItem.fromJson( factory GithubInstallationRepositoriesItem.fromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$GithubInstallationRepositoriesItemFromJson(json); _$GithubInstallationRepositoriesItemFromJson(json);
List<GithubNotificationItemRepo>? repositoriesAdded, repositoriesRemoved;
String? repositoriesSelection;
int? id;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckrunItem { class GithubCheckrunItem {
String? status;
String? name;
int? id;
GithubCheckrunItem(); GithubCheckrunItem();
factory GithubCheckrunItem.fromJson(Map<String, dynamic> json) => factory GithubCheckrunItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckrunItemFromJson(json); _$GithubCheckrunItemFromJson(json);
String? status;
String? name;
int? id;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubCheckSuiteItem { class GithubCheckSuiteItem {
String? status;
String? conclusion;
GithubCheckSuiteItem(); GithubCheckSuiteItem();
factory GithubCheckSuiteItem.fromJson(Map<String, dynamic> json) => factory GithubCheckSuiteItem.fromJson(Map<String, dynamic> json) =>
_$GithubCheckSuiteItemFromJson(json); _$GithubCheckSuiteItemFromJson(json);
String? status;
String? conclusion;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubContentReferenceItem { class GithubContentReferenceItem {
int? id;
String? reference;
GithubContentReferenceItem(); GithubContentReferenceItem();
factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) => factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) =>
_$GithubContentReferenceItemFromJson(json); _$GithubContentReferenceItemFromJson(json);
int? id;
String? reference;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubContributorItem { class GithubContributorItem {
GithubContributorItem();
factory GithubContributorItem.fromJson(Map<String, dynamic> json) =>
_$GithubContributorItemFromJson(json);
int? id; int? id;
String? login; String? login;
String? avatarUrl; String? avatarUrl;
String? htmlUrl; String? htmlUrl;
int? contributions; int? contributions;
GithubContributorItem();
factory GithubContributorItem.fromJson(Map<String, dynamic> json) =>
_$GithubContributorItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubUserOrganizationItem { class GithubUserOrganizationItem {
GithubUserOrganizationItem();
factory GithubUserOrganizationItem.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationItemFromJson(json);
int? id; int? id;
String? login; String? login;
String? avatarUrl; String? avatarUrl;
String? description; String? description;
String? url; String? url;
GithubUserOrganizationItem();
factory GithubUserOrganizationItem.fromJson(Map<String, dynamic> json) =>
_$GithubUserOrganizationItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
@ -339,6 +319,9 @@ class GistFiles {
this.truncated, this.truncated,
this.content, this.content,
}); });
factory GistFiles.fromJson(Map<String, dynamic> json) =>
_$GistFilesFromJson(json);
String? filename; String? filename;
int? size; int? size;
String? rawUrl; String? rawUrl;
@ -346,21 +329,21 @@ class GistFiles {
String? language; String? language;
bool? truncated; bool? truncated;
String? content; String? content;
factory GistFiles.fromJson(Map<String, dynamic> json) =>
_$GistFilesFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubGistsItem { class GithubGistsItem {
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
_$GithubGistsItemFromJson(json);
String? id; String? id;
String? description; String? description;
bool? public; bool? public;
Map<String, GistFiles>? files; Map<String, GistFiles>? files;
GithubEventUser? owner; GithubEventUser? owner;
List<GistFiles> get fileNames { List<GistFiles> get fileNames {
List<GistFiles> filenames = []; final filenames = <GistFiles>[];
files!.forEach((String key, GistFiles value) { files!.forEach((key, value) {
filenames.add(value); filenames.add(value);
}); });
return filenames; return filenames;
@ -368,32 +351,28 @@ class GithubGistsItem {
DateTime? createdAt; DateTime? createdAt;
DateTime? updatedAt; DateTime? updatedAt;
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
_$GithubGistsItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubFilesItem { class GithubFilesItem {
GithubFilesItem();
factory GithubFilesItem.fromJson(Map<String, dynamic> json) =>
_$GithubFilesItemFromJson(json);
String? filename; String? filename;
String? status; String? status;
int? additions; int? additions;
int? deletions; int? deletions;
int? changes; int? changes;
String? patch; String? patch;
GithubFilesItem();
factory GithubFilesItem.fromJson(Map<String, dynamic> json) =>
_$GithubFilesItemFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GithubComparisonItem { class GithubComparisonItem {
GithubComparisonItem();
factory GithubComparisonItem.fromJson(Map<String, dynamic> json) =>
_$GithubComparisonItemFromJson(json);
List<GithubFilesItem>? files; List<GithubFilesItem>? files;
String? status; String? status;
int? aheadBy; int? aheadBy;
int? behindBy; int? behindBy;
GithubComparisonItem();
factory GithubComparisonItem.fromJson(Map<String, dynamic> json) =>
_$GithubComparisonItemFromJson(json);
} }

View File

@ -6,22 +6,20 @@ part of 'github.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
GithubEvent _$GithubEventFromJson(Map<String, dynamic> json) { GithubEvent _$GithubEventFromJson(Map<String, dynamic> json) => GithubEvent()
return GithubEvent() ..actor = json['actor'] == null
..actor = json['actor'] == null ? null
? null : GithubEventUser.fromJson(json['actor'] as Map<String, dynamic>)
: GithubEventUser.fromJson(json['actor'] as Map<String, dynamic>) ..type = json['type'] as String?
..type = json['type'] as String? ..repo = json['repo'] == null
..repo = json['repo'] == null ? null
? null : GithubEventRepo.fromJson(json['repo'] as Map<String, dynamic>)
: GithubEventRepo.fromJson(json['repo'] as Map<String, dynamic>) ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String)
: DateTime.parse(json['created_at'] as String) ..payload = json['payload'] == null
..payload = json['payload'] == null ? null
? null : GithubEventPayload.fromJson(json['payload'] as Map<String, dynamic>);
: GithubEventPayload.fromJson(json['payload'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GithubEventToJson(GithubEvent instance) => Map<String, dynamic> _$GithubEventToJson(GithubEvent instance) =>
<String, dynamic>{ <String, dynamic>{
@ -32,11 +30,10 @@ Map<String, dynamic> _$GithubEventToJson(GithubEvent instance) =>
'payload': instance.payload, 'payload': instance.payload,
}; };
GithubEventUser _$GithubEventUserFromJson(Map<String, dynamic> json) { GithubEventUser _$GithubEventUserFromJson(Map<String, dynamic> json) =>
return GithubEventUser() GithubEventUser()
..login = json['login'] as String? ..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String?; ..avatarUrl = json['avatar_url'] as String?;
}
Map<String, dynamic> _$GithubEventUserToJson(GithubEventUser instance) => Map<String, dynamic> _$GithubEventUserToJson(GithubEventUser instance) =>
<String, dynamic>{ <String, dynamic>{
@ -44,72 +41,71 @@ Map<String, dynamic> _$GithubEventUserToJson(GithubEventUser instance) =>
'avatar_url': instance.avatarUrl, 'avatar_url': instance.avatarUrl,
}; };
GithubEventRepo _$GithubEventRepoFromJson(Map<String, dynamic> json) { GithubEventRepo _$GithubEventRepoFromJson(Map<String, dynamic> json) =>
return GithubEventRepo()..name = json['name'] as String?; GithubEventRepo()..name = json['name'] as String?;
}
Map<String, dynamic> _$GithubEventRepoToJson(GithubEventRepo instance) => Map<String, dynamic> _$GithubEventRepoToJson(GithubEventRepo instance) =>
<String, dynamic>{ <String, dynamic>{
'name': instance.name, 'name': instance.name,
}; };
GithubEventPayload _$GithubEventPayloadFromJson(Map<String, dynamic> json) { GithubEventPayload _$GithubEventPayloadFromJson(Map<String, dynamic> json) =>
return GithubEventPayload() GithubEventPayload()
..issue = json['issue'] == null ..issue = json['issue'] == null
? null ? null
: GithubEventIssue.fromJson(json['issue'] as Map<String, dynamic>) : GithubEventIssue.fromJson(json['issue'] as Map<String, dynamic>)
..pullRequest = json['pull_request'] == null ..pullRequest = json['pull_request'] == null
? null ? null
: GithubEventIssue.fromJson( : GithubEventIssue.fromJson(
json['pull_request'] as Map<String, dynamic>) json['pull_request'] as Map<String, dynamic>)
..comment = json['comment'] == null ..comment = json['comment'] == null
? null ? null
: GithubEventComment.fromJson(json['comment'] as Map<String, dynamic>) : GithubEventComment.fromJson(json['comment'] as Map<String, dynamic>)
..release = json['release'] == null ..release = json['release'] == null
? null ? null
: GithubEventRelease.fromJson(json['release'] as Map<String, dynamic>) : GithubEventRelease.fromJson(json['release'] as Map<String, dynamic>)
..action = json['action'] as String? ..action = json['action'] as String?
..ref = json['ref'] as String? ..ref = json['ref'] as String?
..refType = json['ref_type'] as String? ..refType = json['ref_type'] as String?
..before = json['before'] as String? ..before = json['before'] as String?
..head = json['head'] as String? ..head = json['head'] as String?
..commits = (json['commits'] as List<dynamic>?) ..commits = (json['commits'] as List<dynamic>?)
?.map((e) => GithubEventCommit.fromJson(e as Map<String, dynamic>)) ?.map((e) => GithubEventCommit.fromJson(e as Map<String, dynamic>))
.toList() .toList()
..forkee = json['forkee'] as Map<String, dynamic>? ..forkee = json['forkee'] as Map<String, dynamic>?
..pages = (json['pages'] as List<dynamic>?) ..pages = (json['pages'] as List<dynamic>?)
?.map((e) => GithubPagesItem.fromJson(e as Map<String, dynamic>)) ?.map((e) => GithubPagesItem.fromJson(e as Map<String, dynamic>))
.toList() .toList()
..securityAdvisory = json['security_advisory'] == null ..securityAdvisory = json['security_advisory'] == null
? null ? null
: GithubSecurityItem.fromJson( : GithubSecurityItem.fromJson(
json['security_advisory'] as Map<String, dynamic>) json['security_advisory'] as Map<String, dynamic>)
..alert = json['alert'] == null ..alert = json['alert'] == null
? null ? null
: GithubAlertItem.fromJson(json['alert'] as Map<String, dynamic>) : GithubAlertItem.fromJson(json['alert'] as Map<String, dynamic>)
..project = json['project'] == null ..project = json['project'] == null
? null ? null
: GithubProjectItem.fromJson(json['project'] as Map<String, dynamic>) : GithubProjectItem.fromJson(json['project'] as Map<String, dynamic>)
..projectColumn = json['project_column'] == null ..projectColumn = json['project_column'] == null
? null ? null
: GithubProjectColumnItem.fromJson( : GithubProjectColumnItem.fromJson(
json['project_column'] as Map<String, dynamic>) json['project_column'] as Map<String, dynamic>)
..installation = json['installation'] == null ..installation = json['installation'] == null
? null ? null
: GithubInstallationRepositoriesItem.fromJson( : GithubInstallationRepositoriesItem.fromJson(
json['installation'] as Map<String, dynamic>) json['installation'] as Map<String, dynamic>)
..checkRun = json['check_run'] == null ..checkRun = json['check_run'] == null
? null ? null
: GithubCheckrunItem.fromJson(json['check_run'] as Map<String, dynamic>) : GithubCheckrunItem.fromJson(
..checkSuite = json['check_suite'] == null json['check_run'] as Map<String, dynamic>)
? null ..checkSuite = json['check_suite'] == null
: GithubCheckSuiteItem.fromJson( ? null
json['check_suite'] as Map<String, dynamic>) : GithubCheckSuiteItem.fromJson(
..contentReference = json['content_reference'] == null json['check_suite'] as Map<String, dynamic>)
? null ..contentReference = json['content_reference'] == null
: GithubContentReferenceItem.fromJson( ? null
json['content_reference'] as Map<String, dynamic>); : GithubContentReferenceItem.fromJson(
} json['content_reference'] as Map<String, dynamic>);
Map<String, dynamic> _$GithubEventPayloadToJson(GithubEventPayload instance) => Map<String, dynamic> _$GithubEventPayloadToJson(GithubEventPayload instance) =>
<String, dynamic>{ <String, dynamic>{
@ -135,22 +131,21 @@ Map<String, dynamic> _$GithubEventPayloadToJson(GithubEventPayload instance) =>
'content_reference': instance.contentReference, 'content_reference': instance.contentReference,
}; };
GithubEventIssue _$GithubEventIssueFromJson(Map<String, dynamic> json) { GithubEventIssue _$GithubEventIssueFromJson(Map<String, dynamic> json) =>
return GithubEventIssue() GithubEventIssue()
..title = json['title'] as String? ..title = json['title'] as String?
..user = json['user'] == null ..user = json['user'] == null
? null ? null
: GithubEventUser.fromJson(json['user'] as Map<String, dynamic>) : GithubEventUser.fromJson(json['user'] as Map<String, dynamic>)
..number = json['number'] as int? ..number = json['number'] as int?
..body = json['body'] as String? ..body = json['body'] as String?
..pullRequest = json['pull_request'] ..pullRequest = json['pull_request']
..state = json['state'] as String? ..state = json['state'] as String?
..comments = json['comments'] as int? ..comments = json['comments'] as int?
..merged = json['merged'] as bool? ..merged = json['merged'] as bool?
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String); : DateTime.parse(json['created_at'] as String);
}
Map<String, dynamic> _$GithubEventIssueToJson(GithubEventIssue instance) => Map<String, dynamic> _$GithubEventIssueToJson(GithubEventIssue instance) =>
<String, dynamic>{ <String, dynamic>{
@ -165,15 +160,14 @@ Map<String, dynamic> _$GithubEventIssueToJson(GithubEventIssue instance) =>
'created_at': instance.createdAt?.toIso8601String(), 'created_at': instance.createdAt?.toIso8601String(),
}; };
GithubEventComment _$GithubEventCommentFromJson(Map<String, dynamic> json) { GithubEventComment _$GithubEventCommentFromJson(Map<String, dynamic> json) =>
return GithubEventComment() GithubEventComment()
..body = json['body'] as String? ..body = json['body'] as String?
..user = json['user'] == null ..user = json['user'] == null
? null ? null
: GithubEventUser.fromJson(json['user'] as Map<String, dynamic>) : GithubEventUser.fromJson(json['user'] as Map<String, dynamic>)
..commitId = json['commit_id'] as String? ..commitId = json['commit_id'] as String?
..htmlUrl = json['html_url'] as String?; ..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GithubEventCommentToJson(GithubEventComment instance) => Map<String, dynamic> _$GithubEventCommentToJson(GithubEventComment instance) =>
<String, dynamic>{ <String, dynamic>{
@ -183,11 +177,10 @@ Map<String, dynamic> _$GithubEventCommentToJson(GithubEventComment instance) =>
'html_url': instance.htmlUrl, 'html_url': instance.htmlUrl,
}; };
GithubEventCommit _$GithubEventCommitFromJson(Map<String, dynamic> json) { GithubEventCommit _$GithubEventCommitFromJson(Map<String, dynamic> json) =>
return GithubEventCommit() GithubEventCommit()
..sha = json['sha'] as String? ..sha = json['sha'] as String?
..message = json['message'] as String?; ..message = json['message'] as String?;
}
Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) => Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) =>
<String, dynamic>{ <String, dynamic>{
@ -195,11 +188,10 @@ Map<String, dynamic> _$GithubEventCommitToJson(GithubEventCommit instance) =>
'message': instance.message, 'message': instance.message,
}; };
GithubEventRelease _$GithubEventReleaseFromJson(Map<String, dynamic> json) { GithubEventRelease _$GithubEventReleaseFromJson(Map<String, dynamic> json) =>
return GithubEventRelease() GithubEventRelease()
..htmlUrl = json['html_url'] as String? ..htmlUrl = json['html_url'] as String?
..tagName = json['tag_name'] as String?; ..tagName = json['tag_name'] as String?;
}
Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) => Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) =>
<String, dynamic>{ <String, dynamic>{
@ -208,22 +200,21 @@ Map<String, dynamic> _$GithubEventReleaseToJson(GithubEventRelease instance) =>
}; };
GithubNotificationItem _$GithubNotificationItemFromJson( GithubNotificationItem _$GithubNotificationItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubNotificationItem() GithubNotificationItem()
..id = json['id'] as String? ..id = json['id'] as String?
..subject = json['subject'] == null ..subject = json['subject'] == null
? null ? null
: GithubNotificationItemSubject.fromJson( : GithubNotificationItemSubject.fromJson(
json['subject'] as Map<String, dynamic>) json['subject'] as Map<String, dynamic>)
..updatedAt = json['updated_at'] == null ..updatedAt = json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String) : DateTime.parse(json['updated_at'] as String)
..repository = json['repository'] == null ..repository = json['repository'] == null
? null ? null
: GithubNotificationItemRepo.fromJson( : GithubNotificationItemRepo.fromJson(
json['repository'] as Map<String, dynamic>) json['repository'] as Map<String, dynamic>)
..unread = json['unread'] as bool?; ..unread = json['unread'] as bool?;
}
Map<String, dynamic> _$GithubNotificationItemToJson( Map<String, dynamic> _$GithubNotificationItemToJson(
GithubNotificationItem instance) => GithubNotificationItem instance) =>
@ -236,12 +227,11 @@ Map<String, dynamic> _$GithubNotificationItemToJson(
}; };
GithubNotificationItemSubject _$GithubNotificationItemSubjectFromJson( GithubNotificationItemSubject _$GithubNotificationItemSubjectFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubNotificationItemSubject() GithubNotificationItemSubject()
..title = json['title'] as String? ..title = json['title'] as String?
..type = json['type'] as String? ..type = json['type'] as String?
..url = json['url'] as String?; ..url = json['url'] as String?;
}
Map<String, dynamic> _$GithubNotificationItemSubjectToJson( Map<String, dynamic> _$GithubNotificationItemSubjectToJson(
GithubNotificationItemSubject instance) => GithubNotificationItemSubject instance) =>
@ -252,9 +242,8 @@ Map<String, dynamic> _$GithubNotificationItemSubjectToJson(
}; };
GithubNotificationItemRepo _$GithubNotificationItemRepoFromJson( GithubNotificationItemRepo _$GithubNotificationItemRepoFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubNotificationItemRepo()..fullName = json['full_name'] as String?; GithubNotificationItemRepo()..fullName = json['full_name'] as String?;
}
Map<String, dynamic> _$GithubNotificationItemRepoToJson( Map<String, dynamic> _$GithubNotificationItemRepoToJson(
GithubNotificationItemRepo instance) => GithubNotificationItemRepo instance) =>
@ -262,15 +251,14 @@ Map<String, dynamic> _$GithubNotificationItemRepoToJson(
'full_name': instance.fullName, 'full_name': instance.fullName,
}; };
GithubTreeItem _$GithubTreeItemFromJson(Map<String, dynamic> json) { GithubTreeItem _$GithubTreeItemFromJson(Map<String, dynamic> json) =>
return GithubTreeItem() GithubTreeItem()
..name = json['name'] as String? ..name = json['name'] as String?
..path = json['path'] as String? ..path = json['path'] as String?
..size = json['size'] as int? ..size = json['size'] as int?
..type = json['type'] as String? ..type = json['type'] as String?
..downloadUrl = json['download_url'] as String? ..downloadUrl = json['download_url'] as String?
..content = json['content'] as String?; ..content = json['content'] as String?;
}
Map<String, dynamic> _$GithubTreeItemToJson(GithubTreeItem instance) => Map<String, dynamic> _$GithubTreeItemToJson(GithubTreeItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -282,12 +270,11 @@ Map<String, dynamic> _$GithubTreeItemToJson(GithubTreeItem instance) =>
'content': instance.content, 'content': instance.content,
}; };
GithubPagesItem _$GithubPagesItemFromJson(Map<String, dynamic> json) { GithubPagesItem _$GithubPagesItemFromJson(Map<String, dynamic> json) =>
return GithubPagesItem() GithubPagesItem()
..pageName = json['page_name'] as String? ..pageName = json['page_name'] as String?
..title = json['title'] as String? ..title = json['title'] as String?
..action = json['action'] as String?; ..action = json['action'] as String?;
}
Map<String, dynamic> _$GithubPagesItemToJson(GithubPagesItem instance) => Map<String, dynamic> _$GithubPagesItemToJson(GithubPagesItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -296,12 +283,11 @@ Map<String, dynamic> _$GithubPagesItemToJson(GithubPagesItem instance) =>
'action': instance.action, 'action': instance.action,
}; };
GithubSecurityItem _$GithubSecurityItemFromJson(Map<String, dynamic> json) { GithubSecurityItem _$GithubSecurityItemFromJson(Map<String, dynamic> json) =>
return GithubSecurityItem() GithubSecurityItem()
..summary = json['summary'] as String? ..summary = json['summary'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..severity = json['severity'] as String?; ..severity = json['severity'] as String?;
}
Map<String, dynamic> _$GithubSecurityItemToJson(GithubSecurityItem instance) => Map<String, dynamic> _$GithubSecurityItemToJson(GithubSecurityItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -310,11 +296,10 @@ Map<String, dynamic> _$GithubSecurityItemToJson(GithubSecurityItem instance) =>
'severity': instance.severity, 'severity': instance.severity,
}; };
GithubAlertItem _$GithubAlertItemFromJson(Map<String, dynamic> json) { GithubAlertItem _$GithubAlertItemFromJson(Map<String, dynamic> json) =>
return GithubAlertItem() GithubAlertItem()
..affectedPackageName = json['affected_package_name'] as String? ..affectedPackageName = json['affected_package_name'] as String?
..affectedRange = json['affected_range'] as String?; ..affectedRange = json['affected_range'] as String?;
}
Map<String, dynamic> _$GithubAlertItemToJson(GithubAlertItem instance) => Map<String, dynamic> _$GithubAlertItemToJson(GithubAlertItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -322,13 +307,12 @@ Map<String, dynamic> _$GithubAlertItemToJson(GithubAlertItem instance) =>
'affected_range': instance.affectedRange, 'affected_range': instance.affectedRange,
}; };
GithubProjectItem _$GithubProjectItemFromJson(Map<String, dynamic> json) { GithubProjectItem _$GithubProjectItemFromJson(Map<String, dynamic> json) =>
return GithubProjectItem() GithubProjectItem()
..name = json['name'] as String? ..name = json['name'] as String?
..state = json['state'] as String? ..state = json['state'] as String?
..body = json['body'] as String? ..body = json['body'] as String?
..htmlUrl = json['html_url'] as String?; ..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GithubProjectItemToJson(GithubProjectItem instance) => Map<String, dynamic> _$GithubProjectItemToJson(GithubProjectItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -339,12 +323,11 @@ Map<String, dynamic> _$GithubProjectItemToJson(GithubProjectItem instance) =>
}; };
GithubProjectColumnItem _$GithubProjectColumnItemFromJson( GithubProjectColumnItem _$GithubProjectColumnItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubProjectColumnItem() GithubProjectColumnItem()
..htmlUrl = json['html_url'] as String? ..htmlUrl = json['html_url'] as String?
..columnsUrl = json['columns_url'] as String? ..columnsUrl = json['columns_url'] as String?
..name = json['name'] as String?; ..name = json['name'] as String?;
}
Map<String, dynamic> _$GithubProjectColumnItemToJson( Map<String, dynamic> _$GithubProjectColumnItemToJson(
GithubProjectColumnItem instance) => GithubProjectColumnItem instance) =>
@ -355,19 +338,18 @@ Map<String, dynamic> _$GithubProjectColumnItemToJson(
}; };
GithubInstallationRepositoriesItem _$GithubInstallationRepositoriesItemFromJson( GithubInstallationRepositoriesItem _$GithubInstallationRepositoriesItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubInstallationRepositoriesItem() GithubInstallationRepositoriesItem()
..repositoriesAdded = (json['repositories_added'] as List<dynamic>?) ..repositoriesAdded = (json['repositories_added'] as List<dynamic>?)
?.map((e) => ?.map((e) =>
GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>)) GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
.toList() .toList()
..repositoriesRemoved = (json['repositories_removed'] as List<dynamic>?) ..repositoriesRemoved = (json['repositories_removed'] as List<dynamic>?)
?.map((e) => ?.map((e) =>
GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>)) GithubNotificationItemRepo.fromJson(e as Map<String, dynamic>))
.toList() .toList()
..repositoriesSelection = json['repositories_selection'] as String? ..repositoriesSelection = json['repositories_selection'] as String?
..id = json['id'] as int?; ..id = json['id'] as int?;
}
Map<String, dynamic> _$GithubInstallationRepositoriesItemToJson( Map<String, dynamic> _$GithubInstallationRepositoriesItemToJson(
GithubInstallationRepositoriesItem instance) => GithubInstallationRepositoriesItem instance) =>
@ -378,12 +360,11 @@ Map<String, dynamic> _$GithubInstallationRepositoriesItemToJson(
'id': instance.id, 'id': instance.id,
}; };
GithubCheckrunItem _$GithubCheckrunItemFromJson(Map<String, dynamic> json) { GithubCheckrunItem _$GithubCheckrunItemFromJson(Map<String, dynamic> json) =>
return GithubCheckrunItem() GithubCheckrunItem()
..status = json['status'] as String? ..status = json['status'] as String?
..name = json['name'] as String? ..name = json['name'] as String?
..id = json['id'] as int?; ..id = json['id'] as int?;
}
Map<String, dynamic> _$GithubCheckrunItemToJson(GithubCheckrunItem instance) => Map<String, dynamic> _$GithubCheckrunItemToJson(GithubCheckrunItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -392,11 +373,11 @@ Map<String, dynamic> _$GithubCheckrunItemToJson(GithubCheckrunItem instance) =>
'id': instance.id, 'id': instance.id,
}; };
GithubCheckSuiteItem _$GithubCheckSuiteItemFromJson(Map<String, dynamic> json) { GithubCheckSuiteItem _$GithubCheckSuiteItemFromJson(
return GithubCheckSuiteItem() Map<String, dynamic> json) =>
..status = json['status'] as String? GithubCheckSuiteItem()
..conclusion = json['conclusion'] as String?; ..status = json['status'] as String?
} ..conclusion = json['conclusion'] as String?;
Map<String, dynamic> _$GithubCheckSuiteItemToJson( Map<String, dynamic> _$GithubCheckSuiteItemToJson(
GithubCheckSuiteItem instance) => GithubCheckSuiteItem instance) =>
@ -406,11 +387,10 @@ Map<String, dynamic> _$GithubCheckSuiteItemToJson(
}; };
GithubContentReferenceItem _$GithubContentReferenceItemFromJson( GithubContentReferenceItem _$GithubContentReferenceItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubContentReferenceItem() GithubContentReferenceItem()
..id = json['id'] as int? ..id = json['id'] as int?
..reference = json['reference'] as String?; ..reference = json['reference'] as String?;
}
Map<String, dynamic> _$GithubContentReferenceItemToJson( Map<String, dynamic> _$GithubContentReferenceItemToJson(
GithubContentReferenceItem instance) => GithubContentReferenceItem instance) =>
@ -420,14 +400,13 @@ Map<String, dynamic> _$GithubContentReferenceItemToJson(
}; };
GithubContributorItem _$GithubContributorItemFromJson( GithubContributorItem _$GithubContributorItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubContributorItem() GithubContributorItem()
..id = json['id'] as int? ..id = json['id'] as int?
..login = json['login'] as String? ..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String? ..avatarUrl = json['avatar_url'] as String?
..htmlUrl = json['html_url'] as String? ..htmlUrl = json['html_url'] as String?
..contributions = json['contributions'] as int?; ..contributions = json['contributions'] as int?;
}
Map<String, dynamic> _$GithubContributorItemToJson( Map<String, dynamic> _$GithubContributorItemToJson(
GithubContributorItem instance) => GithubContributorItem instance) =>
@ -440,14 +419,13 @@ Map<String, dynamic> _$GithubContributorItemToJson(
}; };
GithubUserOrganizationItem _$GithubUserOrganizationItemFromJson( GithubUserOrganizationItem _$GithubUserOrganizationItemFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GithubUserOrganizationItem() GithubUserOrganizationItem()
..id = json['id'] as int? ..id = json['id'] as int?
..login = json['login'] as String? ..login = json['login'] as String?
..avatarUrl = json['avatar_url'] as String? ..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..url = json['url'] as String?; ..url = json['url'] as String?;
}
Map<String, dynamic> _$GithubUserOrganizationItemToJson( Map<String, dynamic> _$GithubUserOrganizationItemToJson(
GithubUserOrganizationItem instance) => GithubUserOrganizationItem instance) =>
@ -459,17 +437,15 @@ Map<String, dynamic> _$GithubUserOrganizationItemToJson(
'url': instance.url, 'url': instance.url,
}; };
GistFiles _$GistFilesFromJson(Map<String, dynamic> json) { GistFiles _$GistFilesFromJson(Map<String, dynamic> json) => GistFiles(
return GistFiles( filename: json['filename'] as String?,
filename: json['filename'] as String?, size: json['size'] as int?,
size: json['size'] as int?, rawUrl: json['raw_url'] as String?,
rawUrl: json['raw_url'] as String?, type: json['type'] as String?,
type: json['type'] as String?, language: json['language'] as String?,
language: json['language'] as String?, truncated: json['truncated'] as bool?,
truncated: json['truncated'] as bool?, content: json['content'] as String?,
content: json['content'] as String?, );
);
}
Map<String, dynamic> _$GistFilesToJson(GistFiles instance) => <String, dynamic>{ Map<String, dynamic> _$GistFilesToJson(GistFiles instance) => <String, dynamic>{
'filename': instance.filename, 'filename': instance.filename,
@ -481,24 +457,23 @@ Map<String, dynamic> _$GistFilesToJson(GistFiles instance) => <String, dynamic>{
'content': instance.content, 'content': instance.content,
}; };
GithubGistsItem _$GithubGistsItemFromJson(Map<String, dynamic> json) { GithubGistsItem _$GithubGistsItemFromJson(Map<String, dynamic> json) =>
return GithubGistsItem() GithubGistsItem()
..id = json['id'] as String? ..id = json['id'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..public = json['public'] as bool? ..public = json['public'] as bool?
..files = (json['files'] as Map<String, dynamic>?)?.map( ..files = (json['files'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, GistFiles.fromJson(e as Map<String, dynamic>)), (k, e) => MapEntry(k, GistFiles.fromJson(e as Map<String, dynamic>)),
) )
..owner = json['owner'] == null ..owner = json['owner'] == null
? null ? null
: GithubEventUser.fromJson(json['owner'] as Map<String, dynamic>) : GithubEventUser.fromJson(json['owner'] as Map<String, dynamic>)
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String) : DateTime.parse(json['created_at'] as String)
..updatedAt = json['updated_at'] == null ..updatedAt = json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String); : DateTime.parse(json['updated_at'] as String);
}
Map<String, dynamic> _$GithubGistsItemToJson(GithubGistsItem instance) => Map<String, dynamic> _$GithubGistsItemToJson(GithubGistsItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -511,15 +486,14 @@ Map<String, dynamic> _$GithubGistsItemToJson(GithubGistsItem instance) =>
'updated_at': instance.updatedAt?.toIso8601String(), 'updated_at': instance.updatedAt?.toIso8601String(),
}; };
GithubFilesItem _$GithubFilesItemFromJson(Map<String, dynamic> json) { GithubFilesItem _$GithubFilesItemFromJson(Map<String, dynamic> json) =>
return GithubFilesItem() GithubFilesItem()
..filename = json['filename'] as String? ..filename = json['filename'] as String?
..status = json['status'] as String? ..status = json['status'] as String?
..additions = json['additions'] as int? ..additions = json['additions'] as int?
..deletions = json['deletions'] as int? ..deletions = json['deletions'] as int?
..changes = json['changes'] as int? ..changes = json['changes'] as int?
..patch = json['patch'] as String?; ..patch = json['patch'] as String?;
}
Map<String, dynamic> _$GithubFilesItemToJson(GithubFilesItem instance) => Map<String, dynamic> _$GithubFilesItemToJson(GithubFilesItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -531,15 +505,15 @@ Map<String, dynamic> _$GithubFilesItemToJson(GithubFilesItem instance) =>
'patch': instance.patch, 'patch': instance.patch,
}; };
GithubComparisonItem _$GithubComparisonItemFromJson(Map<String, dynamic> json) { GithubComparisonItem _$GithubComparisonItemFromJson(
return GithubComparisonItem() Map<String, dynamic> json) =>
..files = (json['files'] as List<dynamic>?) GithubComparisonItem()
?.map((e) => GithubFilesItem.fromJson(e as Map<String, dynamic>)) ..files = (json['files'] as List<dynamic>?)
.toList() ?.map((e) => GithubFilesItem.fromJson(e as Map<String, dynamic>))
..status = json['status'] as String? .toList()
..aheadBy = json['ahead_by'] as int? ..status = json['status'] as String?
..behindBy = json['behind_by'] as int?; ..aheadBy = json['ahead_by'] as int?
} ..behindBy = json['behind_by'] as int?;
Map<String, dynamic> _$GithubComparisonItemToJson( Map<String, dynamic> _$GithubComparisonItemToJson(
GithubComparisonItem instance) => GithubComparisonItem instance) =>

View File

@ -4,6 +4,9 @@ part 'gitlab.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabUser { class GitlabUser {
GitlabUser();
factory GitlabUser.fromJson(Map<String, dynamic> json) =>
_$GitlabUserFromJson(json);
int? id; int? id;
String? username; String? username;
String? name; String? name;
@ -11,70 +14,70 @@ class GitlabUser {
String? bio; String? bio;
DateTime? createdAt; DateTime? createdAt;
int? accessLevel; int? accessLevel;
GitlabUser();
factory GitlabUser.fromJson(Map<String, dynamic> json) =>
_$GitlabUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabGroup { class GitlabGroup {
GitlabGroup();
factory GitlabGroup.fromJson(Map<String, dynamic> json) =>
_$GitlabGroupFromJson(json);
int? id; int? id;
String? path; String? path;
String? name; String? name;
String? avatarUrl; String? avatarUrl;
String? description; String? description;
List<GitlabProject>? projects; List<GitlabProject>? projects;
GitlabGroup();
factory GitlabGroup.fromJson(Map<String, dynamic> json) =>
_$GitlabGroupFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoProject { class GitlabTodoProject {
String? pathWithNamespace;
GitlabTodoProject(); GitlabTodoProject();
factory GitlabTodoProject.fromJson(Map<String, dynamic> json) => factory GitlabTodoProject.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoProjectFromJson(json); _$GitlabTodoProjectFromJson(json);
String? pathWithNamespace;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodo { class GitlabTodo {
GitlabTodo();
factory GitlabTodo.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoFromJson(json);
GitlabUser? author; GitlabUser? author;
GitlabTodoProject? project; GitlabTodoProject? project;
String? actionName; String? actionName;
String? targetType; String? targetType;
GitlabTodoTarget? target; GitlabTodoTarget? target;
GitlabTodo();
factory GitlabTodo.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTodoTarget { class GitlabTodoTarget {
GitlabTodoTarget();
factory GitlabTodoTarget.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoTargetFromJson(json);
int? iid; int? iid;
int? projectId; int? projectId;
String? title; String? title;
GitlabUser? author; GitlabUser? author;
String? description; String? description;
DateTime? createdAt; DateTime? createdAt;
GitlabTodoTarget();
factory GitlabTodoTarget.fromJson(Map<String, dynamic> json) =>
_$GitlabTodoTargetFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssueNote { class GitlabIssueNote {
GitlabIssueNote();
factory GitlabIssueNote.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueNoteFromJson(json);
GitlabUser? author; GitlabUser? author;
String? body; String? body;
bool? system; bool? system;
DateTime? createdAt; DateTime? createdAt;
GitlabIssueNote();
factory GitlabIssueNote.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueNoteFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProject { class GitlabProject {
GitlabProject();
factory GitlabProject.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectFromJson(json);
int? id; int? id;
String? name; String? name;
String? avatarUrl; String? avatarUrl;
@ -93,103 +96,103 @@ class GitlabProject {
DateTime? lastActivityAt; DateTime? lastActivityAt;
DateTime? createdAt; DateTime? createdAt;
String? defaultBranch; String? defaultBranch;
GitlabProject();
factory GitlabProject.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectBadge { class GitlabProjectBadge {
String? renderedImageUrl;
GitlabProjectBadge(); GitlabProjectBadge();
factory GitlabProjectBadge.fromJson(Map<String, dynamic> json) => factory GitlabProjectBadge.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectBadgeFromJson(json); _$GitlabProjectBadgeFromJson(json);
String? renderedImageUrl;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectStatistics { class GitlabProjectStatistics {
int? commitCount;
int? repositorySize;
GitlabProjectStatistics(); GitlabProjectStatistics();
factory GitlabProjectStatistics.fromJson(Map<String, dynamic> json) => factory GitlabProjectStatistics.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectStatisticsFromJson(json); _$GitlabProjectStatisticsFromJson(json);
int? commitCount;
int? repositorySize;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabProjectNamespace { class GitlabProjectNamespace {
GitlabProjectNamespace();
factory GitlabProjectNamespace.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectNamespaceFromJson(json);
int? id; int? id;
String? name; String? name;
String? path; String? path;
String? kind; String? kind;
GitlabProjectNamespace();
factory GitlabProjectNamespace.fromJson(Map<String, dynamic> json) =>
_$GitlabProjectNamespaceFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabTreeItem { class GitlabTreeItem {
String type;
String path;
String name;
GitlabTreeItem({required this.type, required this.path, required this.name}); GitlabTreeItem({required this.type, required this.path, required this.name});
factory GitlabTreeItem.fromJson(Map<String, dynamic> json) => factory GitlabTreeItem.fromJson(Map<String, dynamic> json) =>
_$GitlabTreeItemFromJson(json); _$GitlabTreeItemFromJson(json);
String type;
String path;
String name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBlob { class GitlabBlob {
String? content;
GitlabBlob(); GitlabBlob();
factory GitlabBlob.fromJson(Map<String, dynamic> json) => factory GitlabBlob.fromJson(Map<String, dynamic> json) =>
_$GitlabBlobFromJson(json); _$GitlabBlobFromJson(json);
String? content;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEvent { class GitlabEvent {
GitlabEvent();
factory GitlabEvent.fromJson(Map<String, dynamic> json) =>
_$GitlabEventFromJson(json);
GitlabUser? author; GitlabUser? author;
String? actionName; String? actionName;
String? targetType; String? targetType;
GitlabEventNote? note; GitlabEventNote? note;
GitlabEvent();
factory GitlabEvent.fromJson(Map<String, dynamic> json) =>
_$GitlabEventFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabEventNote { class GitlabEventNote {
String? body;
String? noteableType;
int? noteableIid;
GitlabEventNote(); GitlabEventNote();
factory GitlabEventNote.fromJson(Map<String, dynamic> json) => factory GitlabEventNote.fromJson(Map<String, dynamic> json) =>
_$GitlabEventNoteFromJson(json); _$GitlabEventNoteFromJson(json);
String? body;
String? noteableType;
int? noteableIid;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabCommit { class GitlabCommit {
GitlabCommit();
factory GitlabCommit.fromJson(Map<String, dynamic> json) =>
_$GitlabCommitFromJson(json);
String? id; String? id;
String? shortId; String? shortId;
String? title; String? title;
DateTime? createdAt; DateTime? createdAt;
String? authorName; String? authorName;
String? message; String? message;
GitlabCommit();
factory GitlabCommit.fromJson(Map<String, dynamic> json) =>
_$GitlabCommitFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabDiff { class GitlabDiff {
String? diff;
String? newPath;
String? oldPath;
GitlabDiff(); GitlabDiff();
factory GitlabDiff.fromJson(Map<String, dynamic> json) => factory GitlabDiff.fromJson(Map<String, dynamic> json) =>
_$GitlabDiffFromJson(json); _$GitlabDiffFromJson(json);
String? diff;
String? newPath;
String? oldPath;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabIssue { class GitlabIssue {
GitlabIssue();
factory GitlabIssue.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueFromJson(json);
String? title; String? title;
int? iid; int? iid;
int? projectId; int? projectId;
@ -197,25 +200,22 @@ class GitlabIssue {
int? userNotesCount; int? userNotesCount;
DateTime? updatedAt; DateTime? updatedAt;
List<String>? labels; List<String>? labels;
GitlabIssue();
factory GitlabIssue.fromJson(Map<String, dynamic> json) =>
_$GitlabIssueFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabStarrer { class GitlabStarrer {
DateTime? starredSince;
GitlabUser? user;
GitlabStarrer(); GitlabStarrer();
factory GitlabStarrer.fromJson(Map<String, dynamic> json) => factory GitlabStarrer.fromJson(Map<String, dynamic> json) =>
_$GitlabStarrerFromJson(json); _$GitlabStarrerFromJson(json);
DateTime? starredSince;
GitlabUser? user;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GitlabBranch { class GitlabBranch {
String? name;
bool? merged;
GitlabBranch(); GitlabBranch();
factory GitlabBranch.fromJson(Map<String, dynamic> json) => factory GitlabBranch.fromJson(Map<String, dynamic> json) =>
_$GitlabBranchFromJson(json); _$GitlabBranchFromJson(json);
String? name;
bool? merged;
} }

View File

@ -6,18 +6,16 @@ part of 'gitlab.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
GitlabUser _$GitlabUserFromJson(Map<String, dynamic> json) { GitlabUser _$GitlabUserFromJson(Map<String, dynamic> json) => GitlabUser()
return GitlabUser() ..id = json['id'] as int?
..id = json['id'] as int? ..username = json['username'] as String?
..username = json['username'] as String? ..name = json['name'] as String?
..name = json['name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..bio = json['bio'] as String?
..bio = json['bio'] as String? ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String)
: DateTime.parse(json['created_at'] as String) ..accessLevel = json['access_level'] as int?;
..accessLevel = json['access_level'] as int?;
}
Map<String, dynamic> _$GitlabUserToJson(GitlabUser instance) => Map<String, dynamic> _$GitlabUserToJson(GitlabUser instance) =>
<String, dynamic>{ <String, dynamic>{
@ -30,17 +28,15 @@ Map<String, dynamic> _$GitlabUserToJson(GitlabUser instance) =>
'access_level': instance.accessLevel, 'access_level': instance.accessLevel,
}; };
GitlabGroup _$GitlabGroupFromJson(Map<String, dynamic> json) { GitlabGroup _$GitlabGroupFromJson(Map<String, dynamic> json) => GitlabGroup()
return GitlabGroup() ..id = json['id'] as int?
..id = json['id'] as int? ..path = json['path'] as String?
..path = json['path'] as String? ..name = json['name'] as String?
..name = json['name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..description = json['description'] as String?
..description = json['description'] as String? ..projects = (json['projects'] as List<dynamic>?)
..projects = (json['projects'] as List<dynamic>?) ?.map((e) => GitlabProject.fromJson(e as Map<String, dynamic>))
?.map((e) => GitlabProject.fromJson(e as Map<String, dynamic>)) .toList();
.toList();
}
Map<String, dynamic> _$GitlabGroupToJson(GitlabGroup instance) => Map<String, dynamic> _$GitlabGroupToJson(GitlabGroup instance) =>
<String, dynamic>{ <String, dynamic>{
@ -52,30 +48,27 @@ Map<String, dynamic> _$GitlabGroupToJson(GitlabGroup instance) =>
'projects': instance.projects, 'projects': instance.projects,
}; };
GitlabTodoProject _$GitlabTodoProjectFromJson(Map<String, dynamic> json) { GitlabTodoProject _$GitlabTodoProjectFromJson(Map<String, dynamic> json) =>
return GitlabTodoProject() GitlabTodoProject()
..pathWithNamespace = json['path_with_namespace'] as String?; ..pathWithNamespace = json['path_with_namespace'] as String?;
}
Map<String, dynamic> _$GitlabTodoProjectToJson(GitlabTodoProject instance) => Map<String, dynamic> _$GitlabTodoProjectToJson(GitlabTodoProject instance) =>
<String, dynamic>{ <String, dynamic>{
'path_with_namespace': instance.pathWithNamespace, 'path_with_namespace': instance.pathWithNamespace,
}; };
GitlabTodo _$GitlabTodoFromJson(Map<String, dynamic> json) { GitlabTodo _$GitlabTodoFromJson(Map<String, dynamic> json) => GitlabTodo()
return GitlabTodo() ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>) ..project = json['project'] == null
..project = json['project'] == null ? null
? null : GitlabTodoProject.fromJson(json['project'] as Map<String, dynamic>)
: GitlabTodoProject.fromJson(json['project'] as Map<String, dynamic>) ..actionName = json['action_name'] as String?
..actionName = json['action_name'] as String? ..targetType = json['target_type'] as String?
..targetType = json['target_type'] as String? ..target = json['target'] == null
..target = json['target'] == null ? null
? null : GitlabTodoTarget.fromJson(json['target'] as Map<String, dynamic>);
: GitlabTodoTarget.fromJson(json['target'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GitlabTodoToJson(GitlabTodo instance) => Map<String, dynamic> _$GitlabTodoToJson(GitlabTodo instance) =>
<String, dynamic>{ <String, dynamic>{
@ -86,19 +79,18 @@ Map<String, dynamic> _$GitlabTodoToJson(GitlabTodo instance) =>
'target': instance.target, 'target': instance.target,
}; };
GitlabTodoTarget _$GitlabTodoTargetFromJson(Map<String, dynamic> json) { GitlabTodoTarget _$GitlabTodoTargetFromJson(Map<String, dynamic> json) =>
return GitlabTodoTarget() GitlabTodoTarget()
..iid = json['iid'] as int? ..iid = json['iid'] as int?
..projectId = json['project_id'] as int? ..projectId = json['project_id'] as int?
..title = json['title'] as String? ..title = json['title'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>) : GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..description = json['description'] as String? ..description = json['description'] as String?
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String); : DateTime.parse(json['created_at'] as String);
}
Map<String, dynamic> _$GitlabTodoTargetToJson(GitlabTodoTarget instance) => Map<String, dynamic> _$GitlabTodoTargetToJson(GitlabTodoTarget instance) =>
<String, dynamic>{ <String, dynamic>{
@ -110,17 +102,16 @@ Map<String, dynamic> _$GitlabTodoTargetToJson(GitlabTodoTarget instance) =>
'created_at': instance.createdAt?.toIso8601String(), 'created_at': instance.createdAt?.toIso8601String(),
}; };
GitlabIssueNote _$GitlabIssueNoteFromJson(Map<String, dynamic> json) { GitlabIssueNote _$GitlabIssueNoteFromJson(Map<String, dynamic> json) =>
return GitlabIssueNote() GitlabIssueNote()
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>) : GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
..body = json['body'] as String? ..body = json['body'] as String?
..system = json['system'] as bool? ..system = json['system'] as bool?
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String); : DateTime.parse(json['created_at'] as String);
}
Map<String, dynamic> _$GitlabIssueNoteToJson(GitlabIssueNote instance) => Map<String, dynamic> _$GitlabIssueNoteToJson(GitlabIssueNote instance) =>
<String, dynamic>{ <String, dynamic>{
@ -130,39 +121,38 @@ Map<String, dynamic> _$GitlabIssueNoteToJson(GitlabIssueNote instance) =>
'created_at': instance.createdAt?.toIso8601String(), 'created_at': instance.createdAt?.toIso8601String(),
}; };
GitlabProject _$GitlabProjectFromJson(Map<String, dynamic> json) { GitlabProject _$GitlabProjectFromJson(Map<String, dynamic> json) =>
return GitlabProject() GitlabProject()
..id = json['id'] as int? ..id = json['id'] as int?
..name = json['name'] as String? ..name = json['name'] as String?
..avatarUrl = json['avatar_url'] as String? ..avatarUrl = json['avatar_url'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..starCount = json['star_count'] as int? ..starCount = json['star_count'] as int?
..forksCount = json['forks_count'] as int? ..forksCount = json['forks_count'] as int?
..visibility = json['visibility'] as String? ..visibility = json['visibility'] as String?
..readmeUrl = json['readme_url'] as String? ..readmeUrl = json['readme_url'] as String?
..webUrl = json['web_url'] as String? ..webUrl = json['web_url'] as String?
..namespace = json['namespace'] == null ..namespace = json['namespace'] == null
? null ? null
: GitlabProjectNamespace.fromJson( : GitlabProjectNamespace.fromJson(
json['namespace'] as Map<String, dynamic>) json['namespace'] as Map<String, dynamic>)
..owner = json['owner'] == null ..owner = json['owner'] == null
? null ? null
: GitlabUser.fromJson(json['owner'] as Map<String, dynamic>) : GitlabUser.fromJson(json['owner'] as Map<String, dynamic>)
..issuesEnabled = json['issues_enabled'] as bool? ..issuesEnabled = json['issues_enabled'] as bool?
..openIssuesCount = json['open_issues_count'] as int? ..openIssuesCount = json['open_issues_count'] as int?
..mergeRequestsEnabled = json['merge_requests_enabled'] as bool? ..mergeRequestsEnabled = json['merge_requests_enabled'] as bool?
..statistics = json['statistics'] == null ..statistics = json['statistics'] == null
? null ? null
: GitlabProjectStatistics.fromJson( : GitlabProjectStatistics.fromJson(
json['statistics'] as Map<String, dynamic>) json['statistics'] as Map<String, dynamic>)
..lastActivityAt = json['last_activity_at'] == null ..lastActivityAt = json['last_activity_at'] == null
? null ? null
: DateTime.parse(json['last_activity_at'] as String) : DateTime.parse(json['last_activity_at'] as String)
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String) : DateTime.parse(json['created_at'] as String)
..defaultBranch = json['default_branch'] as String?; ..defaultBranch = json['default_branch'] as String?;
}
Map<String, dynamic> _$GitlabProjectToJson(GitlabProject instance) => Map<String, dynamic> _$GitlabProjectToJson(GitlabProject instance) =>
<String, dynamic>{ <String, dynamic>{
@ -186,10 +176,9 @@ Map<String, dynamic> _$GitlabProjectToJson(GitlabProject instance) =>
'default_branch': instance.defaultBranch, 'default_branch': instance.defaultBranch,
}; };
GitlabProjectBadge _$GitlabProjectBadgeFromJson(Map<String, dynamic> json) { GitlabProjectBadge _$GitlabProjectBadgeFromJson(Map<String, dynamic> json) =>
return GitlabProjectBadge() GitlabProjectBadge()
..renderedImageUrl = json['rendered_image_url'] as String?; ..renderedImageUrl = json['rendered_image_url'] as String?;
}
Map<String, dynamic> _$GitlabProjectBadgeToJson(GitlabProjectBadge instance) => Map<String, dynamic> _$GitlabProjectBadgeToJson(GitlabProjectBadge instance) =>
<String, dynamic>{ <String, dynamic>{
@ -197,11 +186,10 @@ Map<String, dynamic> _$GitlabProjectBadgeToJson(GitlabProjectBadge instance) =>
}; };
GitlabProjectStatistics _$GitlabProjectStatisticsFromJson( GitlabProjectStatistics _$GitlabProjectStatisticsFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GitlabProjectStatistics() GitlabProjectStatistics()
..commitCount = json['commit_count'] as int? ..commitCount = json['commit_count'] as int?
..repositorySize = json['repository_size'] as int?; ..repositorySize = json['repository_size'] as int?;
}
Map<String, dynamic> _$GitlabProjectStatisticsToJson( Map<String, dynamic> _$GitlabProjectStatisticsToJson(
GitlabProjectStatistics instance) => GitlabProjectStatistics instance) =>
@ -211,13 +199,12 @@ Map<String, dynamic> _$GitlabProjectStatisticsToJson(
}; };
GitlabProjectNamespace _$GitlabProjectNamespaceFromJson( GitlabProjectNamespace _$GitlabProjectNamespaceFromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) =>
return GitlabProjectNamespace() GitlabProjectNamespace()
..id = json['id'] as int? ..id = json['id'] as int?
..name = json['name'] as String? ..name = json['name'] as String?
..path = json['path'] as String? ..path = json['path'] as String?
..kind = json['kind'] as String?; ..kind = json['kind'] as String?;
}
Map<String, dynamic> _$GitlabProjectNamespaceToJson( Map<String, dynamic> _$GitlabProjectNamespaceToJson(
GitlabProjectNamespace instance) => GitlabProjectNamespace instance) =>
@ -228,13 +215,12 @@ Map<String, dynamic> _$GitlabProjectNamespaceToJson(
'kind': instance.kind, 'kind': instance.kind,
}; };
GitlabTreeItem _$GitlabTreeItemFromJson(Map<String, dynamic> json) { GitlabTreeItem _$GitlabTreeItemFromJson(Map<String, dynamic> json) =>
return GitlabTreeItem( GitlabTreeItem(
type: json['type'] as String, type: json['type'] as String,
path: json['path'] as String, path: json['path'] as String,
name: json['name'] as String, name: json['name'] as String,
); );
}
Map<String, dynamic> _$GitlabTreeItemToJson(GitlabTreeItem instance) => Map<String, dynamic> _$GitlabTreeItemToJson(GitlabTreeItem instance) =>
<String, dynamic>{ <String, dynamic>{
@ -243,26 +229,23 @@ Map<String, dynamic> _$GitlabTreeItemToJson(GitlabTreeItem instance) =>
'name': instance.name, 'name': instance.name,
}; };
GitlabBlob _$GitlabBlobFromJson(Map<String, dynamic> json) { GitlabBlob _$GitlabBlobFromJson(Map<String, dynamic> json) =>
return GitlabBlob()..content = json['content'] as String?; GitlabBlob()..content = json['content'] as String?;
}
Map<String, dynamic> _$GitlabBlobToJson(GitlabBlob instance) => Map<String, dynamic> _$GitlabBlobToJson(GitlabBlob instance) =>
<String, dynamic>{ <String, dynamic>{
'content': instance.content, 'content': instance.content,
}; };
GitlabEvent _$GitlabEventFromJson(Map<String, dynamic> json) { GitlabEvent _$GitlabEventFromJson(Map<String, dynamic> json) => GitlabEvent()
return GitlabEvent() ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>) ..actionName = json['action_name'] as String?
..actionName = json['action_name'] as String? ..targetType = json['target_type'] as String?
..targetType = json['target_type'] as String? ..note = json['note'] == null
..note = json['note'] == null ? null
? null : GitlabEventNote.fromJson(json['note'] as Map<String, dynamic>);
: GitlabEventNote.fromJson(json['note'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GitlabEventToJson(GitlabEvent instance) => Map<String, dynamic> _$GitlabEventToJson(GitlabEvent instance) =>
<String, dynamic>{ <String, dynamic>{
@ -272,12 +255,11 @@ Map<String, dynamic> _$GitlabEventToJson(GitlabEvent instance) =>
'note': instance.note, 'note': instance.note,
}; };
GitlabEventNote _$GitlabEventNoteFromJson(Map<String, dynamic> json) { GitlabEventNote _$GitlabEventNoteFromJson(Map<String, dynamic> json) =>
return GitlabEventNote() GitlabEventNote()
..body = json['body'] as String? ..body = json['body'] as String?
..noteableType = json['noteable_type'] as String? ..noteableType = json['noteable_type'] as String?
..noteableIid = json['noteable_iid'] as int?; ..noteableIid = json['noteable_iid'] as int?;
}
Map<String, dynamic> _$GitlabEventNoteToJson(GitlabEventNote instance) => Map<String, dynamic> _$GitlabEventNoteToJson(GitlabEventNote instance) =>
<String, dynamic>{ <String, dynamic>{
@ -286,17 +268,15 @@ Map<String, dynamic> _$GitlabEventNoteToJson(GitlabEventNote instance) =>
'noteable_iid': instance.noteableIid, 'noteable_iid': instance.noteableIid,
}; };
GitlabCommit _$GitlabCommitFromJson(Map<String, dynamic> json) { GitlabCommit _$GitlabCommitFromJson(Map<String, dynamic> json) => GitlabCommit()
return GitlabCommit() ..id = json['id'] as String?
..id = json['id'] as String? ..shortId = json['short_id'] as String?
..shortId = json['short_id'] as String? ..title = json['title'] as String?
..title = json['title'] as String? ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String)
: DateTime.parse(json['created_at'] as String) ..authorName = json['author_name'] as String?
..authorName = json['author_name'] as String? ..message = json['message'] as String?;
..message = json['message'] as String?;
}
Map<String, dynamic> _$GitlabCommitToJson(GitlabCommit instance) => Map<String, dynamic> _$GitlabCommitToJson(GitlabCommit instance) =>
<String, dynamic>{ <String, dynamic>{
@ -308,12 +288,10 @@ Map<String, dynamic> _$GitlabCommitToJson(GitlabCommit instance) =>
'message': instance.message, 'message': instance.message,
}; };
GitlabDiff _$GitlabDiffFromJson(Map<String, dynamic> json) { GitlabDiff _$GitlabDiffFromJson(Map<String, dynamic> json) => GitlabDiff()
return GitlabDiff() ..diff = json['diff'] as String?
..diff = json['diff'] as String? ..newPath = json['new_path'] as String?
..newPath = json['new_path'] as String? ..oldPath = json['old_path'] as String?;
..oldPath = json['old_path'] as String?;
}
Map<String, dynamic> _$GitlabDiffToJson(GitlabDiff instance) => Map<String, dynamic> _$GitlabDiffToJson(GitlabDiff instance) =>
<String, dynamic>{ <String, dynamic>{
@ -322,21 +300,19 @@ Map<String, dynamic> _$GitlabDiffToJson(GitlabDiff instance) =>
'old_path': instance.oldPath, 'old_path': instance.oldPath,
}; };
GitlabIssue _$GitlabIssueFromJson(Map<String, dynamic> json) { GitlabIssue _$GitlabIssueFromJson(Map<String, dynamic> json) => GitlabIssue()
return GitlabIssue() ..title = json['title'] as String?
..title = json['title'] as String? ..iid = json['iid'] as int?
..iid = json['iid'] as int? ..projectId = json['project_id'] as int?
..projectId = json['project_id'] as int? ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GitlabUser.fromJson(json['author'] as Map<String, dynamic>)
: GitlabUser.fromJson(json['author'] as Map<String, dynamic>) ..userNotesCount = json['user_notes_count'] as int?
..userNotesCount = json['user_notes_count'] as int? ..updatedAt = json['updated_at'] == null
..updatedAt = json['updated_at'] == null ? null
? null : DateTime.parse(json['updated_at'] as String)
: DateTime.parse(json['updated_at'] as String) ..labels =
..labels = (json['labels'] as List<dynamic>?)?.map((e) => e as String).toList();
(json['labels'] as List<dynamic>?)?.map((e) => e as String).toList();
}
Map<String, dynamic> _$GitlabIssueToJson(GitlabIssue instance) => Map<String, dynamic> _$GitlabIssueToJson(GitlabIssue instance) =>
<String, dynamic>{ <String, dynamic>{
@ -349,15 +325,14 @@ Map<String, dynamic> _$GitlabIssueToJson(GitlabIssue instance) =>
'labels': instance.labels, 'labels': instance.labels,
}; };
GitlabStarrer _$GitlabStarrerFromJson(Map<String, dynamic> json) { GitlabStarrer _$GitlabStarrerFromJson(Map<String, dynamic> json) =>
return GitlabStarrer() GitlabStarrer()
..starredSince = json['starred_since'] == null ..starredSince = json['starred_since'] == null
? null ? null
: DateTime.parse(json['starred_since'] as String) : DateTime.parse(json['starred_since'] as String)
..user = json['user'] == null ..user = json['user'] == null
? null ? null
: GitlabUser.fromJson(json['user'] as Map<String, dynamic>); : GitlabUser.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> _$GitlabStarrerToJson(GitlabStarrer instance) => Map<String, dynamic> _$GitlabStarrerToJson(GitlabStarrer instance) =>
<String, dynamic>{ <String, dynamic>{
@ -365,11 +340,9 @@ Map<String, dynamic> _$GitlabStarrerToJson(GitlabStarrer instance) =>
'user': instance.user, 'user': instance.user,
}; };
GitlabBranch _$GitlabBranchFromJson(Map<String, dynamic> json) { GitlabBranch _$GitlabBranchFromJson(Map<String, dynamic> json) => GitlabBranch()
return GitlabBranch() ..name = json['name'] as String?
..name = json['name'] as String? ..merged = json['merged'] as bool?;
..merged = json['merged'] as bool?;
}
Map<String, dynamic> _$GitlabBranchToJson(GitlabBranch instance) => Map<String, dynamic> _$GitlabBranchToJson(GitlabBranch instance) =>
<String, dynamic>{ <String, dynamic>{

View File

@ -4,18 +4,21 @@ part 'gogs.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsUser { class GogsUser {
GogsUser();
factory GogsUser.fromJson(Map<String, dynamic> json) =>
_$GogsUserFromJson(json);
int? id; int? id;
String? username; String? username;
String? fullName; String? fullName;
String? avatarUrl; String? avatarUrl;
String? email; String? email;
GogsUser();
factory GogsUser.fromJson(Map<String, dynamic> json) =>
_$GogsUserFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsRepository { class GogsRepository {
GogsRepository();
factory GogsRepository.fromJson(Map<String, dynamic> json) =>
_$GogsRepositoryFromJson(json);
int? id; int? id;
String? fullName; String? fullName;
bool? private; bool? private;
@ -29,13 +32,13 @@ class GogsRepository {
int? forksCount; int? forksCount;
String? website; String? website;
int? watchersCount; int? watchersCount;
GogsRepository();
factory GogsRepository.fromJson(Map<String, dynamic> json) =>
_$GogsRepositoryFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsOrg { class GogsOrg {
GogsOrg();
factory GogsOrg.fromJson(Map<String, dynamic> json) =>
_$GogsOrgFromJson(json);
int? id; int? id;
String? username; String? username;
String? fullName; String? fullName;
@ -43,73 +46,72 @@ class GogsOrg {
String? description; String? description;
String? location; String? location;
String? website; String? website;
GogsOrg();
factory GogsOrg.fromJson(Map<String, dynamic> json) =>
_$GogsOrgFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsTree { class GogsTree {
GogsTree({required this.type, required this.name});
factory GogsTree.fromJson(Map<String, dynamic> json) =>
_$GogsTreeFromJson(json);
String type; String type;
String name; String name;
String? path; String? path;
int? size; int? size;
String? downloadUrl; String? downloadUrl;
GogsTree({required this.type, required this.name});
factory GogsTree.fromJson(Map<String, dynamic> json) =>
_$GogsTreeFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsBlob extends GogsTree { class GogsBlob extends GogsTree {
String? content; GogsBlob({required super.type, required super.name});
GogsBlob({required String type, required String name})
: super(name: name, type: type);
factory GogsBlob.fromJson(Map<String, dynamic> json) => factory GogsBlob.fromJson(Map<String, dynamic> json) =>
_$GogsBlobFromJson(json); _$GogsBlobFromJson(json);
String? content;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsBranch { class GogsBranch {
String? name;
GogsBranch(); GogsBranch();
factory GogsBranch.fromJson(Map<String, dynamic> json) => factory GogsBranch.fromJson(Map<String, dynamic> json) =>
_$GogsBranchFromJson(json); _$GogsBranchFromJson(json);
String? name;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommit { class GogsCommit {
GogsCommit();
factory GogsCommit.fromJson(Map<String, dynamic> json) =>
_$GogsCommitFromJson(json);
GogsUser? author; GogsUser? author;
GogsCommitDetail? commit; GogsCommitDetail? commit;
String? sha; String? sha;
String? htmlUrl; String? htmlUrl;
GogsCommit();
factory GogsCommit.fromJson(Map<String, dynamic> json) =>
_$GogsCommitFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitDetail { class GogsCommitDetail {
String? message;
GogsCommitAuthor? author;
GogsCommitAuthor? committer;
GogsCommitDetail(); GogsCommitDetail();
factory GogsCommitDetail.fromJson(Map<String, dynamic> json) => factory GogsCommitDetail.fromJson(Map<String, dynamic> json) =>
_$GogsCommitDetailFromJson(json); _$GogsCommitDetailFromJson(json);
String? message;
GogsCommitAuthor? author;
GogsCommitAuthor? committer;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsCommitAuthor { class GogsCommitAuthor {
String? name;
String? email;
DateTime? date;
GogsCommitAuthor(); GogsCommitAuthor();
factory GogsCommitAuthor.fromJson(Map<String, dynamic> json) => factory GogsCommitAuthor.fromJson(Map<String, dynamic> json) =>
_$GogsCommitAuthorFromJson(json); _$GogsCommitAuthorFromJson(json);
String? name;
String? email;
DateTime? date;
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsIssue { class GogsIssue {
GogsIssue();
factory GogsIssue.fromJson(Map<String, dynamic> json) =>
_$GogsIssueFromJson(json);
int? number; int? number;
String? state; String? state;
String? title; String? title;
@ -119,16 +121,13 @@ class GogsIssue {
DateTime? createdAt; DateTime? createdAt;
DateTime? updatedAt; DateTime? updatedAt;
int? comments; int? comments;
GogsIssue();
factory GogsIssue.fromJson(Map<String, dynamic> json) =>
_$GogsIssueFromJson(json);
} }
@JsonSerializable(fieldRename: FieldRename.snake) @JsonSerializable(fieldRename: FieldRename.snake)
class GogsLabel { class GogsLabel {
String? name;
String? color;
GogsLabel(); GogsLabel();
factory GogsLabel.fromJson(Map<String, dynamic> json) => factory GogsLabel.fromJson(Map<String, dynamic> json) =>
_$GogsLabelFromJson(json); _$GogsLabelFromJson(json);
String? name;
String? color;
} }

View File

@ -6,14 +6,12 @@ part of 'gogs.dart';
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
GogsUser _$GogsUserFromJson(Map<String, dynamic> json) { GogsUser _$GogsUserFromJson(Map<String, dynamic> json) => GogsUser()
return GogsUser() ..id = json['id'] as int?
..id = json['id'] as int? ..username = json['username'] as String?
..username = json['username'] as String? ..fullName = json['full_name'] as String?
..fullName = json['full_name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..email = json['email'] as String?;
..email = json['email'] as String?;
}
Map<String, dynamic> _$GogsUserToJson(GogsUser instance) => <String, dynamic>{ Map<String, dynamic> _$GogsUserToJson(GogsUser instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
@ -23,28 +21,27 @@ Map<String, dynamic> _$GogsUserToJson(GogsUser instance) => <String, dynamic>{
'email': instance.email, 'email': instance.email,
}; };
GogsRepository _$GogsRepositoryFromJson(Map<String, dynamic> json) { GogsRepository _$GogsRepositoryFromJson(Map<String, dynamic> json) =>
return GogsRepository() GogsRepository()
..id = json['id'] as int? ..id = json['id'] as int?
..fullName = json['full_name'] as String? ..fullName = json['full_name'] as String?
..private = json['private'] as bool? ..private = json['private'] as bool?
..owner = json['owner'] == null ..owner = json['owner'] == null
? null ? null
: GogsUser.fromJson(json['owner'] as Map<String, dynamic>) : GogsUser.fromJson(json['owner'] as Map<String, dynamic>)
..htmlUrl = json['html_url'] as String? ..htmlUrl = json['html_url'] as String?
..description = json['description'] as String? ..description = json['description'] as String?
..defaultBranch = json['default_branch'] as String? ..defaultBranch = json['default_branch'] as String?
..createdAt = json['created_at'] == null ..createdAt = json['created_at'] == null
? null ? null
: DateTime.parse(json['created_at'] as String) : DateTime.parse(json['created_at'] as String)
..updatedAt = json['updated_at'] == null ..updatedAt = json['updated_at'] == null
? null ? null
: DateTime.parse(json['updated_at'] as String) : DateTime.parse(json['updated_at'] as String)
..starsCount = json['stars_count'] as int? ..starsCount = json['stars_count'] as int?
..forksCount = json['forks_count'] as int? ..forksCount = json['forks_count'] as int?
..website = json['website'] as String? ..website = json['website'] as String?
..watchersCount = json['watchers_count'] as int?; ..watchersCount = json['watchers_count'] as int?;
}
Map<String, dynamic> _$GogsRepositoryToJson(GogsRepository instance) => Map<String, dynamic> _$GogsRepositoryToJson(GogsRepository instance) =>
<String, dynamic>{ <String, dynamic>{
@ -63,16 +60,14 @@ Map<String, dynamic> _$GogsRepositoryToJson(GogsRepository instance) =>
'watchers_count': instance.watchersCount, 'watchers_count': instance.watchersCount,
}; };
GogsOrg _$GogsOrgFromJson(Map<String, dynamic> json) { GogsOrg _$GogsOrgFromJson(Map<String, dynamic> json) => GogsOrg()
return GogsOrg() ..id = json['id'] as int?
..id = json['id'] as int? ..username = json['username'] as String?
..username = json['username'] as String? ..fullName = json['full_name'] as String?
..fullName = json['full_name'] as String? ..avatarUrl = json['avatar_url'] as String?
..avatarUrl = json['avatar_url'] as String? ..description = json['description'] as String?
..description = json['description'] as String? ..location = json['location'] as String?
..location = json['location'] as String? ..website = json['website'] as String?;
..website = json['website'] as String?;
}
Map<String, dynamic> _$GogsOrgToJson(GogsOrg instance) => <String, dynamic>{ Map<String, dynamic> _$GogsOrgToJson(GogsOrg instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
@ -84,15 +79,13 @@ Map<String, dynamic> _$GogsOrgToJson(GogsOrg instance) => <String, dynamic>{
'website': instance.website, 'website': instance.website,
}; };
GogsTree _$GogsTreeFromJson(Map<String, dynamic> json) { GogsTree _$GogsTreeFromJson(Map<String, dynamic> json) => GogsTree(
return GogsTree( type: json['type'] as String,
type: json['type'] as String, name: json['name'] as String,
name: json['name'] as String, )
) ..path = json['path'] as String?
..path = json['path'] as String? ..size = json['size'] as int?
..size = json['size'] as int? ..downloadUrl = json['download_url'] as String?;
..downloadUrl = json['download_url'] as String?;
}
Map<String, dynamic> _$GogsTreeToJson(GogsTree instance) => <String, dynamic>{ Map<String, dynamic> _$GogsTreeToJson(GogsTree instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@ -102,16 +95,14 @@ Map<String, dynamic> _$GogsTreeToJson(GogsTree instance) => <String, dynamic>{
'download_url': instance.downloadUrl, 'download_url': instance.downloadUrl,
}; };
GogsBlob _$GogsBlobFromJson(Map<String, dynamic> json) { GogsBlob _$GogsBlobFromJson(Map<String, dynamic> json) => GogsBlob(
return GogsBlob( type: json['type'] as String,
type: json['type'] as String, name: json['name'] as String,
name: json['name'] as String, )
) ..path = json['path'] as String?
..path = json['path'] as String? ..size = json['size'] as int?
..size = json['size'] as int? ..downloadUrl = json['download_url'] as String?
..downloadUrl = json['download_url'] as String? ..content = json['content'] as String?;
..content = json['content'] as String?;
}
Map<String, dynamic> _$GogsBlobToJson(GogsBlob instance) => <String, dynamic>{ Map<String, dynamic> _$GogsBlobToJson(GogsBlob instance) => <String, dynamic>{
'type': instance.type, 'type': instance.type,
@ -122,26 +113,23 @@ Map<String, dynamic> _$GogsBlobToJson(GogsBlob instance) => <String, dynamic>{
'content': instance.content, 'content': instance.content,
}; };
GogsBranch _$GogsBranchFromJson(Map<String, dynamic> json) { GogsBranch _$GogsBranchFromJson(Map<String, dynamic> json) =>
return GogsBranch()..name = json['name'] as String?; GogsBranch()..name = json['name'] as String?;
}
Map<String, dynamic> _$GogsBranchToJson(GogsBranch instance) => Map<String, dynamic> _$GogsBranchToJson(GogsBranch instance) =>
<String, dynamic>{ <String, dynamic>{
'name': instance.name, 'name': instance.name,
}; };
GogsCommit _$GogsCommitFromJson(Map<String, dynamic> json) { GogsCommit _$GogsCommitFromJson(Map<String, dynamic> json) => GogsCommit()
return GogsCommit() ..author = json['author'] == null
..author = json['author'] == null ? null
? null : GogsUser.fromJson(json['author'] as Map<String, dynamic>)
: GogsUser.fromJson(json['author'] as Map<String, dynamic>) ..commit = json['commit'] == null
..commit = json['commit'] == null ? null
? null : GogsCommitDetail.fromJson(json['commit'] as Map<String, dynamic>)
: GogsCommitDetail.fromJson(json['commit'] as Map<String, dynamic>) ..sha = json['sha'] as String?
..sha = json['sha'] as String? ..htmlUrl = json['html_url'] as String?;
..htmlUrl = json['html_url'] as String?;
}
Map<String, dynamic> _$GogsCommitToJson(GogsCommit instance) => Map<String, dynamic> _$GogsCommitToJson(GogsCommit instance) =>
<String, dynamic>{ <String, dynamic>{
@ -151,16 +139,16 @@ Map<String, dynamic> _$GogsCommitToJson(GogsCommit instance) =>
'html_url': instance.htmlUrl, 'html_url': instance.htmlUrl,
}; };
GogsCommitDetail _$GogsCommitDetailFromJson(Map<String, dynamic> json) { GogsCommitDetail _$GogsCommitDetailFromJson(Map<String, dynamic> json) =>
return GogsCommitDetail() GogsCommitDetail()
..message = json['message'] as String? ..message = json['message'] as String?
..author = json['author'] == null ..author = json['author'] == null
? null ? null
: GogsCommitAuthor.fromJson(json['author'] as Map<String, dynamic>) : GogsCommitAuthor.fromJson(json['author'] as Map<String, dynamic>)
..committer = json['committer'] == null ..committer = json['committer'] == null
? null ? null
: GogsCommitAuthor.fromJson(json['committer'] as Map<String, dynamic>); : GogsCommitAuthor.fromJson(
} json['committer'] as Map<String, dynamic>);
Map<String, dynamic> _$GogsCommitDetailToJson(GogsCommitDetail instance) => Map<String, dynamic> _$GogsCommitDetailToJson(GogsCommitDetail instance) =>
<String, dynamic>{ <String, dynamic>{
@ -169,13 +157,12 @@ Map<String, dynamic> _$GogsCommitDetailToJson(GogsCommitDetail instance) =>
'committer': instance.committer, 'committer': instance.committer,
}; };
GogsCommitAuthor _$GogsCommitAuthorFromJson(Map<String, dynamic> json) { GogsCommitAuthor _$GogsCommitAuthorFromJson(Map<String, dynamic> json) =>
return GogsCommitAuthor() GogsCommitAuthor()
..name = json['name'] as String? ..name = json['name'] as String?
..email = json['email'] as String? ..email = json['email'] as String?
..date = ..date =
json['date'] == null ? null : DateTime.parse(json['date'] as String); json['date'] == null ? null : DateTime.parse(json['date'] as String);
}
Map<String, dynamic> _$GogsCommitAuthorToJson(GogsCommitAuthor instance) => Map<String, dynamic> _$GogsCommitAuthorToJson(GogsCommitAuthor instance) =>
<String, dynamic>{ <String, dynamic>{
@ -184,26 +171,24 @@ Map<String, dynamic> _$GogsCommitAuthorToJson(GogsCommitAuthor instance) =>
'date': instance.date?.toIso8601String(), 'date': instance.date?.toIso8601String(),
}; };
GogsIssue _$GogsIssueFromJson(Map<String, dynamic> json) { GogsIssue _$GogsIssueFromJson(Map<String, dynamic> json) => GogsIssue()
return GogsIssue() ..number = json['number'] as int?
..number = json['number'] as int? ..state = json['state'] as String?
..state = json['state'] as String? ..title = json['title'] as String?
..title = json['title'] as String? ..body = json['body'] as String?
..body = json['body'] as String? ..user = json['user'] == null
..user = json['user'] == null ? null
? null : GogsUser.fromJson(json['user'] as Map<String, dynamic>)
: GogsUser.fromJson(json['user'] as Map<String, dynamic>) ..labels = (json['labels'] as List<dynamic>?)
..labels = (json['labels'] as List<dynamic>?) ?.map((e) => GogsLabel.fromJson(e as Map<String, dynamic>))
?.map((e) => GogsLabel.fromJson(e as Map<String, dynamic>)) .toList()
.toList() ..createdAt = json['created_at'] == null
..createdAt = json['created_at'] == null ? null
? null : DateTime.parse(json['created_at'] as String)
: DateTime.parse(json['created_at'] as String) ..updatedAt = json['updated_at'] == null
..updatedAt = json['updated_at'] == null ? null
? null : DateTime.parse(json['updated_at'] as String)
: DateTime.parse(json['updated_at'] as String) ..comments = json['comments'] as int?;
..comments = json['comments'] as int?;
}
Map<String, dynamic> _$GogsIssueToJson(GogsIssue instance) => <String, dynamic>{ Map<String, dynamic> _$GogsIssueToJson(GogsIssue instance) => <String, dynamic>{
'number': instance.number, 'number': instance.number,
@ -217,11 +202,9 @@ Map<String, dynamic> _$GogsIssueToJson(GogsIssue instance) => <String, dynamic>{
'comments': instance.comments, 'comments': instance.comments,
}; };
GogsLabel _$GogsLabelFromJson(Map<String, dynamic> json) { GogsLabel _$GogsLabelFromJson(Map<String, dynamic> json) => GogsLabel()
return GogsLabel() ..name = json['name'] as String?
..name = json['name'] as String? ..color = json['color'] as String?;
..color = json['color'] as String?;
}
Map<String, dynamic> _$GogsLabelToJson(GogsLabel instance) => <String, dynamic>{ Map<String, dynamic> _$GogsLabelToJson(GogsLabel instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,

View File

@ -1,31 +1,25 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:git_touch/models/github.dart'; import 'package:git_touch/models/github.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import '../utils/utils.dart';
class NotificationGroup { class NotificationGroup {
NotificationGroup(this.fullName);
String? fullName; String? fullName;
List<GithubNotificationItem> items = []; List<GithubNotificationItem> items = [];
Tuple2<String, String>? _repo; Tuple2<String, String>? _repo;
String get owner { String get owner {
if (_repo == null) { _repo ??= parseRepositoryFullName(fullName!);
_repo = parseRepositoryFullName(fullName!);
}
return _repo!.item1; return _repo!.item1;
} }
String get name { String get name {
if (_repo == null) { _repo ??= parseRepositoryFullName(fullName!);
_repo = parseRepositoryFullName(fullName!);
}
return _repo!.item2; return _repo!.item2;
} }
String get key => '_$hashCode'; String get key => '_$hashCode';
NotificationGroup(this.fullName);
} }
class NotificationModel with ChangeNotifier { class NotificationModel with ChangeNotifier {

View File

@ -1,21 +1,14 @@
import 'package:universal_io/io.dart';
import 'dart:async'; import 'dart:async';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:fimber/fimber.dart'; import 'package:fimber/fimber.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_button.dart';
import 'package:primer/primer.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/S.dart'; import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/utils/utils.dart';
class AppThemeType { import 'package:git_touch/widgets/action_button.dart';
static const material = 0; import 'package:shared_preferences/shared_preferences.dart';
static const cupertino = 1; import 'package:universal_io/io.dart';
static const values = [AppThemeType.material, AppThemeType.cupertino];
}
class AppBrightnessType { class AppBrightnessType {
static const followSystem = 0; static const followSystem = 0;
@ -35,77 +28,48 @@ class AppMarkdownType {
} }
class PickerItem<T> { class PickerItem<T> {
PickerItem(this.value, {required this.text});
final T value; final T value;
final String? text; final String? text;
PickerItem(this.value, {required this.text});
} }
class PickerGroupItem<T> { class PickerGroupItem<T> {
final T value;
final List<PickerItem<T>> items;
final Function(T value)? onChange;
final Function(T value)? onClose;
PickerGroupItem({ PickerGroupItem({
required this.value, required this.value,
required this.items, required this.items,
this.onChange, this.onChange,
this.onClose, this.onClose,
}); });
final T value;
final List<PickerItem<T>> items;
final Function(T value)? onChange;
final Function(T value)? onClose;
} }
class SelectorItem<T> { class SelectorItem<T> {
SelectorItem({required this.value, required this.text});
T value; T value;
String text; String text;
SelectorItem({required this.value, required this.text});
} }
// No animation. For replacing route // No animation. For replacing route
// TODO: Go back // TODO: Go back
class StaticRoute extends PageRouteBuilder { class StaticRoute extends PageRouteBuilder {
final WidgetBuilder? builder;
StaticRoute({this.builder}) StaticRoute({this.builder})
: super( : super(
pageBuilder: (BuildContext context, Animation<double> animation, pageBuilder: (context, animation, secondaryAnimation) {
Animation<double> secondaryAnimation) {
return builder!(context); return builder!(context);
}, },
transitionsBuilder: (BuildContext context, transitionsBuilder: (context, animation, secondaryAnimation, child) {
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
return child; return child;
}, },
); );
} final WidgetBuilder? builder;
class Palette {
final Color primary;
final Color text;
final Color secondaryText;
final Color tertiaryText;
final Color background;
final Color grayBackground;
final Color border;
const Palette({
required this.primary,
required this.text,
required this.secondaryText,
required this.tertiaryText,
required this.background,
required this.grayBackground,
required this.border,
});
} }
class ThemeModel with ChangeNotifier { class ThemeModel with ChangeNotifier {
String? markdownCss; String? markdownCss;
int? _theme;
int? get theme => _theme;
bool get ready => _theme != null;
Brightness systemBrightness = Brightness.light; Brightness systemBrightness = Brightness.light;
void setSystemBrightness(Brightness v) { void setSystemBrightness(Brightness v) {
if (v != systemBrightness) { if (v != systemBrightness) {
@ -177,51 +141,11 @@ class ThemeModel with ChangeNotifier {
notifyListeners(); notifyListeners();
} }
final router = FluroRouter();
final paletteLight = Palette(
primary: PrimerColors.blue500,
text: Colors.black,
secondaryText: Colors.grey.shade800,
tertiaryText: Colors.grey.shade600,
background: Colors.white,
grayBackground: Colors.grey.shade100,
border: Colors.grey.shade300,
);
final paletteDark = Palette(
primary: PrimerColors.blue500,
text: Colors.grey.shade300,
secondaryText: Colors.grey.shade400,
tertiaryText: Colors.grey.shade500,
background: Colors.black,
grayBackground: Colors.grey.shade900,
border: Colors.grey.shade700,
);
Palette get palette {
switch (brightness) {
case Brightness.dark:
return paletteDark;
case Brightness.light:
default:
return paletteLight;
}
}
Future<void> init() async { Future<void> init() async {
markdownCss = await rootBundle.loadString('images/github-markdown.css'); markdownCss = await rootBundle.loadString('images/github-markdown.css');
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final v = prefs.getInt(StorageKeys.iTheme);
Fimber.d('read theme: $v');
if (AppThemeType.values.contains(v)) {
_theme = v;
} else if (Platform.isIOS || Platform.isMacOS) {
_theme = AppThemeType.cupertino;
} else {
_theme = AppThemeType.material;
}
final b = prefs.getInt(StorageKeys.iBrightness); final b = prefs.getInt(StorageKeys.iBrightness);
Fimber.d('read brightness: $b'); Fimber.d('read brightness: $b');
if (AppBrightnessType.values.contains(b)) { if (AppBrightnessType.values.contains(b)) {
@ -239,49 +163,6 @@ class ThemeModel with ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<void> setTheme(int v) async {
_theme = v;
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(StorageKeys.iTheme, v);
Fimber.d('write theme: $v');
notifyListeners();
}
push(BuildContext context, String url, {bool replace = false}) {
// Fimber.d(url);
if (url.startsWith('/')) {
return router.navigateTo(
context,
url,
transition: theme == AppThemeType.cupertino
? TransitionType.cupertino
: TransitionType.material,
replace: replace,
);
} else {
launchUrl(url);
}
}
Future<void> showWarning(BuildContext context, String message) async {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text(message),
actions: <Widget>[
CupertinoDialogAction(
child: const Text('OK'),
onPressed: () {
Navigator.pop(context, true);
},
),
],
);
},
);
}
Future<bool?> showConfirm(BuildContext context, Widget content) { Future<bool?> showConfirm(BuildContext context, Widget content) {
return showCupertinoDialog( return showCupertinoDialog(
context: context, context: context,
@ -290,11 +171,11 @@ class ThemeModel with ChangeNotifier {
title: content, title: content,
actions: <Widget>[ actions: <Widget>[
CupertinoDialogAction( CupertinoDialogAction(
child: const Text('cancel'),
isDefaultAction: true, isDefaultAction: true,
onPressed: () { onPressed: () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
child: const Text('cancel'),
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: const Text('OK'), child: const Text('OK'),
@ -306,37 +187,15 @@ class ThemeModel with ChangeNotifier {
); );
}, },
); );
// default:
// return showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// content: content,
// actions: <Widget>[
// FlatButton(
// child: const Text('CANCEL'),
// onPressed: () {
// Navigator.pop(context, false);
// },
// ),
// FlatButton(
// child: const Text('OK'),
// onPressed: () {
// Navigator.pop(context, true);
// },
// )
// ],
// );
// },
// );
} }
static Timer? _debounce; static Timer? _debounce;
String? _selectedItem; String? _selectedItem;
showPicker(BuildContext context, PickerGroupItem<String?> groupItem) async { showPicker(BuildContext context, PickerGroupItem<String?> groupItem) async {
await showCupertinoModalPopup( await AntPopup.show(
context: context, context: context,
closeOnMaskClick: true,
builder: (context) { builder: (context) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -344,10 +203,10 @@ class ThemeModel with ChangeNotifier {
Container( Container(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
decoration: BoxDecoration( decoration: BoxDecoration(
color: palette.background, color: AntTheme.of(context).colorBackground,
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: palette.grayBackground, color: AntTheme.of(context).colorBox,
width: 0.0, width: 0.0,
), ),
), ),
@ -356,7 +215,6 @@ class ThemeModel with ChangeNotifier {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: Text('Cancel'),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
_selectedItem = groupItem.value; _selectedItem = groupItem.value;
@ -365,9 +223,9 @@ class ThemeModel with ChangeNotifier {
horizontal: 16.0, horizontal: 16.0,
vertical: 5.0, vertical: 5.0,
), ),
child: const Text('Cancel'),
), ),
CupertinoButton( CupertinoButton(
child: Text('Confirm'),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
groupItem.onClose!(_selectedItem); groupItem.onClose!(_selectedItem);
@ -376,18 +234,15 @@ class ThemeModel with ChangeNotifier {
horizontal: 16.0, horizontal: 16.0,
vertical: 5.0, vertical: 5.0,
), ),
child: const Text('Confirm'),
) )
], ],
), ),
), ),
Container( SizedBox(
height: 216, height: 216,
child: CupertinoPicker( child: CupertinoPicker(
backgroundColor: palette.background, backgroundColor: AntTheme.of(context).colorBackground,
children: <Widget>[
for (var v in groupItem.items)
Text(v.text!, style: TextStyle(color: palette.text)),
],
itemExtent: 40, itemExtent: 40,
scrollController: FixedExtentScrollController( scrollController: FixedExtentScrollController(
initialItem: groupItem.items initialItem: groupItem.items
@ -406,6 +261,12 @@ class ThemeModel with ChangeNotifier {
}); });
} }
}, },
children: <Widget>[
for (var v in groupItem.items)
Text(v.text!,
style:
TextStyle(color: AntTheme.of(context).colorText)),
],
), ),
) )
], ],
@ -415,33 +276,23 @@ class ThemeModel with ChangeNotifier {
} }
showActions(BuildContext context, List<ActionItem> actionItems) async { showActions(BuildContext context, List<ActionItem> actionItems) async {
final value = await showCupertinoModalPopup<int>( await AntActionSheet.show(
context: context, context: context,
builder: (BuildContext context) { extra: const Text('Actions'),
return CupertinoActionSheet( actions: [
title: Text('Actions'), for (final item in actionItems)
actions: actionItems.asMap().entries.map((entry) { AntActionSheetAction(
return CupertinoActionSheetAction( text: Text(
child: Text(entry.value.text!), item.text!,
isDestructiveAction: entry.value.isDestructiveAction, style: TextStyle(
onPressed: () { color: item.danger ? AntTheme.of(context).colorDanger : null),
Navigator.pop(context, entry.key); ),
}, onClick: () {
); item.onTap?.call(context);
}).toList(),
cancelButton: CupertinoActionSheetAction(
child: const Text('Cancel'),
isDefaultAction: true,
onPressed: () {
Navigator.pop(context);
}, },
key: null,
), ),
); ],
},
); );
if (value != null) {
actionItems[value].onTap!(context);
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,16 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class CommonScaffold extends StatelessWidget { class CommonScaffold extends StatelessWidget {
final Widget title; const CommonScaffold({
final Widget body;
final Widget? action;
final PreferredSizeWidget? bottom;
CommonScaffold({
required this.title, required this.title,
required this.body, required this.body,
this.action, this.action,
this.bottom,
}); });
final Widget title;
final Widget body;
final Widget? action;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -22,26 +18,12 @@ class CommonScaffold extends StatelessWidget {
// FIXME: A hack to get brightness before MaterialApp been built // FIXME: A hack to get brightness before MaterialApp been built
theme.setSystemBrightness(MediaQuery.of(context).platformBrightness); theme.setSystemBrightness(MediaQuery.of(context).platformBrightness);
switch (theme.theme) { return CupertinoPageScaffold(
case AppThemeType.cupertino: navigationBar: CupertinoNavigationBar(
return CupertinoPageScaffold( middle: title,
navigationBar: CupertinoNavigationBar( trailing: action,
middle: title, ),
trailing: action, child: SafeArea(child: body),
), );
child: SafeArea(child: body),
);
default:
return Scaffold(
appBar: AppBar(
title: title,
actions: [
if (action != null) action!,
],
bottom: bottom,
),
body: body,
);
}
} }
} }

View File

@ -1,31 +1,28 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart'; import 'package:git_touch/widgets/empty.dart';
import 'package:git_touch/widgets/error_reload.dart'; import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/loading.dart'; import 'package:git_touch/widgets/loading.dart';
import 'package:git_touch/widgets/empty.dart';
export 'package:git_touch/utils/utils.dart'; export 'package:git_touch/utils/utils.dart';
// This is a scaffold for infinite scroll screens // This is a scaffold for infinite scroll screens
class ListStatefulScaffold<T, K> extends StatefulWidget { class ListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title; const ListStatefulScaffold({
final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
ListStatefulScaffold({
required this.title, required this.title,
required this.fetch, required this.fetch,
required this.itemBuilder, required this.itemBuilder,
this.actionBuilder, this.actionBuilder,
}); });
final Widget title;
final Widget Function()? actionBuilder;
final Widget Function(T payload) itemBuilder;
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
@override @override
_ListStatefulScaffoldState<T, K> createState() => State<ListStatefulScaffold<T, K>> createState() =>
_ListStatefulScaffoldState(); _ListStatefulScaffoldState();
} }
@ -39,7 +36,7 @@ class _ListStatefulScaffoldState<T, K>
K? cursor; K? cursor;
bool? hasMore; bool? hasMore;
ScrollController _controller = ScrollController(); final ScrollController _controller = ScrollController();
@override @override
void initState() { void initState() {
@ -69,13 +66,13 @@ class _ListStatefulScaffoldState<T, K>
loading = true; loading = true;
}); });
try { try {
final ListPayload<T, K> p = await widget.fetch(null); final p = await widget.fetch(null);
items = p.items.toList(); items = p.items.toList();
cursor = p.cursor; cursor = p.cursor;
hasMore = p.hasMore; hasMore = p.hasMore;
} catch (err) { } catch (err) {
error = err.toString(); error = err.toString();
throw err; rethrow;
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -91,13 +88,13 @@ class _ListStatefulScaffoldState<T, K>
loadingMore = true; loadingMore = true;
}); });
try { try {
ListPayload<T, K> p = await widget.fetch(cursor); final p = await widget.fetch(cursor);
items.addAll(p.items); items.addAll(p.items);
cursor = p.cursor; cursor = p.cursor;
hasMore = p.hasMore; hasMore = p.hasMore;
} catch (err) { } catch (err) {
error = err.toString(); error = err.toString();
throw err; rethrow;
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -107,82 +104,45 @@ class _ListStatefulScaffoldState<T, K>
} }
} }
Widget _buildItem(BuildContext context, int index) {
if (index == 2 * items.length) {
if (hasMore != false) {
return Loading(more: true);
} else {
return Container();
}
} else if (index % 2 == 1) {
return CommonStyle.border;
} else {
return widget.itemBuilder(items[index ~/ 2]);
}
}
Widget _buildCupertinoSliver() { Widget _buildCupertinoSliver() {
if (error.isNotEmpty) { if (error.isNotEmpty) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: ErrorReload(text: error, onTap: _refresh), child: ErrorReload(text: error, onTap: _refresh),
); );
} else if (loading && items.isEmpty) { } else if (loading && items.isEmpty) {
return SliverToBoxAdapter(child: Loading(more: false)); return const SliverToBoxAdapter(child: Loading(more: false));
} else if (items.isEmpty) { } else if (items.isEmpty) {
return SliverToBoxAdapter(child: EmptyWidget()); return SliverToBoxAdapter(child: EmptyWidget());
} else { } else {
return SliverList( return AntSliverList(
delegate: SliverChildBuilderDelegate( count: items.length + 1,
_buildItem, itemBuilder: (context, index) {
childCount: 2 * items.length + 1, if (index == items.length) {
), if (hasMore != false) {
return const Loading(more: true);
} else {
return Container();
}
}
return widget.itemBuilder(items[index]);
},
); );
} }
} }
Widget _buildMaterial() {
if (error.isNotEmpty) {
return ErrorReload(text: error, onTap: _refresh);
} else if (loading && items.isEmpty) {
return Loading(more: false);
} else if (items.isEmpty) {
return EmptyWidget();
} else {
return Scrollbar(
child: ListView.builder(
controller: _controller,
itemCount: 2 * items.length + 1,
itemBuilder: _buildItem,
),
);
}
}
Widget _buildBody() {
switch (Provider.of<ThemeModel>(context).theme) {
case AppThemeType.cupertino:
return CupertinoScrollbar(
child: CustomScrollView(
controller: _controller,
slivers: [
CupertinoSliverRefreshControl(onRefresh: _refresh),
_buildCupertinoSliver(),
],
),
);
default:
return RefreshIndicator(
onRefresh: _refresh,
child: _buildMaterial(),
);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CommonScaffold( return CommonScaffold(
title: widget.title, title: widget.title,
body: _buildBody(), body: CupertinoScrollbar(
child: CustomScrollView(
controller: _controller,
slivers: [
CupertinoSliverRefreshControl(onRefresh: _refresh),
_buildCupertinoSliver(),
],
),
),
action: widget.actionBuilder?.call(), action: widget.actionBuilder?.call(),
); );
} }

View File

@ -1,20 +1,11 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart'; import 'package:git_touch/widgets/error_reload.dart';
import '../widgets/loading.dart'; import 'package:git_touch/widgets/link.dart';
import '../widgets/link.dart'; import 'package:git_touch/widgets/loading.dart';
import '../widgets/error_reload.dart';
class LongListPayload<T, K> { class LongListPayload<T, K> {
T header;
int totalCount;
String? cursor;
List<K> leadingItems;
List<K>? trailingItems;
LongListPayload({ LongListPayload({
required this.header, required this.header,
required this.totalCount, required this.totalCount,
@ -22,6 +13,11 @@ class LongListPayload<T, K> {
required this.leadingItems, required this.leadingItems,
this.trailingItems, this.trailingItems,
}); });
T header;
int totalCount;
String? cursor;
List<K> leadingItems;
List<K>? trailingItems;
} }
// This is a scaffold for issue and pull request // This is a scaffold for issue and pull request
@ -29,14 +25,7 @@ class LongListPayload<T, K> {
// We should load leading and trailing items at first fetching, and do load more in the middle // We should load leading and trailing items at first fetching, and do load more in the middle
// e.g. https://github.com/reactjs/rfcs/pull/68 // e.g. https://github.com/reactjs/rfcs/pull/68
class LongListStatefulScaffold<T, K> extends StatefulWidget { class LongListStatefulScaffold<T, K> extends StatefulWidget {
final Widget title; const LongListStatefulScaffold({
final Widget Function(T t)? trailingBuilder;
final Widget Function(T t) headerBuilder;
final Widget Function(K k) itemBuilder;
final Future<LongListPayload<T, K>> Function() onRefresh;
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
LongListStatefulScaffold({
required this.title, required this.title,
this.trailingBuilder, this.trailingBuilder,
required this.headerBuilder, required this.headerBuilder,
@ -44,9 +33,15 @@ class LongListStatefulScaffold<T, K> extends StatefulWidget {
required this.onRefresh, required this.onRefresh,
required this.onLoadMore, required this.onLoadMore,
}); });
final Widget title;
final Widget Function(T t)? trailingBuilder;
final Widget Function(T t) headerBuilder;
final Widget Function(K k) itemBuilder;
final Future<LongListPayload<T, K>> Function() onRefresh;
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
@override @override
_LongListStatefulScaffoldState<T, K> createState() => State<LongListStatefulScaffold<T, K>> createState() =>
_LongListStatefulScaffoldState(); _LongListStatefulScaffoldState();
} }
@ -74,7 +69,7 @@ class _LongListStatefulScaffoldState<T, K>
payload = await widget.onRefresh(); payload = await widget.onRefresh();
} catch (err) { } catch (err) {
error = err.toString(); error = err.toString();
throw err; rethrow;
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -90,11 +85,10 @@ class _LongListStatefulScaffoldState<T, K>
loadingMore = true; loadingMore = true;
}); });
try { try {
LongListPayload<T?, K> _payload = final LongListPayload<T?, K> p = await widget.onLoadMore(payload!.cursor);
await widget.onLoadMore(payload!.cursor); payload!.totalCount = p.totalCount;
payload!.totalCount = _payload.totalCount; payload!.cursor = p.cursor;
payload!.cursor = _payload.cursor; payload!.leadingItems.addAll(p.leadingItems);
payload!.leadingItems.addAll(_payload.leadingItems);
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -105,18 +99,16 @@ class _LongListStatefulScaffoldState<T, K>
} }
Widget _buildItem(BuildContext context, int index) { Widget _buildItem(BuildContext context, int index) {
final theme = Provider.of<ThemeModel>(context);
if (index % 2 == 1) { if (index % 2 == 1) {
return CommonStyle.border; return CommonStyle.border;
} }
int realIndex = index ~/ 2; final realIndex = index ~/ 2;
if (realIndex < payload!.leadingItems.length) { if (realIndex < payload!.leadingItems.length) {
return widget.itemBuilder(payload!.leadingItems[realIndex]); return widget.itemBuilder(payload!.leadingItems[realIndex]);
} else if (realIndex == payload!.leadingItems.length) { } else if (realIndex == payload!.leadingItems.length) {
var count = payload!.totalCount - final count = payload!.totalCount -
payload!.leadingItems.length + payload!.leadingItems.length +
payload!.trailingItems!.length; payload!.trailingItems!.length;
return Container( return Container(
@ -127,20 +119,21 @@ class _LongListStatefulScaffoldState<T, K>
child: Container( child: Container(
padding: CommonStyle.padding, padding: CommonStyle.padding,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: theme.palette.text), border: Border.all(color: AntTheme.of(context).colorText),
), ),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text('$count hidden items', Text('$count hidden items',
style: style: TextStyle(
TextStyle(color: theme.palette.text, fontSize: 15)), color: AntTheme.of(context).colorText, fontSize: 15)),
Padding(padding: EdgeInsets.only(top: 4)), const Padding(padding: EdgeInsets.only(top: 4)),
loadingMore loadingMore
? CupertinoActivityIndicator() ? const CupertinoActivityIndicator()
: Text( : Text(
'Load more...', 'Load more...',
style: TextStyle( style: TextStyle(
color: theme.palette.primary, fontSize: 16), color: AntTheme.of(context).colorPrimary,
fontSize: 16),
), ),
], ],
), ),
@ -155,7 +148,7 @@ class _LongListStatefulScaffoldState<T, K>
} }
int get _itemCount { int get _itemCount {
int count = payload!.leadingItems.length + payload!.trailingItems!.length; var count = payload!.leadingItems.length + payload!.trailingItems!.length;
if (payload!.totalCount > count) { if (payload!.totalCount > count) {
count++; count++;
} }
@ -168,7 +161,7 @@ class _LongListStatefulScaffoldState<T, K>
child: ErrorReload(text: error, onTap: _refresh)); child: ErrorReload(text: error, onTap: _refresh));
} else if (loading) { } else if (loading) {
// TODO: // TODO:
return SliverToBoxAdapter(child: Loading(more: false)); return const SliverToBoxAdapter(child: Loading(more: false));
} else { } else {
return SliverList( return SliverList(
delegate: delegate:
@ -179,51 +172,27 @@ class _LongListStatefulScaffoldState<T, K>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (Provider.of<ThemeModel>(context).theme) { final slivers = <Widget>[
case AppThemeType.cupertino: CupertinoSliverRefreshControl(onRefresh: _refresh)
List<Widget> slivers = [ ];
CupertinoSliverRefreshControl(onRefresh: _refresh) if (payload != null) {
]; slivers.add(
if (payload != null) { SliverToBoxAdapter(child: widget.headerBuilder(payload!.header)),
slivers.add( );
SliverToBoxAdapter(child: widget.headerBuilder(payload!.header)),
);
}
slivers.add(_buildSliver());
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: widget.title,
trailing: payload == null
? null
: widget.trailingBuilder!(payload!.header),
),
child: SafeArea(
child: CupertinoScrollbar(
child: CustomScrollView(slivers: slivers),
),
),
);
default:
return Scaffold(
appBar: AppBar(
title: widget.title,
actions: payload == null
? null
: [widget.trailingBuilder!(payload!.header)],
),
body: RefreshIndicator(
onRefresh: _refresh,
child: Scrollbar(
child: CustomScrollView(slivers: [
if (payload != null)
SliverToBoxAdapter(
child: widget.headerBuilder(payload!.header)),
_buildSliver(),
]),
),
),
);
} }
slivers.add(_buildSliver());
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: widget.title,
trailing:
payload == null ? null : widget.trailingBuilder!(payload!.header),
),
child: SafeArea(
child: CupertinoScrollbar(
child: CustomScrollView(slivers: slivers),
),
),
);
} }
} }

View File

@ -1,18 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/scaffolds/utils.dart'; import 'package:git_touch/scaffolds/utils.dart';
class RefreshStatefulScaffold<T> extends StatefulWidget { class RefreshStatefulScaffold<T> extends StatefulWidget {
final Widget title; const RefreshStatefulScaffold({
final Widget? Function(T data, void Function(T newData) setData) bodyBuilder;
final Future<T> Function() fetch;
final Widget? Function(T data, void Function(T newData) setData)?
actionBuilder;
final Widget? action;
final canRefresh;
RefreshStatefulScaffold({
required this.title, required this.title,
required this.bodyBuilder, required this.bodyBuilder,
required this.fetch, required this.fetch,
@ -20,9 +12,16 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
this.action, this.action,
this.canRefresh = true, this.canRefresh = true,
}) : assert(actionBuilder == null || action == null); }) : assert(actionBuilder == null || action == null);
final Widget title;
final Widget? Function(T data, void Function(T newData) setData) bodyBuilder;
final Future<T> Function() fetch;
final Widget? Function(T data, void Function(T newData) setData)?
actionBuilder;
final Widget? action;
final bool canRefresh;
@override @override
_RefreshStatefulScaffoldState<T> createState() => State<RefreshStatefulScaffold<T>> createState() =>
_RefreshStatefulScaffoldState(); _RefreshStatefulScaffoldState();
} }
@ -48,7 +47,7 @@ class _RefreshStatefulScaffoldState<T>
_data = await widget.fetch(); _data = await widget.fetch();
} catch (err) { } catch (err) {
_error = err.toString(); _error = err.toString();
throw err; rethrow;
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -61,7 +60,7 @@ class _RefreshStatefulScaffoldState<T>
Widget? get _action { Widget? get _action {
if (widget.action != null) return widget.action; if (widget.action != null) return widget.action;
if (widget.actionBuilder == null || _data == null) return null; if (widget.actionBuilder == null || _data == null) return null;
return widget.actionBuilder!(_data!, (v) { return widget.actionBuilder!(_data as T, (v) {
setState(() { setState(() {
_data = v; _data = v;
}); });
@ -71,7 +70,7 @@ class _RefreshStatefulScaffoldState<T>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget child = ErrorLoadingWrapper( Widget child = ErrorLoadingWrapper(
bodyBuilder: () => widget.bodyBuilder(_data!, (v) { bodyBuilder: () => widget.bodyBuilder(_data as T, (v) {
setState(() { setState(() {
_data = v; _data = v;
}); });

View File

@ -1,22 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
class SingleScaffold extends StatelessWidget { class SingleScaffold extends StatelessWidget {
final Widget title; const SingleScaffold({
final Widget body;
final Widget? action;
SingleScaffold({
required this.title, required this.title,
required this.body, required this.body,
this.action, this.action,
}); });
final Widget title;
final Widget body;
final Widget? action;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CommonScaffold( return CommonScaffold(
title: title, title: title,
body: Scrollbar(child: SingleChildScrollView(child: body)), body: CupertinoScrollbar(child: SingleChildScrollView(child: body)),
action: action, action: action,
); );
} }

View File

@ -1,20 +1,9 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/scaffolds/utils.dart'; import 'package:git_touch/scaffolds/utils.dart';
import 'package:provider/provider.dart';
class TabScaffold extends StatelessWidget { class TabScaffold extends StatelessWidget {
final Widget title; const TabScaffold({
final Widget body;
final Widget? action;
final void Function() onRefresh;
final List<String> tabs;
final int activeTab;
final Function(int index) onTabSwitch;
TabScaffold({
required this.title, required this.title,
required this.body, required this.body,
this.action, this.action,
@ -23,57 +12,41 @@ class TabScaffold extends StatelessWidget {
required this.activeTab, required this.activeTab,
required this.onTabSwitch, required this.onTabSwitch,
}); });
final Widget title;
Widget _buildTitle(BuildContext context) { final Widget body;
switch (Provider.of<ThemeModel>(context).theme) { final Widget? action;
case AppThemeType.cupertino: final void Function() onRefresh;
return DefaultTextStyle( final List<String> tabs;
style: DefaultTextStyle.of(context).style.copyWith(fontSize: 14), final int activeTab;
child: Row( final Function(int index) onTabSwitch;
children: [
Expanded(
child: CupertinoSlidingSegmentedControl<int>(
groupValue: activeTab,
onValueChanged: (v) {
if (v == null) return;
onTabSwitch(v);
},
children: tabs.asMap().map((key, text) => MapEntry(
key,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(text),
))),
),
),
],
),
);
default:
return title;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final scaffold = CommonScaffold( return CommonScaffold(
title: _buildTitle(context), title: DefaultTextStyle(
style: DefaultTextStyle.of(context).style.copyWith(fontSize: 14),
child: Row(
children: [
Expanded(
child: CupertinoSlidingSegmentedControl<int>(
groupValue: activeTab,
onValueChanged: (v) {
if (v == null) return;
onTabSwitch(v);
},
children: tabs.asMap().map((key, text) => MapEntry(
key,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(text),
))),
),
),
],
),
),
body: RefreshWrapper(body: body, onRefresh: onRefresh), body: RefreshWrapper(body: body, onRefresh: onRefresh),
// action: action, // TODO: // action: action, // TODO:
bottom: TabBar(
onTap: onTabSwitch,
tabs: tabs.map((text) => Tab(text: text.toUpperCase())).toList(),
),
); );
switch (Provider.of<ThemeModel>(context).theme) {
case AppThemeType.cupertino:
return scaffold;
default:
return DefaultTabController(
length: tabs.length,
child: scaffold,
);
}
} }
} }

View File

@ -1,25 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/scaffolds/tab.dart'; import 'package:git_touch/scaffolds/tab.dart';
import 'package:git_touch/scaffolds/utils.dart'; import 'package:git_touch/scaffolds/utils.dart';
class TabStatefulScaffold<T> extends StatefulWidget { class TabStatefulScaffold<T> extends StatefulWidget {
final Widget title; const TabStatefulScaffold({
final Widget Function(T payload, int activeTab) bodyBuilder;
final Future<T> Function(int activeTab) fetchData;
final List<String> tabs;
final Widget Function(T payload, void Function() refresh)? actionBuilder;
TabStatefulScaffold({
required this.title, required this.title,
required this.bodyBuilder, required this.bodyBuilder,
required this.fetchData, required this.fetchData,
required this.tabs, required this.tabs,
this.actionBuilder, this.actionBuilder,
}); });
final Widget title;
final Widget Function(T payload, int activeTab) bodyBuilder;
final Future<T> Function(int activeTab) fetchData;
final List<String> tabs;
final Widget Function(T payload, void Function() refresh)? actionBuilder;
@override @override
_TabStatefulScaffoldState<T> createState() => _TabStatefulScaffoldState(); State<TabStatefulScaffold<T>> createState() => _TabStatefulScaffoldState();
} }
class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> { class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
@ -74,7 +73,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
_payload = await widget.fetchData(_activeTab); _payload = await widget.fetchData(_activeTab);
} catch (err) { } catch (err) {
_error = err.toString(); _error = err.toString();
throw err; rethrow;
} finally { } finally {
if (mounted) { if (mounted) {
setState(() { setState(() {
@ -90,7 +89,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
title: widget.title, title: widget.title,
action: widget.actionBuilder == null action: widget.actionBuilder == null
? null ? null
: widget.actionBuilder!(_payload!, _refresh), : widget.actionBuilder!(_payload as T, _refresh),
tabs: widget.tabs, tabs: widget.tabs,
activeTab: _activeTab, activeTab: _activeTab,
onTabSwitch: (selected) async { onTabSwitch: (selected) async {
@ -105,7 +104,7 @@ class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {
}, },
onRefresh: _refresh, onRefresh: _refresh,
body: ErrorLoadingWrapper( body: ErrorLoadingWrapper(
bodyBuilder: () => widget.bodyBuilder(_payload!, _activeTab), bodyBuilder: () => widget.bodyBuilder(_payload as T, _activeTab),
error: _error, error: _error,
loading: _payload == null, loading: _payload == null,
reload: _refresh, reload: _refresh,

View File

@ -1,55 +1,40 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/error_reload.dart'; import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/loading.dart'; import 'package:git_touch/widgets/loading.dart';
import 'package:provider/provider.dart';
class RefreshWrapper extends StatelessWidget { class RefreshWrapper extends StatelessWidget {
final Widget body; const RefreshWrapper({
final void Function() onRefresh;
RefreshWrapper({
required this.onRefresh, required this.onRefresh,
required this.body, required this.body,
}); });
final Widget body;
final void Function() onRefresh;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (Provider.of<ThemeModel>(context).theme) { return CupertinoScrollbar(
case AppThemeType.cupertino: child: CustomScrollView(
return CupertinoScrollbar( slivers: <Widget>[
child: CustomScrollView( CupertinoSliverRefreshControl(
slivers: <Widget>[ onRefresh: onRefresh as Future<void> Function()?),
CupertinoSliverRefreshControl( SliverToBoxAdapter(child: body),
onRefresh: onRefresh as Future<void> Function()?), ],
SliverToBoxAdapter(child: body), ),
], );
),
);
default:
return RefreshIndicator(
onRefresh: onRefresh as Future<void> Function(),
child: Scrollbar(
child: SingleChildScrollView(child: body),
),
);
}
} }
} }
class ErrorLoadingWrapper extends StatelessWidget { class ErrorLoadingWrapper extends StatelessWidget {
final String error; const ErrorLoadingWrapper({
final bool loading;
final void Function() reload;
final Widget? Function() bodyBuilder;
ErrorLoadingWrapper({
required this.error, required this.error,
required this.loading, required this.loading,
required this.reload, required this.reload,
required this.bodyBuilder, required this.bodyBuilder,
}); });
final String error;
final bool loading;
final void Function() reload;
final Widget? Function() bodyBuilder;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -58,7 +43,7 @@ class ErrorLoadingWrapper extends StatelessWidget {
} }
if (loading) { if (loading) {
return Loading(); return const Loading();
} }
return bodyBuilder()!; return bodyBuilder()!;

View File

@ -1,69 +0,0 @@
// import 'package:flutter/material.dart';
// import 'package:git_touch/models/theme.dart';
// import 'package:git_touch/scaffolds/single.dart';
// import 'package:git_touch/widgets/app_bar_title.dart';
// import 'package:git_touch/widgets/table_view.dart';
// import 'package:launch_review/launch_review.dart';
// import 'package:package_info/package_info.dart';
// import 'package:provider/provider.dart';
// /// Unused
// class AboutScreen extends StatefulWidget {
// @override
// _AboutScreenState createState() => _AboutScreenState();
// }
// class _AboutScreenState extends State<AboutScreen> {
// var _version = '';
// @override
// void initState() {
// super.initState();
// PackageInfo.fromPlatform().then((info) {
// setState(() {
// _version = info.version;
// });
// });
// }
// @override
// Widget build(BuildContext context) {
// final theme = Provider.of<ThemeModel>(context);
// return SingleScaffold(
// title: AppBarTitle('About'),
// body: Column(
// children: <Widget>[
// SizedBox(height: 32),
// ClipRRect(
// borderRadius: BorderRadius.circular(24),
// child: Image.asset(
// 'images/icon.png',
// width: 96,
// ),
// ),
// SizedBox(height: 12),
// Text(
// 'GitTouch',
// style: TextStyle(fontSize: 20, color: theme.palette.text),
// ),
// SizedBox(height: 48),
// TableView(items: [
// TableViewItem(text: Text('Version'), rightWidget: Text(_version)),
// TableViewItem(text: Text('Source Code'), url: '/pd4d10/git-touch'),
// TableViewItem(
// text: Text('Feedback'), url: '/pd4d10/git-touch/issues/new'),
// TableViewItem(
// text: Text('Rate This App'),
// onTap: () {
// LaunchReview.launch(
// androidAppId: 'io.github.pd4d10.gittouch',
// iOSAppId: '1452042346',
// );
// },
// ),
// ]),
// ],
// ),
// );
// }
// }

View File

@ -1,24 +1,22 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/commit_item.dart'; import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbCommitsScreen extends StatelessWidget { class BbCommitsScreen extends StatelessWidget {
const BbCommitsScreen(this.owner, this.name, this.ref);
final String owner; final String owner;
final String name; final String name;
final String ref; final String ref;
BbCommitsScreen(this.owner, this.name, this.ref);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbCommit, String?>( return ListStatefulScaffold<BbCommit, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.commits), title: Text(AppLocalizations.of(context)!.commits),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/commits/$ref'); nextUrl ?? '/repositories/$owner/$name/commits/$ref');

View File

@ -1,18 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart'; import 'package:git_touch/widgets/repo_item.dart';
import 'package:git_touch/widgets/repository_item.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbExploreScreen extends StatelessWidget { class BbExploreScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<BbRepo, String?>( return ListStatefulScaffold<BbRepo, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.explore), title: Text(AppLocalizations.of(context)!.explore),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories?role=member&sort=-updated_on'); nextUrl ?? '/repositories?role=member&sort=-updated_on');
@ -25,7 +23,7 @@ class BbExploreScreen extends StatelessWidget {
); );
}, },
itemBuilder: (v) { itemBuilder: (v) {
return RepositoryItem.bb(payload: v); return RepoItem.bb(payload: v);
}, },
); );
} }

View File

@ -1,29 +1,29 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart'; import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/avatar.dart'; import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/comment_item.dart'; import 'package:git_touch/widgets/comment_item.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:primer/primer.dart'; import 'package:primer/primer.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
class BbIssueScreen extends StatelessWidget { class BbIssueScreen extends StatelessWidget {
const BbIssueScreen(this.owner, this.name, this.number, {this.isPr = false});
final String owner; final String owner;
final String name; final String name;
final String number; final String number;
final bool isPr; final bool isPr;
BbIssueScreen(this.owner, this.name, this.number, {this.isPr: false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<BbIssues, Iterable<BbComment>>>( return RefreshStatefulScaffold<Tuple2<BbIssues, Iterable<BbComment>>>(
title: Text("Issue: #$number"), title: Text('Issue: #$number'),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final res = await Future.wait([ final res = await Future.wait([
@ -45,7 +45,6 @@ class BbIssueScreen extends StatelessWidget {
bodyBuilder: (data, _) { bodyBuilder: (data, _) {
final issue = data.item1; final issue = data.item1;
final comments = data.item2; final comments = data.item2;
final theme = context.read<ThemeModel>();
return Column(children: <Widget>[ return Column(children: <Widget>[
Container( Container(
padding: CommonStyle.padding, padding: CommonStyle.padding,
@ -60,43 +59,43 @@ class BbIssueScreen extends StatelessWidget {
url: issue.reporter!.avatarUrl, url: issue.reporter!.avatarUrl,
size: AvatarSize.extraSmall, size: AvatarSize.extraSmall,
), ),
SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
'$owner / $name', '$owner / $name',
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: theme.palette.secondaryText, color: AntTheme.of(context).colorTextSecondary,
), ),
), ),
SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
'#$number', '#$number',
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: theme.palette.tertiaryText, color: AntTheme.of(context).colorWeak,
), ),
), ),
], ],
), ),
), ),
SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
issue.title!, issue.title!,
style: TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
SizedBox(height: 8), const SizedBox(height: 8),
StateLabel(StateLabelStatus.issueOpened), StateLabel(StateLabelStatus.issueOpened),
SizedBox(height: 16), const SizedBox(height: 16),
CommonStyle.border, CommonStyle.border,
], ],
)), )),
Column(children: [ Column(children: [
for (var comment in comments) ...[ for (var comment in comments) ...[
Padding( Padding(
padding: EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: CommentItem( child: CommentItem(
avatar: Avatar( avatar: Avatar(
url: comment.user!.avatarUrl, url: comment.user!.avatarUrl,
@ -107,7 +106,7 @@ class BbIssueScreen extends StatelessWidget {
login: comment.user!.displayName, login: comment.user!.displayName,
prefix: 'bitbucket')), prefix: 'bitbucket')),
CommonStyle.border, CommonStyle.border,
SizedBox(height: 16), const SizedBox(height: 16),
], ],
]), ]),
]); ]);

View File

@ -1,20 +1,19 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbIssueCommentScreen extends StatefulWidget { class BbIssueCommentScreen extends StatefulWidget {
const BbIssueCommentScreen(this.owner, this.name, this.number);
final String owner; final String owner;
final String name; final String name;
final String number; final String number;
BbIssueCommentScreen(this.owner, this.name, this.number);
@override @override
_BbIssueCommentScreenState createState() => _BbIssueCommentScreenState(); State<BbIssueCommentScreen> createState() => _BbIssueCommentScreenState();
} }
class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> { class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
@ -22,16 +21,15 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return CommonScaffold( return CommonScaffold(
title: Text('New Comment'), title: const Text('New Comment'),
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: CommonStyle.padding, padding: CommonStyle.padding,
child: CupertinoTextField( child: CupertinoTextField(
style: TextStyle(color: theme.palette.text), style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body, placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) { onChanged: (v) {
setState(() { setState(() {
@ -41,9 +39,10 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
maxLines: 10, maxLines: 10,
), ),
), ),
CupertinoButton.filled( AntButton(
child: Text('Comment'), color: AntTheme.of(context).colorPrimary,
onPressed: () async { child: const Text('Comment'),
onClick: () async {
await auth.fetchBb( await auth.fetchBb(
'/repositories/${widget.owner}/${widget.name}/issues/${widget.number}/comments', '/repositories/${widget.owner}/${widget.name}/issues/${widget.number}/comments',
isPost: true, isPost: true,
@ -52,8 +51,7 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
}, },
); );
Navigator.pop(context, true); Navigator.pop(context, true);
await theme.push( await context.pushUrl(
context,
'/bitbucket/${widget.owner}/${widget.name}/issues/${widget.number}', '/bitbucket/${widget.owner}/${widget.name}/issues/${widget.number}',
replace: true, replace: true,
); );

View File

@ -1,20 +1,19 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/common.dart'; import 'package:git_touch/scaffolds/common.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbIssueFormScreen extends StatefulWidget { class BbIssueFormScreen extends StatefulWidget {
const BbIssueFormScreen(this.owner, this.name);
final String owner; final String owner;
final String name; final String name;
BbIssueFormScreen(this.owner, this.name);
@override @override
_BbIssueFormScreenState createState() => _BbIssueFormScreenState(); State<BbIssueFormScreen> createState() => _BbIssueFormScreenState();
} }
class _BbIssueFormScreenState extends State<BbIssueFormScreen> { class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
@ -23,7 +22,6 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return CommonScaffold( return CommonScaffold(
title: Text(AppLocalizations.of(context)!.submitAnIssue), title: Text(AppLocalizations.of(context)!.submitAnIssue),
@ -32,7 +30,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
Padding( Padding(
padding: CommonStyle.padding, padding: CommonStyle.padding,
child: CupertinoTextField( child: CupertinoTextField(
style: TextStyle(color: theme.palette.text), style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.title, placeholder: AppLocalizations.of(context)!.title,
onChanged: (v) { onChanged: (v) {
setState(() { setState(() {
@ -44,7 +42,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
Padding( Padding(
padding: CommonStyle.padding, padding: CommonStyle.padding,
child: CupertinoTextField( child: CupertinoTextField(
style: TextStyle(color: theme.palette.text), style: TextStyle(color: AntTheme.of(context).colorText),
placeholder: AppLocalizations.of(context)!.body, placeholder: AppLocalizations.of(context)!.body,
onChanged: (v) { onChanged: (v) {
setState(() { setState(() {
@ -54,9 +52,10 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
maxLines: 10, maxLines: 10,
), ),
), ),
CupertinoButton.filled( AntButton(
color: AntTheme.of(context).colorPrimary,
child: Text(AppLocalizations.of(context)!.submit), child: Text(AppLocalizations.of(context)!.submit),
onPressed: () async { onClick: () async {
await auth.fetchBbJson( await auth.fetchBbJson(
'/repositories/${widget.owner}/${widget.name}/issues', '/repositories/${widget.owner}/${widget.name}/issues',
isPost: true, isPost: true,
@ -65,8 +64,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
return BbIssues.fromJson(v); return BbIssues.fromJson(v);
}); });
Navigator.pop(context, true); Navigator.pop(context, true);
await theme.push( await context.pushUrl(
context,
'/bitbucket/${widget.owner}/${widget.name}/issues', '/bitbucket/${widget.owner}/${widget.name}/issues',
replace: true, replace: true,
); );

View File

@ -1,23 +1,22 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart'; import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/issue_item.dart'; import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbIssuesScreen extends StatelessWidget { class BbIssuesScreen extends StatelessWidget {
const BbIssuesScreen(this.owner, this.name);
final String owner; final String owner;
final String name; final String name;
BbIssuesScreen(this.owner, this.name);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<BbIssues, String?>( return ListStatefulScaffold<BbIssues, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.issues), title: Text(AppLocalizations.of(context)!.issues),
actionBuilder: () { actionBuilder: () {
return ActionEntry( return ActionEntry(
iconData: Octicons.plus, url: '/bitbucket/$owner/$name/issues/new'); iconData: Octicons.plus, url: '/bitbucket/$owner/$name/issues/new');
@ -35,13 +34,13 @@ class BbIssuesScreen extends StatelessWidget {
); );
}, },
itemBuilder: (v) { itemBuilder: (v) {
int issueNumber = final issueNumber =
int.parse(v.issueLink!.replaceFirst(RegExp(r'.*\/'), '')); int.parse(v.issueLink!.replaceFirst(RegExp(r'.*\/'), ''));
return IssueItem( return IssueItem(
avatarUrl: v.reporter!.avatarUrl, avatarUrl: v.reporter!.avatarUrl,
author: v.reporter!.displayName, author: v.reporter!.displayName,
title: v.title, title: v.title,
subtitle: '#' + issueNumber.toString(), subtitle: '#$issueNumber',
commentCount: 0, commentCount: 0,
updatedAt: v.createdOn, updatedAt: v.createdOn,
url: '/bitbucket/$owner/$name/issues/$issueNumber', url: '/bitbucket/$owner/$name/issues/$issueNumber',

View File

@ -1,30 +1,30 @@
import 'dart:convert'; import 'dart:convert';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:universal_io/io.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/action_entry.dart'; import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/blob_view.dart'; import 'package:git_touch/widgets/blob_view.dart';
import 'package:git_touch/widgets/object_tree.dart'; import 'package:git_touch/widgets/object_tree.dart';
import 'package:provider/provider.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:provider/provider.dart';
import 'package:universal_io/io.dart';
class BbObjectScreen extends StatelessWidget { class BbObjectScreen extends StatelessWidget {
const BbObjectScreen(this.owner, this.name, this.ref, {this.path});
final String owner; final String owner;
final String name; final String name;
final String ref; final String ref;
final String? path; final String? path;
BbObjectScreen(this.owner, this.name, this.ref, {this.path});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<dynamic, String?>( return ListStatefulScaffold<dynamic, String?>(
title: AppBarTitle(path ?? 'Files'), title: Text(path ?? 'Files'),
fetch: (next) async { fetch: (next) async {
final res = await auth.fetchBb( final res = await auth.fetchBb(
next ?? '/repositories/$owner/$name/src/$ref/${path ?? ''}'); next ?? '/repositories/$owner/$name/src/$ref/${path ?? ''}');
@ -53,7 +53,7 @@ class BbObjectScreen extends StatelessWidget {
if (pl is String) { if (pl is String) {
return BlobView(path, text: pl); return BlobView(path, text: pl);
} else if (pl is BbTree) { } else if (pl is BbTree) {
return ObjectTreeItem( return createObjectTreeItem(
name: p.basename(pl.path), name: p.basename(pl.path),
type: pl.type, type: pl.type,
// size: v.type == 'commit_file' ? v.size : null, // size: v.type == 'commit_file' ? v.size : null,
@ -66,7 +66,7 @@ class BbObjectScreen extends StatelessWidget {
} }
}, },
actionBuilder: () { actionBuilder: () {
return ActionEntry( return const ActionEntry(
iconData: Ionicons.cog, iconData: Ionicons.cog,
url: '/choose-code-theme', url: '/choose-code-theme',
); );

View File

@ -1,23 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/issue_item.dart'; import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbPullsScreen extends StatelessWidget { class BbPullsScreen extends StatelessWidget {
const BbPullsScreen(this.owner, this.name);
final String owner; final String owner;
final String name; final String name;
BbPullsScreen(this.owner, this.name);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
return ListStatefulScaffold<BbPulls, String?>( return ListStatefulScaffold<BbPulls, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.pullRequests), title: Text(AppLocalizations.of(context)!.pullRequests),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context.read<AuthModel>().fetchBbWithPage( final res = await context.read<AuthModel>().fetchBbWithPage(
nextUrl ?? '/repositories/$owner/$name/pullrequests'); nextUrl ?? '/repositories/$owner/$name/pullrequests');
@ -30,13 +28,13 @@ class BbPullsScreen extends StatelessWidget {
); );
}, },
itemBuilder: (v) { itemBuilder: (v) {
int pullNumber = final pullNumber =
int.parse(v.pullRequestLink!.replaceFirst(RegExp(r'.*\/'), '')); int.parse(v.pullRequestLink!.replaceFirst(RegExp(r'.*\/'), ''));
return IssueItem( return IssueItem(
avatarUrl: v.author!.avatarUrl, avatarUrl: v.author!.avatarUrl,
author: v.author!.displayName, author: v.author!.displayName,
title: v.title, title: v.title,
subtitle: '#' + pullNumber.toString(), subtitle: '#$pullNumber',
commentCount: 0, commentCount: 0,
updatedAt: v.createdOn, updatedAt: v.createdOn,
url: url:

View File

@ -1,30 +1,31 @@
import 'dart:convert'; import 'dart:convert';
import 'package:antd_mobile/antd_mobile.dart';
import 'package:filesize/filesize.dart'; import 'package:filesize/filesize.dart';
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/markdown_view.dart'; import 'package:git_touch/widgets/markdown_view.dart';
import 'package:git_touch/widgets/repo_header.dart'; import 'package:git_touch/widgets/repo_header.dart';
import 'package:git_touch/widgets/table_view.dart'; import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbRepoScreen extends StatelessWidget { class BbRepoScreen extends StatelessWidget {
const BbRepoScreen(this.owner, this.name, {this.branch});
final String owner; final String owner;
final String name; final String name;
final String? branch; final String? branch;
BbRepoScreen(this.owner, this.name, {this.branch});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple3<BbRepo, String?, List<BbBranch>>>( return RefreshStatefulScaffold<Tuple3<BbRepo, String?, List<BbBranch>>>(
title: AppBarTitle(AppLocalizations.of(context)!.repository), title: Text(AppLocalizations.of(context)!.repository),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final r = await auth.fetchBbJson('/repositories/$owner/$name'); final r = await auth.fetchBbJson('/repositories/$owner/$name');
@ -56,38 +57,44 @@ class BbRepoScreen extends StatelessWidget {
homepageUrl: p.website, homepageUrl: p.website,
), ),
CommonStyle.border, CommonStyle.border,
TableView( AntList(
items: [ children: [
TableViewItem( AntListItem(
leftIconData: Octicons.code, prefix: const Icon(Octicons.code),
text: Text('Code'), extra: Text(filesize(p.size)),
rightWidget: Text(filesize(p.size)), onClick: () {
url: context.push(
'/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}', '/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}');
},
child: const Text('Code'),
), ),
TableViewItem( AntListItem(
leftIconData: Octicons.issue_opened, prefix: const Icon(Octicons.issue_opened),
text: Text('Issues'), child: const Text('Issues'),
url: '/bitbucket/$owner/$name/issues', onClick: () {
context.push('/bitbucket/$owner/$name/issues');
},
), ),
TableViewItem( AntListItem(
leftIconData: Octicons.git_pull_request, prefix: const Icon(Octicons.git_pull_request),
text: Text('Pull requests'), child: const Text('Pull requests'),
url: '/bitbucket/$owner/$name/pulls', onClick: () {
context.push('/bitbucket/$owner/$name/pulls');
},
), ),
TableViewItem( AntListItem(
leftIconData: Octicons.history, prefix: const Icon(Octicons.history),
text: Text('Commits'), child: const Text('Commits'),
url: onClick: () {
'/bitbucket/$owner/$name/commits/${branch ?? p.mainbranch!.name}', context.push(
'/bitbucket/$owner/$name/commits/${branch ?? p.mainbranch!.name}');
},
), ),
TableViewItem( AntListItem(
leftIconData: Octicons.git_branch, prefix: const Icon(Octicons.git_branch),
text: Text(AppLocalizations.of(context)!.branches), extra: Text(
rightWidget: Text((branch ?? p.mainbranch!.name)! + '${(branch ?? p.mainbranch!.name)!}${branches.length}'),
'' + onClick: () async {
branches.length.toString()),
onTap: () async {
if (branches.length < 2) return; if (branches.length < 2) return;
await theme.showPicker( await theme.showPicker(
@ -99,14 +106,15 @@ class BbRepoScreen extends StatelessWidget {
.toList(), .toList(),
onClose: (ref) { onClose: (ref) {
if (ref != branch) { if (ref != branch) {
theme.push( context.pushUrl(
context, '/bitbucket/$owner/$name?branch=$ref', '/bitbucket/$owner/$name?branch=$ref',
replace: true); replace: true);
} }
}, },
), ),
); );
}, },
child: Text(AppLocalizations.of(context)!.branches),
), ),
], ],
), ),

View File

@ -1,19 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart'; import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/user_item.dart'; import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago; import 'package:timeago/timeago.dart' as timeago;
import 'package:git_touch/utils/utils.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class BbTeamsScreen extends StatelessWidget { class BbTeamsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListStatefulScaffold<BbUser, String?>( return ListStatefulScaffold<BbUser, String?>(
title: AppBarTitle(AppLocalizations.of(context)!.teams), title: Text(AppLocalizations.of(context)!.teams),
fetch: (nextUrl) async { fetch: (nextUrl) async {
final res = await context final res = await context
.read<AuthModel>() .read<AuthModel>()

View File

@ -1,26 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart'; import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart'; import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/repository_item.dart'; import 'package:git_touch/widgets/repo_item.dart';
import 'package:git_touch/widgets/user_header.dart'; import 'package:git_touch/widgets/user_header.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:git_touch/utils/utils.dart';
class BbUserScreen extends StatelessWidget { class BbUserScreen extends StatelessWidget {
const BbUserScreen(this.login, {this.isTeam = false});
final String? login; final String? login;
final bool isTeam; final bool isTeam;
BbUserScreen(this.login, {this.isTeam = false});
bool get isViewer => login == null; bool get isViewer => login == null;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final auth = Provider.of<AuthModel>(context); final auth = Provider.of<AuthModel>(context);
final _accountId = auth.activeAccount!.accountId; final accountId = auth.activeAccount!.accountId;
final _login = login ?? auth.activeAccount!.login; final finalLogin = login ?? auth.activeAccount!.login;
return RefreshStatefulScaffold<Tuple2<BbUser, Iterable<BbRepo>>>( return RefreshStatefulScaffold<Tuple2<BbUser, Iterable<BbRepo>>>(
title: Text(isViewer title: Text(isViewer
? 'Me' ? 'Me'
@ -30,16 +30,16 @@ class BbUserScreen extends StatelessWidget {
fetch: () async { fetch: () async {
final res = await Future.wait([ final res = await Future.wait([
auth auth
.fetchBbJson('/${isTeam ? 'teams' : 'users'}/$_accountId') .fetchBbJson('/${isTeam ? 'teams' : 'users'}/$accountId')
.then((value) => BbUser.fromJson(value)), .then((value) => BbUser.fromJson(value)),
auth auth
.fetchBbWithPage('/repositories/$_login') .fetchBbWithPage('/repositories/$finalLogin')
.then((value) => [for (var v in value.items) BbRepo.fromJson(v)]), .then((value) => [for (var v in value.items) BbRepo.fromJson(v)]),
]); ]);
return Tuple2(res[0] as BbUser, res[1] as Iterable<BbRepo>); return Tuple2(res[0] as BbUser, res[1] as Iterable<BbRepo>);
}, },
action: isViewer action: isViewer
? ActionEntry( ? const ActionEntry(
iconData: Ionicons.cog, iconData: Ionicons.cog,
url: '/settings', url: '/settings',
) )
@ -50,7 +50,7 @@ class BbUserScreen extends StatelessWidget {
return Column( return Column(
children: <Widget>[ children: <Widget>[
UserHeader( UserHeader(
login: _login, login: finalLogin,
avatarUrl: user.avatarUrl, avatarUrl: user.avatarUrl,
name: user.displayName, name: user.displayName,
createdAt: user.createdOn, createdAt: user.createdOn,
@ -59,9 +59,7 @@ class BbUserScreen extends StatelessWidget {
), ),
CommonStyle.border, CommonStyle.border,
Column( Column(
children: <Widget>[ children: <Widget>[for (var v in repos) RepoItem.bb(payload: v)],
for (var v in repos) RepositoryItem.bb(payload: v)
],
) )
], ],
); );

View File

@ -1,19 +1,18 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:flutter_highlight/flutter_highlight.dart'; import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:flutter_highlight/theme_map.dart'; import 'package:flutter_highlight/theme_map.dart';
import 'package:git_touch/models/code.dart'; import 'package:git_touch/models/code.dart';
import 'package:git_touch/models/theme.dart'; import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/single.dart'; import 'package:git_touch/scaffolds/single.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/table_view.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class CodeThemeScreen extends StatelessWidget { class CodeThemeScreen extends StatelessWidget {
String _getCode(bool isDark) => '''// ${isDark ? 'Dark' : 'Light'} Mode String _getCode(bool isDark) => '''// ${isDark ? 'Dark' : 'Light'} Mode
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@override @override
@ -35,23 +34,22 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var codeProvider = Provider.of<CodeModel>(context); final codeProvider = Provider.of<CodeModel>(context);
var theme = Provider.of<ThemeModel>(context); final theme = Provider.of<ThemeModel>(context);
return SingleScaffold( return SingleScaffold(
title: AppBarTitle(AppLocalizations.of(context)!.codeTheme), title: Text(AppLocalizations.of(context)!.codeTheme),
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
CommonStyle.verticalGap, CommonStyle.verticalGap,
TableView( AntList(
headerText: AppLocalizations.of(context)!.fontStyle, mode: AntListMode.card,
hasIcon: false, header: Text(AppLocalizations.of(context)!.fontStyle),
items: [ children: [
TableViewItem( AntListItem(
text: Text(AppLocalizations.of(context)!.fontSize), extra: Text(codeProvider.fontSize.toString()),
rightWidget: Text(codeProvider.fontSize.toString()), onClick: () {
onTap: () {
theme.showPicker( theme.showPicker(
context, context,
PickerGroupItem( PickerGroupItem(
@ -66,11 +64,11 @@ class MyApp extends StatelessWidget {
), ),
); );
}, },
child: Text(AppLocalizations.of(context)!.fontSize),
), ),
TableViewItem( AntListItem(
text: Text(AppLocalizations.of(context)!.fontFamily), extra: Text(codeProvider.fontFamily),
rightWidget: Text(codeProvider.fontFamily), onClick: () {
onTap: () {
theme.showPicker( theme.showPicker(
context, context,
PickerGroupItem( PickerGroupItem(
@ -78,23 +76,24 @@ class MyApp extends StatelessWidget {
items: CodeModel.fontFamilies items: CodeModel.fontFamilies
.map((v) => PickerItem(v, text: v)) .map((v) => PickerItem(v, text: v))
.toList(), .toList(),
onChange: (String? value) { onChange: (value) {
codeProvider.setFontFamily(value!); codeProvider.setFontFamily(value!);
}, },
), ),
); );
}, },
child: Text(AppLocalizations.of(context)!.fontFamily),
), ),
], ],
), ),
CommonStyle.verticalGap, CommonStyle.verticalGap,
TableView( AntList(
headerText: AppLocalizations.of(context)!.syntaxHighlighting, mode: AntListMode.card,
items: [ header: Text(AppLocalizations.of(context)!.syntaxHighlighting),
TableViewItem( children: [
text: Text(AppLocalizations.of(context)!.light), AntListItem(
rightWidget: Text(codeProvider.theme), extra: Text(codeProvider.theme),
onTap: () { onClick: () {
theme.showPicker( theme.showPicker(
context, context,
PickerGroupItem( PickerGroupItem(
@ -108,11 +107,20 @@ class MyApp extends StatelessWidget {
), ),
); );
}, },
child: Text(AppLocalizations.of(context)!.light),
), ),
TableViewItem( AntListItem(
text: Text(AppLocalizations.of(context)!.dark), child: HighlightView(
rightWidget: Text(codeProvider.themeDark), _getCode(false),
onTap: () { language: 'dart',
theme: themeMap[codeProvider.theme]!,
textStyle: codeProvider.fontStyle,
padding: CommonStyle.padding,
),
),
AntListItem(
extra: Text(codeProvider.themeDark),
onClick: () {
theme.showPicker( theme.showPicker(
context, context,
PickerGroupItem( PickerGroupItem(
@ -126,29 +134,19 @@ class MyApp extends StatelessWidget {
), ),
); );
}, },
child: Text(AppLocalizations.of(context)!.dark),
), ),
AntListItem(
child: HighlightView(
_getCode(true),
language: 'dart',
theme: themeMap[codeProvider.themeDark]!,
textStyle: codeProvider.fontStyle,
padding: CommonStyle.padding,
),
)
], ],
), ),
HighlightView(
_getCode(false),
language: 'dart',
theme: themeMap[codeProvider.theme]!,
textStyle: TextStyle(
fontSize: codeProvider.fontSize.toDouble(),
fontFamily: codeProvider.fontFamilyUsed,
),
padding: CommonStyle.padding,
),
HighlightView(
_getCode(true),
language: 'dart',
theme: themeMap[codeProvider.themeDark]!,
textStyle: TextStyle(
fontSize: codeProvider.fontSize.toDouble(),
fontFamily: codeProvider.fontFamilyUsed,
),
padding: CommonStyle.padding,
),
], ],
), ),
); );

View File

@ -1,31 +1,31 @@
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:git_touch/models/auth.dart'; import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart'; import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart'; import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/blob_view.dart'; import 'package:git_touch/widgets/blob_view.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class GeBlobScreen extends StatelessWidget { class GeBlobScreen extends StatelessWidget {
const GeBlobScreen(this.owner, this.name, this.sha, this.path);
final String owner; final String owner;
final String name; final String name;
final String sha; final String sha;
final String path; final String path;
GeBlobScreen(this.owner, this.name, this.sha, this.path);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RefreshStatefulScaffold<String?>( return RefreshStatefulScaffold<String?>(
title: AppBarTitle(AppLocalizations.of(context)!.file), title: Text(AppLocalizations.of(context)!.file),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final res = await auth.fetchGitee('/repos/$owner/$name/git/blobs/$sha'); final res = await auth.fetchGitee('/repos/$owner/$name/git/blobs/$sha');
return GiteeBlob.fromJson(res).content; return GiteeBlob.fromJson(res).content;
}, },
action: ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'), action:
const ActionEntry(iconData: Ionicons.cog, url: '/choose-code-theme'),
bodyBuilder: (content, _) { bodyBuilder: (content, _) {
return BlobView(path, base64Text: content); return BlobView(path, base64Text: content);
}, },

View File

@ -1,4 +1,6 @@
import 'package:flutter/material.dart'; import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart'; import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/refresh_stateful.dart'; import 'package:git_touch/scaffolds/refresh_stateful.dart';
import 'package:git_touch/utils/utils.dart'; import 'package:git_touch/utils/utils.dart';
@ -7,20 +9,17 @@ import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/files_item.dart'; import 'package:git_touch/widgets/files_item.dart';
import 'package:git_touch/widgets/link.dart'; import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/theme.dart';
class GeCommitScreen extends StatelessWidget { class GeCommitScreen extends StatelessWidget {
const GeCommitScreen(this.owner, this.name, this.sha);
final String owner; final String owner;
final String name; final String name;
final String sha; final String sha;
GeCommitScreen(this.owner, this.name, this.sha);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = context.watch<ThemeModel>();
return RefreshStatefulScaffold<GiteeCommit>( return RefreshStatefulScaffold<GiteeCommit>(
title: Text("Commit: ${sha.substring(0, 7)}"), title: Text('Commit: ${sha.substring(0, 7)}'),
fetch: () async { fetch: () async {
final auth = context.read<AuthModel>(); final auth = context.read<AuthModel>();
final items = await auth.fetchGitee('/repos/$owner/$name/commits/$sha'); final items = await auth.fetchGitee('/repos/$owner/$name/commits/$sha');
@ -43,29 +42,29 @@ class GeCommitScreen extends StatelessWidget {
url: data.author!.avatarUrl, url: data.author!.avatarUrl,
size: AvatarSize.extraSmall, size: AvatarSize.extraSmall,
), ),
SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
'$owner / $name', '$owner / $name',
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: theme.palette.secondaryText, color: AntTheme.of(context).colorTextSecondary,
), ),
), ),
SizedBox(width: 4), const SizedBox(width: 4),
Text( Text(
'${sha.substring(0, 7)}', sha.substring(0, 7),
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: theme.palette.tertiaryText, color: AntTheme.of(context).colorWeak,
), ),
), ),
], ],
), ),
), ),
SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
data.commit!.message!, data.commit!.message!,
style: TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),

Some files were not shown because too many files have changed in this diff Show More