@@ -77,44 +77,67 @@ class _GalleryPhotoViewWrapperState extends State<GalleryPhotoViewWrapper> {
77
77
color: Colors .black,
78
78
pageGestureAxis: SlideAxis .both),
79
79
child: GestureDetector (
80
- child: ExtendedImageGesturePageView .builder (
81
- itemBuilder: (BuildContext context, int index) {
82
- var item = widget.galleryItems[index];
83
- Widget image = item.path.startsWith ('http' )
84
- ? ExtendedImage .network (
85
- item.path,
86
- fit: BoxFit .contain,
87
- cache: true ,
88
- mode: ExtendedImageMode .gesture,
89
- enableSlideOutPage: true ,
90
- loadStateChanged: (state) =>
91
- defaultLoadStateChanged (state, iconSize: 50 ),
92
- )
93
- : ExtendedImage .file (
94
- File (item.path),
95
- fit: BoxFit .contain,
96
- mode: ExtendedImageMode .gesture,
97
- enableSlideOutPage: true ,
98
- loadStateChanged: (state) =>
99
- defaultLoadStateChanged (state, iconSize: 50 ),
80
+ child: Stack (
81
+ // fit: StackFit.expand,
82
+ alignment: Alignment .bottomRight,
83
+ children: [
84
+ ExtendedImageGesturePageView .builder (
85
+ itemBuilder: (BuildContext context, int index) {
86
+ var item = widget.galleryItems[index];
87
+ Widget image = item.path.startsWith ('http' )
88
+ ? ExtendedImage .network (
89
+ item.path,
90
+ fit: BoxFit .contain,
91
+ cache: true ,
92
+ mode: ExtendedImageMode .gesture,
93
+ enableSlideOutPage: true ,
94
+ loadStateChanged: (state) =>
95
+ defaultLoadStateChanged (state, iconSize: 50 ),
96
+ )
97
+ : ExtendedImage .file (
98
+ File (item.path),
99
+ fit: BoxFit .contain,
100
+ mode: ExtendedImageMode .gesture,
101
+ enableSlideOutPage: true ,
102
+ loadStateChanged: (state) =>
103
+ defaultLoadStateChanged (state, iconSize: 50 ),
104
+ );
105
+ image = Container (
106
+ child: image,
107
+ );
108
+ if (index == currentIndex) {
109
+ return Hero (
110
+ tag: index,
111
+ child: image,
100
112
);
101
- image = Container (
102
- child: image,
103
- );
104
- if (index == currentIndex) {
105
- return Hero (
106
- tag: index,
107
- child: image,
108
- );
109
- } else {
110
- return image;
111
- }
112
- },
113
- itemCount: widget.galleryItems.length,
114
- controller: PageController (
115
- initialPage: currentIndex,
116
- ),
117
- scrollDirection: Axis .horizontal,
113
+ } else {
114
+ return image;
115
+ }
116
+ },
117
+ itemCount: widget.galleryItems.length,
118
+ controller: PageController (
119
+ initialPage: currentIndex,
120
+ ),
121
+ onPageChanged: onPageChanged,
122
+ scrollDirection: Axis .horizontal,
123
+ ),
124
+ SafeArea (
125
+ child: Container (
126
+ margin: EdgeInsets .only (right: 10 ),
127
+ decoration: BoxDecoration (
128
+ borderRadius: BorderRadius .all (Radius .circular (4 )),
129
+ color: Colors .grey),
130
+ padding: EdgeInsets .fromLTRB (5 , 2 , 5 , 2 ),
131
+ child: Text (
132
+ '${currentIndex + 1 } / ${widget .galleryItems .length }' ,
133
+ style: TextStyle (
134
+ color: Colors .white,
135
+ decoration: TextDecoration .none,
136
+ fontWeight: FontWeight .normal,
137
+ fontSize: 10 ),
138
+ ),
139
+ ))
140
+ ],
118
141
),
119
142
onLongPress: () {
120
143
_showBottomPane ();
@@ -134,9 +157,41 @@ class _GalleryPhotoViewWrapperState extends State<GalleryPhotoViewWrapper> {
134
157
mainAxisSize: MainAxisSize .min,
135
158
children: [
136
159
ListTile (
137
- title: Text ('复制链接' ),
160
+ title: Text (
161
+ '图床类型' ,
162
+ style: TextStyle (fontWeight: FontWeight .bold),
163
+ ),
164
+ subtitle: Text (widget.galleryItems[currentIndex].type),
165
+ ),
166
+ ListTile (
167
+ title: Text (
168
+ '图片链接' ,
169
+ style: TextStyle (fontWeight: FontWeight .bold),
170
+ ),
171
+ subtitle: Text (widget.galleryItems[currentIndex].path),
172
+ onTap: () {
173
+ _handleCopy (
174
+ widget.galleryItems[currentIndex].path, context);
175
+ },
176
+ ),
177
+ ListTile (
178
+ title: Text (
179
+ '图片信息' ,
180
+ style: TextStyle (fontWeight: FontWeight .bold),
181
+ ),
182
+ subtitle: Text (widget.galleryItems[currentIndex].info),
183
+ onTap: () {
184
+ _handleCopy (
185
+ widget.galleryItems[currentIndex].info, context);
186
+ },
187
+ ),
188
+ ListTile (
189
+ title: Text (
190
+ '取消' ,
191
+ style: TextStyle (fontWeight: FontWeight .bold),
192
+ ),
138
193
onTap: () {
139
- _handleCopy (context);
194
+ Navigator . pop (context);
140
195
},
141
196
),
142
197
],
@@ -146,9 +201,8 @@ class _GalleryPhotoViewWrapperState extends State<GalleryPhotoViewWrapper> {
146
201
}
147
202
148
203
/// 复制链接
149
- _handleCopy (BuildContext context) {
150
- Clipboard .setData (
151
- ClipboardData (text: widget.galleryItems[currentIndex].path));
204
+ _handleCopy (String content, BuildContext context) {
205
+ Clipboard .setData (ClipboardData (text: content));
152
206
Toast .show ('已复制到剪切板' , context);
153
207
Navigator .pop (context);
154
208
}
0 commit comments