Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Container(
- height: 350.0,
- child: ListView.builder(
- physics: NeverScrollableScrollPhysics(),
- itemCount: 3,
- controller: scrollController,
- scrollDirection: Axis.horizontal,
- itemBuilder: (context, position) {
- return GestureDetector(
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Card(
- child: Container(
- width: 250.0,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Icon(
- cardsList[position].icon,
- color: appColors[position],
- ),
- Icon(
- Icons.more_vert,
- color: Colors.grey,
- )
- ],
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0, vertical: 4.0),
- child: Text(
- "${cardsList[position].tasksRemaining} Tasks",
- style:
- TextStyle(color: Colors.grey),
- ),
- ),
- Padding(
- padding:
- const EdgeInsets.symmetric(
- horizontal: 8.0,
- vertical: 4.0),
- child: Text(
- "${cardsList[position].cardTitle}",
- style:
- TextStyle(fontSize: 28.0),
- )),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: LinearProgressIndicator(
- value: cardsList[position]
- .taskCompletion,
- ),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10.0)),
- ),
- ),
- onHorizontalDragEnd: (details) {
- animationController = AnimationController(
- vsync: this,
- duration: Duration(milliseconds: 450));
- curvedAnimation = CurvedAnimation(
- parent: animationController,
- curve: Curves.fastOutSlowIn);
- animationController.addListener(() {
- setState(() {
- currentColor =
- colorTween.evaluate(curvedAnimation);
- });
- });
- if (details.velocity.pixelsPerSecond.dx > 0) {
- if (cardIndex > 0) {
- cardIndex--;
- colorTween = ColorTween(
- begin: currentColor,
- end: appColors[cardIndex]);
- }
- } else {
- if (cardIndex < 2) {
- cardIndex++;
- colorTween = ColorTween(
- begin: currentColor,
- end: appColors[cardIndex]);
- }
- }
- setState(() {
- scrollController.animateTo((cardIndex) * 256.0,
- duration: Duration(milliseconds: 450),
- curve: Curves.fastOutSlowIn);
- });
- colorTween.animate(curvedAnimation);
- animationController.forward();
- });
- },
- ),
- ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement