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) {} } catch (e) {}
} }
// 使 cached_network_image // 使 my_flutter_drag_scale Listview
// 使 flutter_drag_scale PhotoView ScrollPhysics scrollPhysics;
bool bZoomedInit = true; //
Widget getNetworkImage(String url) { Widget getNetworkImage(String url) {
return CachedNetworkImage( return CachedNetworkImage(
imageUrl: url, imageUrl: url,
alignment: Alignment.topCenter, 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) => placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0), getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error), 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(), : SizedBox.shrink(),
KeyboardAvoider( ListView(
autoScroll: true, // physics: NeverScrollableScrollPhysics(), // ListView
child: Container( // physics: null, // ListView
color: Color.fromRGBO(244, 244, 244, 1), physics: scrollPhysics,
child: Column( children: [
children: <Widget>[ Container(
//1 color: Color.fromRGBO(244, 244, 244, 1),
getHdAndPlay(), child: Column(
//2 children: <Widget>[
imageWztp, //1
SizedBox(height: ScreenUtil().setHeight(_marginVer)), getHdAndPlay(),
//3 //2
getWztpSmxx(), imageWztp,
SizedBox(height: ScreenUtil().setHeight(_marginVer)), SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//7 //3
getHyshInfo('hycsInfo'), getWztpSmxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)), SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//8 //7
getHyshInfo('hyfhInfo'), getHyshInfo('hycsInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)), SizedBox(height: ScreenUtil().setHeight(_marginVer)),
// //75 //8
// getWzxxPart5(), getHyshInfo('hyfhInfo'),
// //86 SizedBox(height: ScreenUtil().setHeight(_marginVer)),
// getWzxxPart6(), // //75
// SizedBox(height: 6), // getWzxxPart5(),
// Divider(height: 1.0, color: Colors.blue), // //86
// SizedBox(height: 6), // getWzxxPart6(),
//67 // SizedBox(height: 6),
//getWzxxPart7(), // Divider(height: 1.0, color: Colors.blue),
// SizedBox(height: 8), // SizedBox(height: 6),
// Divider(height: 1.0, color: Colors.blue), //67
SizedBox(height: 18), //getWzxxPart7(),
//9 // SizedBox(height: 8),
getTsjjQr(), // Divider(height: 1.0, color: Colors.blue),
SizedBox(height: 10), SizedBox(height: 18),
], //9
getTsjjQr(),
SizedBox(height: 10),
],
),
), ),
), ],
), ),
Positioned( Positioned(
//alignment: Alignment(0.9, 0.35), //alignment: Alignment(0.9, 0.35),

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

Loading…
Cancel
Save