Skip to content

Commit dd2561d

Browse files
committed
Animation updates fro ImageGallery
1 parent e779b76 commit dd2561d

File tree

2 files changed

+53
-32
lines changed

2 files changed

+53
-32
lines changed

lib/pages/TestPage.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,17 @@ class TestPageState extends State {
142142
mainAxisAlignment: MainAxisAlignment.center,
143143
crossAxisAlignment: CrossAxisAlignment.center,
144144
children: [
145-
SizedBox(width: 60.0,),
145+
// SizedBox(width: 60.0,),
146146
SkillsColumn([
147147
SkillItem("Main", ["Android", "Kotlin", "Java", "Flutter"]),
148148
SkillItem("UI", ["Jetpack Compose", "XML"]),
149149
SkillItem(
150-
"Data", ["Realm", "Room", "SQL", "Retrofit", "GraphQL", "JSON"]),
150+
"Data", ["Realm", "Room", "SQL", "Retrofit", "GraphQL", "JSON", "XML"]),
151151
SkillItem(
152-
"Architecture", ["Clean", "MVP", "MVVM", "MVI", "Redux"]),
152+
"Architecture", ["Clean", "MVP", "MVVM", "MVI", "Redux", "Multi Module", "SDUI/BDUI"]),
153153
SkillItem("DI", ["Dagger 2", "Koin", "Hilt"]),
154-
SkillItem("Async", ["RxJava 2", "Kotlin Coroutines", "Hilt"]),
154+
SkillItem("Async", ["RxJava 2", "Kotlin Coroutines", "Hilt", "Threads"]),
155+
SkillItem("Other", ["Python", "Figma",]),
155156
]),
156157
SizedBox(width: 16.0,),
157158
WorkExpTimeline(),
@@ -195,7 +196,7 @@ class TestPageState extends State {
195196
ImageModel(
196197
resourcePath: "assets/img/img_gallery_2.jpg",
197198
title: "Feel nothing",
198-
description: "Bad thoughts and this is its representation",
199+
description: "Testing new fog FX",
199200
goToUrl: "https://www.artstation.com/artwork/NG60w5"),
200201
ImageModel(
201202
resourcePath: "assets/img/img_gallery_3.jpg",
@@ -205,7 +206,7 @@ class TestPageState extends State {
205206
ImageModel(
206207
resourcePath: "assets/img/img_gallery_4.jpg",
207208
title: "Zero comfort zone",
208-
description: "My first try with photoreal materials and light",
209+
description: "My first try with photoreal render",
209210
goToUrl: "https://www.artstation.com/artwork/yJVD5x"),
210211
ImageModel(
211212
resourcePath: "assets/img/img_gallery_5.jpg",

lib/widgets/base/ImageGallery.dart

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:developer';
23

34
import 'package:collection/collection.dart';
@@ -52,7 +53,8 @@ class SimpleGalleryState extends State with TickerProviderStateMixin {
5253
var lastMaxWidth = 0.0;
5354

5455
List<AnimationController> controllers = [];
55-
List<Animation> opacityAcnimations = [];
56+
List<AnimationController> fadeControllers = [];
57+
List<Animation<double>> opacityAcnimations = [];
5658

5759
SimpleGalleryState(
5860
{required this.imagesResList,
@@ -73,8 +75,19 @@ class SimpleGalleryState extends State with TickerProviderStateMixin {
7375
setState(() {});
7476
}),
7577
);
78+
79+
fadeControllers.add(
80+
AnimationController(
81+
vsync: this,
82+
duration: Duration(milliseconds: 500),
83+
reverseDuration: Duration(milliseconds: 100),
84+
animationBehavior: AnimationBehavior.normal)
85+
..addListener(() {
86+
setState(() {});
87+
}),
88+
);
7689
opacityAcnimations
77-
.add(Tween<double>(begin: 0.0, end: 1.0).animate(controllers[index]));
90+
.add(Tween<double>(begin: 0.0, end: 1.0).animate(fadeControllers[index]));
7891
}
7992
}
8093

@@ -116,30 +129,30 @@ class SimpleGalleryState extends State with TickerProviderStateMixin {
116129
children: [
117130
Spacer(),
118131
Container(
119-
color: AppColors.BgBlack45,
120-
child: Column(
121-
mainAxisAlignment: MainAxisAlignment.center,
122-
crossAxisAlignment: CrossAxisAlignment.stretch,
123-
children: [
124-
SizedBox(
125-
height: 16.0,
126-
),
127-
TextTitle(
128-
text: imagesResList[index].title,
129-
textColor: accentFilterColor,
130-
textAlign: TextAlign.center,
131-
),
132-
TextContent(
133-
text: imagesResList[index].description,
134-
textColor: accentFilterColor,
135-
textAlign: TextAlign.center,
136-
),
137-
SizedBox(
138-
height: 32.0,
139-
)
140-
],
141-
),
142-
)
132+
color: AppColors.BgBlack45,
133+
child: Column(
134+
mainAxisAlignment: MainAxisAlignment.center,
135+
crossAxisAlignment:
136+
CrossAxisAlignment.stretch,
137+
children: [
138+
SizedBox(
139+
height: 16.0,
140+
),
141+
TextTitle(
142+
text: imagesResList[index].title,
143+
textColor: accentFilterColor,
144+
textAlign: TextAlign.center,
145+
),
146+
TextContent(
147+
text: imagesResList[index].description,
148+
textColor: accentFilterColor,
149+
textAlign: TextAlign.center,
150+
),
151+
SizedBox(
152+
height: 32.0,
153+
)
154+
],
155+
))
143156
],
144157
),
145158
),
@@ -174,11 +187,18 @@ class SimpleGalleryState extends State with TickerProviderStateMixin {
174187
});
175188
}
176189

190+
Timer? delayedAppear = null;
191+
177192
void _animateShow(int index) {
178193
controllers[index].forward();
194+
delayedAppear = Timer(Duration(milliseconds: 300), () {
195+
fadeControllers[index].forward();
196+
});
179197
}
180198

181199
void _animateHide(int index) {
200+
delayedAppear?.cancel();
201+
fadeControllers[index].reverse();
182202
controllers[index].reverse();
183203
}
184204

0 commit comments

Comments
 (0)