Reputation: 1340
I have InteractiveViewer
inside Scaffold, and inside them one time I have landscape images, another time portrait image. But dimensions of InteractiveViewer
always have dimension like on page startup. How to allow to display image inside InteractiveViewer
on whole body?
Here is code:
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body:Center( child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(20.0),
maxScale: 5.0,
child: FlutterLogo(size: 100),
),),)
);
}
}
output when I resize object inside InteractiveViewer
with fingers:
but I expect:
Upvotes: 1
Views: 362
Reputation: 63569
You can use clipBehavior: Clip.none,
But the view depend on inner size. Also can be experiment on constrained: false
InteractiveViewer(
boundaryMargin: const EdgeInsets.all(2.0),
clipBehavior: Clip.none,
maxScale: 5.0,
child: FlutterLogo(size: 100)),
But the child has to be bigger for InteractiveViewer
body: Center(
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(2.0),
maxScale: 5.0,
minScale: 1,
child: SizedBox(
width: 500, // this
height: 500,
child: Center(child: FlutterLogo(size: 100)),
),
),
),
Upvotes: 1