i have to make that type zoom effect to container how use in flutter without any package.
if use interactive view that time red container padding 20 not set as constant if green zoom that time red also zoom.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Flutter Container Layout'),
),
body: Container(
color: Colors.red, // Red container in full screen
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: InteractiveViewer(
boundaryMargin: EdgeInsets.all(double.infinity),
minScale: 0.1,
maxScale: 4,
child: Center(
child: Padding(
padding: EdgeInsets.all(20.0), // Padding of 20 on all sides for green container
child: Container(
width: 200.0,
height: 200.0,
color: Colors.green, // Green container
),
),
),
),
),
),
);
}
}
2
Answers
You can use Transform.scale inside GestureDetector like below instead use of
InteractiveViewer.
If your issue just with padding wrap the
InteractiveViewer
widget itself with padding :I create this method to zoom Image with specific action :
and this method to reset the original image:
controllers :
Hope that helps !!!