@@ -15,25 +15,37 @@ import 'dialog.dart';
15
15
import 'page.dart' ;
16
16
import 'store.dart' ;
17
17
18
+ /// Identifies which [LightboxHero] s should match up with each other
19
+ /// to produce a hero animation.
20
+ ///
21
+ /// See [Hero.tag] , the field where we use instances of this class.
22
+ ///
23
+ /// The intended behavior is that when the user acts on an image
24
+ /// in the message list to have the app expand it in the lightbox,
25
+ /// a hero animation goes from the original view of the image
26
+ /// to the version in the lightbox,
27
+ /// and back to the original upon exiting the lightbox.
18
28
class _LightboxHeroTag {
19
29
_LightboxHeroTag ({
20
30
required this .messageImageContext,
21
31
required this .src,
22
32
});
23
33
24
- /// The [BuildContext] of the image in the message list that's being expanded
25
- /// into the lightbox. Used to coordinate the Hero animation between this specific
26
- /// image and the lightbox view.
34
+ /// The [BuildContext] for the [MessageImage] being expanded into the lightbox.
27
35
///
28
- /// This helps ensure the animation only happens between the correct image instances,
29
- /// preventing unwanted animations between different message lists or between
30
- /// different images that happen to have the same URL.
36
+ /// In particular this prevents hero animations between
37
+ /// different message lists that happen to have the same message.
38
+ /// It also distinguishes different copies of the same image
39
+ /// in a given message list.
31
40
// TODO: write a regression test for #44, duplicate images within a message
32
41
final BuildContext messageImageContext;
33
42
34
- /// The image source URL. Used to match the source and destination images
35
- /// during the Hero animation, ensuring the animation only occurs between
36
- /// images showing the same content.
43
+ /// The image source URL.
44
+ ///
45
+ /// This ensures the animation only occurs between matching images, even if
46
+ /// the message was edited before navigating back to the message list
47
+ /// so that the original [MessageImage] has been replaced in the tree
48
+ /// by a different image.
37
49
final Uri src;
38
50
39
51
@override
0 commit comments