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

Failed assertion: line 742 pos 12: 'attached': is not true. #60

Open
easazade opened this issue Mar 29, 2020 · 0 comments
Open

Failed assertion: line 742 pos 12: 'attached': is not true. #60

easazade opened this issue Mar 29, 2020 · 0 comments

Comments

@easazade
Copy link

easazade commented Mar 29, 2020

the error and the stack trace

'package:flutter/src/services/text_input.dart': Failed assertion: line 742 pos 12: 'attached': is not true.

The following assertion was thrown building TxtBuildEditable(state: _TxtBuildEditableState#e1377):
'package:flutter/src/services/text_input.dart': Failed assertion: line 742 pos 12: 'attached': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md

The relevant error-causing widget was:
Txt file:///C:/workspace/flutter/smart_school/lib/widgets/app_text_field.dart:25:14
When the exception was thrown, this was the stack:
#2 TextInputConnection.setStyle (package:flutter/src/services/text_input.dart:742:12)
#3 EditableTextState.didUpdateWidget (package:flutter/src/widgets/editable_text.dart:1162:29)
#4 StatefulElement.update (package:flutter/src/widgets/framework.dart:4396:58)
#5 Element.updateChild (package:flutter/src/widgets/framework.dart:2977:15)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)

here is the code i use as a textField widget in my app. now it works fine but i get this error when i'm using multiple instances of this widget in a page. when i tap first field keyboard pops up and the i tap on another field suddenly error happens. and that only happens if the first field (or any other ) still has the focus.

class AppTextField extends StatefulWidget {
  final StringCallback onChange;
  final String hint;
  final TextInputType inputType;

  AppTextField(this.onChange, {this.hint,this.inputType});

  @override
  State<StatefulWidget> createState() => _AppTextField();
}

class _AppTextField extends State<AppTextField> {
  String value = '';

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(color: AppColors.THEME_GREY, borderRadius: BorderRadius.circular(6)),
      child: Txt(
        '',
        style: TxtStyle()
          ..fontSize(14)
          ..fontFamily(Fonts.SAMIM)
          ..padding(horizontal: 10,vertical: 5)
          ..editable(
            placeholder: widget.hint,
            maxLines: 1,
            onChange: widget.onChange,
            keyboardType: widget.inputType ?? TextInputType.text
          ),
      ),
    );
  }
}
@easazade easazade changed the title 'package:flutter/src/services/text_input.dart': Failed assertion: line 742 pos 12: 'attached': is not true. Failed assertion: line 742 pos 12: 'attached': is not true. Mar 29, 2020
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

1 participant