-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added app logo animation instead of loader
- Loading branch information
1 parent
a13ce6b
commit 58e330b
Showing
5 changed files
with
179 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,175 @@ | ||
import 'package:flutter_spinkit/flutter_spinkit.dart'; | ||
// import 'package:flutter_spinkit/flutter_spinkit.dart'; | ||
// import 'package:flutter/material.dart'; | ||
|
||
// class Loading extends StatelessWidget { | ||
// @override | ||
// Widget build(BuildContext context) { | ||
// return Container( | ||
// color: Color.fromRGBO(10, 80, 106, 1), | ||
// child: Center( | ||
// child: SpinKitFoldingCube(color: Colors.white, size: 50.0), | ||
// )); | ||
// } | ||
// } | ||
import 'dart:async'; | ||
import 'package:flutter/animation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class Loading extends StatelessWidget { | ||
class SplashScreen1Sub extends StatefulWidget { | ||
@override | ||
_SplashScreen1SubState createState() => _SplashScreen1SubState(); | ||
} | ||
|
||
class _SplashScreen1SubState extends State<SplashScreen1Sub> | ||
with TickerProviderStateMixin { | ||
double _fontSize = 2; | ||
double _containerSize = 1.5; | ||
double _textOpacity = 0.0; | ||
double _containerOpacity = 0.0; | ||
|
||
AnimationController _controller; | ||
Animation<double> animation1; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_controller = | ||
AnimationController(vsync: this, duration: Duration(seconds: 3)); | ||
|
||
animation1 = Tween<double>(begin: 40, end: 20).animate(CurvedAnimation( | ||
parent: _controller, curve: Curves.fastLinearToSlowEaseIn)) | ||
..addListener(() { | ||
setState(() { | ||
_textOpacity = 1.0; | ||
}); | ||
}); | ||
|
||
_controller.forward(); | ||
|
||
Timer(Duration(seconds: 2), () { | ||
setState(() { | ||
_fontSize = 1.3; | ||
}); | ||
}); | ||
|
||
Timer(Duration(seconds: 2), () { | ||
setState(() { | ||
_containerSize = 2; | ||
_containerOpacity = 1; | ||
}); | ||
}); | ||
|
||
// Timer(Duration(seconds: 4), () { | ||
// setState(() { | ||
// Navigator.pushReplacement( | ||
// context, PageTransition1(SplashScreen1SubHome())); | ||
// }); | ||
// }); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
_controller.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
double _width = MediaQuery.of(context).size.width; | ||
double _height = MediaQuery.of(context).size.height; | ||
|
||
return Scaffold( | ||
backgroundColor: Color.fromRGBO(10, 80, 106, 1), | ||
body: Stack( | ||
children: [ | ||
Column( | ||
children: [ | ||
AnimatedContainer( | ||
duration: Duration(milliseconds: 2000), | ||
curve: Curves.fastLinearToSlowEaseIn, | ||
height: _height / _fontSize), | ||
AnimatedOpacity( | ||
duration: Duration(milliseconds: 1000), | ||
opacity: _textOpacity, | ||
child: Text( | ||
'BHBS', | ||
style: TextStyle( | ||
color: Colors.white, | ||
fontWeight: FontWeight.bold, | ||
fontSize: animation1.value, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
Center( | ||
child: AnimatedOpacity( | ||
duration: Duration(milliseconds: 2000), | ||
curve: Curves.fastLinearToSlowEaseIn, | ||
opacity: _containerOpacity, | ||
child: AnimatedContainer( | ||
duration: Duration(milliseconds: 2000), | ||
curve: Curves.fastLinearToSlowEaseIn, | ||
height: _width / _containerSize, | ||
width: _width / _containerSize, | ||
alignment: Alignment.center, | ||
decoration: BoxDecoration( | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(30), | ||
), | ||
child: Image.asset('assets/logo.png'), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class PageTransition1 extends PageRouteBuilder { | ||
final Widget page; | ||
|
||
PageTransition1(this.page) | ||
: super( | ||
pageBuilder: (context, animation, anotherAnimation) => page, | ||
transitionDuration: Duration(milliseconds: 4000), | ||
transitionsBuilder: (context, animation, anotherAnimation, child) { | ||
animation = CurvedAnimation( | ||
curve: Curves.fastLinearToSlowEaseIn, | ||
parent: animation, | ||
); | ||
return Align( | ||
alignment: Alignment.bottomCenter, | ||
child: SizeTransition( | ||
sizeFactor: animation, | ||
child: page, | ||
axisAlignment: 0, | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
|
||
class SplashScreen1SubHome extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
color: Color.fromRGBO(10, 80, 106, 1), | ||
child: Center( | ||
child: SpinKitFoldingCube(color: Colors.white, size: 50.0), | ||
)); | ||
return Scaffold( | ||
backgroundColor: Colors.white, | ||
appBar: AppBar( | ||
brightness: Brightness.dark, | ||
backgroundColor: Color.fromRGBO(10, 80, 106, 1), | ||
centerTitle: true, | ||
title: Text( | ||
'BHBS', | ||
style: TextStyle( | ||
color: Colors.white, | ||
fontWeight: FontWeight.bold, | ||
fontSize: 20, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters