From 7cf7ccd2028e3cee99301d3bcc53c834b440b72d Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 24 Mar 2021 13:16:43 +0800 Subject: [PATCH] null safety version release --- .fvm/fvm_config.json | 3 ++ .gitignore | 1 + .vscode/settings.json | 3 ++ CHANGELOG.md | 6 ++- example/lib/main.dart | 25 ++--------- example/pubspec.lock | 44 +++++++++--------- example/pubspec.yaml | 4 +- .../random_chinese_charater.dart | 45 +++++++++---------- pubspec.lock | 40 ++++++++--------- pubspec.yaml | 10 ++--- 10 files changed, 84 insertions(+), 97 deletions(-) create mode 100644 .fvm/fvm_config.json create mode 100644 .vscode/settings.json diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json new file mode 100644 index 0000000..1c922f8 --- /dev/null +++ b/.fvm/fvm_config.json @@ -0,0 +1,3 @@ +{ + "flutterSdkVersion": "stable" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1985397..b76ade6 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ build/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 +flutter_sdk diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..67dba15 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dart.flutterSdkPath": "/Users/akufe/fvm/versions/stable" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ac07159..a232584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ -## [0.0.1] - TODO: Add release date. +## [0.1.0-nullsafety.0] -* TODO: Describe initial release. +## [0.0.1] + +* first release. diff --git a/example/lib/main.dart b/example/lib/main.dart index 0da74d8..4713506 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -33,7 +33,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, required this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect @@ -51,20 +51,8 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - int _counter = 0; String _char = ''; - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -101,9 +89,7 @@ class _MyHomePageState extends State { children: [ Text( '$_char', - style: TextStyle( - fontSize: 30 - ), + style: TextStyle(fontSize: 30), ), SizedBox( height: 10, @@ -126,7 +112,7 @@ class _MyHomePageState extends State { child: Text('易经'), color: Colors.blue, ), - MaterialButton( + MaterialButton( onPressed: () { setState(() { _char = RandomCharacter.getEmoji(length: 5); @@ -138,11 +124,6 @@ class _MyHomePageState extends State { ], ), ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. ); } } diff --git a/example/pubspec.lock b/example/pubspec.lock index e01f5f2..f1395e1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,56 +7,56 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.0" + version: "1.0.2" fake_async: dependency: transitive description: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -73,28 +73,28 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" random_character: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.1" + version: "0.1.0-nullsafety.0" sky_engine: dependency: transitive description: flutter @@ -106,56 +106,56 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.17.0 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c619dc2..eaf2c23 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -27,7 +27,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 + cupertino_icons: ^1.0.2 random_character: path: ../ diff --git a/lib/chinese_character/random_chinese_charater.dart b/lib/chinese_character/random_chinese_charater.dart index fbbb97a..131fb0a 100644 --- a/lib/chinese_character/random_chinese_charater.dart +++ b/lib/chinese_character/random_chinese_charater.dart @@ -1,121 +1,120 @@ import 'dart:math'; class RandomCharacter { - static String getChinese({int length}) { + static String getChinese({int length = 2}) { int max = 0x9FEF - 0x4e00 + 1; int base = 0x4e00; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getYijing({int length}) { + static String getYijing({int length = 2}) { int max = 0x4DE0 - 0x4DC0 + 1; int base = 0x4DC0; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getHiragana({int length}) { + static String getHiragana({int length = 2}) { int max = 0x3080 - 0x3040 + 1; int base = 0x3040; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getkatakana({int length}) { + static String getkatakana({int length = 2}) { int max = 0x30E0 - 0x30A0 + 1; int base = 0x30A0; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getJPCharacter({int length}) { + static String getJPCharacter({int length = 2}) { int max = 0x30E0 - 0x3040 + 1; int base = 0x3040; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getEmoji({int length}) { + static String getEmoji({int length = 2}) { int max = 0x1F64F - 0x1F601 + 1; int base = 0x1F601; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getNum({int length}) { + static String getNum({int length = 2}) { int max = 0x003A - 0x0030 + 1; int base = 0x0030; int r; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { r = base + Random().nextInt(max); rc = rc + String.fromCharCode(r); } return rc; } - static String getENCharacter({int length}) { + static String getENCharacter({int length = 2}) { String _alphabet = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { rc = rc + _alphabet[Random().nextInt(_alphabet.length)]; } return rc; } - static String getLowerCase({int length}) { + static String getLowerCase({int length = 2}) { String _alphabet = 'qwertyuiopasdfghjklzxcvbnm'; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { rc = rc + _alphabet[Random().nextInt(_alphabet.length)]; } return rc; } - static String getUpperCase({int length}) { + static String getUpperCase({int length = 2}) { String _alphabet = 'QWERTYUIOPASDFGHJKLZXCVBNM'; String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { rc = rc + _alphabet[Random().nextInt(_alphabet.length)]; } return rc; } - static String getCustom(String string, {int length}) { - assert(string != null); + static String getCustom(String string, {int length = 2}) { String rc = ''; - for (var i = 0; i < length ?? 2; i++) { + for (var i = 0; i < length; i++) { rc = rc + string[Random().nextInt(string.length)]; } return rc; diff --git a/pubspec.lock b/pubspec.lock index 7d9884e..6c77e39 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.flutter-io.cn" source: hosted - version: "1.15.0-nullsafety.3" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -66,21 +66,21 @@ packages: name: matcher url: "https://pub.flutter-io.cn" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -92,56 +92,56 @@ packages: name: source_span url: "https://pub.flutter-io.cn" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.flutter-io.cn" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.flutter-io.cn" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.flutter-io.cn" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.flutter-io.cn" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.17.0 <2.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c37a91d..7bcc2b8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: random_character -description: A new Flutter package. -version: 0.0.1 +description: a random character generator. +version: 0.1.0-nullsafety.0 homepage: https://github.com/meng-fucius/random_character environment: - sdk: ">=2.7.0 <3.0.0" - flutter: ">=1.17.0 <2.0.0" + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" dependencies: flutter: @@ -20,7 +20,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # To add assets to your package, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg @@ -31,7 +30,6 @@ flutter: # # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. - # To add custom fonts to your package, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a