From 3225ff9a014135566c3f30927e47b7d1b4d087bc Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 30 Sep 2024 13:40:32 +0300 Subject: [PATCH] feat: add rive loading animation in profile page --- android/app/build.gradle | 2 +- assets/rive_animations/loading.riv | Bin 0 -> 881 bytes .../bloc/profile_cubit/profile_cubit.dart | 1 + .../presentation/pages/profile_screen.dart | 14 +++++++++++++- pubspec.yaml | 2 ++ 5 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 assets/rive_animations/loading.riv diff --git a/android/app/build.gradle b/android/app/build.gradle index 7652369e..bc059244 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ if (flutterVersionName == null) { android { namespace = "com.eatvioapp.app" compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion + ndkVersion = "25.1.8937393" compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/assets/rive_animations/loading.riv b/assets/rive_animations/loading.riv new file mode 100644 index 0000000000000000000000000000000000000000..9453df007eabcc5f635f8cafd436e8526d82b9fb GIT binary patch literal 881 zcmZ9LT}YEr7{{Npouv%&W5)7brXvzWD4ix^&F$=U1xvfB_k9l$1glob(qJvbx~MKH z^hQD|MXWAFNGPNahzPg6%#TqZRuX9!LisUWl7p!5tMl$yMCamM9DdLLJpbo^&S8(T zKMm9`d!uLyCD5XN8qeTaJcr|W9xvboUcyNX|F5lpHUnhWWB{y*Q3PoKuf%kKK5 zxRl9E521ZaLnL+Xj<-dGna4kf6uvU-kfX1oM6pbiglW<`$cc~DSQYXXEMe*0&042C zeNZJz`!jQx_GFiF;=W(63Xkf|5$VISK;*SuHln!w_7H82mUE(`@l8ZHCgwz>B33D1 z&MG6yYJ07dc3bXnqPOdKM0n8BACg*1O2hI>ZU<35jmI36Hgs?z<>2Uzey5~4kfqO^ zMA1e^Z++b$n1+jM6pWV;S*ui})u918oVP)+K3u$yu3|HhjqG+Mc-j-9Zu5qh>wdk+ zy}bP{gyo+@?O|*{ zez|jyD8KSc2~9?$|9H{TkTeJK>@u6R$*`?(oh>awmSwui(le#f%i-w(6sz1jog8&> z?@zi%T`b3(Ts?K z8X>BwvHtQ3lf5Urj219TV6=o$5+lZLFSOZg09y>YBE)u6 zY6mE&G)naizH{}BKC5jX0-@XlmWoWscO%HJvAfZMsjDLdDk?LN1ie9@^^o`E*%S*^ htthR|+w2QiZ9u>YuDeJF)!=|YD`KBu3L&@vzX1XV6p8=< literal 0 HcmV?d00001 diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index f6052a4b..85d18e1e 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -29,6 +29,7 @@ class ProfileCubit extends Cubit { _currentPeriod = period; try { final profile = await profileRepository.getMyProfile(); + await Future.delayed(Duration(seconds: 1)); emit(ProfileState.loaded( profile: profile, profileDetails: await profileRepository.getMyProfileDetails(), diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 39a64846..b0643e63 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; +import 'package:rive/rive.dart'; import 'package:share_plus/share_plus.dart'; class ProfileScreen extends StatefulWidget { @@ -287,7 +288,18 @@ class _ProfileScreenState extends State { return Scaffold( appBar: AppBar(), body: Center( - child: CircularProgressIndicator(), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 32, + width: 32, + child: RiveAnimation.asset( + 'assets/rive_animations/loading.riv', + ), + ), + ], + ) ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 91ec8f78..0b30677b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -47,6 +47,7 @@ dependencies: file_picker: ^8.1.2 audioplayers: ^6.1.0 intl: ^0.19.0 + rive: ^0.13.14 dev_dependencies: build_runner: ^2.4.12 @@ -64,6 +65,7 @@ flutter: - assets/images/ - assets/audio/ - assets/icons/ + - assets/rive_animations/ flutter_intl: enabled: true