As already mentioned in the title my keyboard does not show up when i click on TextField-Widgets. That is the same for every TextField across my application, but wasn't like that always. Unfortunately i don't use version control so I can't find out what's the error causing it.
I don't think it's some error in the code, my flutter doctor
is fine also. I'll put my pubspec.yaml
aswell as my build.gradle
files, since I changed some of the stuff in them, maybe that helps. I'll also put one example of a textfield.
It happens on both Android devices I've tested, which are both on Android 9.0. I tried it on emulator with 8.1 Oreo and the keyboard seems to work on there.
one of my usage cases:
SliverList(
delegate: SliverChildListDelegate([
ListTile(
leading: Icon(Icons.call_to_action),
title: TextField(
decoration: InputDecoration(
labelText: "Name", border: InputBorder.none),
),
),
]),
pubspec.yaml
:
name: whatever
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
google_sign_in: ^3.2.1
googleapis: ^0.52.0
googleapis_auth: ^0.2.5+2
sqflite: ^0.12.2+1
firebase_core: ^0.2.5+1
firebase_database: ^1.0.5
barcode_scan: ^0.0.7
numberpicker: ^0.1.7
flutter_speed_dial: ^1.0.8
image_picker: ^0.4.10
chewie: ^0.8.0
sticky_headers: ^0.1.7
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
fonts:
- family: Circular
fonts:
- asset: fonts/circular-regular.ttf
- asset: fonts/circular-bold.ttf
weight: 700
App-Level build.gradle
:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.whatever"
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
Project-Level build.gradle
:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Removing enableFlutterDriverExtension()
from my void main()
method, as noted here in Github solved this for me. I'm still running against API 28 (no need to downgrade to 27)
Targeting API 28 seems to have some problems with showing keyboard on physical devices providing some links hope they help with your problem
将我的targetSdkVersion更改为27可解决我的问题... nonono
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.