将滑动布局用ScrollConfiguration包裹,设置自定义behavior:
导包:
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:flutter/services.dart';
用ScrollConfiguration包裹滑动子布局:
ScrollConfiguration(
behavior: MyBehavior(),
child: ListView(),
);
自定义behavior:
class MyBehavior extends ScrollBehavior{
@override
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {
if(Platform.isAndroid||Platform.isFuchsia){
return child;
}else{
return super.buildViewportChrome(context,child,axisDirection);
}
}
}