Created
September 30, 2020 18:44
-
-
Save anmolseth06/c099384aac15b640cd1560a8a68ec463 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'dart:ui'; | |
import 'package:cloud_firestore/cloud_firestore.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:laundary_application/model/laundaryItem.dart'; | |
import 'package:laundary_application/widgets/animatedAppBar.dart'; | |
import 'package:laundary_application/widgets/gradentContainer.dart'; | |
import 'package:laundary_application/widgets/laundryItemWidget.dart'; | |
import 'package:laundary_application/widgets/weekGoals.dart'; | |
class MyHomePage extends StatefulWidget { | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { | |
// ignore: non_constant_identifier_names | |
AnimationController _ColorAnimationController; | |
// ignore: non_constant_identifier_names | |
AnimationController _TextAnimationController; | |
Animation _colorTween, _homeTween, _workOutTween, _iconTween, _drawerTween; | |
@override | |
void initState() { | |
_ColorAnimationController = | |
AnimationController(vsync: this, duration: Duration(seconds: 0)); | |
_colorTween = ColorTween(begin: Colors.transparent, end: Colors.white) | |
.animate(_ColorAnimationController); | |
_iconTween = | |
ColorTween(begin: Colors.white, end: Colors.lightBlue.withOpacity(0.5)) | |
.animate(_ColorAnimationController); | |
_drawerTween = ColorTween(begin: Colors.white, end: Colors.black) | |
.animate(_ColorAnimationController); | |
_homeTween = ColorTween(begin: Colors.white, end: Colors.blue) | |
.animate(_ColorAnimationController); | |
_workOutTween = ColorTween(begin: Colors.white, end: Colors.black) | |
.animate(_ColorAnimationController); | |
_TextAnimationController = | |
AnimationController(vsync: this, duration: Duration(seconds: 0)); | |
super.initState(); | |
} | |
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey(); | |
bool scrollListener(ScrollNotification scrollInfo) { | |
bool scroll = false; | |
if (scrollInfo.metrics.axis == Axis.vertical) { | |
_ColorAnimationController.animateTo(scrollInfo.metrics.pixels / 80); | |
_TextAnimationController.animateTo(scrollInfo.metrics.pixels); | |
return scroll = true; | |
} | |
return scroll; | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
key: scaffoldKey, | |
drawer: Drawer(), | |
backgroundColor: Color(0xFFEEEEEE), | |
body: NotificationListener<ScrollNotification>( | |
onNotification: scrollListener, | |
child: Stack( | |
children: [ | |
Container( | |
height: double.infinity, | |
child: Stack( | |
children: <Widget>[ | |
SingleChildScrollView( | |
child: Stack( | |
children: <Widget>[ | |
Column( | |
children: <Widget>[ | |
//ADD_MORE_WIDGETS | |
], | |
), | |
//ADD_MORE_WIDGETS | |
], | |
), | |
), | |
AnimatedAppBar( | |
drawerTween: _drawerTween, | |
onPressed: () { | |
scaffoldKey.currentState.openDrawer(); | |
}, | |
colorAnimationController: _ColorAnimationController, | |
colorTween: _colorTween, | |
homeTween: _homeTween, | |
iconTween: _iconTween, | |
workOutTween: _workOutTween, | |
) | |
], | |
), | |
), | |
//ADD_MORE_WIDGETS | |
], | |
), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment