From 018133d171ecf8634d49c14b4425b53d8dc11426 Mon Sep 17 00:00:00 2001 From: Victor Mutuku Date: Wed, 15 Mar 2023 13:20:09 +0300 Subject: [PATCH] Updated Code Samples on ReadMe File. --- README.md | 112 +++++++++++----------- ios/Flutter/flutter_export_environment.sh | 10 +- 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 60ec0fa..e938a02 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,7 @@ import 'package:keyboard_actions/keyboard_actions.dart'; class Content extends StatefulWidget { - const Content({ - Key key, - }) : super(key: key); + const Content({super.key}); @override _ContentState createState() => _ContentState(); @@ -104,7 +102,7 @@ class _ContentState extends State { return AlertDialog( content: Text("Custom Action"), actions: [ - FlatButton( + TextButton( child: Text("OK"), onPressed: () => Navigator.of(context).pop(), ) @@ -115,9 +113,9 @@ class _ContentState extends State { ), KeyboardActionsItem( focusNode: _nodeText4, - displayCloseWidget: false, + displayDoneButton: false, ), - KeyboardActionsItem( + KeyboardActionsItem( focusNode: _nodeText5, toolbarButtons: [ //button 1 @@ -166,57 +164,60 @@ class _ContentState extends State { @override Widget build(BuildContext context) { - return KeyboardActions( - config: _buildConfig(context), - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - TextField( - keyboardType: TextInputType.number, - focusNode: _nodeText1, - decoration: InputDecoration( - hintText: "Input Number", + return Scaffold( + appBar: AppBar(title: Text('Keyboard Actions Sample')), + body: KeyboardActions( + config: _buildConfig(context), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + TextField( + keyboardType: TextInputType.number, + focusNode: _nodeText1, + decoration: InputDecoration( + hintText: "Input Number", + ), ), - ), - TextField( - keyboardType: TextInputType.text, - focusNode: _nodeText2, - decoration: InputDecoration( - hintText: "Input Text with Custom Done Button", + TextField( + keyboardType: TextInputType.text, + focusNode: _nodeText2, + decoration: InputDecoration( + hintText: "Input Text with Custom Done Button", + ), ), - ), - TextField( - keyboardType: TextInputType.number, - focusNode: _nodeText3, - decoration: InputDecoration( - hintText: "Input Number with Custom Action", + TextField( + keyboardType: TextInputType.number, + focusNode: _nodeText3, + decoration: InputDecoration( + hintText: "Input Number with Custom Action", + ), ), - ), - TextField( - keyboardType: TextInputType.text, - focusNode: _nodeText4, - decoration: InputDecoration( - hintText: "Input Text without Done button", + TextField( + keyboardType: TextInputType.text, + focusNode: _nodeText4, + decoration: InputDecoration( + hintText: "Input Text without Done button", + ), ), - ), - TextField( - keyboardType: TextInputType.number, - focusNode: _nodeText5, - decoration: InputDecoration( - hintText: "Input Number with Toolbar Buttons", + TextField( + keyboardType: TextInputType.number, + focusNode: _nodeText5, + decoration: InputDecoration( + hintText: "Input Number with Toolbar Buttons", + ), ), - ), - TextField( - keyboardType: TextInputType.number, - focusNode: _nodeText6, - decoration: InputDecoration( - hintText: "Input Number with Custom Footer", + TextField( + keyboardType: TextInputType.number, + focusNode: _nodeText6, + decoration: InputDecoration( + hintText: "Input Number with Custom Footer", + ), ), - ), - ], + ], + ), ), ), ), @@ -224,6 +225,7 @@ class _ContentState extends State { } } + ``` ## Using Custom Keyboard @@ -280,7 +282,7 @@ class Content extends StatelessWidget { builder: (context, val, hasFocus) { return Container( alignment: Alignment.center, - color: hasFocus ? Colors.grey[300] : Colors.white, + color: hasFocus! ? Colors.grey[300] : Colors.white, child: Text( val, style: @@ -296,7 +298,7 @@ class Content extends StatelessWidget { builder: (context, val, hasFocus) { return Container( width: double.maxFinite, - color: val ?? Colors.transparent, + color: val, ); }, ), @@ -316,7 +318,7 @@ class ColorPickerKeyboard extends StatelessWidget final ValueNotifier notifier; static const double _kKeyboardHeight = 200; - ColorPickerKeyboard({Key key, this.notifier}) : super(key: key); + ColorPickerKeyboard({super.key, required this.notifier}); @override Widget build(BuildContext context) { @@ -357,7 +359,7 @@ class CounterKeyboard extends StatelessWidget implements PreferredSizeWidget { final ValueNotifier notifier; - CounterKeyboard({Key key, this.notifier}) : super(key: key); + CounterKeyboard({super.key, required this.notifier}); @override Size get preferredSize => Size.fromHeight(200); diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 2a44c3c..7d3aab7 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -1,12 +1,12 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/diego/fvm/versions/3.7.3" -export "FLUTTER_APPLICATION_PATH=/Users/diego/Development/workspaces/flutter/flutter_keyboard_actions" +export "FLUTTER_ROOT=C:\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\Dell\Videos\flutter_keyboard_actions" export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" -export "FLUTTER_BUILD_NAME=4.1.1" -export "FLUTTER_BUILD_NUMBER=4.1.1" +export "FLUTTER_BUILD_NAME=4.2.0" +export "FLUTTER_BUILD_NUMBER=4.2.0" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false"