Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLUT-180: Added App Launch Animation #1672

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/hmssdk_flutter/example/assets/splash_asset.json

Large diffs are not rendered by default.

33 changes: 29 additions & 4 deletions packages/hmssdk_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hmssdk_flutter_example/app_settings_bottom_sheet.dart';
import 'package:hmssdk_flutter_example/qr_code_screen.dart';
import 'package:hmssdk_flutter_example/room_service.dart';
import 'package:lottie/lottie.dart';
import 'package:provider/provider.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:uni_links/uni_links.dart';
Expand Down Expand Up @@ -57,9 +58,11 @@ class HMSExampleApp extends StatefulWidget {
context.findAncestorStateOfType<_HMSExampleAppState>()!;
}

class _HMSExampleAppState extends State<HMSExampleApp> {
class _HMSExampleAppState extends State<HMSExampleApp>
with TickerProviderStateMixin {
ThemeMode _themeMode = ThemeMode.dark;
Uri? _currentURI;
late AnimationController _controller;

ThemeData _darkTheme = ThemeData(
bottomSheetTheme: BottomSheetThemeData(
Expand Down Expand Up @@ -88,6 +91,10 @@ class _HMSExampleAppState extends State<HMSExampleApp> {
_initURIHandler();
_incomingLinkHandler();
initDynamicLinks();
_controller = AnimationController(
duration: Duration(seconds: (5)),
vsync: this,
);
}

Future<void> _initURIHandler() async {
Expand Down Expand Up @@ -173,9 +180,27 @@ class _HMSExampleAppState extends State<HMSExampleApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(
deepLinkURL: _currentURI == null ? null : _currentURI.toString(),
),
home: Builder(builder: (context) {
return Lottie.asset(
'assets/splash_asset.json',
controller: _controller,
fit: BoxFit.fill,
animate: true,
onLoaded: (composition) {
_controller
..duration = composition.duration
..forward().whenComplete(() => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => HomePage(
deepLinkURL: _currentURI == null
? null
: _currentURI.toString(),
)),
));
},
);
}),
theme: _lightTheme,
darkTheme: _darkTheme,
themeMode: _themeMode,
Expand Down
13 changes: 7 additions & 6 deletions packages/hmssdk_flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ packages:
hmssdk_flutter:
dependency: transitive
description:
path: ".."
relative: true
source: path
name: hmssdk_flutter
sha256: f61fb1ffcaf7296e0e2eeff9bc34d699baf9190136b8570a15cde61819cf3276
url: "https://pub.dev"
source: hosted
version: "1.9.5"
http:
dependency: transitive
Expand All @@ -314,10 +315,10 @@ packages:
dependency: transitive
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.18.1"
version: "0.19.0"
js:
dependency: transitive
description:
Expand All @@ -335,7 +336,7 @@ packages:
source: hosted
version: "5.0.0"
lottie:
dependency: transitive
dependency: "direct main"
description:
name: lottie
sha256: a93542cc2d60a7057255405f62252533f8e8956e7e06754955669fd32fb4b216
Expand Down
1 change: 1 addition & 0 deletions packages/hmssdk_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies:
hms_room_kit:
path: ../../hms_room_kit

lottie: ^2.7.0
firebase_crashlytics: 3.3.2
firebase_core: 2.13.1
firebase_performance: 0.9.2+2
Expand Down