当前位置:   article > 正文

android调用flutter页面,Android上使用flutter boost从flutter页面跳转到原生页面,再返回到flutter页面时,有一定概率出现flutter页面不响应onTap事...

flutter fragment 调用安卓原生界面没有反应

demo是使用flutter boost的demo修改的,只是将FirstRouteWidget改了一下,增加了一个分页加载的图片列表,在加载时,快速点击转圈的位置,当加载完下一页数据后,转圈的位置会变成一张图片,点击会跳转到原生页面,如果跳转恰好在某个时机,再返回flutter页面的时候,列表的图片无法再响应onTap事件,页面滑动也没有惯性。

class FirstRouteWidget extends StatefulWidget {

@override

_FirstRouteWidgetState createState() => _FirstRouteWidgetState();

}

class _FirstRouteWidgetState extends State {

int length = 10;

void load() {

Future.delayed(Duration(seconds: 1), () {

setState(() {

length += 10;

});

});

}

@override

Widget build(BuildContext context) {

return Scaffold(

appBar: AppBar(

title: Text('First Route'),

),

body: ListView.builder(

itemBuilder: (BuildContext context, int index) {

if (index == length) {

load();

return Center(

child: Container(

margin: EdgeInsets.all(20),

width: 60.0,

height: 60.0,

child: CircularProgressIndicator(),

),

);

} else if (index > length) {

return null;

}

return InkWell(

child: Container(

color: Colors.white,

child: Container(

color: Colors.amber,

padding: const EdgeInsets.all(5),

child: Image.network(urls[index], width: 300,height: 300,fit:BoxFit.contain),

),

),

onTap: () {

FlutterBoost.singleton.open("sample://nativePage");

},

);

},

),

);

}

}

环境信息如下:

Flutter Boost 版本: origin/v1.12.13-hotfixes,

commit:c09cb81cf072d26aeab19204935bb2ffa4ad1b38

Target Platform:Android

Devices:Redmi Note 7

$ flutter doctor --verbose

[✓] Flutter (Channel v1.12.13-hotfixes, v1.12.13+hotfix.8, on Mac OS X 10.14.6 18G2022, locale zh-Hans-CN)

• Flutter version 1.12.13+hotfix.8 at /Users/living/Git/flutter

• Framework revision 0b8abb4724 (6 weeks ago), 2020-02-11 11:44:36 -0800

• Engine revision e1e6ced81d

• Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)

• Android SDK at /Users/living/Data/Android/sdk

• Android NDK location not configured (optional; useful for native profiling support)

• Platform android-29, build-tools 29.0.2

• ANDROID_HOME = /Users/living/Data/Android/sdk

• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java

• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)

• Xcode at /Applications/Xcode.app/Contents/Developer

• Xcode 11.3, Build version 11C29

• CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)

• Android Studio at /Applications/Android Studio.app/Contents

• Flutter plugin version 44.0.2

• Dart plugin version 192.7761

• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] Connected device

! No devices available

! Doctor found issues in 1 category.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/810296
推荐阅读
相关标签
  

闽ICP备14008679号