Skip to content

Commit

Permalink
completed issue #164 ==> Completed splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
igopi77 committed Jun 2, 2024
1 parent 92b5f66 commit ab70c8d
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 2 deletions.
Binary file added assets/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:learn/landing_page.dart';
import 'package:learn/splash_screen.dart';
import 'package:learn/utils/route/routes.dart';

DateTime? currentBackPressTime;
Expand All @@ -22,7 +23,7 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
title: 'Learn',
themeMode: ThemeMode.system,
home: LandingPage(),
home: SplashScreen(),
onGenerateRoute: Routers.generateRoute,
);
}
Expand Down
97 changes: 97 additions & 0 deletions lib/splash_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:learn/landing_page.dart';

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

@override
State<SplashScreen> createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeInAnimation;
late Animation<double> _scaleAnimation;

@override
void initState() {
super.initState();

_controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
);

_fadeInAnimation = Tween<double>(begin: 0.3, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeIn),
);

_scaleAnimation = Tween<double>(begin: 0.8, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeOutBack),
);

_controller.forward();

Timer(const Duration(seconds: 5), () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const LandingPage()),
);
});
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Transform.scale(
scale: _scaleAnimation.value,
child: Opacity(
opacity: _fadeInAnimation.value,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
),
child: Center(
child: Image.asset(
"assets/images/splash.png",
height: 200,
width: 200,
),
),
),
),
);
},
),
const SizedBox(height: 10),
FadeTransition(
opacity: _fadeInAnimation,
child: const Text(
"Curiosity Starts Here!",
style: TextStyle(
fontFamily: "Comic",
fontSize: 20,
color: Colors.black,
),
),
),
],
),
);
}
}
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ flutter:
- assets/explore/
- assets/seasons/
- assets/occupations/

- assets/fruitsVeges/

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

0 comments on commit ab70c8d

Please sign in to comment.