akvelon / flutter-code-editor

Flutter Code Editor is a multi-platform code editor supporting syntax highlighting, code blocks folding, autocompletion, read-only code blocks, hiding specific code blocks, themes, and more.

Home Page:https://akvelon.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Suggestions popup is not closed after view change

nausharipov opened this issue · 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,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}