dependencies {
//...
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}
platform :ios, '9.0'
target 'Runner' do
use_frameworks!
#...
pod 'CachedNetworkImage'
end
void main() {
WidgetsFlutterBinding.ensureInitialized();
// This line will solve the issue
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]).then((_) {
runApp(MyApp());
});
}
这段代码会强制应用在横屏和竖屏之间进行切换,如果没有设置此项,则在一些场合下可能会导致缺少原生实现的问题。