Skip to content

Commit

Permalink
Merge pull request #6 from Perumallpardhiv/splashScreen
Browse files Browse the repository at this point in the history
Added Splash Screen
  • Loading branch information
chinmayilondhe committed Oct 21, 2022
2 parents ff0cf3a + c0de06c commit d1dba52
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 7 deletions.
1 change: 1 addition & 0 deletions assets/animation.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lib/main.dart
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:movie_app/views/home_page.dart';
import 'package:movie_app/views/movie_description.dart';
import 'package:movie_app/views/splashScreen.dart';

main(List<String> args) {
runApp(MyApp());
Expand All @@ -20,12 +21,12 @@ class MyApp extends StatelessWidget {
),
)
),
home: HomePage(),
initialRoute: HomePage.id,
home: splashScreen(),
// initialRoute: HomePage.id,
routes: <String, WidgetBuilder>{
HomePage.id : (context) => HomePage(),
MovieDescription.id: (context) => MovieDescription(),
},
);
}
}
}
46 changes: 46 additions & 0 deletions lib/views/splashScreen.dart
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:movie_app/views/home_page.dart';

class splashScreen extends StatefulWidget {
const splashScreen({super.key});

@override
State<splashScreen> createState() => _splashScreenState();
}

class _splashScreenState extends State<splashScreen> {
@override
void initState() {
Future.delayed(Duration(seconds: 5), () {
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => HomePage()));
});
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Container(
alignment: Alignment.center,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 300,
width: 300,
child: Lottie.asset('assets/animation.json', repeat: true)),
SizedBox(height: 20),
Text(
"Movie World",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
],
),
),
);
}
}
2 changes: 1 addition & 1 deletion lib/widgets/bottomnavbar.dart
Expand Up @@ -37,7 +37,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
BottomNavigationBarItem(
icon: BottomNavItem(
icon: Icons.bookmark,
isSelected: (index == 1),
isSelected: index == 1,
),
label: "",
),
Expand Down
16 changes: 15 additions & 1 deletion pubspec.lock
@@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.2"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -116,6 +123,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
lottie:
dependency: "direct main"
description:
name: lottie
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.3"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -291,4 +305,4 @@ packages:
version: "0.2.0+2"
sdks:
dart: ">=2.18.2 <3.0.0"
flutter: ">=3.0.0"
flutter: ">=3.3.0"
5 changes: 3 additions & 2 deletions pubspec.yaml
Expand Up @@ -31,6 +31,7 @@ environment:
dependencies:
flutter:
sdk: flutter
lottie: ^1.4.3


# The following adds the Cupertino Icons font to your application.
Expand Down Expand Up @@ -62,8 +63,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
assets:
- assets/
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down

0 comments on commit d1dba52

Please sign in to comment.