diff --git a/CHANGELOG.md b/CHANGELOG.md index 85df812..70339d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.1.1 +- Bump `playx_core` dependency to `^0.7.4`. +- Wrap `PlayxThemeBuilder`'s child in a `Theme` widget to ensure correct theme data is applied down the widget tree. +- Refactor `PlayxThemeSwitchingArea` to use `context.xTheme` for better theme access. + ## 1.1.0 > **Note**: This release contains breaking changes. - Updated to Flutter 3.27 / Dart 3.5. diff --git a/README.md b/README.md index ca17413..a722b2e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Playx Theme: Effortlessly control your app's visual style. Seamlessly switch the Add the following line to your `dependencies` in `pubspec.yaml`: ```yaml -playx_theme: ^1.0.4 +playx_theme: ^1.1.1 ``` ## Usage diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts index a6ae87b..76b702e 100644 --- a/example/android/app/build.gradle.kts +++ b/example/android/app/build.gradle.kts @@ -24,7 +24,7 @@ android { applicationId = "io.sourcya.playx.theme.example" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = 23 + minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 7c56964..1dc6cf7 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index e549ee2..620e46e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '12.0' +# platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 802f4b0..dcaac4c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -26,11 +26,11 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" SPEC CHECKSUMS: - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 - path_provider_foundation: 2a68637f8a62df7f6e790a428d1bdf72cb4e2d59 + path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 -PODFILE CHECKSUM: 4305caec6b40dde0ae97be1573c53de1882a07e5 +PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e COCOAPODS: 1.16.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 5311fda..c200dbe 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -455,7 +455,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -585,7 +585,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -636,7 +636,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/lib/main.dart b/example/lib/main.dart index bc7035a..9a54ede 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -106,7 +106,7 @@ class HomeScreen extends StatelessWidget { PlayxTheme .supportedThemes[index] .id, - animate: false, + animate: true, animation: const PlayxThemeAnimation .horizontalSlide()); @@ -138,7 +138,7 @@ class HomeScreen extends StatelessWidget { ), onPressed: () { PlayxTheme.next( - animation: const PlayxThemeFadeAnimation( + animation: PlayxThemeClipperAnimation( duration: Duration(milliseconds: 500), ), animate: false, diff --git a/example/pubspec.lock b/example/pubspec.lock index d0285cd..8f439da 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -106,10 +106,10 @@ packages: dependency: transitive description: name: flutter_dotenv - sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b + sha256: d4130c4a43e0b13fefc593bc3961f2cb46e30cb79e253d4a526b1b5d24ae1ce4 url: "https://pub.dev" source: hosted - version: "5.2.1" + version: "6.0.0" flutter_lints: dependency: "direct dev" description: @@ -180,10 +180,10 @@ packages: dependency: transitive description: name: get_it - sha256: f126a3e286b7f5b578bf436d5592968706c4c1de28a228b870ce375d9f743103 + sha256: "84792561b731b6463d053e9761a5236da967c369da10b134b8585a5e18429956" url: "https://pub.dev" source: hosted - version: "8.0.3" + version: "9.0.5" js: dependency: transitive description: @@ -196,26 +196,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" lints: dependency: transitive description: @@ -316,17 +316,17 @@ packages: dependency: transitive description: name: playx_core - sha256: "2ec52210e11918d2d4d86580ee9f859da434346ffb2fecbb3f903d931414f369" + sha256: b49e07caeda91353f04f68d52c751fdec0513faf46646c74ef785ca258fd1683 url: "https://pub.dev" source: hosted - version: "0.7.3" + version: "0.7.4" playx_theme: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.1.0" + version: "1.1.1" plugin_platform_interface: dependency: transitive description: @@ -440,10 +440,10 @@ packages: dependency: transitive description: name: talker_logger - sha256: f1755d517e5ca8b119b65ad2fc1079746a8d03bd565e75d6b9d5aedf5c1d5b15 + sha256: "8218836d871ea5ab1ec616cffe3cdae84e8fb44022d5cc04c95d7b220572b8fb" url: "https://pub.dev" source: hosted - version: "4.9.1" + version: "5.0.2" term_glyph: dependency: transitive description: @@ -456,18 +456,18 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.6" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -496,10 +496,10 @@ packages: dependency: transitive description: name: worker_manager - sha256: af3db5e6c6c8a74ab8f72e25e9d305f8ff60984ca55551397e3c8828ebf30509 + sha256: "1bce9f894a0c187856f5fc0e150e7fe1facce326f048ca6172947754dac3d4f3" url: "https://pub.dev" source: hosted - version: "7.2.6" + version: "7.2.7" xdg_directories: dependency: transitive description: diff --git a/lib/src/widgets/animation/playx_theme_switching_area.dart b/lib/src/widgets/animation/playx_theme_switching_area.dart index 8affa01..d7d3624 100644 --- a/lib/src/widgets/animation/playx_theme_switching_area.dart +++ b/lib/src/widgets/animation/playx_theme_switching_area.dart @@ -15,25 +15,25 @@ class PlayxThemeSwitchingArea extends StatelessWidget { Widget build(BuildContext context) { final controller = XThemeController.instance; final themeAnimation = controller.themeAnimation; + final xTheme = context.xTheme; if (controller.oldTheme == null || - controller.oldTheme == controller.theme || + controller.oldTheme == xTheme || !(controller.controller?.isAnimating == true) || themeAnimation == null) { // If there is no old theme, or no animation in progress, just show the current theme - return Material(child: _getPage(controller.theme.themeData)); + return Material(child: _getPage(xTheme.themeData)); } else { // Create the widgets for the transition late final Widget oldThemeWidget, newThemeWidget; if (themeAnimation.isReversed) { - oldThemeWidget = - _getPage(controller.theme.themeData); // Show the new theme first + oldThemeWidget = _getPage(xTheme.themeData); // Show the new theme first newThemeWidget = RawImage(image: controller.image); // Transition from screenshot } else { oldThemeWidget = RawImage( image: controller.image); // Show the old theme screenshot first newThemeWidget = - _getPage(controller.theme.themeData); // Transition to the new theme + _getPage(xTheme.themeData); // Transition to the new theme } // Create a widget based on the selected animation type diff --git a/lib/src/widgets/playx_theme_builder.dart b/lib/src/widgets/playx_theme_builder.dart index 642cd2d..bd23c13 100644 --- a/lib/src/widgets/playx_theme_builder.dart +++ b/lib/src/widgets/playx_theme_builder.dart @@ -64,9 +64,12 @@ class _ThemeProviderState extends State builder: (context, xTheme, _) { return PlayxInheritedTheme( theme: xTheme, - child: RepaintBoundary( - key: controller.previewContainer, - child: widget.child ?? widget.builder!(context, xTheme), + child: Theme( + data: xTheme.themeData, + child: RepaintBoundary( + key: controller.previewContainer, + child: widget.child ?? widget.builder!(context, xTheme), + ), ), ); }, diff --git a/pubspec.yaml b/pubspec.yaml index 1e137f5..f3eb35d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: playx_theme description: Simplify app theming in Flutter with Playx Theme. Effortlessly switch themes, enjoy smooth animations, and customize color schemes with ease. -version: 1.1.0 +version: 1.1.1 homepage: https://sourcya.io repository: https://github.com/playx-flutter/playx_theme issue_tracker: https://github.com/playx-flutter/playx_theme/issues @@ -18,7 +18,7 @@ environment: dependencies: flutter: sdk: flutter - playx_core: ^0.7.3 + playx_core: ^0.7.4 flex_seed_scheme: ^3.5.1 animated_theme_switcher: ^2.0.10