Skip to content

Commit

Permalink
update usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleunghk committed Aug 7, 2020
1 parent 3b64721 commit 6a68723
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 84 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.2

* update usage example

## 0.0.1

* initial release with iOS support
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_native_text_input","path":"/Users/henryleung/flutter-native-text-input/","dependencies":[]}],"android":[],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_native_text_input","dependencies":[]}],"date_created":"2020-08-07 19:35:43.248184","version":"1.21.0-1.0.pre"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_native_text_input","path":"/Users/henryleung/flutter-native-text-input/","dependencies":[]}],"android":[],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_native_text_input","dependencies":[]}],"date_created":"2020-08-07 19:59:23.390207","version":"1.21.0-1.0.pre"}
78 changes: 0 additions & 78 deletions example/lib/demo_page.dart

This file was deleted.

75 changes: 74 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'demo_page.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());

Expand All @@ -15,3 +19,72 @@ class _MyAppState extends State<MyApp> {
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()));
}),
),
],
),
);
}
}
6 changes: 3 additions & 3 deletions ios/flutter_native_text_input.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#
Pod::Spec.new do |s|
s.name = 'flutter_native_text_input'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.version = '0.0.2'
s.summary = 'Native text input for Flutter'
s.description = <<-DESC
A new flutter plugin project.
Native text input for Flutter
DESC
s.homepage = 'https://github.com/henryleunghk/flutter-native-text-input'
s.license = { :file => '../LICENSE' }
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_native_text_input
description: Native text input for Flutter. Currently iOS-only with the use of UITextView.

version: 0.0.1
version: 0.0.2
homepage: https://github.com/henryleunghk/flutter-native-text-input

environment:
Expand Down

0 comments on commit 6a68723

Please sign in to comment.