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

Exception when selecting text inside a FormField #1

Closed
ice-j opened this issue Jan 25, 2020 · 19 comments
Closed

Exception when selecting text inside a FormField #1

ice-j opened this issue Jan 25, 2020 · 19 comments
Labels
bug Something isn't working

Comments

@ice-j
Copy link

ice-j commented Jan 25, 2020

Steps to reproduce:

  1. Add TextField widget to the app (like this).
  2. Open the app and type some text in the field
  3. Try and select the text (to copy it for example)

Log

I/flutter (30736): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (30736): The following assertion was thrown building
I/flutter (30736): _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#0c596](dirty, state: _OverlayEntryState#026a0):
I/flutter (30736): No MediaQuery widget found.
I/flutter (30736): _OverlayEntry widgets require a MediaQuery widget ancestor.
I/flutter (30736): The specific widget that could not find a MediaQuery ancestor was:
I/flutter (30736): _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#0c596]
I/flutter (30736): The ownership chain for the affected widget is:
I/flutter (30736): "_OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#0c596] ← Stack ← _Theatre ← Overlay ←
I/flutter (30736): Directionality ← FlutterEasyLoading ← MyApp ← [root]"
I/flutter (30736): Typically, the MediaQuery widget is introduced by the MaterialApp or WidgetsApp widget at the top of
I/flutter (30736): your application widget tree.
I/flutter (30736):
I/flutter (30736): The relevant error-causing widget was:
I/flutter (30736): Overlay file:///D:/Projects/flutter_easyloading/lib/src/widgets/loading.dart:35:14
I/flutter (30736):
I/flutter (30736): When the exception was thrown, this was the stack:
I/flutter (30736): #0 debugCheckHasMediaQuery. (package:flutter/src/widgets/debug.dart:219:7)
I/flutter (30736): #1 debugCheckHasMediaQuery (package:flutter/src/widgets/debug.dart:231:4)
I/flutter (30736): #2 _MaterialTextSelectionControls.buildToolbar (package:flutter/src/material/text_selection.dart:148:12)
I/flutter (30736): #3 TextSelectionOverlay._buildToolbar (package:flutter/src/widgets/text_selection.dart:556:34)
I/flutter (30736): #4 _OverlayEntryState.build (package:flutter/src/widgets/overlay.dart:169:25)
I/flutter (30736): #5 StatefulElement.build (package:flutter/src/widgets/framework.dart:4440:27)
I/flutter (30736): #6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4329:15)
I/flutter (30736): #7 Element.rebuild (package:flutter/src/widgets/framework.dart:4053:5)
I/flutter (30736): #8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4312:5)
I/flutter (30736): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4487:11)
I/flutter (30736): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4307:5)
I/flutter (30736): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3297:14)
I/flutter (30736): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:3091:12)
I/flutter (30736): #13 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5326:32)
I/flutter (30736): #14 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5694:17)
I/flutter (30736): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:3080:15)
I/flutter (30736): #16 _TheatreElement.update (package:flutter/src/widgets/overlay.dart:615:16)
I/flutter (30736): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:3080:15)
I/flutter (30736): #18 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4349:16)
I/flutter (30736): #19 Element.rebuild (package:flutter/src/widgets/framework.dart:4053:5)
I/flutter (30736): #20 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2532:33)
I/flutter (30736): #21 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:796:20)
I/flutter (30736): #22 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
I/flutter (30736): #23 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1108:15)
I/flutter (30736): #24 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1047:9)
I/flutter (30736): #25 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:963:5)
I/flutter (30736): #29 _invoke (dart:ui/hooks.dart:260:10)
I/flutter (30736): #30 _drawFrame (dart:ui/hooks.dart:218:3)
I/flutter (30736): (elided 3 frames from package dart:async)
I/flutter (30736):
I/flutter (30736): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (30736): Another exception was thrown: No MediaQuery widget found.

@WingCH
Copy link

WingCH commented Mar 4, 2020

some problem, any solution?

@nslogx
Copy link
Owner

nslogx commented Mar 4, 2020

some problem, any solution?

Hi, could you please provide more infomation about this issue? @WingCH

@nslogx nslogx added the bug Something isn't working label Mar 4, 2020
@nslogx
Copy link
Owner

nslogx commented Mar 4, 2020

@ice-j
Sorry, I didn't have the same problem
if you can record a video of this problem, that will be helpful, Thanks.

@WingCH
Copy link

WingCH commented Mar 4, 2020

Thanks your quick reply

i just create sample demo code.
according to @ice-j

  1. Add TextField widget to the app (like this).
  2. Open the app and type some text in the field
  3. Try and select the text (to copy it for example) <- long click textfield

