mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 11:18:41 +00:00
fix #245
This commit is contained in:
parent
2b4ba6b81b
commit
cd9a5bab97
3 changed files with 115 additions and 96 deletions
|
|
@ -97,8 +97,9 @@ class _InChatMediaViewerState extends State<InChatMediaViewer> {
|
|||
if (galleryItemIndex == null) return;
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MemoriesPhotoSliderView(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, a1, a2) => MemoriesPhotoSliderView(
|
||||
galleryItems: widget.galleryItems,
|
||||
initialIndex: galleryItemIndex!,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -166,14 +166,22 @@ class MemoriesViewState extends State<MemoriesView> {
|
|||
Future<void> open(BuildContext context, int index) async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MemoriesPhotoSliderView(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, a1, a2) => MemoriesPhotoSliderView(
|
||||
galleryItems: galleryItems,
|
||||
initialIndex: index,
|
||||
scrollDirection: verticalGallery ? Axis.vertical : Axis.horizontal,
|
||||
),
|
||||
// transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||
// return child;
|
||||
// },
|
||||
// transitionDuration: Duration.zero,
|
||||
// reverseTransitionDuration: Duration.zero,
|
||||
),
|
||||
);
|
||||
) as bool?;
|
||||
setState(() {});
|
||||
|
||||
await initAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ class MemoriesPhotoSliderView extends StatefulWidget {
|
|||
required this.galleryItems,
|
||||
super.key,
|
||||
this.loadingBuilder,
|
||||
this.backgroundDecoration,
|
||||
this.minScale,
|
||||
this.maxScale,
|
||||
this.initialIndex = 0,
|
||||
|
|
@ -27,7 +26,6 @@ class MemoriesPhotoSliderView extends StatefulWidget {
|
|||
}) : pageController = PageController(initialPage: initialIndex);
|
||||
|
||||
final LoadingBuilder? loadingBuilder;
|
||||
final BoxDecoration? backgroundDecoration;
|
||||
final dynamic minScale;
|
||||
final dynamic maxScale;
|
||||
final int initialIndex;
|
||||
|
|
@ -43,6 +41,7 @@ class MemoriesPhotoSliderView extends StatefulWidget {
|
|||
|
||||
class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
||||
late int currentIndex = widget.initialIndex;
|
||||
final GlobalKey<State<StatefulWidget>> key = GlobalKey();
|
||||
|
||||
void onPageChanged(int index) {
|
||||
setState(() {
|
||||
|
|
@ -102,9 +101,17 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return Dismissible(
|
||||
key: key,
|
||||
direction: DismissDirection.vertical,
|
||||
resizeDuration: null,
|
||||
onDismissed: (d) {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white.withAlpha(0),
|
||||
body: Container(
|
||||
decoration: widget.backgroundDecoration,
|
||||
color: context.color.surface,
|
||||
constraints: BoxConstraints.expand(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
),
|
||||
|
|
@ -112,7 +119,9 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
|||
alignment: Alignment.bottomRight,
|
||||
children: <Widget>[
|
||||
MediaViewSizing(
|
||||
bottomNavigation: Row(
|
||||
bottomNavigation: Container(
|
||||
color: context.color.surface,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FilledButton.icon(
|
||||
|
|
@ -149,6 +158,7 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
PhotoViewGallery.builder(
|
||||
|
|
@ -156,7 +166,6 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
|||
builder: _buildItem,
|
||||
itemCount: widget.galleryItems.length,
|
||||
loadingBuilder: widget.loadingBuilder,
|
||||
backgroundDecoration: widget.backgroundDecoration,
|
||||
pageController: widget.pageController,
|
||||
onPageChanged: onPageChanged,
|
||||
scrollDirection: widget.scrollDirection,
|
||||
|
|
@ -195,6 +204,7 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue