Skip to content

Commit

Permalink
Release flutter nineold widget version 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh committed Jul 15, 2020
1 parent a231c74 commit 355c931
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 85 deletions.
42 changes: 21 additions & 21 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 24 additions & 17 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.3.1

1.图片长按回调图片位置

2.修复图片显示错位bug

## 1.3.0

1.增加查看图片长按事件回调
Expand Down
41 changes: 30 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ dependencies:

# 版本更新

## 1.3.1

1.图片长按回调图片位置

2.修复图片显示错位bug

## 1.3.0

1.增加查看图片长按事件回调
Expand Down Expand Up @@ -87,19 +93,18 @@ class _MyHomePageState extends State<MyHomePage> {
),
body: Container(
child: NineOldWidget(
images: images[count],
onLongPressListener: () {
images: images[count],//必填
onLongPressListener: (position) {//可选
//长按事件回调
print("长按事件回调");
print("长按事件回调当前位置 : $position");
},
backgroundColor: Colors.grey,//加载背景颜色
valueColor: Colors.blue,//加载进度条颜色
strokeWidth: 4,//加载进度条宽度
moreStyle: TextStyle(
fontSize: 14,
color: Colors.orange
),//更多加号样式
backgroundColor: Colors.white,//可选
//加载背景颜色
valueColor: Colors.red,//可选
//加载进度条颜色
strokeWidth: 4,//可选
//加载进度条宽度
moreStyle: TextStyle(fontSize: 28, color: Colors.orange), //更多加号样式
),
),
floatingActionButton: FloatingActionButton(
Expand All @@ -117,6 +122,20 @@ class _MyHomePageState extends State<MyHomePage> {
```


NineOldWidget控件构造方法以及参数设置

```
NineOldWidget(
{@required this.images,
this.moreStyle,
this.backgroundColor = Colors.white,
this.strokeWidth = 3,
this.valueColor = Colors.tealAccent,
this.onLongPressListener});
```




### 使用说明
NineOldWidget 是用来封装图片九宫格显示的组件, 方便使用者能更好的使用该插件. 使用者只要需要注入图片集合,集成和Photo_view的Hero动画以及网络图片加载的展位图进度显示,就可以实现图片查看,九宫格列表
Expand Down
25 changes: 12 additions & 13 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class _MyHomePageState extends State<MyHomePage> {
"https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2417108265,1198830140&fm=26&gp=0.jpg");
list.add(
"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=244450851,2728981198&fm=26&gp=0.jpg");
list.add(
"https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=882251069,3759945909&fm=11&gp=0.jpg");
list.add(
"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2083759825,3454063564&fm=26&gp=0.jpg");
list.add(
Expand All @@ -64,6 +62,8 @@ class _MyHomePageState extends State<MyHomePage> {
"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3153722339,140981551&fm=26&gp=0.jpg");
list.add(
"https://t8.baidu.com/it/u=3571592872,3353494284&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1584605109&t=4c346851d3f4f4cf76439fe6440ffe9f");
list.add(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1594817167403&di=87226dc3d6b70a7e02722b9f9bd9f33a&imgtype=0&src=http%3A%2F%2Ft9.baidu.com%2Fit%2Fu%3D1307125826%2C3433407105%26fm%3D79%26app%3D86%26f%3DJPEG%3Fw%3D5760%26h%3D3240");
return list;
}

Expand All @@ -75,19 +75,18 @@ class _MyHomePageState extends State<MyHomePage> {
),
body: Container(
child: NineOldWidget(
images: images[count],
onLongPressListener: () {
images: images[count],//必填
onLongPressListener: (position) {//可选
//长按事件回调
print("长按事件回调");
print("长按事件回调当前位置 : $position");
},
backgroundColor: Colors.white,//加载背景颜色
valueColor: Colors.red,//加载进度条颜色
strokeWidth: 4,//加载进度条宽度
moreStyle: TextStyle(
fontSize: 28,
color: Colors.orange
),//更多加号样式

backgroundColor: Colors.white,//可选
//加载背景颜色
valueColor: Colors.red,//可选
//加载进度条颜色
strokeWidth: 4,//可选
//加载进度条宽度
moreStyle: TextStyle(fontSize: 28, color: Colors.orange), //更多加号样式
),
),
floatingActionButton: FloatingActionButton(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.0"
version: "1.3.0"
path:
dependency: transitive
description:
Expand Down
24 changes: 12 additions & 12 deletions lib/loader/image_with_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'package:transparent_image/transparent_image.dart';

class ImageWithLoader extends StatelessWidget {
const ImageWithLoader(
{this.url,
{@required this.url,
@required this.backgroundColor,
@required this.strokeWidth,
@required this.valueColor,
this.fit = BoxFit.cover,
this.loaderSize = 48.0,
this.backgroundColor = Colors.white,
this.strokeWidth = 3,
this.valueColor = Colors.tealAccent});
this.loaderSize = 48.0});

final String url;
final BoxFit fit;
Expand All @@ -31,9 +31,9 @@ class ImageWithLoader extends StatelessWidget {
width: loaderSize,
height: loaderSize,
child: _buildCircularProgressIndicator(
backgroundColor: backgroundColor,
strokeWidth: strokeWidth,
valueColor: valueColor),
cpBackgroundColor: backgroundColor,
cpStrokeWidth: strokeWidth,
cpValueColor: valueColor),
),
),
),
Expand All @@ -48,10 +48,10 @@ class ImageWithLoader extends StatelessWidget {
}

CircularProgressIndicator _buildCircularProgressIndicator(
{Color backgroundColor, double strokeWidth, Color valueColor}) {
{Color cpBackgroundColor, double cpStrokeWidth, Color cpValueColor}) {
return CircularProgressIndicator(
backgroundColor: backgroundColor,
strokeWidth: strokeWidth,
valueColor: AlwaysStoppedAnimation<Color>(valueColor),
backgroundColor: cpBackgroundColor,
strokeWidth: cpStrokeWidth,
valueColor: AlwaysStoppedAnimation<Color>(cpValueColor),
);
}
10 changes: 6 additions & 4 deletions lib/watcher/gallery_watcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';

typedef OnLongPressCallback = void Function();

typedef OnLongPressCallback = void Function(int position);

class GalleryPhotoViewWrapper extends StatefulWidget {
GalleryPhotoViewWrapper({
Expand All @@ -31,7 +30,6 @@ class GalleryPhotoViewWrapper extends StatefulWidget {

final OnLongPressCallback onLongPressListener;


@override
State<StatefulWidget> createState() {
return _GalleryPhotoViewWrapperState();
Expand Down Expand Up @@ -62,7 +60,11 @@ class _GalleryPhotoViewWrapperState extends State<GalleryPhotoViewWrapper> {
height: MediaQuery.of(context).size.height,
),
child: InkWell(
onLongPress: widget.onLongPressListener,
onLongPress: () {
if (null != widget.onLongPressListener) {
widget.onLongPressListener(currentIndex);
}
},
child: Stack(
alignment: Alignment.bottomRight,
children: <Widget>[
Expand Down
8 changes: 4 additions & 4 deletions lib/widget/nine_old_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class NineOldWidget extends StatelessWidget {
final OnLongPressCallback onLongPressListener;

NineOldWidget(
{this.images,
{@required this.images,
this.moreStyle,
this.backgroundColor,
this.strokeWidth,
this.valueColor,
this.backgroundColor = Colors.white,
this.strokeWidth = 3,
this.valueColor = Colors.tealAccent,
this.onLongPressListener});

double width;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nineold
description: Nineoldwidget is a component used to encapsulate the nine palace display of pictures.
version: 1.3.0
version: 1.3.1
homepage: https://github.com/lanzhu1993/flutter_nineold

environment:
Expand Down

0 comments on commit 355c931

Please sign in to comment.