video: https://drive.google.com/file/d/1xUKi21OO9O5b6bFgyqot0kYrgNa3QHm9/view?usp=sharing

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return FlutterEasyLoading(
      child: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          // This is the theme of your application.
          //
          // Try running your application with "flutter run". You'll see the
          // application has a blue toolbar. Then, without quitting the app, try
          // changing the primarySwatch below to Colors.green and then invoke
          // "hot reload" (press "r" in the console where you ran "flutter run",
          // or simply save your changes to "hot reload" in a Flutter IDE).
          // Notice that the counter didn't reset back to zero; the application
          // is not restarted.
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: TextField(
        decoration: InputDecoration(
          border: OutlineInputBorder(),
          labelText: 'Text input',
        ),
      ),
    ));
  }
}

@nslogx
Copy link
Owner

nslogx commented Mar 4, 2020

@WingCH I will check soon
Thanks

@nslogx
Copy link
Owner

nslogx commented Mar 5, 2020

@WingCH

Hi, It's ok when i try to repeat this bug

can you tell me more infomation about this bug, such as OS version etc.

2020-03-05 21-39-18 2020-03-05 21_39_59

@WingCH
Copy link

WingCH commented Mar 5, 2020

Very magical
when i use my macbook build apps, the bug is disappeared, but if i use my company imac the bug still here.

According to my memory imac is using beta channel, but macbook is using channel stable

macbook

Flutter 1.12.13+hotfix.8 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 0b8abb4724 (3 weeks ago) • 2020-02-11 11:44:36 -0800
Engine • revision e1e6ced81d
Tools • Dart 2.7.0

@WingCH
Copy link

WingCH commented Mar 6, 2020

imac

Flutter 1.14.6 • channel beta • https://github.com/flutter/flutter.git
Framework • revision fabeb2a16f (5 weeks ago) • 2020-01-28 07:56:51 -0800
Engine • revision c4229bfbba
Tools • Dart 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

@genius1212
Copy link

I have the same problem. It will appear when you click textfield several times in a row.
The reason is that the ’FlutterEasyLoading‘ is placed outside the ’MaterialApp‘. When I put the ’FlutterEasyLoading‘ in the ’MaterialApp‘, it's ok.

MaterialApp(
debugShowCheckedModeBanner: false,
title: "App",
theme: MyThemeColor.shopTheme,
onGenerateRoute: Application.router.generator,
home: FlutterEasyLoading(
child: IndexPage(),
),
)
But it only works on one page.

@CripyIce
Copy link

CripyIce commented Apr 1, 2020

Having the same issue here...
flutter doctor:

[✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.4 19E266, locale en-IL)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[!] VS Code (version 1.43.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)

@5c0rp264
Copy link

5c0rp264 commented Apr 3, 2020

@huangjianke the same bug here is happening to me...
Flutter doctor :

[✓] Flutter (Channel master, v1.16.4-pre.88, on Mac OS X 10.15.4 19E266, locale en-FR)
    • Flutter version 1.16.4-pre.88 at /Users/quentinaoustin/flutterSDK/flutter
    • Framework revision ab14307e0c (4 hours ago), 2020-04-03 00:56:01 -0400
    • Engine revision f5127cc07a
    • Dart version 2.8.0 (build 2.8.0-dev.19.0 fae35fca47)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/quentinaoustin/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • 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)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.1

[✓] 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)

[✓] IntelliJ IDEA Community Edition (version 2019.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 44.0.3
    • Dart plugin version 193.6911.31

[✓] Connected device (1 available)
    • sdk gphone x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 1 category.
Process finished with exit code 0

This bug is only happening for me when testing on Android devices.

Tell me if you want me to send my code to your mail for debugging.

Here is the full error on screen :
image

@benmo1602
Copy link

flutter_easyloading 和 flutter_localizations 是否有冲突 ?

@zhujiahong
Copy link

有大佬解决了吗 加上textfield长按就报错

@nslogx
Copy link
Owner

nslogx commented Apr 13, 2020

有大佬解决了吗 加上textfield长按就报错

@zhujiahong 先使用flutter稳定版试试

@zhujiahong
Copy link

有大佬解决了吗 加上textfield长按就报错

@zhujiahong 先使用flutter稳定版试试

谢谢可以了

@123LI
Copy link

123LI commented May 6, 2020

有大佬解决了吗加上textfield长按就报错

@sckoh
Copy link

sckoh commented May 8, 2020

this is happening in flutter 1.17 stable release

@123LI
Copy link

123LI commented May 9, 2020

有谁解决了可以把方法共享下,让其他人参考下

@nslogx
Copy link
Owner

nslogx commented May 12, 2020

#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants