转自https://www.jianshu.com/p/12ee9456eb2e
pubspec.yaml 引入 flutter_drag_scale 点击右上角的packages get 也就是flutter packages get 然后 main.dart 中引入
dependencies:
flutter:
sdk: flutter
flutter_drag_scale:
git: https://github.com/LiuC520/flutter_drag_scale.git
main.dart
import 'package:flutter/material.dart';
import 'package:flutter_drag_scale/flutter_drag_scale.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 400.0,
width: 400,
child: Center(
child: DragScaleContainer(
doubleTapStillScale: true,
child: new Image(
image: new NetworkImage(
'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
),
),
),
);
}
}