There is no native InputAccessoryView bar above the keyboard when running a Flutter app on iOS (physical device) when using keyboardType=TextInputType.emailAddress,keyboardType=TextInputType.text or several other keyboard types with a TextField widget. Research indicates this should only be happening with a numeric keyboard type, and
the InputAccessoryBar with "Done" button should be appearing. Abbreviated code:
TextField(
decoration: InputDecoration(
labelText: "Email Address",
),
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next,
),
How do I get the InputAccessoryView to appear with the Done button so a user can hide the keyboard? I don't want a Done button in the keyboard because that needs to be the Next button, and I hope I don't need a plugin or widget.
Flutter 3.3.10 • channel stable
Related
I have an issue with a Flutter IOS app
I have a webview with a youtube video embedded in an iframe
I have a widget containing the webview positioned under a flutter regular widget (such as a bottom or top bar, or a dialog)
Issue is that tapping on the flutter element above the webview actually starts the youtube video, even though the tap was NOT done directly on the webview.
This only happens on IOS. Android works fine.
Does anyone know how to prevent this from happening? I would like to have a dialog shown over the webview, but not start the video when a dialog option is tapped.
I suspect iframe is the issue here
Here is the code for webview part (I use InAppWebView here, but behavior is the same with WebView flutter), and photos for both android and ios apps
body: ListView(
children: [
const SizedBox(
height: 700,
),
SizedBox(
height: 400,
child: InAppWebView(
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(),
),
onWebViewCreated: (InAppWebViewController controller) {
controller.loadData(
data:
'<iframe id="inlineFrameExample" title="Inline Frame Example" width="500" height="200" src="https://www.youtube-nocookie.com/embed/-dLDifsmJo4?wmode=opaque"></iframe>',
);
},
),
),
],
),
in my Flutter app, I use web view. For android, I use willpopscope so when someone presses the back button review page will pop to its previous state.
But in iOS willpopscope is not working, I have tried cupertino_back_gesture package it also not working.
I also tried the gesture detector it works but not working accurately.
is there any solution or any method to do swipe back in flutter iOS web view.
currently i am trying to do this
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: primaryColor,
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
},
),
),
home: LocationCheck(),
),
);
I want to make android and IOS style.
I want to convert the code below into Cupertino, IOS style.
But I Can't Use Drawer Menu for IOS style. Why?
How can I use?
return Scaffold(
key: _scaffoldKey,
drawer: Drawer(),
appBar: AppBar(
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
color: MyColors.blue,
),
),
centerTitle: true,
title: Text('Test', style: MyTextStyles.appBarTitle(deviceType) ),
actions: <Widget>[
Builder(
builder: (BuildContext context) => PlatformIconButton(
onPressed: () {
Scaffold.of(context).openDrawer();
},
icon: Icon(
Icons.menu,
)))])
body: .........
The Drawer widget is a Material-exclusive widget, and you can't use it directly on iOS.
You could build your own "Drawer-like" widget for iOS by replicating the build construction of a Drawer widget, but I would not recommend that, because drawers don't have that iOS "look and feel". As an iOS user myself, I know some very influential apps like Twitter have something that looks like a Drawer, but I think that is not the way a native iOS app would handle that kind of navigation.
What you can do instead, is having a Drawer widget for Android, and a bottom tab bar for iOS, which is a component that is way more common in iOS-styled apps. You can use the Platform class to check if your code is being executed on Android or iOS, and choose the right widget based on that.
Here is one example of such a build logic that you might find useful. I am very sorry I can't paste the code directly, I had this screenshot from a presentation I made and I don't remember where did I place the code for this project, but I hope you find it useful.
I am trying to style a TextField in Flutter using the InputDecoration class.
Here is the implementation-
new TextField(
decoration: new InputDecoration(
border: InputBorder.none, // The named parameter border isn't defined
hintText: 'Please enter a search term'
),
);
But this results in a red squiggly line underneath border property with message
The parameter border isn't defined
Rest properties are working fine. Here is the screenshot of same -
PS - I'm new to Flutter.
You're on v0.0.22 of Flutter which is many months old. I found this PR from around the same time which says:
What was called the "divider" is now a configurable border
So my guess is that maybe the version you're using didn't have border.
You should switch to the beta channel (flutter channel beta) to try again with more recent code.
Please take a look at the following Flutter code snippet: it creates a TextField that is intended as a single line input field tat will submit its value when Return is pressed:
child: new TextField(
decoration: _deco,
maxLines: 1,
autofocus: true,
onSubmitted: (newValue) {print(newValue);},
onChanged: (newValue) {
setState(() {
strTemperature = newValue.trim();
});
})),
On the iOS Simulator the corresponding app looks as follows:
As you can see the widget is configured with maxLines = 1, but when I click the Return key on the onscreen keyboard, line feeds are insert. Please spot the narrow blue cursor a couple of lines below the widget. Also, I see no console output, which should be the case because of my onSubmitted() lambda.
Am I configuring the text field correctly, or am I missing something?
This looks to me like it's actually just a bug in the iOS version of Flutter. Filed issue #9839.