hyzp_ybqx-Commit157:已修改好fhycx_content_new.dart。使用自定义 my_flutter_drag_scale 插件,完美解决Listview滚动与图片缩放拖动之间的手势冲突,不会消耗点击事件,滚动很灵敏

master
WinUser01 4 years ago
parent 7cbc6127e9
commit 2fb22de8a5

@ -133,26 +133,45 @@ class _FhycxPageState extends State<FhycxContentNew> {
} catch (e) {}
}
// 使 cached_network_image
// 使 flutter_drag_scale PhotoView
// 使 my_flutter_drag_scale Listview
ScrollPhysics scrollPhysics;
bool bZoomedInit = true; //
Widget getNetworkImage(String url) {
return CachedNetworkImage(
imageUrl: url,
alignment: Alignment.topCenter,
imageBuilder: (context, imageProvider) => DragScaleContainer(
doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill)
// child: Image(
// image: NetworkImage(
// 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
// ),
),
// imageBuilder: (context, imageProvider) => PhotoView(
// imageProvider: imageProvider,
// ),
//placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error),
imageBuilder: (context, imageProvider) {
return DragScaleContainer(
doubleTapStillScale: false,
child: Image(image: imageProvider, fit: BoxFit.fill),
scaleChangedCallback: (ScaleChangedModel model) {
print("model.scale = ${model.scale}");
bZoomedInit = (1.0 == model.scale);
scrollPhysics = PageScrollPhysics();
setState(() {});
},
pointerDownCallback: () {
if (bZoomedInit) {
if (scrollPhysics != PageScrollPhysics()) {
scrollPhysics = PageScrollPhysics();
setState(() {});
}
} else {
if (scrollPhysics != NeverScrollableScrollPhysics()) {
scrollPhysics = NeverScrollableScrollPhysics();
setState(() {});
}
}
},
pointerUpCallback: () {
scrollPhysics = PageScrollPhysics();
setState(() {});
},
);
},
);
}
@ -754,44 +773,48 @@ class _FhycxPageState extends State<FhycxContentNew> {
),
)
: SizedBox.shrink(),
KeyboardAvoider(
autoScroll: true,
child: Container(
color: Color.fromRGBO(244, 244, 244, 1),
child: Column(
children: <Widget>[
//1
getHdAndPlay(),
//2
imageWztp,
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//3
getWztpSmxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//7
getHyshInfo('hycsInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//8
getHyshInfo('hyfhInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
// //75
// getWzxxPart5(),
// //86
// getWzxxPart6(),
// SizedBox(height: 6),
// Divider(height: 1.0, color: Colors.blue),
// SizedBox(height: 6),
//67
//getWzxxPart7(),
// SizedBox(height: 8),
// Divider(height: 1.0, color: Colors.blue),
SizedBox(height: 18),
//9
getTsjjQr(),
SizedBox(height: 10),
],
ListView(
// physics: NeverScrollableScrollPhysics(), // ListView
// physics: null, // ListView
physics: scrollPhysics,
children: [
Container(
color: Color.fromRGBO(244, 244, 244, 1),
child: Column(
children: <Widget>[
//1
getHdAndPlay(),
//2
imageWztp,
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//3
getWztpSmxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//7
getHyshInfo('hycsInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//8
getHyshInfo('hyfhInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
// //75
// getWzxxPart5(),
// //86
// getWzxxPart6(),
// SizedBox(height: 6),
// Divider(height: 1.0, color: Colors.blue),
// SizedBox(height: 6),
//67
//getWzxxPart7(),
// SizedBox(height: 8),
// Divider(height: 1.0, color: Colors.blue),
SizedBox(height: 18),
//9
getTsjjQr(),
SizedBox(height: 10),
],
),
),
),
],
),
Positioned(
//alignment: Alignment(0.9, 0.35),

@ -595,6 +595,8 @@ class _HyshPageState extends State<HyshContentNew> with SingleTickerProviderStat
// }
// 使 my_flutter_drag_scale Listview
ScrollPhysics scrollPhysics;
bool bZoomedInit = true; //
Widget getNetworkImage(String url) {
return CachedNetworkImage(
imageUrl: url,
@ -691,9 +693,6 @@ class _HyshPageState extends State<HyshContentNew> with SingleTickerProviderStat
double _marginVertical5 = 10;
double _marginVertical6 = 20;
ScrollPhysics scrollPhysics;
bool bZoomedInit = true; //
Future getTopTabsMap() async {
//map
topTabs_map.forEach((key, value) {

Loading…
Cancel
Save