1.集成firebase

2.优化功能
This commit is contained in:
fengshengxiong 2024-05-23 18:22:18 +08:00
parent d0031ddce7
commit 9f361ce560
106 changed files with 12882 additions and 330 deletions

View File

@ -1,5 +1,9 @@
plugins { plugins {
id "com.android.application" id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
id "kotlin-android" id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin" id "dev.flutter.flutter-gradle-plugin"
} }
@ -27,7 +31,7 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
namespace "com.now.wallpaper" namespace "com.hello.wallpaper"
compileSdk flutter.compileSdkVersion compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
@ -46,7 +50,7 @@ android {
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 "com.now.wallpaper" applicationId "com.hello.wallpaper"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// minSdkVersion flutter.minSdkVersion // minSdkVersion flutter.minSdkVersion
@ -54,6 +58,9 @@ android {
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
// Enable MultiDex.
multiDexEnabled true
} }
signingConfigs { signingConfigs {
@ -79,6 +86,15 @@ android {
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
} }
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
if (!variant.buildType.isDebuggable()) {
// APK输出文件名
outputFileName = "hello-wallpaper-${flutterVersionName}-${variant.buildType.name}.apk"
}
}
}
} }
flutter { flutter {

View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "318284530945",
"project_id": "nowwallpaper",
"storage_bucket": "nowwallpaper.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:318284530945:android:c7dd2abf520a9840250700",
"android_client_info": {
"package_name": "com.hello.wallpaper"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDP6CpkN3HMpCofXlToug-hadYpTLEgE0E"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -5,8 +5,7 @@
<uses-permission <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" android:maxSdkVersion="32"
tools:ignore="ScopedStorage" tools:ignore="ScopedStorage"/>
/>
<uses-permission <uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE" android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" android:maxSdkVersion="32"
@ -18,7 +17,9 @@
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/launcher_icon" android:icon="@mipmap/launcher_icon"
android:label="@string/app_name" android:label="@string/app_name"
android:requestLegacyExternalStorage="true"> android:requestLegacyExternalStorage="true"
android:enableOnBackInvokedCallback="true"
tools:targetApi="tiramisu">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
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"

View File

@ -1,4 +1,4 @@
package com.now.wallpaper package com.hello.wallpaper
import io.flutter.Log import io.flutter.Log
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
@ -13,7 +13,7 @@ class MainActivity : FlutterActivity() {
} catch (e: Exception) { } catch (e: Exception) {
Log.e( Log.e(
"GeneratedPluginRegistrant", "GeneratedPluginRegistrant",
"Error registering plugin set_wallpaper, com.now.wallpaper.SetWallpaperPlugin", "Error registering plugin set_wallpaper, com.hello.wallpaper.SetWallpaperPlugin",
) )
} }
} }

View File

