diff --git a/projects/chapters/chapter_07/animation_demo/.fvmrc b/projects/chapters/chapter_07/animation_demo/.fvmrc index 906bbb34..b57db98d 100644 --- a/projects/chapters/chapter_07/animation_demo/.fvmrc +++ b/projects/chapters/chapter_07/animation_demo/.fvmrc @@ -1,3 +1,3 @@ { - "flutter": "3.24.3" + "flutter": "3.38.4" } \ No newline at end of file diff --git a/projects/chapters/chapter_07/animation_demo/.gitignore b/projects/chapters/chapter_07/animation_demo/.gitignore index dd1f453b..247300b8 100644 --- a/projects/chapters/chapter_07/animation_demo/.gitignore +++ b/projects/chapters/chapter_07/animation_demo/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related @@ -19,7 +21,7 @@ migrate_working_dir/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ diff --git a/projects/chapters/chapter_07/animation_demo/android/app/build.gradle b/projects/chapters/chapter_07/animation_demo/android/app/build.gradle.kts similarity index 74% rename from projects/chapters/chapter_07/animation_demo/android/app/build.gradle rename to projects/chapters/chapter_07/animation_demo/android/app/build.gradle.kts index 68c094d0..4313c2a9 100644 --- a/projects/chapters/chapter_07/animation_demo/android/app/build.gradle +++ b/projects/chapters/chapter_07/animation_demo/android/app/build.gradle.kts @@ -1,22 +1,22 @@ plugins { - id "com.android.application" - id "kotlin-android" + id("com.android.application") + id("kotlin-android") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. - id "dev.flutter.flutter-gradle-plugin" + id("dev.flutter.flutter-gradle-plugin") } android { namespace = "com.example.animation_demo" compileSdk = flutter.compileSdkVersion - ndkVersion = "28.0.12433566" + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_17.toString() } defaultConfig { @@ -34,11 +34,11 @@ android { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug + signingConfig = signingConfigs.getByName("debug") } } } flutter { source = "../.." -} +} \ No newline at end of file diff --git a/projects/chapters/chapter_07/animation_demo/android/build.gradle b/projects/chapters/chapter_07/animation_demo/android/build.gradle deleted file mode 100644 index d2ffbffa..00000000 --- a/projects/chapters/chapter_07/animation_demo/android/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = "../build" -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(":app") -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/projects/chapters/chapter_07/animation_demo/android/build.gradle.kts b/projects/chapters/chapter_07/animation_demo/android/build.gradle.kts new file mode 100644 index 00000000..dbee657b --- /dev/null +++ b/projects/chapters/chapter_07/animation_demo/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/projects/chapters/chapter_07/animation_demo/android/gradle/wrapper/gradle-wrapper.properties b/projects/chapters/chapter_07/animation_demo/android/gradle/wrapper/gradle-wrapper.properties index 7bb2df6b..74b269f3 100644 --- a/projects/chapters/chapter_07/animation_demo/android/gradle/wrapper/gradle-wrapper.properties +++ b/projects/chapters/chapter_07/animation_demo/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip diff --git a/projects/chapters/chapter_07/animation_demo/android/settings.gradle b/projects/chapters/chapter_07/animation_demo/android/settings.gradle deleted file mode 100644 index b9e43bd3..00000000 --- a/projects/chapters/chapter_07/animation_demo/android/settings.gradle +++ /dev/null @@ -1,25 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.1.0" apply false - id "org.jetbrains.kotlin.android" version "1.8.22" apply false -} - -include ":app" diff --git a/projects/chapters/chapter_07/animation_demo/android/settings.gradle.kts b/projects/chapters/chapter_07/animation_demo/android/settings.gradle.kts new file mode 100644 index 00000000..1ed7e18c --- /dev/null +++ b/projects/chapters/chapter_07/animation_demo/android/settings.gradle.kts @@ -0,0 +1,27 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.12.3" apply false + id("com.android.library") version "8.12.3" apply false + id("org.jetbrains.kotlin.android") version "2.2.21" apply false +} + +include(":app") diff --git a/projects/chapters/chapter_07/animation_demo/ios/Flutter/AppFrameworkInfo.plist b/projects/chapters/chapter_07/animation_demo/ios/Flutter/AppFrameworkInfo.plist index 7c569640..1dc6cf76 100644 --- a/projects/chapters/chapter_07/animation_demo/ios/Flutter/AppFrameworkInfo.plist +++ b/projects/chapters/chapter_07/animation_demo/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/projects/chapters/chapter_07/animation_demo/ios/Podfile b/projects/chapters/chapter_07/animation_demo/ios/Podfile index 164df534..7d3cdc8f 100644 --- a/projects/chapters/chapter_07/animation_demo/ios/Podfile +++ b/projects/chapters/chapter_07/animation_demo/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '12.0' +platform :ios, '15.6' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/projects/chapters/chapter_07/animation_demo/ios/Podfile.lock b/projects/chapters/chapter_07/animation_demo/ios/Podfile.lock index 0debf427..357afd08 100644 --- a/projects/chapters/chapter_07/animation_demo/ios/Podfile.lock +++ b/projects/chapters/chapter_07/animation_demo/ios/Podfile.lock @@ -2,34 +2,27 @@ PODS: - Flutter (1.0.0) - fluttertoast (0.0.2): - Flutter - - Toast - - rive_common (0.0.1): + - rive_native (0.0.1): - Flutter - - Toast (4.1.1) DEPENDENCIES: - Flutter (from `Flutter`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - - rive_common (from `.symlinks/plugins/rive_common/ios`) - -SPEC REPOS: - trunk: - - Toast + - rive_native (from `.symlinks/plugins/rive_native/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" - rive_common: - :path: ".symlinks/plugins/rive_common/ios" + rive_native: + :path: ".symlinks/plugins/rive_native/ios" SPEC CHECKSUMS: - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c - rive_common: cbbac3192af00d7341f19dae2f26298e9e37d99e - Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 + rive_native: 777d743a0b4e4e1cdbdafd80035a44d44771a5fc -PODFILE CHECKSUM: 7be2f5f74864d463a8ad433546ed1de7e0f29aef +PODFILE CHECKSUM: 83f6a08c58d4b249cda5d50acce1e33fac59623c -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/project.pbxproj b/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/project.pbxproj index d5f3c72e..715c8818 100644 --- a/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/project.pbxproj +++ b/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/project.pbxproj @@ -114,7 +114,6 @@ 11B908229593600C7A33AC5C /* Pods-RunnerTests.release.xcconfig */, D5743D7ECACF17C6AA1E5F17 /* Pods-RunnerTests.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -455,7 +454,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 = 15.6; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -473,6 +472,7 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -584,7 +584,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 = 15.6; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -635,7 +635,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 = 15.6; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -655,6 +655,7 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -677,6 +678,7 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8e3ca5df..e3773d42 100644 --- a/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/projects/chapters/chapter_07/animation_demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/projects/chapters/chapter_07/animation_demo/lib/main.dart b/projects/chapters/chapter_07/animation_demo/lib/main.dart index 0342ab8b..73aab68e 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/main.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/main.dart @@ -1,4 +1,5 @@ import 'package:animation_demo/res/app_theme.dart'; +import 'package:animation_demo/res/l10n/app_localizations.dart'; import 'package:animation_demo/view/components/app_bar.dart'; import 'package:animation_demo/view/components/page_indicator.dart'; import 'package:animation_demo/view/page1_animated_size.dart'; @@ -12,11 +13,12 @@ import 'package:animation_demo/view/page8_lottie.dart'; import 'package:animation_demo/view/page9_rive.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:rive/rive.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + await RiveNative.init(); await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); runApp(const AnimationDemo()); diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/app_theme.dart b/projects/chapters/chapter_07/animation_demo/lib/res/app_theme.dart index 800ecb60..964fcf3f 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/res/app_theme.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/res/app_theme.dart @@ -22,7 +22,7 @@ abstract final class AppTheme { if (states.contains(WidgetState.pressed)) { return blue400; } else if (states.contains(WidgetState.disabled)) { - return white.withOpacity(0.5); + return white.withAlpha(127); } else { return blue700; } @@ -31,7 +31,7 @@ abstract final class AppTheme { if (states.contains(WidgetState.pressed)) { return blue700; } else if (states.contains(WidgetState.disabled)) { - return blue800.withOpacity(0.25); + return blue800.withAlpha(64); } else { return white; } diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/gen/assets.gen.dart b/projects/chapters/chapter_07/animation_demo/lib/res/gen/assets.gen.dart index 01336193..5bb9d0f0 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/res/gen/assets.gen.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/res/gen/assets.gen.dart @@ -1,3 +1,5 @@ +// dart format width=80 + /// GENERATED CODE - DO NOT MODIFY BY HAND /// ***************************************************** /// FlutterGen @@ -5,13 +7,12 @@ // coverage:ignore-file // ignore_for_file: type=lint -// ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use +// ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_svg/flutter_svg.dart' as _svg; import 'package:lottie/lottie.dart' as _lottie; -import 'package:rive/rive.dart' as _rive; import 'package:vector_graphics/vector_graphics.dart' as _vg; class $AssetsFontGen { @@ -59,10 +60,10 @@ class $AssetsRiveGen { const $AssetsRiveGen(); /// File path: assets/rive/bme.riv - RiveGenImage get bme => const RiveGenImage('assets/rive/bme.riv'); + String get bme => 'assets/rive/bme.riv'; /// List of all assets - List get values => [bme]; + List get values => [bme]; } class $AssetsSvgGen { @@ -82,7 +83,7 @@ class $AssetsSvgGen { } class Assets { - Assets._(); + const Assets._(); static const $AssetsFontGen font = $AssetsFontGen(); static const $AssetsImagesGen images = $AssetsImagesGen(); @@ -96,12 +97,14 @@ class AssetGenImage { this._assetName, { this.size, this.flavors = const {}, + this.animation, }); final String _assetName; final Size? size; final Set flavors; + final AssetGenImageAnimation? animation; Image image({ Key? key, @@ -124,7 +127,7 @@ class AssetGenImage { bool gaplessPlayback = true, bool isAntiAlias = false, String? package, - FilterQuality filterQuality = FilterQuality.low, + FilterQuality filterQuality = FilterQuality.medium, int? cacheWidth, int? cacheHeight, }) { @@ -172,6 +175,18 @@ class AssetGenImage { String get keyName => _assetName; } +class AssetGenImageAnimation { + const AssetGenImageAnimation({ + required this.isAnimation, + required this.duration, + required this.frames, + }); + + final bool isAnimation; + final Duration duration; + final int frames; +} + class SvgGenImage { const SvgGenImage( this._assetName, { @@ -204,6 +219,7 @@ class SvgGenImage { String? semanticsLabel, bool excludeFromSemantics = false, _svg.SvgTheme? theme, + _svg.ColorMapper? colorMapper, ColorFilter? colorFilter, Clip clipBehavior = Clip.hardEdge, @deprecated Color? color, @@ -223,6 +239,7 @@ class SvgGenImage { assetBundle: bundle, packageName: package, theme: theme, + colorMapper: colorMapper, ); } return _svg.SvgPicture( @@ -249,47 +266,6 @@ class SvgGenImage { String get keyName => _assetName; } -class RiveGenImage { - const RiveGenImage( - this._assetName, { - this.flavors = const {}, - }); - - final String _assetName; - final Set flavors; - - _rive.RiveAnimation rive({ - String? artboard, - List animations = const [], - List stateMachines = const [], - BoxFit? fit, - Alignment? alignment, - Widget? placeHolder, - bool antialiasing = true, - bool useArtboardSize = false, - List<_rive.RiveAnimationController> controllers = const [], - _rive.OnInitCallback? onInit, - }) { - return _rive.RiveAnimation.asset( - _assetName, - artboard: artboard, - animations: animations, - stateMachines: stateMachines, - fit: fit, - alignment: alignment, - placeHolder: placeHolder, - antialiasing: antialiasing, - useArtboardSize: useArtboardSize, - controllers: controllers, - onInit: onInit, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} - class LottieGenImage { const LottieGenImage( this._assetName, { @@ -325,6 +301,9 @@ class LottieGenImage { bool? addRepaintBoundary, FilterQuality? filterQuality, void Function(String)? onWarning, + _lottie.LottieDecoder? decoder, + _lottie.RenderCache? renderCache, + bool? backgroundLoading, }) { return _lottie.Lottie.asset( _assetName, @@ -349,6 +328,9 @@ class LottieGenImage { addRepaintBoundary: addRepaintBoundary, filterQuality: filterQuality, onWarning: onWarning, + decoder: decoder, + renderCache: renderCache, + backgroundLoading: backgroundLoading, ); } diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/gen/fonts.gen.dart b/projects/chapters/chapter_07/animation_demo/lib/res/gen/fonts.gen.dart index 8c5af685..a2bd14e4 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/res/gen/fonts.gen.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/res/gen/fonts.gen.dart @@ -1,3 +1,4 @@ +// dart format width=80 /// GENERATED CODE - DO NOT MODIFY BY HAND /// ***************************************************** /// FlutterGen @@ -5,7 +6,7 @@ // coverage:ignore-file // ignore_for_file: type=lint -// ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use +// ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import class FontFamily { FontFamily._(); diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_en.arb b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_en.arb index 459ccf34..2196d76b 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_en.arb +++ b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_en.arb @@ -9,5 +9,6 @@ "riveLastHint": "Hover state was disabled for mobile, click one for hover effect, click again to reset.", "staggeredAnimation": "Staggered Animation", "startAnimation": "Start animation", - "stopAnimation": "Stop animation" + "stopAnimation": "Stop animation", + "animationLoadingFailed": "Failed to load animation" } \ No newline at end of file diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations.dart b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations.dart new file mode 100644 index 00000000..6e98bba5 --- /dev/null +++ b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations.dart @@ -0,0 +1,199 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart' as intl; + +import 'app_localizations_en.dart'; + +// ignore_for_file: type=lint + +/// Callers can lookup localized strings with an instance of AppLocalizations +/// returned by `AppLocalizations.of(context)`. +/// +/// Applications need to include `AppLocalizations.delegate()` in their app's +/// `localizationDelegates` list, and the locales they support in the app's +/// `supportedLocales` list. For example: +/// +/// ```dart +/// import 'l10n/app_localizations.dart'; +/// +/// return MaterialApp( +/// localizationsDelegates: AppLocalizations.localizationsDelegates, +/// supportedLocales: AppLocalizations.supportedLocales, +/// home: MyApplicationHome(), +/// ); +/// ``` +/// +/// ## Update pubspec.yaml +/// +/// Please make sure to update your pubspec.yaml to include the following +/// packages: +/// +/// ```yaml +/// dependencies: +/// # Internationalization support. +/// flutter_localizations: +/// sdk: flutter +/// intl: any # Use the pinned version from flutter_localizations +/// +/// # Rest of dependencies +/// ``` +/// +/// ## iOS Applications +/// +/// iOS applications define key application metadata, including supported +/// locales, in an Info.plist file that is built into the application bundle. +/// To configure the locales supported by your app, you’ll need to edit this +/// file. +/// +/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. +/// Then, in the Project Navigator, open the Info.plist file under the Runner +/// project’s Runner folder. +/// +/// Next, select the Information Property List item, select Add Item from the +/// Editor menu, then select Localizations from the pop-up menu. +/// +/// Select and expand the newly-created Localizations item then, for each +/// locale your application supports, add a new item and select the locale +/// you wish to add from the pop-up menu in the Value field. This list should +/// be consistent with the languages listed in the AppLocalizations.supportedLocales +/// property. +abstract class AppLocalizations { + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + static AppLocalizations? of(BuildContext context) { + return Localizations.of(context, AppLocalizations); + } + + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); + + /// A list of this localizations delegate along with the default localizations + /// delegates. + /// + /// Returns a list of localizations delegates containing this delegate along with + /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, + /// and GlobalWidgetsLocalizations.delegate. + /// + /// Additional delegates can be added by appending to this list in + /// MaterialApp. This list does not have to be used at all if a custom list + /// of delegates is preferred or required. + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + /// A list of this localizations delegate's supported locales. + static const List supportedLocales = [Locale('en')]; + + /// No description provided for @changeAnimation. + /// + /// In en, this message translates to: + /// **'Change animation'** + String get changeAnimation; + + /// No description provided for @changeCurve. + /// + /// In en, this message translates to: + /// **'Change curve'** + String get changeCurve; + + /// No description provided for @customEventTriggered. + /// + /// In en, this message translates to: + /// **'Custom event triggered!'** + String get customEventTriggered; + + /// No description provided for @forMoreVisit. + /// + /// In en, this message translates to: + /// **'For more:'** + String get forMoreVisit; + + /// No description provided for @nonRebuiltWidget. + /// + /// In en, this message translates to: + /// **'Non-rebuilt\nwidget'** + String get nonRebuiltWidget; + + /// No description provided for @reverseAnimation. + /// + /// In en, this message translates to: + /// **'Reverse animation'** + String get reverseAnimation; + + /// No description provided for @riveHint. + /// + /// In en, this message translates to: + /// **'Click on the animation.'** + String get riveHint; + + /// No description provided for @riveLastHint. + /// + /// In en, this message translates to: + /// **'Hover state was disabled for mobile, click one for hover effect, click again to reset.'** + String get riveLastHint; + + /// No description provided for @staggeredAnimation. + /// + /// In en, this message translates to: + /// **'Staggered Animation'** + String get staggeredAnimation; + + /// No description provided for @startAnimation. + /// + /// In en, this message translates to: + /// **'Start animation'** + String get startAnimation; + + /// No description provided for @stopAnimation. + /// + /// In en, this message translates to: + /// **'Stop animation'** + String get stopAnimation; + + /// No description provided for @animationLoadingFailed. + /// + /// In en, this message translates to: + /// **'Failed to load animation'** + String get animationLoadingFailed; +} + +class _AppLocalizationsDelegate + extends LocalizationsDelegate { + const _AppLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return SynchronousFuture(lookupAppLocalizations(locale)); + } + + @override + bool isSupported(Locale locale) => + ['en'].contains(locale.languageCode); + + @override + bool shouldReload(_AppLocalizationsDelegate old) => false; +} + +AppLocalizations lookupAppLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'en': + return AppLocalizationsEn(); + } + + throw FlutterError( + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.'); +} diff --git a/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations_en.dart b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations_en.dart new file mode 100644 index 00000000..ebd70e99 --- /dev/null +++ b/projects/chapters/chapter_07/animation_demo/lib/res/l10n/app_localizations_en.dart @@ -0,0 +1,47 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for English (`en`). +class AppLocalizationsEn extends AppLocalizations { + AppLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get changeAnimation => 'Change animation'; + + @override + String get changeCurve => 'Change curve'; + + @override + String get customEventTriggered => 'Custom event triggered!'; + + @override + String get forMoreVisit => 'For more:'; + + @override + String get nonRebuiltWidget => 'Non-rebuilt\nwidget'; + + @override + String get reverseAnimation => 'Reverse animation'; + + @override + String get riveHint => 'Click on the animation.'; + + @override + String get riveLastHint => + 'Hover state was disabled for mobile, click one for hover effect, click again to reset.'; + + @override + String get staggeredAnimation => 'Staggered Animation'; + + @override + String get startAnimation => 'Start animation'; + + @override + String get stopAnimation => 'Stop animation'; + + @override + String get animationLoadingFailed => 'Failed to load animation'; +} diff --git a/projects/chapters/chapter_07/animation_demo/lib/utilities/extensions/context_extensions.dart b/projects/chapters/chapter_07/animation_demo/lib/utilities/extensions/context_extensions.dart index 143139ec..db70ae9e 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/utilities/extensions/context_extensions.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/utilities/extensions/context_extensions.dart @@ -1,5 +1,5 @@ +import 'package:animation_demo/res/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; extension LocalizationExtension on BuildContext { AppLocalizations get l10n => AppLocalizations.of(this)!; diff --git a/projects/chapters/chapter_07/animation_demo/lib/view/components/page_indicator.dart b/projects/chapters/chapter_07/animation_demo/lib/view/components/page_indicator.dart index 0645f938..8d031add 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/view/components/page_indicator.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/view/components/page_indicator.dart @@ -29,7 +29,7 @@ class PageIndicator extends StatelessWidget { height: currentPage == index ? AppDimensions.h12 : AppDimensions.h8, width: currentPage == index ? AppDimensions.h12 : AppDimensions.h8, decoration: BoxDecoration( - color: Colors.grey.withOpacity(currentPage == index ? 1.0 : 0.5), + color: Colors.grey.withAlpha(currentPage == index ? 255 : 127), shape: BoxShape.circle, ), ), diff --git a/projects/chapters/chapter_07/animation_demo/lib/view/page5_staggered_animation.dart b/projects/chapters/chapter_07/animation_demo/lib/view/page5_staggered_animation.dart index 2fbd232f..3b375dd9 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/view/page5_staggered_animation.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/view/page5_staggered_animation.dart @@ -206,6 +206,7 @@ class _StaggerAnimation extends StatelessWidget { opacity: _opacity.value, child: Text( context.l10n.startAnimation, + textAlign: TextAlign.center, style: const TextStyle(color: AppTheme.white, fontWeight: FontWeight.w500), ), ), diff --git a/projects/chapters/chapter_07/animation_demo/lib/view/page9_rive.dart b/projects/chapters/chapter_07/animation_demo/lib/view/page9_rive.dart index e02f6561..a822695b 100644 --- a/projects/chapters/chapter_07/animation_demo/lib/view/page9_rive.dart +++ b/projects/chapters/chapter_07/animation_demo/lib/view/page9_rive.dart @@ -30,11 +30,29 @@ class _RiveAnimationDemoState extends State { }.entries.toList(); int _assetIndex = 0; + File? _riveFile; + RiveWidgetController? _controller; + StateMachine? _activeStateMachine; + Object? _loadError; + bool _isLoading = true; + + @override + void initState() { + super.initState(); + _loadRiveFile(); + } + + @override + void dispose() { + _detachStateMachine(); + _controller?.dispose(); + _riveFile?.dispose(); + super.dispose(); + } void setNextAsset() { - setState(() { - _assetIndex = (_assetIndex + 1) % _artboardStateMachineMapping.length; - }); + final nextIndex = (_assetIndex + 1) % _artboardStateMachineMapping.length; + _selectAsset(nextIndex); } @override @@ -54,14 +72,21 @@ class _RiveAnimationDemoState extends State { child: OutlinedText(text: context.l10n.forMoreVisit, textStyle: context.textTheme.displaySmall), ), Expanded( - child: isRocketsite - ? _ComplexRiveAnim(artboard: currentAnim.key, stateMachine: currentAnim.value) - : RiveAnimation.asset( - key: ValueKey(currentAnim.key + currentAnim.value), // Only for changing artboards correctly - Assets.rive.bme.path, - artboard: currentAnim.key, - stateMachines: [currentAnim.value], + child: switch ((_isLoading, _loadError, _controller)) { + (true, _, _) => const Center(child: CircularProgressIndicator.adaptive()), + (false, final Object? error, _) when error != null => Center( + child: Text( + context.l10n.animationLoadingFailed, + style: context.textTheme.bodyLarge, + textAlign: TextAlign.center, ), + ), + (_, _, final RiveWidgetController? controller) when controller != null => RiveWidget( + key: ValueKey(currentAnim.key + currentAnim.value), + controller: controller, + ), + _ => const SizedBox.shrink(), + }, ), _AnimationsInfoBox(isRocketsite: isRocketsite), ], @@ -69,30 +94,82 @@ class _RiveAnimationDemoState extends State { ), ); } -} - -// -// A bit more complex Rive animation handling. -// -class _ComplexRiveAnim extends StatefulWidget { - _ComplexRiveAnim({ - required this.artboard, - required this.stateMachine, - }) : super(key: ValueKey(artboard + stateMachine)); + Future _loadRiveFile() async { + try { + final file = await File.asset( + Assets.rive.bme, + riveFactory: Factory.rive, + ); + if (!mounted) { + file?.dispose(); + return; + } + setState(() { + _riveFile = file; + _isLoading = false; + _loadError = null; + }); + _selectAsset(_assetIndex); + } catch (error) { + if (!mounted) { + return; + } + setState(() { + _loadError = error; + _isLoading = false; + }); + } + } - final String artboard; - final String stateMachine; + void _selectAsset(int index) { + final resolvedIndex = index % _artboardStateMachineMapping.length; + + _detachStateMachine(); + final previousController = _controller; + _controller = null; + previousController?.dispose(); + + RiveWidgetController? newController; + StateMachine? newStateMachine; + Object? newError = _loadError; + + final file = _riveFile; + if (file != null) { + final entry = _artboardStateMachineMapping[resolvedIndex]; + try { + newController = RiveWidgetController( + file, + artboardSelector: ArtboardSelector.byName(entry.key), + stateMachineSelector: StateMachineSelector.byName(entry.value), + ); + newError = null; + + if (entry.key == 'Rocketsite AB') { + newStateMachine = newController.stateMachine..addEventListener(_handleRiveEvents); + } + } catch (error) { + newController?.dispose(); + newController = null; + newStateMachine = null; + newError = error; + } + } - @override - State<_ComplexRiveAnim> createState() => _ComplexRiveAnimState(); -} + setState(() { + _assetIndex = resolvedIndex; + _controller = newController; + _activeStateMachine = newStateMachine; + _loadError = newError; + }); + } -class _ComplexRiveAnimState extends State<_ComplexRiveAnim> { - StateMachineController? _controller; + void _detachStateMachine() { + _activeStateMachine?.removeEventListener(_handleRiveEvents); + _activeStateMachine = null; + } - void _handleRiveEvents(RiveEvent event) { - // Has to match the event name added in Rive editor. + void _handleRiveEvents(Event event) { if (event.name == 'AnimationEND') { Fluttertoast.showToast( msg: context.l10n.customEventTriggered, @@ -101,29 +178,6 @@ class _ComplexRiveAnimState extends State<_ComplexRiveAnim> { ); } } - - @override - void dispose() { - _controller?.removeEventListener(_handleRiveEvents); - _controller?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return RiveAnimation.asset( - Assets.rive.bme.path, - artboard: widget.artboard, - stateMachines: [widget.stateMachine], - onInit: (artboard) { - _controller = StateMachineController.fromArtboard(artboard, 'Site SM'); - if (_controller != null) { - _controller?.addEventListener(_handleRiveEvents); - artboard.addController(_controller!); - } - }, - ); - } } // diff --git a/projects/chapters/chapter_07/animation_demo/pubspec.lock b/projects/chapters/chapter_07/animation_demo/pubspec.lock index d3115303..1b422487 100644 --- a/projects/chapters/chapter_07/animation_demo/pubspec.lock +++ b/projects/chapters/chapter_07/animation_demo/pubspec.lock @@ -5,23 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 + sha256: "8d7ff3948166b8ec5da0fbb5962000926b8e02f2ed9b3e51d1738905fbd4c98d" url: "https://pub.dev" source: hosted - version: "72.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.2" + version: "93.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 + sha256: de7148ed2fcec579b19f122c1800933dfa028f6d9fd38a152b04b1516cec120b url: "https://pub.dev" source: hosted - version: "6.7.0" + version: "10.0.1" animated_svg: dependency: "direct main" description: @@ -34,10 +29,10 @@ packages: dependency: transitive description: name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" url: "https://pub.dev" source: hosted - version: "3.6.1" + version: "4.0.7" args: dependency: transitive description: @@ -66,18 +61,18 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "275bf6bb2a00a9852c28d4e0b410da1d833a734d57d39d44f94bfc895a484ec3" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "4.0.4" build_config: dependency: transitive description: name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + sha256: "4f64382b97504dc2fcdf487d5aae33418e08b4703fc21249e4db6d804a4d0187" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" build_daemon: dependency: transitive description: @@ -86,30 +81,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.dev" - source: hosted - version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" - url: "https://pub.dev" - source: hosted - version: "2.4.13" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + sha256: b4d854962a32fd9f8efc0b76f98214790b833af8b2e9b2df6bfc927c0415a072 url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "2.10.5" built_collection: dependency: transitive description: @@ -122,18 +101,18 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: "7931c90b84bc573fef103548e354258ae4c9d28d140e41961df6843c5d60d4d8" url: "https://pub.dev" source: hosted - version: "8.9.2" + version: "8.12.3" characters: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" checked_yaml: dependency: transitive description: @@ -146,10 +125,10 @@ packages: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" code_builder: dependency: transitive description: @@ -162,10 +141,18 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.1" + color: + dependency: transitive + description: + name: color + sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb + url: "https://pub.dev" + source: hosted + version: "3.0.0" convert: dependency: transitive description: @@ -194,10 +181,18 @@ packages: dependency: transitive description: name: dart_style - sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + sha256: "8a0aa2b9bae196552b71575efc94580e447546c26c7120577bb6f81fbd33b52e" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + dartx: + dependency: transitive + description: + name: dartx + sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244" url: "https://pub.dev" source: hosted - version: "2.3.7" + version: "1.2.0" drawing_animation: dependency: "direct main" description: @@ -211,10 +206,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.3" ffi: dependency: transitive description: @@ -244,14 +239,30 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_gen_core: + dependency: transitive + description: + name: flutter_gen_core + sha256: b6bafbbd981da2f964eb45bcb8b8a7676a281084f8922c0c75de4cfbaa849311 + url: "https://pub.dev" + source: hosted + version: "5.12.0" + flutter_gen_runner: + dependency: "direct dev" + description: + name: flutter_gen_runner + sha256: c99b10af9d404e3f46fd1927e7d90099779e935e86022674c4c2a9e6c2a93b29 + url: "https://pub.dev" + source: hosted + version: "5.12.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -269,10 +280,10 @@ packages: dependency: "direct main" description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95" url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.2.3" flutter_test: dependency: "direct dev" description: flutter @@ -287,18 +298,10 @@ packages: dependency: "direct main" description: name: fluttertoast - sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc" + sha256: "144ddd74d49c865eba47abe31cbc746c7b311c82d6c32e571fd73c4264b740e2" url: "https://pub.dev" source: hosted - version: "8.2.8" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" + version: "9.0.0" glob: dependency: transitive description: @@ -315,6 +318,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + hashcodes: + dependency: transitive + description: + name: hashcodes + sha256: "80f9410a5b3c8e110c4b7604546034749259f5d6dcca63e0d3c17c9258f1a651" + url: "https://pub.dev" + source: hosted + version: "2.0.0" http: dependency: transitive description: @@ -339,14 +350,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image: + dependency: transitive + description: + name: image + sha256: "492bd52f6c4fbb6ee41f781ff27765ce5f627910e1e0cbecfa3d9add5562604c" + url: "https://pub.dev" + source: hosted + version: "4.7.2" + image_size_getter: + dependency: transitive + description: + name: image_size_getter + sha256: "7c26937e0ae341ca558b7556591fd0cc456fcc454583b7cb665d2f03e93e590f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" intl: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.20.2" io: dependency: transitive description: @@ -355,14 +382,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" json_annotation: dependency: transitive description: @@ -375,66 +394,58 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.5" + 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: name: lints - sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" + sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.0" logging: dependency: transitive description: name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" lottie: dependency: "direct main" description: name: lottie - sha256: "6a24ade5d3d918c306bb1c21a6b9a04aab0489d51a2582522eea820b4093b62b" + sha256: "8ae0be46dbd9e19641791dc12ee480d34e1fd3f84c749adc05f3ad9342b71b95" url: "https://pub.dev" source: hosted - version: "3.1.2" - macros: - dependency: transitive - description: - name: macros - sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" - url: "https://pub.dev" - source: hosted - version: "0.1.2-main.4" + version: "3.3.2" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: @@ -447,10 +458,10 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.0" mime: dependency: transitive description: @@ -471,10 +482,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" path_parsing: dependency: transitive description: @@ -507,6 +518,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.dev" + source: hosted + version: "6.0.3" pub_semver: dependency: transitive description: @@ -527,18 +546,18 @@ packages: dependency: "direct main" description: name: rive - sha256: cd45b071b288e4bef05f25423e1001a9b3218b81745deae18c9b4d2a2952cc56 + sha256: d3901d82850e17395a149d05c8b446a16eca42b328bac6ca9bd9ed760016f20c url: "https://pub.dev" source: hosted - version: "0.13.14" - rive_common: + version: "0.14.1" + rive_native: dependency: transitive description: - name: rive_common - sha256: c7bf0781b1621629361579c300ac2f8aa1a238227a242202a596e82becc244d7 + name: rive_native + sha256: "955e7820b7cd508f4885aa6f25d6240791c932756291c400326ab8b1f3c57c7d" url: "https://pub.dev" source: hosted - version: "0.4.11" + version: "0.1.1" shelf: dependency: transitive description: @@ -559,7 +578,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -572,18 +591,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" stream_transform: dependency: transitive description: @@ -612,18 +631,18 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.2" - timing: + version: "0.7.7" + time: dependency: transitive description: - name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + name: time + sha256: "46187cf30bffdab28c56be9a63861b36e4ab7347bf403297595d6a97e10c789f" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.1.6" typed_data: dependency: transitive description: @@ -636,10 +655,10 @@ packages: dependency: "direct main" description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.19" vector_graphics_codec: dependency: transitive description: @@ -652,18 +671,18 @@ packages: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: "201e876b5d52753626af64b6359cd13ac6011b80728731428fd34bc840f71c9b" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.20" 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: @@ -721,5 +740,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" diff --git a/projects/chapters/chapter_07/animation_demo/pubspec.yaml b/projects/chapters/chapter_07/animation_demo/pubspec.yaml index 1dba7259..348f06cf 100644 --- a/projects/chapters/chapter_07/animation_demo/pubspec.yaml +++ b/projects/chapters/chapter_07/animation_demo/pubspec.yaml @@ -1,10 +1,10 @@ name: animation_demo description: A new Flutter project. -publish_to: 'none' +publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=3.5.0 <4.0.0' + sdk: ">=3.5.0 <4.0.0" dependencies: flutter: @@ -17,22 +17,23 @@ dependencies: cupertino_icons: ^1.0.8 flutter_screenutil: ^5.9.3 animated_svg: ^2.1.0 - rive: ^0.13.14 - lottie: ^3.1.2 - flutter_svg: ^2.0.10+1 + rive: ^0.14.1 + lottie: ^3.3.2 + flutter_svg: ^2.2.3 # Potentially discountinued, may be switched to the official package if it gets updated drawing_animation: - git: + git: url: https://github.com/Kanyade/drawing_animation.git ref: master - vector_graphics: ^1.1.11+1 - fluttertoast: ^8.2.8 + vector_graphics: ^1.1.19 + fluttertoast: ^9.0.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - build_runner: ^2.4.13 + flutter_lints: ^6.0.0 + build_runner: ^2.10.5 + flutter_gen_runner: ^5.5.2 flutter_gen: output: lib/res/gen/ # Optional (default: lib/gen/) @@ -40,7 +41,6 @@ flutter_gen: integrations: flutter_svg: true - rive: true lottie: true flutter: