From 2dfab093bc5f974b2df1e89af2278add14c04459 Mon Sep 17 00:00:00 2001 From: yangyxd Date: Mon, 28 Oct 2019 16:29:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8D=E5=BB=BA,=20?= =?UTF-8?q?=E5=8F=91=E5=B8=83=201.1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 89 ++- .metadata | 10 + CHANGELOG.md | 4 + LICENSE | 42 +- README.md | 508 +++++++++--------- android/.gitignore | 8 - android/build.gradle | 34 -- android/gradle.properties | 1 - android/settings.gradle | 1 - android/src/main/AndroidManifest.xml | 3 - .../flutterpicker/FlutterPickerPlugin.java | 25 - example/test/widget_test.dart | 25 - flutter_picker.iml | 40 +- flutter_picker_android.iml | 30 -- ios/.gitignore | 36 -- ios/Assets/.gitkeep | 0 ios/Classes/FlutterPickerPlugin.h | 4 - ios/Classes/FlutterPickerPlugin.m | 20 - ios/flutter_picker.podspec | 21 - lib/PickerLocalizationsDelegate.dart | 46 +- lib/flutter_picker.dart | 4 +- pubspec.yaml | 15 +- test/flutter_picker_test.dart | 12 + 23 files changed, 431 insertions(+), 547 deletions(-) create mode 100644 .metadata delete mode 100644 android/.gitignore delete mode 100644 android/build.gradle delete mode 100644 android/gradle.properties delete mode 100644 android/settings.gradle delete mode 100644 android/src/main/AndroidManifest.xml delete mode 100644 android/src/main/java/com/yangyxd/flutterpicker/FlutterPickerPlugin.java delete mode 100644 example/test/widget_test.dart delete mode 100644 flutter_picker_android.iml delete mode 100644 ios/.gitignore delete mode 100644 ios/Assets/.gitkeep delete mode 100644 ios/Classes/FlutterPickerPlugin.h delete mode 100644 ios/Classes/FlutterPickerPlugin.m delete mode 100644 ios/flutter_picker.podspec create mode 100644 test/flutter_picker_test.dart diff --git a/.gitignore b/.gitignore index 4c70518..9d169fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,75 @@ -# See https://www.dartlang.org/guides/libraries/private-files - -# Files and directories created by pub -.dart_tool/ -.packages -.pub/ -build/ -# If you're building an application, you may want to check-in your pubspec.lock -pubspec.lock - -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ -.idea +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.packages +.pub-cache/ +.pub/ +build/ + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +/example/*.lock +/*.lock diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..f52c5d0 --- /dev/null +++ b/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f + channel: stable + +project_type: package diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e867f9..6b5ce18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0 + +* Project reconstruction, removing Android, IOS directory. + ## 1.0.15 * Move the edge of the head to the bottom of the head so that it can be hidden by customization. #55 (thank: @StarOfLife) diff --git a/LICENSE b/LICENSE index 9019891..332b7c7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2018 - 2019 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2018 - 2019 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index dbab385..390a0d8 100644 --- a/README.md +++ b/README.md @@ -1,255 +1,255 @@ -# flutter_picker - -[![pub package](https://img.shields.io/pub/v/flutter_picker.svg)](https://pub.dartlang.org/packages/flutter_picker) -![GitHub](https://img.shields.io/github/license/yangyxd/flutter_picker.svg) -[![GitHub stars](https://img.shields.io/github/stars/yangyxd/flutter_picker.svg?style=social&label=Stars)](https://github.com/yangyxd/flutter_picker) - -Flutter plugin picker. Include NumberPicker, DateTimePicker, ArrayPicker, and default linkage Picker. Provide flexible parameters to meet various needs. At the same time, you can extend more functions through custom adapters. - -> Supported Platforms -> * Android -> * IOS - -![image](https://github.com/yangyxd/flutter_picker/blob/master/raw/views.gif) - -## How to Use - -```yaml -# add this line to your dependencies -flutter_picker: - git: git://github.com/yangyxd/flutter_picker.git -``` -```dart -import 'package:flutter_picker/flutter_picker.dart'; -``` - -```dart - - showPicker(BuildContext context) { - Picker picker = new Picker( - adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), - changeToFirst: true, - textAlign: TextAlign.left, - columnPadding: const EdgeInsets.all(8.0), - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.getSelectedValues()); - } - ); - picker.show(_scaffoldKey.currentState); - } - - showPickerModal(BuildContext context) { - new Picker( - adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), - changeToFirst: true, - hideHeader: false, - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.adapter.text); - } - ).showModal(this.context); //_scaffoldKey.currentState); - } - - showPickerIcons(BuildContext context) { - new Picker( - adapter: PickerDataAdapter(data: [ - new PickerItem(text: Icon(Icons.add), value: Icons.add, children: [ - new PickerItem(text: Icon(Icons.more)), - new PickerItem(text: Icon(Icons.aspect_ratio)), - new PickerItem(text: Icon(Icons.android)), - new PickerItem(text: Icon(Icons.menu)), - ]), - new PickerItem(text: Icon(Icons.title), value: Icons.title, children: [ - new PickerItem(text: Icon(Icons.more_vert)), - new PickerItem(text: Icon(Icons.ac_unit)), - new PickerItem(text: Icon(Icons.access_alarm)), - new PickerItem(text: Icon(Icons.account_balance)), - ]), - new PickerItem(text: Icon(Icons.face), value: Icons.face, children: [ - new PickerItem(text: Icon(Icons.add_circle_outline)), - new PickerItem(text: Icon(Icons.add_a_photo)), - new PickerItem(text: Icon(Icons.access_time)), - new PickerItem(text: Icon(Icons.adjust)), - ]), - new PickerItem(text: Icon(Icons.linear_scale), value: Icons.linear_scale, children: [ - new PickerItem(text: Icon(Icons.assistant_photo)), - new PickerItem(text: Icon(Icons.account_balance)), - new PickerItem(text: Icon(Icons.airline_seat_legroom_extra)), - new PickerItem(text: Icon(Icons.airport_shuttle)), - new PickerItem(text: Icon(Icons.settings_bluetooth)), - ]), - new PickerItem(text: Icon(Icons.close), value: Icons.close), - ]), - title: new Text("Select Icon"), - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.getSelectedValues()); - } - ).show(_scaffoldKey.currentState); - } - - showPickerDialog(BuildContext context) { - new Picker( - adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), - hideHeader: true, - title: new Text("Select Data"), - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.getSelectedValues()); - } - ).showDialog(context); - } - - showPickerArray(BuildContext context) { - new Picker( - adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData2), isArray: true), - hideHeader: true, - title: new Text("Please Select"), - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.getSelectedValues()); - } - ).showDialog(context); - } - - showPickerNumber(BuildContext context) { - new Picker( - adapter: NumberPickerAdapter(data: [ - NumberPickerColumn(begin: 0, end: 999), - NumberPickerColumn(begin: 100, end: 200), - ]), - delimiter: [ - PickerDelimiter(child: Container( - width: 30.0, - alignment: Alignment.center, - child: Icon(Icons.more_vert), - )) - ], - hideHeader: true, - title: new Text("Please Select"), - onConfirm: (Picker picker, List value) { - print(value.toString()); - print(picker.getSelectedValues()); - } - ).showDialog(context); - } - -``` -## PickerData Example - -### Array - -```dart - -const PickerData2 = ''' -[ - [ - 1, - 2, - 3, - 4 - ], - [ - 11, - 22, - 33, - 44 - ], - [ - "aaa", - "bbb", - "ccc" - ] -] - '''; -``` - -### Linkage -```dart -const PickerData = ''' -[ - { - "a": [ - { - "a1": [ - 1, - 2, - 3, - 4 - ] - }, - { - "a2": [ - 5, - 6, - 7, - 8 - ] - }, - { - "a3": [ - 9, - 10, - 11, - 12 - ] - } - ] - }, - { - "b": [ - { - "b1": [ - 11, - 22, - 33, - 44 - ] - }, - { - "b2": [ - 55, - 66, - 77, - 88 - ] - }, - { - "b3": [ - 99, - 1010, - 1111, - 1212 - ] - } - ] - }, - { - "c": [ - { - "c1": [ - "a", - "b", - "c" - ] - }, - { - "c2": [ - "aa", - "bb", - "cc" - ] - }, - { - "c3": [ - "aaa", - "bbb", - "ccc" - ] - } - ] - } -] - '''; +# flutter_picker + +[![pub package](https://img.shields.io/pub/v/flutter_picker.svg)](https://pub.dartlang.org/packages/flutter_picker) +![GitHub](https://img.shields.io/github/license/yangyxd/flutter_picker.svg) +[![GitHub stars](https://img.shields.io/github/stars/yangyxd/flutter_picker.svg?style=social&label=Stars)](https://github.com/yangyxd/flutter_picker) + +Flutter plugin picker. Include NumberPicker, DateTimePicker, ArrayPicker, and default linkage Picker. Provide flexible parameters to meet various needs. At the same time, you can extend more functions through custom adapters. + +> Supported Platforms +> * Android +> * IOS + +![image](https://github.com/yangyxd/flutter_picker/blob/master/raw/views.gif) + +## How to Use + +```yaml +# add this line to your dependencies +flutter_picker: + git: git://github.com/yangyxd/flutter_picker.git +``` +```dart +import 'package:flutter_picker/flutter_picker.dart'; +``` + +```dart + + showPicker(BuildContext context) { + Picker picker = new Picker( + adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), + changeToFirst: true, + textAlign: TextAlign.left, + columnPadding: const EdgeInsets.all(8.0), + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.getSelectedValues()); + } + ); + picker.show(_scaffoldKey.currentState); + } + + showPickerModal(BuildContext context) { + new Picker( + adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), + changeToFirst: true, + hideHeader: false, + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.adapter.text); + } + ).showModal(this.context); //_scaffoldKey.currentState); + } + + showPickerIcons(BuildContext context) { + new Picker( + adapter: PickerDataAdapter(data: [ + new PickerItem(text: Icon(Icons.add), value: Icons.add, children: [ + new PickerItem(text: Icon(Icons.more)), + new PickerItem(text: Icon(Icons.aspect_ratio)), + new PickerItem(text: Icon(Icons.android)), + new PickerItem(text: Icon(Icons.menu)), + ]), + new PickerItem(text: Icon(Icons.title), value: Icons.title, children: [ + new PickerItem(text: Icon(Icons.more_vert)), + new PickerItem(text: Icon(Icons.ac_unit)), + new PickerItem(text: Icon(Icons.access_alarm)), + new PickerItem(text: Icon(Icons.account_balance)), + ]), + new PickerItem(text: Icon(Icons.face), value: Icons.face, children: [ + new PickerItem(text: Icon(Icons.add_circle_outline)), + new PickerItem(text: Icon(Icons.add_a_photo)), + new PickerItem(text: Icon(Icons.access_time)), + new PickerItem(text: Icon(Icons.adjust)), + ]), + new PickerItem(text: Icon(Icons.linear_scale), value: Icons.linear_scale, children: [ + new PickerItem(text: Icon(Icons.assistant_photo)), + new PickerItem(text: Icon(Icons.account_balance)), + new PickerItem(text: Icon(Icons.airline_seat_legroom_extra)), + new PickerItem(text: Icon(Icons.airport_shuttle)), + new PickerItem(text: Icon(Icons.settings_bluetooth)), + ]), + new PickerItem(text: Icon(Icons.close), value: Icons.close), + ]), + title: new Text("Select Icon"), + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.getSelectedValues()); + } + ).show(_scaffoldKey.currentState); + } + + showPickerDialog(BuildContext context) { + new Picker( + adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData)), + hideHeader: true, + title: new Text("Select Data"), + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.getSelectedValues()); + } + ).showDialog(context); + } + + showPickerArray(BuildContext context) { + new Picker( + adapter: PickerDataAdapter(pickerdata: new JsonDecoder().convert(PickerData2), isArray: true), + hideHeader: true, + title: new Text("Please Select"), + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.getSelectedValues()); + } + ).showDialog(context); + } + + showPickerNumber(BuildContext context) { + new Picker( + adapter: NumberPickerAdapter(data: [ + NumberPickerColumn(begin: 0, end: 999), + NumberPickerColumn(begin: 100, end: 200), + ]), + delimiter: [ + PickerDelimiter(child: Container( + width: 30.0, + alignment: Alignment.center, + child: Icon(Icons.more_vert), + )) + ], + hideHeader: true, + title: new Text("Please Select"), + onConfirm: (Picker picker, List value) { + print(value.toString()); + print(picker.getSelectedValues()); + } + ).showDialog(context); + } + +``` +## PickerData Example + +### Array + +```dart + +const PickerData2 = ''' +[ + [ + 1, + 2, + 3, + 4 + ], + [ + 11, + 22, + 33, + 44 + ], + [ + "aaa", + "bbb", + "ccc" + ] +] + '''; +``` + +### Linkage +```dart +const PickerData = ''' +[ + { + "a": [ + { + "a1": [ + 1, + 2, + 3, + 4 + ] + }, + { + "a2": [ + 5, + 6, + 7, + 8 + ] + }, + { + "a3": [ + 9, + 10, + 11, + 12 + ] + } + ] + }, + { + "b": [ + { + "b1": [ + 11, + 22, + 33, + 44 + ] + }, + { + "b2": [ + 55, + 66, + 77, + 88 + ] + }, + { + "b3": [ + 99, + 1010, + 1111, + 1212 + ] + } + ] + }, + { + "c": [ + { + "c1": [ + "a", + "b", + "c" + ] + }, + { + "c2": [ + "aa", + "bb", + "cc" + ] + }, + { + "c3": [ + "aaa", + "bbb", + "ccc" + ] + } + ] + } +] + '''; ``` \ No newline at end of file diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index c6cbe56..0000000 --- a/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 09e26df..0000000 --- a/android/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -group 'com.yangyxd.flutterpicker' -version '1.0-SNAPSHOT' - -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' - } -} - -rootProject.allprojects { - repositories { - google() - jcenter() - } -} - -apply plugin: 'com.android.library' - -android { - compileSdkVersion 28 - - defaultConfig { - minSdkVersion 16 - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - lintOptions { - disable 'InvalidPackage' - } -} diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index 8bd86f6..0000000 --- a/android/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 4accba5..0000000 --- a/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'flutter_picker' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml deleted file mode 100644 index 126b2cc..0000000 --- a/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/android/src/main/java/com/yangyxd/flutterpicker/FlutterPickerPlugin.java b/android/src/main/java/com/yangyxd/flutterpicker/FlutterPickerPlugin.java deleted file mode 100644 index dbfddac..0000000 --- a/android/src/main/java/com/yangyxd/flutterpicker/FlutterPickerPlugin.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.yangyxd.flutterpicker; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.Registrar; - -/** FlutterPickerPlugin */ -public class FlutterPickerPlugin implements MethodCallHandler { - /** Plugin registration. */ - public static void registerWith(Registrar registrar) { - final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_picker"); - channel.setMethodCallHandler(new FlutterPickerPlugin()); - } - - @Override - public void onMethodCall(MethodCall call, Result result) { - if (call.method.equals("getPlatformVersion")) { - result.success("Android " + android.os.Build.VERSION.RELEASE); - } else { - result.notImplemented(); - } - } -} diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index dbeb52f..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -// This is a basic Flutter widget test. -// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter -// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to -// find child widgets in the widget tree, read text, and verify that the values of widget properties -// are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:flutter_picker_example/main.dart'; - -void main() { - testWidgets('Verify Platform version', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(new MyApp()); - - // Verify that platform version is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && widget.data.startsWith('Running on:'), - ), - findsOneWidget); - }); -} diff --git a/flutter_picker.iml b/flutter_picker.iml index 73e7ebd..49126dc 100644 --- a/flutter_picker.iml +++ b/flutter_picker.iml @@ -1,19 +1,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/flutter_picker_android.iml b/flutter_picker_android.iml deleted file mode 100644 index ac5d744..0000000 --- a/flutter_picker_android.iml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/.gitignore b/ios/.gitignore deleted file mode 100644 index 710ec6c..0000000 --- a/ios/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/Generated.xcconfig diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ios/Classes/FlutterPickerPlugin.h b/ios/Classes/FlutterPickerPlugin.h deleted file mode 100644 index 4c61cd2..0000000 --- a/ios/Classes/FlutterPickerPlugin.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface FlutterPickerPlugin : NSObject -@end diff --git a/ios/Classes/FlutterPickerPlugin.m b/ios/Classes/FlutterPickerPlugin.m deleted file mode 100644 index fa60b16..0000000 --- a/ios/Classes/FlutterPickerPlugin.m +++ /dev/null @@ -1,20 +0,0 @@ -#import "FlutterPickerPlugin.h" - -@implementation FlutterPickerPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - FlutterMethodChannel* channel = [FlutterMethodChannel - methodChannelWithName:@"flutter_picker" - binaryMessenger:[registrar messenger]]; - FlutterPickerPlugin* instance = [[FlutterPickerPlugin alloc] init]; - [registrar addMethodCallDelegate:instance channel:channel]; -} - -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { - if ([@"getPlatformVersion" isEqualToString:call.method]) { - result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); - } else { - result(FlutterMethodNotImplemented); - } -} - -@end diff --git a/ios/flutter_picker.podspec b/ios/flutter_picker.podspec deleted file mode 100644 index c534fb9..0000000 --- a/ios/flutter_picker.podspec +++ /dev/null @@ -1,21 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# -Pod::Spec.new do |s| - s.name = 'flutter_picker' - s.version = '0.0.1' - s.summary = 'Flutter picker plugin. ' - s.description = <<-DESC -Flutter picker plugin. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.dependency 'Flutter' - - s.ios.deployment_target = '8.0' -end - diff --git a/lib/PickerLocalizationsDelegate.dart b/lib/PickerLocalizationsDelegate.dart index ff7a430..42f82c4 100644 --- a/lib/PickerLocalizationsDelegate.dart +++ b/lib/PickerLocalizationsDelegate.dart @@ -1,24 +1,24 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'dart:async'; -import 'Picker.dart'; - -/// picker localizations -class PickerLocalizationsDelegate - extends LocalizationsDelegate { - const PickerLocalizationsDelegate(); - - static const PickerLocalizationsDelegate delegate = - const PickerLocalizationsDelegate(); - - @override - bool isSupported(Locale locale) => ['en', 'zh', 'ko', 'it', 'ar','fr'].contains(locale.languageCode); - - @override - Future load(Locale locale) { - return SynchronousFuture(new PickerLocalizations(locale)); - } - - @override - bool shouldReload(PickerLocalizationsDelegate old) => false; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'dart:async'; +import 'Picker.dart'; + +/// picker localizations +class PickerLocalizationsDelegate + extends LocalizationsDelegate { + const PickerLocalizationsDelegate(); + + static const PickerLocalizationsDelegate delegate = + const PickerLocalizationsDelegate(); + + @override + bool isSupported(Locale locale) => ['en', 'zh', 'ko', 'it', 'ar','fr'].contains(locale.languageCode); + + @override + Future load(Locale locale) { + return SynchronousFuture(new PickerLocalizations(locale)); + } + + @override + bool shouldReload(PickerLocalizationsDelegate old) => false; } \ No newline at end of file diff --git a/lib/flutter_picker.dart b/lib/flutter_picker.dart index cb7abf5..28a340d 100644 --- a/lib/flutter_picker.dart +++ b/lib/flutter_picker.dart @@ -1,2 +1,2 @@ -export 'Picker.dart'; -export 'PickerLocalizationsDelegate.dart'; +export 'Picker.dart'; +export 'PickerLocalizationsDelegate.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 62a4653..80b9a9f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,15 +4,16 @@ version: 1.0.15 author: yangyxd homepage: https://github.com/yangyxd/flutter_picker +environment: + sdk: ">=2.0.0-dev.28.0 <3.0.0" + flutter: ">=0.1.4 <3.0.0" + dependencies: flutter: sdk: flutter -flutter: - plugin: - androidPackage: com.yangyxd.flutterpicker - pluginClass: FlutterPickerPlugin +dev_dependencies: + flutter_test: + sdk: flutter -environment: - sdk: ">=2.0.0-dev.28.0 <3.0.0" - flutter: ">=0.1.4 <3.0.0" \ No newline at end of file +flutter: diff --git a/test/flutter_picker_test.dart b/test/flutter_picker_test.dart new file mode 100644 index 0000000..b3f1c1d --- /dev/null +++ b/test/flutter_picker_test.dart @@ -0,0 +1,12 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_picker/flutter_picker.dart'; + +void main() { + test('adds one to input values', () { +// final calculator = Calculator(); +// expect(calculator.addOne(2), 3); +// expect(calculator.addOne(-7), -6); +// expect(calculator.addOne(0), 1); +// expect(() => calculator.addOne(null), throwsNoSuchMethodError); + }); +}