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
CupertinoTabScaffold prevents Textfield from gaining focus #45110
Comments
Hello @woozbooz ! Thank you for posting an issue. |
Hi @woozbooz does this code still represent the issue you are describing? simplified code
thank you for the information you provided |
@iapicca No, this code not represent the issue because it not contain CupertinoTabScaffold. The problem is, i think, with FocusScope mechanics inside CupertinoTabScaffold widget.
|
if i comment this line
|
I think flutter team must add to this code (tab_scaffold) some kind of flag wich will show why exactly didChangeDependencies() called. And if it is keyboard appear then not to call _focusActiveTab(); |
If somebody need a workaroud:
in tab_scaffold.dart with next code:
|
same issue on bottomsheet |
flutter doctor -v
Code Sample
|
Confirm, same problem in 1.20 :( If Flutter want to become the world's first multi platform SDK we cannot have this problem after every update. |
Try put the code in a |
Reproduces with this minimal code sample on stable 3.3 and the master 3.6. Screen.Recording.2022-11-23.at.4.16.49.PM.movOn removing code sampleimport 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
home: MainPage(),
);
}
}
class MainPage extends StatefulWidget {
@override
_MyMainPageState createState() => _MyMainPageState();
}
class _MyMainPageState extends State<MainPage>
with SingleTickerProviderStateMixin {
late TextEditingController _txtContrSearch;
@override
void initState() {
_txtContrSearch = TextEditingController();
super.initState();
}
@override
void dispose() {
_txtContrSearch.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(8),
color: Colors.white,
border: Border.all(width: 1, color: Colors.grey.shade400)),
child: CupertinoTextField(
controller: _txtContrSearch,
decoration: null,
textInputAction: TextInputAction.done,
onSubmitted: (x) {},
)),
toolbarOpacity: 1,
),
body: CupertinoTabScaffold(
tabBar: CupertinoTabBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.conversation_bubble),
label: 'Support',
),
BottomNavigationBarItem(
icon: Icon(CupertinoIcons.profile_circled),
label: 'Profile',
),
],
),
tabBuilder: (_context, _index) {
return Container();
}),
);
}
}
flutter doctor -v (mac)
|
The |
Can this still be reproduced on the latest master? |
I want to put TextField on AppBar. When i tap on TextField keyboard just appear for a second and then it disapear without any debug or error message.
sample code
If i remove
CupertinoTabScaffold
keyboard appear and work as intended.Tested on Android 7.
Flutter doctor
The text was updated successfully, but these errors were encountered: