Implement thread image view with scaling and panning

This commit is contained in:
John Wesley 2023-12-27 17:32:06 -05:00
parent fe9de86f98
commit 2dfec9ee62
1 changed files with 39 additions and 7 deletions

View File

@ -25,6 +25,32 @@ class EntryItem extends StatelessWidget {
final Future<void> Function(String)? onReply;
final bool isPreview;
_onImageClick(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
title: Text(item.title),
backgroundColor: const Color(0x66000000),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: InteractiveViewer(
child: Image.network(
item.image!.storageUrl,
),
),
)
],
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Column(
@ -32,18 +58,24 @@ class EntryItem extends StatelessWidget {
children: <Widget>[
if (item.image?.storageUrl != null)
isPreview
? Image.network(
? InkWell(
onTap: () => _onImageClick(context),
child: Image.network(
item.image!.storageUrl,
height: 160,
width: double.infinity,
fit: BoxFit.cover,
),
)
: Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height / 2,
),
child: InkWell(
onTap: () => _onImageClick(context),
child: Image.network(
item.image!.storageUrl,
),
)),
Container(
padding: const EdgeInsets.all(16),