Code Monkey home page Code Monkey logo

Comments (6)

foxsofter avatar foxsofter commented on August 24, 2024 1

键盘不弹出的问题,1.12.x版本是好的,如果在1.17.x遇到此问题,先回退版本吧

from flutter_thrio.

Angdo avatar Angdo commented on August 24, 2024

@neeboo 是在Flutter 1.17 下,原生和Flutter交替打开。回退页面后 TextField 无法正常弹出键盘?

from flutter_thrio.

neeboo avatar neeboo commented on August 24, 2024

@neeboo 是在Flutter 1.17 下,原生和Flutter交替打开。回退页面后 TextField 无法正常弹出键盘?

是的,不只是键盘,其他插件也不能工作了,像我有fb和google登录,都不能使用。

当我需要再使用其他插件的时候就会报:

E/MethodChannel#com.roughike/flutter_facebook_login: Failed to handle method call
    java.lang.NullPointerException: Argument 'activity' cannot be null

因此判断activity可能被干掉了

官方也有相关的问题未解决?flutter/flutter#47342


2020.06.08更新 :疑似解决方案

修改ThrioActivity, 在onResume或者onPostResume里面加上super.delegate.onAttach(this)

最好还加上

io.flutter.embedding.android.ThrioActivity

...
    @SuppressLint("VisibleForTests")
    override fun onResume() {
        super.onResume()
        super.delegate.onAttach(this)
    }

    @SuppressLint("VisibleForTests")
    override fun onPostResume() {
        super.onPostResume()
        super.delegate.onAttach(this)
    }

   // 最好也加上这个 
   override fun shouldAttachEngineToActivity(): Boolean {
        return true
    }
...

分析:

flutter -> native -> flutter ,后面的flutter 会重新加载一遍插件,当pop操作完成的时候,需要在第一个flutter里面重新delegate.onAttach到当前的activity

不知道对不对,请帮忙检查

from flutter_thrio.

foxsofter avatar foxsofter commented on August 24, 2024

实际报错类似这个issue,但这个issue已经在Flutter SDK中了, flutter#30505

from flutter_thrio.

foxsofter avatar foxsofter commented on August 24, 2024

@neeboo 是在Flutter 1.17 下,原生和Flutter交替打开。回退页面后 TextField 无法正常弹出键盘?

是的,不只是键盘,其他插件也不能工作了,像我有fb和google登录,都不能使用。

当我需要再使用其他插件的时候就会报:

E/MethodChannel#com.roughike/flutter_facebook_login: Failed to handle method call
    java.lang.NullPointerException: Argument 'activity' cannot be null

因此判断activity可能被干掉了

官方也有相关的问题未解决?flutter/flutter#47342

2020.06.08更新 :疑似解决方案

修改ThrioActivity, 在onResume或者onPostResume里面加上super.delegate.onAttach(this)

最好还加上

io.flutter.embedding.android.ThrioActivity

...
    @SuppressLint("VisibleForTests")
    override fun onResume() {
        super.onResume()
        super.delegate.onAttach(this)
    }

    @SuppressLint("VisibleForTests")
    override fun onPostResume() {
        super.onPostResume()
        super.delegate.onAttach(this)
    }

   // 最好也加上这个 
   override fun shouldAttachEngineToActivity(): Boolean {
        return true
    }
...

分析:

flutter -> native -> flutter ,后面的flutter 会重新加载一遍插件,当pop操作完成的时候,需要在第一个flutter里面重新delegate.onAttach到当前的activity

不知道对不对,请帮忙检查

你这个我都试过了,不行啊

from flutter_thrio.

neeboo avatar neeboo commented on August 24, 2024

Close but have to wait for better hotfix on flutter engine

from flutter_thrio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.