akvelon/flutter-code-editor

[Bug] Suggestions popup is not closed after view change

nausharipov opened this issue · 0 comments

Demonstration:
https://github.com/akvelon/flutter-code-editor/assets/31556582/327c4050-9021-469a-8b58-940127eef2fc

Reproducible example:

import 'package:flutter/material.dart';
import 'package:flutter_code_editor/flutter_code_editor.dart';
import 'package:flutter_highlight/themes/monokai-sublime.dart';
import 'package:highlight/languages/java.dart';

void main() {
  runApp(const CodeEditor());
}

final controller1 = CodeController(
  text: '',
  language: java,
);

final controller2 = CodeController(
  text: '',
  language: java,
);

final controller3 = CodeController(
  text: '',
  language: java,
);

class CodeEditor extends StatelessWidget {
  const CodeEditor({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: CodeTheme(
          data: CodeThemeData(styles: monokaiSublimeTheme),
          child: DefaultTabController(
            length: 3,
            child: Scaffold(
              appBar: AppBar(
                bottom: const TabBar(
                  tabs: [
                    Tab(icon: Icon(Icons.directions_car)),
                    Tab(icon: Icon(Icons.directions_transit)),
                    Tab(icon: Icon(Icons.directions_bike)),
                  ],
                ),
                title: const Text('Popup bug'),
              ),
              body: TabBarView(
                children: [
                  SingleChildScrollView(
                    child: CodeField(
                      controller: controller1,
                    ),
                  ),
                  SingleChildScrollView(
                    child: CodeField(
                      controller: controller2,
                    ),
                  ),
                  SingleChildScrollView(
                    child: CodeField(
                      controller: controller3,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}