Skip to content

Commit 2557291

Browse files
init project
1 parent 55087a9 commit 2557291

File tree

3 files changed

+104
-16
lines changed

3 files changed

+104
-16
lines changed

README.md

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,53 @@ A new Flutter application.
44

55
## Getting Started
66

7-
This project is a starting point for a Flutter application.
7+
根据flutter_drage_sacle新增放大比例功能,demo 是配合轮播使用
88

9-
A few resources to get you started if this is your first Flutter project:
109

11-
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
1310

14-
For help getting started with Flutter, view our
15-
[online documentation](https://flutter.dev/docs), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
11+
```
12+
import 'package:flutter/material.dart';
13+
import 'package:flutter_swiper/flutter_swiper.dart';
14+
import 'package:yin_drag_sacle/yin_drag_sacle.dart';
15+
16+
void main() => runApp(MyApp());
17+
18+
class MyApp extends StatefulWidget {
19+
@override
20+
MyAppState createState() => new MyAppState();
21+
}
22+
23+
class MyAppState extends State<MyApp> {
24+
List<String> path = [
25+
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575024212241&di=b017d085f3982d951b9a365fbc9cfdd4&imgtype=0&src=http%3A%2F%2Fimg2.mukewang.com%2F5c18cf540001ac8206000338.jpg',
26+
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575024212240&di=a69285fddbc441702f83a707a2d2af17&imgtype=0&src=http%3A%2F%2Fdingyue.nosdn.127.net%2FetqmQabSGrqHXhTvzaS91gV006NWCPDnEgLHRoAVony8E1543979039684.png',
27+
'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg',
28+
];
29+
30+
///item 视图
31+
Widget itemView(BuildContext context, int index) {
32+
String value = path[index];
33+
return DragScaleContainer(
34+
child: Image(image: NetworkImage(value)),
35+
doubleTapStillScale: false,
36+
maxScale: 4, //放大最大倍数
37+
);
38+
}
39+
40+
@override
41+
Widget build(BuildContext context) {
42+
return MaterialApp(
43+
home: Scaffold(
44+
appBar: AppBar(title: Text('图片显示')),
45+
body: Swiper(
46+
itemBuilder: itemView,
47+
itemCount: path.length,
48+
pagination: SwiperPagination(),
49+
control: SwiperControl(),
50+
),
51+
),
52+
);
53+
}
54+
}
55+
56+
```

yin_drag_sacle/README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,62 @@
11
# yin_drag_sacle
22

3-
A new Flutter package.
3+
Image zooming in, zooming out, dragging, you can customize the zoom scale, the project is from flutter_drag_scale, the modification is published to meet their own project
44

55
## Getting Started
66

7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
7+
- amplification
8+
- gesture magnification
9+
- double click to enlarge
10+
- to reduce the
11+
- drag
1112

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
13+
14+
It can be used with Swiper
15+
16+
17+
```
18+
import 'package:flutter/material.dart';
19+
import 'package:flutter_swiper/flutter_swiper.dart';
20+
import 'package:yin_drag_sacle/yin_drag_sacle.dart';
21+
22+
void main() => runApp(MyApp());
23+
24+
class MyApp extends StatefulWidget {
25+
@override
26+
MyAppState createState() => new MyAppState();
27+
}
28+
29+
class MyAppState extends State<MyApp> {
30+
List<String> path = [
31+
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575024212241&di=b017d085f3982d951b9a365fbc9cfdd4&imgtype=0&src=http%3A%2F%2Fimg2.mukewang.com%2F5c18cf540001ac8206000338.jpg',
32+
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575024212240&di=a69285fddbc441702f83a707a2d2af17&imgtype=0&src=http%3A%2F%2Fdingyue.nosdn.127.net%2FetqmQabSGrqHXhTvzaS91gV006NWCPDnEgLHRoAVony8E1543979039684.png',
33+
'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg',
34+
];
35+
36+
///item 视图
37+
Widget itemView(BuildContext context, int index) {
38+
String value = path[index];
39+
return DragScaleContainer(
40+
child: Image(image: NetworkImage(value)),
41+
doubleTapStillScale: false,
42+
maxScale: 4, //放大最大倍数
43+
);
44+
}
45+
46+
@override
47+
Widget build(BuildContext context) {
48+
return MaterialApp(
49+
home: Scaffold(
50+
appBar: AppBar(title: Text('图片显示')),
51+
body: Swiper(
52+
itemBuilder: itemView,
53+
itemCount: path.length,
54+
pagination: SwiperPagination(),
55+
control: SwiperControl(),
56+
),
57+
),
58+
);
59+
}
60+
}
61+
62+
```

yin_drag_sacle/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: yin_drag_sacle
22
description: Image zooming in, zooming out, dragging, you can customize the zoom scale, the project is from flutter_drag_scale, the modification is published to meet their own project
3-
version: 0.0.1
3+
version: 0.0.2
44
author: yin <yin_8023@163.com>
55
homepage: https://github.com/yx544806988/yin_drag_scale.git
66

0 commit comments

Comments
 (0)