@ -1,12 +1,13 @@
package com.now.wallpaper package com.hello.wallpaper
import android.app.WallpaperManager import android.app.WallpaperManager
import android.content.Context import android.content.Context
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.os.Build
import androidx.annotation.RequiresApi
import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.Result
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -23,8 +24,9 @@ class SetWallpaperPlugin : FlutterPlugin, MethodChannel.MethodCallHandler {
channel.setMethodCallHandler(this) channel.setMethodCallHandler(this)
} }
@RequiresApi(Build.VERSION_CODES.N)
@OptIn(DelicateCoroutinesApi::class) @OptIn(DelicateCoroutinesApi::class)
override fun onMethodCall(call: MethodCall, result: Result) { override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
if (call.method == "setWallpaper") { if (call.method == "setWallpaper") {
val path = call.argument<String>("path") val path = call.argument<String>("path")
val wallpaperType = call.argument<Int>("wallpaperType") // 0 for home screen, 1 for lock screen, 2 for both val wallpaperType = call.argument<Int>("wallpaperType") // 0 for home screen, 1 for lock screen, 2 for both

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen --> <?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"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" /> <!-- <item android:drawable="?android:colorBackground" />-->
<item android:drawable="@color/seedColor" />
<!-- You can insert your own image assets here --> <!-- You can insert your own image assets here -->
<item> <item>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen --> <?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"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" /> <!-- <item android:drawable="@android:color/white" />-->
<item android:drawable="@color/seedColor" />
<!-- You can insert your own image assets here --> <!-- You can insert your own image assets here -->
<item>¬ <item>¬

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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>
<item name="android:windowFullscreen">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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>
<item name="android:windowFullscreen">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
</resources>

View File

@ -6,9 +6,6 @@
the Flutter engine 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>
<item name="android:windowFullscreen">true</item> <item name="android:windowFullscreen">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</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

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Light.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>
<item name="android:windowFullscreen">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Light.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>
<item name="android:windowFullscreen">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="seedColor">#0A0A14</color>
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Now wallpaper</string> <string name="app_name">Hello Wallpaper</string>
</resources> </resources>

View File

@ -6,9 +6,6 @@
the Flutter engine 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>
<item name="android:windowFullscreen">true</item> <item name="android:windowFullscreen">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</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

View File

@ -1,4 +1,4 @@
storePassword=123456 storePassword=123456
keyPassword=123456 keyPassword=123456
keyAlias=now_wallpaper keyAlias=wallpaper
storeFile=../now_wallpaper.jks storeFile=../hello_wallpaper.jks

Binary file not shown.

View File

@ -20,6 +20,10 @@ pluginManagement {
plugins { plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false id "com.android.application" version "7.3.0" apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false
// END: FlutterFire Configuration
id "org.jetbrains.kotlin.android" version "1.8.22" apply false id "org.jetbrains.kotlin.android" version "1.8.22" apply false
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 KiB

After

Width:  |  Height:  |  Size: 108 KiB

12207
assets/json/lux_wallpaper.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1
firebase.json Normal file
View File

@ -0,0 +1 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"nowwallpaper","appId":"1:318284530945:android:c7dd2abf520a9840250700","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"nowwallpaper","appId":"1:318284530945:ios:9ac1774ea498265e250700","uploadDebugSymbols":true,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"nowwallpaper","configurations":{"android":"1:318284530945:android:c7dd2abf520a9840250700","ios":"1:318284530945:ios:9ac1774ea498265e250700"}}}}}}

View File

@ -15,6 +15,7 @@
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 */; };
BE2EA703BEDDE99F1866F655 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 874B18522795D289616C343E /* GoogleService-Info.plist */; };
D52A56DB3AAE02F2724B4CBE /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EC70670285B234B265439 /* Pods_RunnerTests.framework */; }; D52A56DB3AAE02F2724B4CBE /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F7EC70670285B234B265439 /* Pods_RunnerTests.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -55,6 +56,7 @@
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>"; };
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>"; };
7B71BC8DD4AFE8E93734BDDC /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; }; 7B71BC8DD4AFE8E93734BDDC /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
874B18522795D289616C343E /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; 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; };
@ -137,6 +139,7 @@
331C8082294A63A400263BE5 /* RunnerTests */, 331C8082294A63A400263BE5 /* RunnerTests */,
0797B7C7F9044CE8DB306198 /* Pods */, 0797B7C7F9044CE8DB306198 /* Pods */,
58D07E0F3F53151088D726CF /* Frameworks */, 58D07E0F3F53151088D726CF /* Frameworks */,
874B18522795D289616C343E /* GoogleService-Info.plist */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -199,6 +202,7 @@
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
39CCEDF39CF579238AE308F0 /* [CP] Embed Pods Frameworks */, 39CCEDF39CF579238AE308F0 /* [CP] Embed Pods Frameworks */,
405E88F0300BCE9602B4DA07 /* [CP] Copy Pods Resources */, 405E88F0300BCE9602B4DA07 /* [CP] Copy Pods Resources */,
41D07400CAF8B16888A62377 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
); );
buildRules = ( buildRules = (
); );
@ -264,6 +268,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
BE2EA703BEDDE99F1866F655 /* GoogleService-Info.plist in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -342,6 +347,24 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
41D07400CAF8B16888A62377 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;
@ -496,7 +519,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.now.wallpaper; PRODUCT_BUNDLE_IDENTIFIER = com.hello.wallpaper;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@ -681,7 +704,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.now.wallpaper; PRODUCT_BUNDLE_IDENTIFIER = com.hello.wallpaper;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -704,7 +727,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.now.wallpaper; PRODUCT_BUNDLE_IDENTIFIER = com.hello.wallpaper;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 522 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 522 KiB

View File

@ -0,0 +1,30 @@
<?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>API_KEY</key>
<string>AIzaSyBAVP2-PNvC07OPHepWpCCb6QzVTRk1cMM</string>
<key>GCM_SENDER_ID</key>
<string>318284530945</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.hello.wallpaper</string>
<key>PROJECT_ID</key>
<string>nowwallpaper</string>
<key>STORAGE_BUCKET</key>
<string>nowwallpaper.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:318284530945:ios:9ac1774ea498265e250700</string>
</dict>
</plist>

View File

@ -7,7 +7,7 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>Now wallpaper</string> <string>Hello Wallpaper</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>

View File

@ -6,8 +6,8 @@ import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'package:applovin_max/applovin_max.dart'; import 'package:applovin_max/applovin_max.dart';
import 'package:flutter/material.dart'; import 'package:hello_wallpaper/common/utils/log_print.dart';
import 'package:now_wallpaper/common/utils/log_print.dart'; import 'package:hello_wallpaper/firebase/analytics_util.dart';
class ApplovinManage { class ApplovinManage {
ApplovinManage._(); ApplovinManage._();
@ -20,9 +20,9 @@ class ApplovinManage {
final String applovinKey = 'nEo4OHOhAZuAK9-IARuNaUfW-yDLBayq9FIGZs0L9XMNTByuDV6dsvMEIGnEAkQu-KR8D42QdKRlbniP910xnK'; final String applovinKey = 'nEo4OHOhAZuAK9-IARuNaUfW-yDLBayq9FIGZs0L9XMNTByuDV6dsvMEIGnEAkQu-KR8D42QdKRlbniP910xnK';
/// 广Id /// 广Id
final String adUnitId1 = 'edc4bd530e79af75'; final String adUnitId1 = 'a2ced77c3755055b';
final String adUnitId2 = '3f38d70ff5e85f92'; final String adUnitId2 = 'a3819ba97232d772';
final String adUnitId3 = '8a0fc2feeba310bc'; final String adUnitId3 = 'bb0bfc77dcfd1fc4';
/// ///
bool isInitialized = false; bool isInitialized = false;
@ -47,17 +47,16 @@ class ApplovinManage {
} }
/// 广 /// 广
void initializeInterstitialAds({VoidCallback? onAdLoadedCallback}) { void initializeInterstitialAds({required Function() onGoHomeTap}) {
if (isInitialized) { if (isInitialized) {
AppLovinMAX.setInterstitialListener(InterstitialListener( AppLovinMAX.setInterstitialListener(InterstitialListener(
onAdLoadedCallback: (ad) { onAdLoadedCallback: (ad) async {
LogPrint.d('插页广告加载成功:${ad.adUnitId}'); LogPrint.d('插页广告加载成功:${ad.adUnitId}');
if (ad.adUnitId == adUnitId1 && isSplashScreen) { if (ad.adUnitId == adUnitId1 && isSplashScreen) {
isSplashScreen = false; await showAdIfReady(adUnitId1);
onAdLoadedCallback!;
showAdIfReady(adUnitId1);
// AppLovinMAX.showInterstitial(adUnitId1);
AppLovinMAX.loadInterstitial(adUnitId1); AppLovinMAX.loadInterstitial(adUnitId1);
isSplashScreen = false;
onGoHomeTap();
} }
_interstitialRetryAttempt = 0; _interstitialRetryAttempt = 0;
}, },
@ -65,8 +64,9 @@ class ApplovinManage {
LogPrint.d('插页广告加载失败adUnitId:$adUnitId,code:${error.code},message:${error.message}'); LogPrint.d('插页广告加载失败adUnitId:$adUnitId,code:${error.code},message:${error.message}');
if (adUnitId == adUnitId1 && isSplashScreen) { if (adUnitId == adUnitId1 && isSplashScreen) {
isSplashScreen = false; isSplashScreen = false;
onGoHomeTap();
} }
// Applovin recommends that you retry with exponentially higher delays up to a maximum delay (in this case 64 seconds). // Applovin建议您以指数级更高的延迟重试64
_interstitialRetryAttempt = _interstitialRetryAttempt + 1; _interstitialRetryAttempt = _interstitialRetryAttempt + 1;
if (_interstitialRetryAttempt > _maxExponentialRetryCount) return; if (_interstitialRetryAttempt > _maxExponentialRetryCount) return;
int retryDelay = pow(2, min(_maxExponentialRetryCount, _interstitialRetryAttempt)).toInt(); int retryDelay = pow(2, min(_maxExponentialRetryCount, _interstitialRetryAttempt)).toInt();
@ -78,9 +78,13 @@ class ApplovinManage {
onAdDisplayedCallback: (ad) { onAdDisplayedCallback: (ad) {
LogPrint.d('插页广告显示成功:${ad.adUnitId}'); LogPrint.d('插页广告显示成功:${ad.adUnitId}');
// _startTimer(); // _startTimer();
//
AnalyticsUtil.logAdImpression(ad.adUnitId, ad.networkName, 1, 1, 0);
}, },
onAdDisplayFailedCallback: (ad, error) { onAdDisplayFailedCallback: (ad, error) {
LogPrint.d('插页广告显示失败adUnitId:${ad.adUnitId},code:${error.code},message:${error.message}'); LogPrint.d('插页广告显示失败adUnitId:${ad.adUnitId},code:${error.code},message:${error.message}');
//
AnalyticsUtil.logAdImpression(ad.adUnitId, ad.networkName, 1, 0, 1);
}, },
onAdClickedCallback: (ad) {}, onAdClickedCallback: (ad) {},
onAdHiddenCallback: (ad) { onAdHiddenCallback: (ad) {

View File

@ -4,7 +4,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:now_wallpaper/res/themes/app_styles.dart'; import 'package:hello_wallpaper/res/themes/app_styles.dart';
class BaseTextButton extends StatelessWidget { class BaseTextButton extends StatelessWidget {
final double? width; final double? width;

View File

@ -5,8 +5,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/button/base_textbutton.dart'; import 'package:hello_wallpaper/common/components/button/base_textbutton.dart';
import 'package:now_wallpaper/common/components/divider_widget.dart'; import 'package:hello_wallpaper/common/components/divider_widget.dart';
class BottomSheetDialog { class BottomSheetDialog {
static void show(void Function(int location) function) { static void show(void Function(int location) function) {

View File

@ -4,8 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/common/utils/obj_util.dart'; import 'package:hello_wallpaper/common/utils/obj_util.dart';
class ProcessDialog extends StatelessWidget { class ProcessDialog extends StatelessWidget {
final double process; final double process;

View File

@ -5,7 +5,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/divider_widget.dart'; import 'package:hello_wallpaper/common/components/divider_widget.dart';
class RemindDialog extends StatelessWidget { class RemindDialog extends StatelessWidget {
const RemindDialog({ const RemindDialog({

View File

@ -4,7 +4,7 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
class ImageNetworkWidget extends StatelessWidget { class ImageNetworkWidget extends StatelessWidget {
const ImageNetworkWidget({ const ImageNetworkWidget({

View File

@ -5,9 +5,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/res/themes/app_colors.dart'; import 'package:hello_wallpaper/res/themes/app_colors.dart';
class BaseAppBar extends StatelessWidget implements PreferredSizeWidget { class BaseAppBar extends StatelessWidget implements PreferredSizeWidget {
const BaseAppBar( const BaseAppBar(

View File

@ -4,8 +4,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/res/themes/app_sizes.dart'; import 'package:hello_wallpaper/res/themes/app_sizes.dart';
class TitleBarWidget extends StatelessWidget { class TitleBarWidget extends StatelessWidget {
const TitleBarWidget( const TitleBarWidget(

View File

@ -6,7 +6,7 @@ import 'dart:async';
import 'package:easy_refresh/easy_refresh.dart'; import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
class BaseEasyRefresh extends StatelessWidget { class BaseEasyRefresh extends StatelessWidget {
const BaseEasyRefresh({ const BaseEasyRefresh({

View File

@ -4,12 +4,12 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:pretty_dio_logger/pretty_dio_logger.dart'; import 'package:pretty_dio_logger/pretty_dio_logger.dart';
import 'package:now_wallpaper/common/components/easy_loading.dart'; import 'package:hello_wallpaper/common/components/easy_loading.dart';
import 'package:now_wallpaper/common/network/base_error.dart'; import 'package:hello_wallpaper/common/network/base_error.dart';
import 'package:now_wallpaper/common/network/dio_interceptor.dart'; import 'package:hello_wallpaper/common/network/dio_interceptor.dart';
import 'package:now_wallpaper/common/utils/log_print.dart'; import 'package:hello_wallpaper/common/utils/log_print.dart';
import 'package:now_wallpaper/generated/json/base/json_convert_content.dart'; import 'package:hello_wallpaper/generated/json/base/json_convert_content.dart';
import 'package:now_wallpaper/models/base_resp_model.dart'; import 'package:hello_wallpaper/models/base_resp_model.dart';
class DioClient { class DioClient {
static final DioClient _instance = DioClient._internal(); static final DioClient _instance = DioClient._internal();

View File

@ -5,7 +5,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:now_wallpaper/models/base_resp_model.dart'; import 'package:hello_wallpaper/models/base_resp_model.dart';
class DioInterceptor extends Interceptor { class DioInterceptor extends Interceptor {
@override @override

View File

@ -3,7 +3,7 @@
// Description: // Description:
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:now_wallpaper/common/utils/log_print.dart'; import 'package:hello_wallpaper/common/utils/log_print.dart';
class SetWallpaper { class SetWallpaper {
static const MethodChannel _channel = MethodChannel('set_wallpaper'); static const MethodChannel _channel = MethodChannel('set_wallpaper');

View File

@ -2,8 +2,8 @@
// Date: 2024/5/8 // Date: 2024/5/8
// Description: // Description:
import 'package:now_wallpaper/common/storage/hive_storage.dart'; import 'package:hello_wallpaper/common/storage/hive_storage.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
class FavoriteData { class FavoriteData {
/// ///

View File

@ -3,7 +3,7 @@
// Description: // Description:
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
const favoriteBox = 'favoriteBox'; const favoriteBox = 'favoriteBox';

View File

@ -7,12 +7,12 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/common/network/dio_client.dart'; import 'package:hello_wallpaper/common/network/dio_client.dart';
import 'package:now_wallpaper/common/utils/filesize_util.dart'; import 'package:hello_wallpaper/common/utils/filesize_util.dart';
import 'package:now_wallpaper/common/utils/local_path_util.dart'; import 'package:hello_wallpaper/common/utils/local_path_util.dart';
import 'package:now_wallpaper/common/utils/log_print.dart'; import 'package:hello_wallpaper/common/utils/log_print.dart';
import 'package:now_wallpaper/common/utils/num_util.dart'; import 'package:hello_wallpaper/common/utils/num_util.dart';
class DownloadUtil { class DownloadUtil {
/// ///

View File

@ -4,7 +4,7 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:now_wallpaper/common/components/dialog/remind_dialog.dart'; import 'package:hello_wallpaper/common/components/dialog/remind_dialog.dart';
class PermissionUtil { class PermissionUtil {
/// ///

View File

@ -2,8 +2,8 @@
// Date: 2024/5/11 // Date: 2024/5/11
// Description: / // Description: /
import 'package:now_wallpaper/common/components/easy_loading.dart'; import 'package:hello_wallpaper/common/components/easy_loading.dart';
import 'package:now_wallpaper/common/plugin/set_wallpaper.dart'; import 'package:hello_wallpaper/common/plugin/set_wallpaper.dart';
class WallpaperManage { class WallpaperManage {
static Future setWallpaper(String imgPath, int location) async { static Future setWallpaper(String imgPath, int location) async {

View File

@ -0,0 +1,29 @@
// Author: fengshengxiong
// Date: 2024/5/22
// Description: firebase analytics工具类
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
class AnalyticsUtil {
/// FlutterFire
static Future<void> initializeFlutterFire() async {
//
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(!kDebugMode);
}
/// 广
static logAdImpression(String adId, String adName, int shouldCount, int successCount, int failCount) {
FirebaseAnalytics.instance.logEvent(
name: 'ad_impression',
parameters: {
'adId': adId,
'adName': adName,
'shouldCount': shouldCount,
'successCount': successCount,
'failCount': failCount,
},
);
}
}

69
lib/firebase_options.dart Normal file
View File

@ -0,0 +1,69 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyDP6CpkN3HMpCofXlToug-hadYpTLEgE0E',
appId: '1:318284530945:android:c7dd2abf520a9840250700',
messagingSenderId: '318284530945',
projectId: 'nowwallpaper',
storageBucket: 'nowwallpaper.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBAVP2-PNvC07OPHepWpCCb6QzVTRk1cMM',
appId: '1:318284530945:ios:9ac1774ea498265e250700',
messagingSenderId: '318284530945',
projectId: 'nowwallpaper',
storageBucket: 'nowwallpaper.appspot.com',
iosBundleId: 'com.hello.wallpaper',
);
}

View File

@ -18,6 +18,6 @@ class Assets {
static const String imagesIcSettings = 'assets/images/ic_settings.png'; static const String imagesIcSettings = 'assets/images/ic_settings.png';
static const String imagesImgError = 'assets/images/img_error.png'; static const String imagesImgError = 'assets/images/img_error.png';
static const String imagesImgPlaceholder = 'assets/images/img_placeholder.png'; static const String imagesImgPlaceholder = 'assets/images/img_placeholder.png';
static const String jsonWallpaper = 'assets/json/wallpaper.json'; static const String jsonLuxWallpaper = 'assets/json/lux_wallpaper.json';
} }

View File

@ -4,8 +4,8 @@
// This file is automatically generated. DO NOT EDIT, all your changes would be lost. // This file is automatically generated. DO NOT EDIT, all your changes would be lost.
import 'package:flutter/material.dart' show debugPrint; import 'package:flutter/material.dart' show debugPrint;
import 'package:now_wallpaper/models/base_resp_model.dart'; import 'package:hello_wallpaper/models/base_resp_model.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
JsonConvert jsonConvert = JsonConvert(); JsonConvert jsonConvert = JsonConvert();

View File

@ -1,5 +1,5 @@
import 'package:now_wallpaper/generated/json/base/json_convert_content.dart'; import 'package:hello_wallpaper/generated/json/base/json_convert_content.dart';
import 'package:now_wallpaper/models/base_resp_model.dart'; import 'package:hello_wallpaper/models/base_resp_model.dart';
BaseRespModel $BaseRespModelFromJson(Map<String, dynamic> json) { BaseRespModel $BaseRespModelFromJson(Map<String, dynamic> json) {
final BaseRespModel baseRespModel = BaseRespModel(); final BaseRespModel baseRespModel = BaseRespModel();

View File

@ -1,5 +1,5 @@
import 'package:now_wallpaper/generated/json/base/json_convert_content.dart'; import 'package:hello_wallpaper/generated/json/base/json_convert_content.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
WallpaperModel $WallpaperModelFromJson(Map<String, dynamic> json) { WallpaperModel $WallpaperModelFromJson(Map<String, dynamic> json) {
final WallpaperModel wallpaperModel = WallpaperModel(); final WallpaperModel wallpaperModel = WallpaperModel();

View File

@ -1,16 +1,20 @@
import 'dart:io'; import 'dart:io';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart';
import 'package:now_wallpaper/common/components/easy_loading.dart'; import 'package:hello_wallpaper/common/components/easy_loading.dart';
import 'package:now_wallpaper/common/storage/hive_storage.dart'; import 'package:hello_wallpaper/common/storage/hive_storage.dart';
import 'package:now_wallpaper/res/themes/app_themes.dart'; import 'package:hello_wallpaper/firebase_options.dart';
import 'package:now_wallpaper/res/values/strings.dart'; import 'package:hello_wallpaper/res/themes/app_themes.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/res/values/strings.dart';
import 'package:hello_wallpaper/routes/app_pages.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -21,8 +25,23 @@ void main() async {
DeviceOrientation.portraitDown, DeviceOrientation.portraitDown,
]); ]);
// Firebase
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
//
FlutterError.onError = (errorDetails) {
FirebaseCrashlytics.instance.recordFlutterError(errorDetails);
};
//
PlatformDispatcher.instance.onError = (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: false);
return true;
};
// 广sdk // 广sdk
await ApplovinManage().initApplovin(); // await ApplovinManage().initApplovin();
// Hive // Hive
await initHive(); await initHive();

View File

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:now_wallpaper/generated/json/base/json_field.dart'; import 'package:hello_wallpaper/generated/json/base/json_field.dart';
import 'package:now_wallpaper/generated/json/base_resp_model.g.dart'; import 'package:hello_wallpaper/generated/json/base_resp_model.g.dart';
@JsonSerializable() @JsonSerializable()
class BaseRespModel { class BaseRespModel {

View File

@ -1,7 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:now_wallpaper/generated/json/base/json_field.dart'; import 'package:hello_wallpaper/generated/json/base/json_field.dart';
import 'package:now_wallpaper/generated/json/wallpaper_model.g.dart'; import 'package:hello_wallpaper/generated/json/wallpaper_model.g.dart';
part 'wallpaper_model.g.dart'; part 'wallpaper_model.g.dart';

View File

@ -1,6 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:now_wallpaper/res/values/strings.dart'; import 'package:hello_wallpaper/res/values/strings.dart';
class AboutController extends GetxController { class AboutController extends GetxController {
var versionName = ''.obs; var versionName = ''.obs;

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/navigation_bar/base_appbar.dart'; import 'package:hello_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/modules/about/about_controller.dart'; import 'package:hello_wallpaper/modules/about/about_controller.dart';
import 'package:now_wallpaper/res/values/strings.dart'; import 'package:hello_wallpaper/res/values/strings.dart';
class AboutView extends GetView<AboutController> { class AboutView extends GetView<AboutController> {
const AboutView({super.key}); const AboutView({super.key});

View File

@ -1,22 +1,32 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/home/home_controller.dart'; import 'package:hello_wallpaper/modules/home/home_controller.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
class CatalogController extends GetxController { class CatalogController extends GetxController {
static CatalogController get to => Get.find<CatalogController>(); static CatalogController get to => Get.find<CatalogController>();
late ScrollController scrollController;
late ViewState viewState; late ViewState viewState;
late List<WallpaperModel> wallpaperModelList; late List<WallpaperModel> wallpaperModelList;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
scrollController = ScrollController();
getData(); getData();
} }
@override
void onClose() {
scrollController.dispose();
super.onClose();
}
void getData() { void getData() {
wallpaperModelList = HomeController.to.wallpaperModelList; wallpaperModelList = HomeController.to.wallpaperModelList;
wallpaperModelList.shuffle();
viewState = wallpaperModelList.isNotEmpty ? ViewState.normal : ViewState.empty; viewState = wallpaperModelList.isNotEmpty ? ViewState.normal : ViewState.empty;
refresh(); refresh();
} }

View File

@ -1,34 +1,42 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/image_network_widget.dart'; import 'package:hello_wallpaper/common/components/image_network_widget.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/catalog/catalog_controller.dart'; import 'package:hello_wallpaper/modules/catalog/catalog_controller.dart';
class CatalogView extends GetView<CatalogController> { class CatalogView extends GetView<CatalogController> {
const CatalogView({super.key}); const CatalogView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.lazyPut(() => CatalogController()); Get.put(CatalogController());
return GetBuilder<CatalogController>( return GetBuilder<CatalogController>(
builder: (logic) { builder: (logic) {
return ListView.separated( return MediaQuery.removePadding(
context: context,
removeTop: true,
child: Scrollbar(
controller: controller.scrollController,
child: ListView.separated(
controller: controller.scrollController,
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 7.h), padding: const EdgeInsets.symmetric(horizontal: 20).w,
itemCount: controller.wallpaperModelList.length, itemCount: controller.wallpaperModelList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildCatalogItem(controller.wallpaperModelList[index]); return _buildCatalogItem(controller.wallpaperModelList[index], index);
}, },
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return SizedBox(height: 24.h); return SizedBox(height: 24.h);
}, },
),
),
); );
}, },
); );
} }
Widget _buildCatalogItem(WallpaperModel item) { Widget _buildCatalogItem(WallpaperModel item, int index) {
final wallpaperList = controller.getRandomFiveList(item); final wallpaperList = controller.getRandomFiveList(item);
return Column( return Column(
children: [ children: [
@ -79,8 +87,8 @@ class CatalogView extends GetView<CatalogController> {
}, },
blendMode: BlendMode.dstIn, blendMode: BlendMode.dstIn,
child: ListView.separated( child: ListView.separated(
scrollDirection: Axis.horizontal,
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
itemCount: wallpaperList.length, itemCount: wallpaperList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildWallpaperItem(wallpaperList, wallpaperList[index], index); return _buildWallpaperItem(wallpaperList, wallpaperList[index], index);
@ -98,12 +106,15 @@ class CatalogView extends GetView<CatalogController> {
Widget _buildWallpaperItem(List<WallpaperData> wallpaperList, WallpaperData item, int index) { Widget _buildWallpaperItem(List<WallpaperData> wallpaperList, WallpaperData item, int index) {
return GestureDetector( return GestureDetector(
onTap: () => controller.onTapItem(wallpaperList, index), onTap: () => controller.onTapItem(wallpaperList, index),
child: Hero(
tag: '$index-${item.original}',
child: ImageNetworkWidget( child: ImageNetworkWidget(
url: item.previewThumb, url: item.previewThumb,
width: 136.w, width: 136.w,
height: double.infinity, height: double.infinity,
radius: 8.r, radius: 8.r,
), ),
),
); );
} }
} }

View File

@ -1,5 +1,5 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/modules/cls_det/cls_det_controller.dart'; import 'package:hello_wallpaper/modules/cls_det/cls_det_controller.dart';
class ClsDetBinding extends Bindings { class ClsDetBinding extends Bindings {
@override @override

View File

@ -1,6 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
class ClsDetController extends GetxController { class ClsDetController extends GetxController {
late final List<WallpaperData> wallpaperDataList; late final List<WallpaperData> wallpaperDataList;

View File

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/image_network_widget.dart'; import 'package:hello_wallpaper/common/components/image_network_widget.dart';
import 'package:now_wallpaper/common/components/navigation_bar/base_appbar.dart'; import 'package:hello_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/cls_det/cls_det_controller.dart'; import 'package:hello_wallpaper/modules/cls_det/cls_det_controller.dart';
class ClsDetView extends GetView<ClsDetController> { class ClsDetView extends GetView<ClsDetController> {
const ClsDetView({super.key}); const ClsDetView({super.key});
@ -14,27 +14,32 @@ class ClsDetView extends GetView<ClsDetController> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: BaseAppBar(controller.clsName), appBar: BaseAppBar(controller.clsName),
body: MasonryGridView.count( body: Scrollbar(
child: MasonryGridView.count(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.w, mainAxisSpacing: 10.w,
crossAxisSpacing: 10.w, crossAxisSpacing: 10.w,
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 7.h), padding: const EdgeInsets.symmetric(horizontal: 20).w,
itemCount: controller.wallpaperDataList.length, itemCount: controller.wallpaperDataList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildDiscoverItem(controller.wallpaperDataList[index], index); return _buildDiscoverItem(controller.wallpaperDataList[index], index);
}, },
), ),
),
); );
} }
Widget _buildDiscoverItem(WallpaperData item, index) { Widget _buildDiscoverItem(WallpaperData item, index) {
return GestureDetector( return GestureDetector(
onTap: () => controller.onTapItem(index), onTap: () => controller.onTapItem(index),
child: Hero(
tag: '$index-${item.original}',
child: ImageNetworkWidget( child: ImageNetworkWidget(
url: item.previewThumb, url: item.previewThumb,
radius: 8.r, radius: 8.r,
), ),
),
); );
} }
} }

View File

@ -1,10 +1,10 @@
import 'package:easy_refresh/easy_refresh.dart'; import 'package:easy_refresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/common/utils/obj_util.dart'; import 'package:hello_wallpaper/common/utils/obj_util.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/home/home_controller.dart'; import 'package:hello_wallpaper/modules/home/home_controller.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
class DiscoverController extends GetxController { class DiscoverController extends GetxController {
static DiscoverController get to => Get.find<DiscoverController>(); static DiscoverController get to => Get.find<DiscoverController>();
@ -37,6 +37,8 @@ class DiscoverController extends GetxController {
} }
viewState = HomeController.to.viewState; viewState = HomeController.to.viewState;
allWallpaper = HomeController.to.wallpaperModelList.expand((element) => element.data ?? <WallpaperData>[]).toList(); allWallpaper = HomeController.to.wallpaperModelList.expand((element) => element.data ?? <WallpaperData>[]).toList();
// List顺序
allWallpaper.shuffle();
_getDataToShow(); _getDataToShow();
} }

View File

@ -2,18 +2,18 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/image_network_widget.dart'; import 'package:hello_wallpaper/common/components/image_network_widget.dart';
import 'package:now_wallpaper/common/components/refresh/base_easyrefresh.dart'; import 'package:hello_wallpaper/common/components/refresh/base_easyrefresh.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/discover/discover_controller.dart'; import 'package:hello_wallpaper/modules/discover/discover_controller.dart';
import 'package:now_wallpaper/res/themes/app_sizes.dart'; import 'package:hello_wallpaper/res/themes/app_sizes.dart';
class DiscoverView extends GetView<DiscoverController> { class DiscoverView extends GetView<DiscoverController> {
const DiscoverView({super.key}); const DiscoverView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.lazyPut(() => DiscoverController()); Get.put(DiscoverController());
return GetBuilder<DiscoverController>( return GetBuilder<DiscoverController>(
builder: (controller) { builder: (controller) {
return Column( return Column(
@ -24,6 +24,10 @@ class DiscoverView extends GetView<DiscoverController> {
SizedBox(height: 7.h), SizedBox(height: 7.h),
], ],
Expanded( Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: Scrollbar(
child: BaseEasyRefresh( child: BaseEasyRefresh(
controller: controller.refreshController, controller: controller.refreshController,
onLoad: controller.onLoad, onLoad: controller.onLoad,
@ -34,13 +38,15 @@ class DiscoverView extends GetView<DiscoverController> {
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 10.w, mainAxisSpacing: 10.w,
crossAxisSpacing: 10.w, crossAxisSpacing: 10.w,
padding: EdgeInsets.fromLTRB(20.w, 0, 20.w, 7.h), padding: const EdgeInsets.symmetric(horizontal: 20).w,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildDiscoverItem(controller.wallpaperDataList[index], index); return _buildDiscoverItem(controller.wallpaperDataList[index], index);
}, },
), ),
), ),
), ),
),
),
], ],
); );
}, },
@ -50,10 +56,13 @@ class DiscoverView extends GetView<DiscoverController> {
Widget _buildDiscoverItem(WallpaperData item, index) { Widget _buildDiscoverItem(WallpaperData item, index) {
return GestureDetector( return GestureDetector(
onTap: () => controller.onTapItem(index), onTap: () => controller.onTapItem(index),
child: Hero(
tag: '$index-${item.original}',
child: ImageNetworkWidget( child: ImageNetworkWidget(
url: item.previewThumb, url: item.previewThumb,
radius: 8.r, radius: 8.r,
), ),
),
); );
} }

View File

@ -1,13 +1,15 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/dialog/remind_dialog.dart'; import 'package:hello_wallpaper/common/components/dialog/remind_dialog.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/common/storage/favorite_data.dart'; import 'package:hello_wallpaper/common/storage/favorite_data.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/home/home_controller.dart'; import 'package:hello_wallpaper/modules/home/home_controller.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
class FavoriteController extends GetxController { class FavoriteController extends GetxController {
static FavoriteController get to => Get.find<FavoriteController>(); static FavoriteController get to => Get.find<FavoriteController>();
late ScrollController scrollController;
late ViewState viewState; late ViewState viewState;
late List<WallpaperData> favoriteList; late List<WallpaperData> favoriteList;
var todayHottestList = <WallpaperData>[]; var todayHottestList = <WallpaperData>[];
@ -16,10 +18,17 @@ class FavoriteController extends GetxController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
scrollController = ScrollController();
getData(); getData();
getTodayHottestList(); getTodayHottestList();
} }
@override
void onClose() {
scrollController.dispose();
super.onClose();
}
void getData() { void getData() {
favoriteList = FavoriteData().getWallpaperData().reversed.toList(); favoriteList = FavoriteData().getWallpaperData().reversed.toList();
_refreshList(); _refreshList();

View File

@ -2,18 +2,18 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/button/base_textbutton.dart'; import 'package:hello_wallpaper/common/components/button/base_textbutton.dart';
import 'package:now_wallpaper/common/components/image_network_widget.dart'; import 'package:hello_wallpaper/common/components/image_network_widget.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/favorite/favorite_controller.dart'; import 'package:hello_wallpaper/modules/favorite/favorite_controller.dart';
class FavoriteView extends GetView<FavoriteController> { class FavoriteView extends GetView<FavoriteController> {
const FavoriteView({super.key}); const FavoriteView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.lazyPut(() => FavoriteController()); Get.put(FavoriteController());
return GetBuilder<FavoriteController>( return GetBuilder<FavoriteController>(
builder: (logic) { builder: (logic) {
return Column( return Column(
@ -21,19 +21,27 @@ class FavoriteView extends GetView<FavoriteController> {
Expanded( Expanded(
child: ViewStateWidget( child: ViewStateWidget(
viewState: controller.viewState, viewState: controller.viewState,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: Scrollbar(
controller: controller.scrollController,
child: MasonryGridView.count( child: MasonryGridView.count(
controller: controller.scrollController,
itemCount: controller.favoriteList.length, itemCount: controller.favoriteList.length,
crossAxisCount: 3, crossAxisCount: 3,
mainAxisSpacing: 7.w, mainAxisSpacing: 7.w,
crossAxisSpacing: 7.w, crossAxisSpacing: 7.w,
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 7.h), padding: const EdgeInsets.symmetric(horizontal: 20).w,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildFavoriteItem(controller.favoriteList[index], index); return _buildFavoriteItem(controller.favoriteList[index], index);
}, },
), ),
), ),
), ),
),
),
if (controller.viewState == ViewState.empty && controller.todayHottestList.isNotEmpty) ...[ if (controller.viewState == ViewState.empty && controller.todayHottestList.isNotEmpty) ...[
_buildTodayHottest(), _buildTodayHottest(),
], ],
@ -47,10 +55,13 @@ class FavoriteView extends GetView<FavoriteController> {
return GestureDetector( return GestureDetector(
onTap: () => controller.onTapItem(index, true), onTap: () => controller.onTapItem(index, true),
onLongPress: () => controller.onLongPress(index), onLongPress: () => controller.onLongPress(index),
child: Hero(
tag: '$index-${item.original}',
child: ImageNetworkWidget( child: ImageNetworkWidget(
url: item.previewThumb, url: item.previewThumb,
radius: 8.r, radius: 8.r,
), ),
),
); );
} }
@ -76,6 +87,8 @@ class FavoriteView extends GetView<FavoriteController> {
padding: const EdgeInsets.symmetric(horizontal: 3.5).w, padding: const EdgeInsets.symmetric(horizontal: 3.5).w,
child: GestureDetector( child: GestureDetector(
onTap: () => controller.onTapItem(e.key, false), onTap: () => controller.onTapItem(e.key, false),
child: Hero(
tag: '${e.key}-${e.value.original}',
child: ImageNetworkWidget( child: ImageNetworkWidget(
url: e.value.previewThumb, url: e.value.previewThumb,
height: 183.h, height: 183.h,
@ -83,6 +96,7 @@ class FavoriteView extends GetView<FavoriteController> {
), ),
), ),
), ),
),
); );
}).toList(), }).toList(),
), ),

View File

@ -1,5 +1,5 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/modules/home/home_controller.dart'; import 'package:hello_wallpaper/modules/home/home_controller.dart';
class HomeBinding extends Bindings { class HomeBinding extends Bindings {
@override @override

View File

@ -4,17 +4,18 @@ import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/firebase/analytics_util.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/modules/catalog/catalog_controller.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/catalog/catalog_view.dart'; import 'package:hello_wallpaper/modules/catalog/catalog_controller.dart';
import 'package:now_wallpaper/modules/discover/discover_controller.dart'; import 'package:hello_wallpaper/modules/catalog/catalog_view.dart';
import 'package:now_wallpaper/modules/discover/discover_view.dart'; import 'package:hello_wallpaper/modules/discover/discover_controller.dart';
import 'package:now_wallpaper/modules/favorite/favorite_controller.dart'; import 'package:hello_wallpaper/modules/discover/discover_view.dart';
import 'package:now_wallpaper/modules/favorite/favorite_view.dart'; import 'package:hello_wallpaper/modules/favorite/favorite_controller.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/modules/favorite/favorite_view.dart';
import 'package:hello_wallpaper/routes/app_pages.dart';
class HomeController extends GetxController with WidgetsBindingObserver { class HomeController extends GetxController with WidgetsBindingObserver {
static HomeController get to => Get.find<HomeController>(); static HomeController get to => Get.find<HomeController>();
@ -33,6 +34,7 @@ class HomeController extends GetxController with WidgetsBindingObserver {
super.onInit(); super.onInit();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
pageController = PageController(initialPage: currentIndex.value); pageController = PageController(initialPage: currentIndex.value);
AnalyticsUtil.initializeFlutterFire();
} }
@override @override
@ -98,7 +100,7 @@ class HomeController extends GetxController with WidgetsBindingObserver {
/// ///
Future<void> _getAllData() async { Future<void> _getAllData() async {
// json文件 // json文件
var data = jsonDecode(await rootBundle.loadString(Assets.jsonWallpaper)); var data = jsonDecode(await rootBundle.loadString(Assets.jsonLuxWallpaper));
if (data != null && data is List) { if (data != null && data is List) {
wallpaperModelList = data.map((e) => WallpaperModel.fromJson(e)).toList(); wallpaperModelList = data.map((e) => WallpaperModel.fromJson(e)).toList();
viewState = wallpaperModelList.isNotEmpty ? ViewState.normal : ViewState.empty; viewState = wallpaperModelList.isNotEmpty ? ViewState.normal : ViewState.empty;

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/keep_alive_wrapper.dart'; import 'package:hello_wallpaper/common/components/keep_alive_wrapper.dart';
import 'package:now_wallpaper/common/components/navigation_bar/title_bar_widget.dart'; import 'package:hello_wallpaper/common/components/navigation_bar/title_bar_widget.dart';
import 'package:now_wallpaper/modules/home/home_controller.dart'; import 'package:hello_wallpaper/modules/home/home_controller.dart';
class HomeView extends GetView<HomeController> { class HomeView extends GetView<HomeController> {
const HomeView({super.key}); const HomeView({super.key});
@ -11,9 +11,9 @@ class HomeView extends GetView<HomeController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SafeArea( body: Column(
child: Column(
children: [ children: [
SizedBox(height: ScreenUtil().statusBarHeight),
Obx(() { Obx(() {
return TitleBarWidget( return TitleBarWidget(
controller.pages[controller.currentIndex.value].label, controller.pages[controller.currentIndex.value].label,
@ -30,7 +30,6 @@ class HomeView extends GetView<HomeController> {
), ),
], ],
), ),
),
bottomNavigationBar: Obx(() { bottomNavigationBar: Obx(() {
return BottomNavigationBar( return BottomNavigationBar(
currentIndex: controller.currentIndex.value, currentIndex: controller.currentIndex.value,

View File

@ -2,10 +2,10 @@ import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/utils/local_path_util.dart'; import 'package:hello_wallpaper/common/utils/local_path_util.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/res/values/strings.dart'; import 'package:hello_wallpaper/res/values/strings.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
class SettingsController extends GetxController { class SettingsController extends GetxController {

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/navigation_bar/base_appbar.dart'; import 'package:hello_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/modules/settings/settings_controller.dart'; import 'package:hello_wallpaper/modules/settings/settings_controller.dart';
class SettingsView extends GetView<SettingsController> { class SettingsView extends GetView<SettingsController> {
const SettingsView({super.key}); const SettingsView({super.key});
@ -14,7 +14,7 @@ class SettingsView extends GetView<SettingsController> {
appBar: const BaseAppBar('Setting'), appBar: const BaseAppBar('Setting'),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 7.h), padding: const EdgeInsets.symmetric(horizontal: 20).w,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0XFF1C1C1D), color: const Color(0XFF1C1C1D),

View File

@ -1,19 +1,17 @@
import 'dart:async'; import 'dart:async';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart';
import 'package:now_wallpaper/routes/app_pages.dart'; import 'package:hello_wallpaper/routes/app_pages.dart';
class SplashScreenController extends GetxController { class SplashScreenController extends GetxController {
Timer? _timer; Timer? _timer;
int _timeCount = 15; int _timeCount = 1;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
ApplovinManage().initializeInterstitialAds( ApplovinManage().initializeInterstitialAds(onGoHomeTap: _openHomePage);
onAdLoadedCallback: _openHomePage,
);
_startTimer(); _startTimer();
} }

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/generated/assets.dart'; import 'package:hello_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/modules/splash_screen/splash_screen_controller.dart'; import 'package:hello_wallpaper/modules/splash_screen/splash_screen_controller.dart';
import 'package:now_wallpaper/res/values/strings.dart'; import 'package:hello_wallpaper/res/values/strings.dart';
class SplashScreenView extends GetView<SplashScreenController> { class SplashScreenView extends GetView<SplashScreenController> {
const SplashScreenView({super.key}); const SplashScreenView({super.key});

View File

@ -5,26 +5,26 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:now_wallpaper/applovin_max/applovin_manage.dart'; import 'package:hello_wallpaper/applovin_max/applovin_manage.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:now_wallpaper/common/components/dialog/bottomsheet_dialog.dart'; import 'package:hello_wallpaper/common/components/dialog/bottomsheet_dialog.dart';
import 'package:now_wallpaper/common/components/easy_loading.dart'; import 'package:hello_wallpaper/common/components/easy_loading.dart';
import 'package:now_wallpaper/common/storage/favorite_data.dart'; import 'package:hello_wallpaper/common/storage/favorite_data.dart';
import 'package:now_wallpaper/common/utils/device_info_util.dart'; import 'package:hello_wallpaper/common/utils/device_info_util.dart';
import 'package:now_wallpaper/common/utils/download_util.dart'; import 'package:hello_wallpaper/common/utils/download_util.dart';
import 'package:now_wallpaper/common/utils/local_path_util.dart'; import 'package:hello_wallpaper/common/utils/local_path_util.dart';
import 'package:now_wallpaper/common/utils/obj_util.dart'; import 'package:hello_wallpaper/common/utils/obj_util.dart';
import 'package:now_wallpaper/common/utils/permission_util.dart'; import 'package:hello_wallpaper/common/utils/permission_util.dart';
import 'package:now_wallpaper/common/utils/wallpaper_manage.dart'; import 'package:hello_wallpaper/common/utils/wallpaper_manage.dart';
import 'package:now_wallpaper/models/wallpaper_model.dart'; import 'package:hello_wallpaper/models/wallpaper_model.dart';
import 'package:now_wallpaper/modules/favorite/favorite_controller.dart'; import 'package:hello_wallpaper/modules/favorite/favorite_controller.dart';
class WallpaperDetController extends GetxController { class WallpaperDetController extends GetxController {
late final List<GlobalKey> globalKey; late final List<GlobalKey> globalKey;
late final PageController pageController;
late final List<WallpaperData> wallpaperList; late final List<WallpaperData> wallpaperList;
late final PageController pageController;
var blurs = <bool>[].obs;
var position = 0; var position = 0;
var showBlur = false.obs;
var filePath = ''; var filePath = '';
@override @override
@ -33,24 +33,30 @@ class WallpaperDetController extends GetxController {
position = Get.arguments['position'] ?? 0; position = Get.arguments['position'] ?? 0;
wallpaperList = Get.arguments['wallpaperList'] ?? <WallpaperData>[]; wallpaperList = Get.arguments['wallpaperList'] ?? <WallpaperData>[];
globalKey = List.generate(wallpaperList.length, (index) => GlobalKey()); globalKey = List.generate(wallpaperList.length, (index) => GlobalKey());
blurs.value = List.generate(wallpaperList.length, (index) => false);
pageController = PageController(initialPage: position); pageController = PageController(initialPage: position);
} }
@override
void onClose() {
pageController.dispose();
super.onClose();
}
/// ///
void onPageChanged(int index) { void onPageChanged(int index) {
position = index; position = index;
filePath = ''; filePath = '';
showBlur.value = false;
} }
/// ///
void onTapBlur() { void onTapBlur() {
showBlur.value = !showBlur.value; blurs[position] = !blurs[position];
} }
/// ///
void onTapDownload() { void onTapDownload() {
if (showBlur.value) { if (blurs[position]) {
// //
_captureScreenshot(); _captureScreenshot();
return; return;
@ -100,7 +106,7 @@ class WallpaperDetController extends GetxController {
void onTapSetWallpaper() async { void onTapSetWallpaper() async {
await ApplovinManage().showAdIfReady(ApplovinManage().adUnitId2); await ApplovinManage().showAdIfReady(ApplovinManage().adUnitId2);
BottomSheetDialog.show((location) async { BottomSheetDialog.show((location) async {
if (showBlur.value) { if (blurs[position]) {
await _captureScreenshot(); await _captureScreenshot();
} else { } else {
if (ObjUtil.isNotEmptyStr(filePath)) { if (ObjUtil.isNotEmptyStr(filePath)) {

View File

@ -5,14 +5,13 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:hello_wallpaper/common/components/button/base_textbutton.dart';
import 'package:hello_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:hello_wallpaper/generated/assets.dart';
import 'package:hello_wallpaper/modules/wallpaper_det/wallpaper_det_controller.dart';
import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view.dart';
import 'package:now_wallpaper/common/components/button/base_textbutton.dart'; import 'package:photo_view/photo_view_gallery.dart';
import 'package:now_wallpaper/common/components/image_network_widget.dart';
import 'package:now_wallpaper/common/components/keep_alive_wrapper.dart';
import 'package:now_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart';
import 'package:now_wallpaper/generated/assets.dart';
import 'package:now_wallpaper/modules/wallpaper_det/wallpaper_det_controller.dart';
class WallpaperDetView extends GetView<WallpaperDetController> { class WallpaperDetView extends GetView<WallpaperDetController> {
const WallpaperDetView({super.key}); const WallpaperDetView({super.key});
@ -21,6 +20,7 @@ class WallpaperDetView extends GetView<WallpaperDetController> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
extendBody: true,
appBar: BaseAppBar( appBar: BaseAppBar(
'', '',
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -29,7 +29,7 @@ class WallpaperDetView extends GetView<WallpaperDetController> {
body: Stack( body: Stack(
fit: StackFit.expand, fit: StackFit.expand,
children: [ children: [
Obx(() => _buildPhotoView()), _buildPhotoView(),
_buildBottomOption(), _buildBottomOption(),
], ],
), ),
@ -64,42 +64,36 @@ class WallpaperDetView extends GetView<WallpaperDetController> {
/// PageView /// PageView
Widget _buildPhotoView() { Widget _buildPhotoView() {
return PageView( return PhotoViewGallery.builder(
physics: const BouncingScrollPhysics(), itemCount: controller.wallpaperList.length,
controller: controller.pageController, scrollPhysics: const BouncingScrollPhysics(),
onPageChanged: (index) => controller.onPageChanged(index), wantKeepAlive: true,
children: controller.wallpaperList.asMap().entries.map((e) { gaplessPlayback: true,
return KeepAliveWrapper( builder: (context, index) {
child: Visibility( return PhotoViewGalleryPageOptions.customChild(
visible: controller.showBlur.value, child: RepaintBoundary(
replacement: PhotoView( key: controller.globalKey[index],
imageProvider: CachedNetworkImageProvider('${e.value.original}'), child: Obx(() {
return ImageFiltered(
enabled: controller.blurs[index],
imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5, tileMode: TileMode.clamp,),
child: PhotoView(
enableRotation: true,
imageProvider: CachedNetworkImageProvider('${controller.wallpaperList[index].original}'),
initialScale: PhotoViewComputedScale.covered, initialScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained * 0.5, minScale: PhotoViewComputedScale.contained * 0.5,
maxScale: PhotoViewComputedScale.covered * 3, maxScale: PhotoViewComputedScale.covered * 3,
loadingBuilder: (context, event) => loadingView(), loadingBuilder: (context, event) => loadingView(),
errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) => errorView, errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) => errorView,
), heroAttributes: PhotoViewHeroAttributes(tag: '${controller.position}-${controller.wallpaperList[index].original}'),
child: RepaintBoundary(
key: controller.globalKey[e.key],
child: PhotoView.customChild(
initialScale: PhotoViewComputedScale.contained,
minScale: PhotoViewComputedScale.contained * 0.5,
maxScale: PhotoViewComputedScale.covered * 3,
child: ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5, tileMode: TileMode.clamp),
child: ImageNetworkWidget(
url: e.value.original,
width: double.infinity,
height: double.infinity,
fit: BoxFit.cover,
),
),
),
),
), ),
); );
}).toList(), }),
),
);
},
pageController: controller.pageController,
onPageChanged: (index) => controller.onPageChanged(index),
); );
} }

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
class WebPageController extends GetxController { class WebPageController extends GetxController {

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:now_wallpaper/common/components/navigation_bar/base_appbar.dart'; import 'package:hello_wallpaper/common/components/navigation_bar/base_appbar.dart';
import 'package:now_wallpaper/common/components/view_state_widget.dart'; import 'package:hello_wallpaper/common/components/view_state_widget.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
import 'web_page_controller.dart'; import 'web_page_controller.dart';

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