Created
June 15, 2021 09:22
-
-
Save PreyeaRegmi/533b9a9877d767cf20aadd4e0ed450a4 to your computer and use it in GitHub Desktop.
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
//Animation controller for showing animation after reveal | |
_postRevealAnimationController = | |
AnimationController(duration: Duration(milliseconds: 600), vsync: this); | |
//Scale animation for showing center logo after reveal is completed | |
_centerIconScale = Tween<double>(begin: 0, end: .5).animate(CurvedAnimation( | |
parent: _postRevealAnimationController, | |
curve: Curves.fastOutSlowIn, | |
)); | |
//_centerIconScale animation used by FAB in the middle | |
Positioned.fromRelativeRect( | |
rect: _titleBaseLinePosTranslateAnim.value.shift(Offset(0, 18)), | |
child: ScaleTransition( | |
scale: _centerIconScale, | |
child: FloatingActionButton( | |
backgroundColor: Colors.white, | |
elevation: 5, | |
onPressed: null, | |
child: Icon(Icons.monetization_on_outlined, | |
size: 100, | |
color: isLeftTabSelected | |
? Colors.deepPurple | |
: Colors.pinkAccent))), | |
), | |
//Tab selection is done by "CurvePageSwitchIndicator" widget | |
Positioned( | |
top: 0, | |
bottom: _titleBaseLinePosTranslateAnim.value.bottom, | |
left: 0, | |
right: 0, | |
child: CurvePageSwitchIndicator(widget.height, widget.width, arcHeight, 3, | |
true, _onLeftTabSelectd, _onRightTabSelectd), | |
); | |
//The build method of CurvePageSwitchIndicator consisting of "CurvePageSwitcher" CustomPainter to paint tab selection arc | |
//and Gesture detectors stacked on top to intercept left and right tap event. | |
///When the reveal scene is completed, left tab is selected and the tab selection fly | |
//towards from the left side of the screen | |
@override | |
Widget build(BuildContext context) { | |
return Stack(children: [ | |
Transform( | |
transform: Matrix4.identity() | |
..setEntry(0, 3, translationDxAnim.value) | |
..setEntry(1, 3, translationDyAnim.value) | |
..rotateZ(rotationAnim.value * 3.14 / 180), | |
alignment: Alignment.bottomLeft, | |
child: Container( | |
height: double.infinity, | |
width: double.infinity, | |
child: CustomPaint( | |
painter: CurvePageSwitcher( | |
widget.arcHeight, | |
widget.arcBottomOffset, | |
showLeftAsFirstPage, | |
pageTabAnimationController!), | |
), | |
)), | |
Row( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: [ | |
Expanded( | |
child: Stack(children: [ | |
Positioned( | |
left: 0, | |
right: 20, | |
bottom: 0, | |
top: 90, | |
child: Transform.rotate( | |
angle: -13 * 3.14 / 180, | |
child: Align( | |
alignment: Alignment.center, | |
child: Text( | |
"Login", | |
style: TextStyle( | |
color: showLeftAsFirstPage | |
? Colors.white | |
: Colors.white60, | |
fontSize: 22, | |
fontWeight: FontWeight.w800), | |
)))), | |
GestureDetector(onTap: _handleLeftTab, | |
) | |
])), | |
Expanded( | |
child: Stack(children: [ | |
Positioned( | |
left: 20, | |
right: 0, | |
bottom: 0, | |
top: 90, | |
child: Transform.rotate( | |
angle: 13 * 3.14 / 180, | |
child: Align( | |
alignment: Alignment.center, | |
child: Text("Signup", | |
style: TextStyle( | |
color: !showLeftAsFirstPage | |
? Colors.white | |
: Colors.white60, | |
fontSize: 22, | |
fontWeight: FontWeight.w800))))), | |
GestureDetector(onTap: _handleRightTab, | |
) | |
])), | |
], | |
), | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment