This is a plugin or iOS Application Development in Flutter using the UITextView format.
Native Text Input for Flutter
A text input widget built with the use of UITextView
for supporting native text view features. This package supports iOS only for now.
Why using this?
Autocorrect tooltips don’t appear on iOS (https://github.com/flutter/flutter/issues/12920)
Many iOS users have established a habit for using convenience features of native UITextView
. No doubt that Flutter provides a lot of useful widgets. However, most Flutter developers should notice that TextField
or CupertinoTextField
provided by Flutter are not using native UI components and hence text input experience becomes different.
Regarding this, this package aims to simply provide the interface to other developers to use native UITextView
directly in your Flutter app.
The above is just showing one of the missing features comparing Flutter TextField from native UITextView, there are some others your app users may find text inputs in your Flutter apps are different from other apps. Those features would be important if you are developing apps that involve composing a text message, messaging app for example.
Hope you find it useful! Enjoy your coding…
Example
import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_native_text_input/flutter_native_text_input.dart'; import 'package:flutter_native_text_input_example/demo_item.dart'; import 'package:flutter_native_text_input_example/more_page.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return MaterialApp(home: HomePage()); } } class HomePage extends StatelessWidget { final FocusNode _focusNode = FocusNode(); _onChangeText(value) => debugPrint("inputValueChanged: $value"); _onSubmittedText(value) => debugPrint("onSubmitted: $value"); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Demo Page'), ), body: ListView( children: <Widget>[ DemoItem( title: 'Flutter TextField Example Usage', child: TextField( onChanged: _onChangeText, onSubmitted: _onSubmittedText, autocorrect: true, decoration: InputDecoration( hintText: 'placeholder', border: InputBorder.none, ), ), ), DemoItem( title: 'Flutter CupertinoTextField Example Usage', child: CupertinoTextField( placeholder: 'placeholder', onChanged: _onChangeText, onSubmitted: _onSubmittedText, ), ), DemoItem( title: 'NativeTextInput Example Usage', child: Platform.isIOS ? NativeTextInput( placeholder: "placeholder", textContentType: TextContentType.password, keyboardType: KeyboardType.defaultType, onChanged: _onChangeText, onSubmitted: _onSubmittedText, focusNode: _focusNode) : TextField( onChanged: _onChangeText, onSubmitted: _onSubmittedText, decoration: InputDecoration( hintText: 'placeholder', border: InputBorder.none, ), ), ), Center( child: FlatButton( color: Colors.blue, colorBrightness: Brightness.dark, child: Text("View More Use Cases"), onPressed: () { Navigator.of(context) .push(MaterialPageRoute(builder: (_) => MorePage())); }), ), ], ), ); } }