tvolkert / chicago

The Chicago widget set for Flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TextInput can try to make a child into a parent of itself

tvolkert opened this issue · comments

cace425 introduced the a bug in TextInput that manifests as the following exception:

Tried to make a child into a parent of itself.
'package:flutter/src/widgets/focus_manager.dart':
Failed assertion: line 1041 pos 12: 'child != this'

Reproducible with the following test:

import 'dart:ui' as ui;

import 'package:chicago/chicago.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  Widget wrap(Widget child) {
    return Localizations(
      locale: Locale('en', 'US'),
      delegates: [
        DefaultWidgetsLocalizations.delegate,
        DefaultMaterialLocalizations.delegate,
      ],
      child: MediaQuery(
        data: MediaQueryData.fromWindow(ui.window),
        child: Directionality(
          textDirection: TextDirection.ltr,
          child: Material(
            child: Navigator(
              onGenerateRoute: (RouteSettings settings) {
                return MaterialPageRoute<void>(
                  settings: settings,
                  builder: (BuildContext context) => child,
                );
              },
            ),
          ),
        ),
      ),
    );
  }

  testWidgets('Can render a TextInput with an onKeyEvent handler', (WidgetTester tester) async {
    await tester.pumpWidget(wrap(
      TextInput(onKeyEvent: (RawKeyEvent event) {}),
    ));
    expect(find.byType(TextInput), findsOneWidget);
  });
}

As of 43f302e, the aforementioned test is checked in, and fails at Tot