Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

输入框长按的时候报错了,有谁解决了的啊 #17

Closed
123LI opened this issue May 6, 2020 · 19 comments
Closed

输入框长按的时候报错了,有谁解决了的啊 #17

123LI opened this issue May 6, 2020 · 19 comments

Comments

@123LI
Copy link

123LI commented May 6, 2020

如果有谁解决了,请教下怎么解决的

@123LI
Copy link
Author

123LI commented May 9, 2020

Exception when selecting text inside a FormField #1. 这里面的方法试了不行啊

@sckoh
Copy link

sckoh commented May 11, 2020

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue

https://api.flutter.dev/flutter/material/MaterialApp/builder.html

@nslogx
Copy link
Owner

nslogx commented May 12, 2020

@sckoh thanks

@nslogx nslogx closed this as completed May 12, 2020
@jb522185660
Copy link

这个解决方案引起另外一个导航的问题

#2 Navigator.pushNamed
package:flutter/…/widgets/navigator.dart:1529
#3 Application.navigateTo
package:commission/routers/application.dart:13
#4 Application.navigateToGoodsDetail
package:commission/routers/application.dart:26
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#2b8e2
debugOwner: GestureDetector
state: ready
won arena
finalPosition: Offset(92.0, 263.3)
finalLocalPosition: Offset(82.0, 97.3)
button: 1
sent tap down
════════════════════════════════════════════════════════════════════════════════

@jb522185660
Copy link

The following assertion was thrown while handling a gesture:
Navigator operation requested with a context that does not include a Navigator.

The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget.
When the exception was thrown, this was the stack
#0 Navigator.of.
package:flutter/…/widgets/navigator.dart:2118
#1 Navigator.of
package:flutter/…/widgets/navigator.dart:2125
#2 Navigator.pushNamed
package:flutter/…/widgets/navigator.dart:1529
#3 Application.navigateTo
package:commission/routers/application.dart:13
#4 Application.navigateToGoodsDetail

@jb522185660
Copy link

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue

https://api.flutter.dev/flutter/material/MaterialApp/builder.html

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue

https://api.flutter.dev/flutter/material/MaterialApp/builder.html

How do you setup router by this solution,
I do this but course a problem,when I push or pop
"Navigator operation requested with a context that does not include a Navigator"

@farmercz
Copy link

这样修改后 路由跳转报错
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Navigator operation requested with a context that does not include a Navigator.
E/flutter ( 7698): The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget.

@tinyc-z
Copy link

tinyc-z commented May 31, 2020

修改后同样报错
Navigator operation requested with a context that does not include a Navigator.

@farmercz
Copy link

farmercz commented Jun 2, 2020

修改后同样报错
Navigator operation requested with a context that does not include a Navigator.

每一个widget 根节点都添加一个EasyLoading

@atishoo
Copy link

atishoo commented Jun 2, 2020

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue
https://api.flutter.dev/flutter/material/MaterialApp/builder.html

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue
https://api.flutter.dev/flutter/material/MaterialApp/builder.html

How do you setup router by this solution,

I do this but course a problem,when I push or pop

"Navigator operation requested with a context that does not include a Navigator"

it works!
but unfortunately,it appears double yellow underlines.

@atishoo
Copy link

atishoo commented Jun 2, 2020

this is the correct solution:

builder: (BuildContext context, Widget child) {
    return Material(
        child: FlutterEasyLoading(
            child: child,
        ),
    );
}

add above code to your MaterialApp😜😜😜

@CoderJasons
Copy link

this is the correct solution:

builder: (BuildContext context, Widget child) {
    return Material(
        child: FlutterEasyLoading(
            child: child,
        ),
    );
}

add above code to your MaterialApp😜😜😜
放在MaterialApp的child,showtoast的时候文案下方会有一个黄色的警告线的问题有遇到过吗

@fangshengfy
Copy link

this is the correct solution:

builder: (BuildContext context, Widget child) {
    return Material(
        child: FlutterEasyLoading(
            child: child,
        ),
    );
}

add above code to your MaterialApp😜😜😜
放在MaterialApp的child,showtoast的时候文案下方会有一个黄色的警告线的问题有遇到过吗

我也遇到了,请问怎么解决

@atishoo
Copy link

atishoo commented Jun 23, 2020

不是放在child,是放在builder

@jasonW9527
Copy link

this is the correct solution:

builder: (BuildContext context, Widget child) {
    return Material(
        child: FlutterEasyLoading(
            child: child,
        ),
    );
}

add above code to your MaterialApp😜😜😜
good,it works!

@silentchild
Copy link

this is the correct solution:

builder: (BuildContext context, Widget child) {
    return Material(
        child: FlutterEasyLoading(
            child: child,
        ),
    );
}

add above code to your MaterialApp😜😜😜
放在MaterialApp的child,showtoast的时候文案下方会有一个黄色的警告线的问题有遇到过吗

我也遇到了,请问怎么解决

一样,谁解决了?

@yakubpashask
Copy link

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue
https://api.flutter.dev/flutter/material/MaterialApp/builder.html

MaterialApp(
  builder: (BuildContext context, Widget child) {
    return FlutterEasyLoading(
      child: child,
    );
  },

put FlutterEasyLoading under builder of MaterialApp will solve this issue
https://api.flutter.dev/flutter/material/MaterialApp/builder.html

How do you setup router by this solution,

I do this but course a problem,when I push or pop

"Navigator operation requested with a context that does not include a Navigator"

Did you get any resolution for the navigator?

@xdd666t
Copy link

xdd666t commented Sep 1, 2020

这问题确实坑,综合上面几位歪果仁提出,和自己尝试,用下面的代码可以解决长按报错,Navigator报错问题,页面必须要向上遍历得到Context,Page要写在Home里面,EasyLoading写在builder里面就行了,把child带下去,这里的child实际就是我们在home里面写的Page

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter EasyLoading',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter EasyLoading'),
      builder: (BuildContext context, Widget child) {
        /// make sure that loading can be displayed in front of all other widgets
        return FlutterEasyLoading(
          child: child,
        );
      },
    );
  }
}

@nslogx nslogx unpinned this issue Sep 24, 2020
@erayhamurlu
Copy link

Just add to bottom GlobalCupertinoLocalizations.delegate where is GlobalMaterialLocalizations.delegate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests