diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a5716..da317cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,48 @@ +## 1.1.1-nullsafety.0 + +- Migrated package and sample to Null Safety +- Bumped up package version + ## 1.1.0 - * The FlutterIcons class is provided to access all Icons + +- The FlutterIcons class is provided to access all Icons ## 1.0.0+1 - * Enforce code robustness + +- Enforce code robustness ## 1.0.0 - * Refactored API + +- Refactored API ## 0.3.1 - * File movement and adding assertions + +- File movement and adding assertions ## 0.3.0 - * WeatherIcons added + +- WeatherIcons added ## 0.2.5 - * IconToggle added + +- IconToggle added ## 0.2.0 - * FontAwesome5_Free added + +- FontAwesome5_Free added ## 0.1.5 - * Update MaterialCommunityIcons to version 4.0.96 + +- Update MaterialCommunityIcons to version 4.0.96 ## 0.1.4 - * Add hasIconData method + +- Add hasIconData method ## 0.1.3 - * Foundation added - + +- Foundation added + ## 0.1.0 - * This library contains several icon libraries, including the well-known ant-design icon library, material icon library, and so on +- This library contains several icon libraries, including the well-known ant-design icon library, material icon library, and so on diff --git a/example/lib/main.dart b/example/lib/main.dart index 995d9c3..52a647a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -27,7 +27,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); final String title; @@ -36,7 +36,6 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e84e54d..207c6fa 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -8,9 +8,9 @@ description: A new Flutter application. # build by specifying --build-name and --build-number, respectively. # Read more about versioning at semver.org. version: 1.0.0+1 - +publish_to: none environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" dependencies: flutter: @@ -20,14 +20,14 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 flutter_icons: -# path: ../ - git: - url: https://github.com/flutter-studio/flutter-icons.git - ref: 1.1.0 + path: ..// + # git: + # url: https://github.com/flutter-studio/flutter-icons.git + # ref: 1.1.0 dev_dependencies: flutter_test: sdk: flutter - # split_icon: ^0.2.0 + # split_icon: ^0.2.0 flutter_icons: includes: @@ -37,7 +37,6 @@ flutter_icons: # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. diff --git a/lib/src/icon_toggle.dart b/lib/src/icon_toggle.dart index f051102..a1749cd 100644 --- a/lib/src/icon_toggle.dart +++ b/lib/src/icon_toggle.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'dart:math' as math; @@ -25,18 +24,18 @@ class IconToggle extends StatefulWidget { final Color activeColor; final Color inactiveColor; final bool value; - final ValueChanged onChanged; + final ValueChanged? onChanged; final AnimatedSwitcherTransitionBuilder transitionBuilder; final Duration duration; - final Duration reverseDuration; + final Duration? reverseDuration; @override _IconToggleState createState() => _IconToggleState(); } class _IconToggleState extends State with SingleTickerProviderStateMixin { - AnimationController _controller; - Animation _position; + AnimationController? _controller; + late Animation _position; bool _cancel = false; @override @@ -46,12 +45,12 @@ class _IconToggleState extends State vsync: this, duration: Duration(milliseconds: 100), reverseDuration: Duration(milliseconds: 50)); - _position = CurvedAnimation(parent: _controller, curve: Curves.linear); + _position = CurvedAnimation(parent: _controller!, curve: Curves.linear); _position.addStatusListener((status) { if (status == AnimationStatus.dismissed && widget.onChanged != null && _cancel == false) { - widget.onChanged(!widget.value); + widget.onChanged!(!widget.value); } }); } @@ -88,7 +87,9 @@ class _IconToggleState extends State reverseDuration: widget.reverseDuration, transitionBuilder: widget.transitionBuilder, child: Icon( - widget.value ? widget.selectedIconData : widget.unselectedIconData, + widget.value + ? widget.selectedIconData + : widget.unselectedIconData, color: widget.value ? widget.activeColor : widget.inactiveColor, size: 22, key: ValueKey(widget.value), @@ -102,19 +103,19 @@ class _IconToggleState extends State class _IconToggleable extends AnimatedWidget { _IconToggleable({ - Animation listenable, + required Animation listenable, this.activeColor, this.inactiveColor, this.child, }) : super(listenable: listenable); - final Color activeColor; - final Color inactiveColor; - final Widget child; + final Color? activeColor; + final Color? inactiveColor; + final Widget? child; @override Widget build(BuildContext context) { return CustomPaint( painter: _IconPainter( - position: listenable, + position: listenable as Animation, activeColor: activeColor, inactiveColor: inactiveColor, ), @@ -125,20 +126,20 @@ class _IconToggleable extends AnimatedWidget { class _IconPainter extends CustomPainter { _IconPainter({ - @required this.position, + required this.position, this.activeColor, this.inactiveColor, }); final Animation position; - final Color activeColor; - final Color inactiveColor; + final Color? activeColor; + final Color? inactiveColor; - double get _value => position != null ? position.value : 0; + double get _value => position.value; @override void paint(Canvas canvas, Size size) { final Paint paint = Paint() - ..color = Color.lerp(inactiveColor, activeColor, _value) + ..color = Color.lerp(inactiveColor, activeColor, _value)! .withOpacity(math.min(_value, 0.15)) ..style = PaintingStyle.fill ..strokeWidth = 2.0; diff --git a/pubspec.yaml b/pubspec.yaml index 34d2c55..4d48e4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: flutter_icons description: Customizable Icons for Flutter,you can use with over 3K+ icons in your flutter project -version: 1.1.0 +version: 1.1.1-nullsafety.0 author: flutter-studio<2534290808@qq.com> homepage: https://github.com/flutter-studio/flutter-icons.git environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.12.0-0 <3.0.0" dependencies: flutter: @@ -21,54 +21,54 @@ dev_dependencies: # The following section is specific to Flutter. flutter: fonts: - - family: Ionicons - fonts: - - asset: fonts/Ionicons.ttf - - family: AntDesign - fonts: - - asset: fonts/AntDesign.ttf - - family: FontAwesome - fonts: - - asset: fonts/FontAwesome.ttf - - family: MaterialIcons - fonts: - - asset: fonts/MaterialIcons.ttf - - family: Entypo - fonts: - - asset: fonts/Entypo.ttf - - family: EvilIcons - fonts: - - asset: fonts/EvilIcons.ttf - - family: Feather - fonts: - - asset: fonts/Feather.ttf - - family: Foundation - fonts: - - asset: fonts/Foundation.ttf - - family: MaterialCommunityIcons - fonts: - - asset: fonts/MaterialCommunityIcons.ttf - - family: Octicons - fonts: - - asset: fonts/Octicons.ttf - - family: SimpleLineIcons - fonts: - - asset: fonts/SimpleLineIcons.ttf - - family: Zocial - fonts: - - asset: fonts/Zocial.ttf - - family: FontAwesome5 - fonts: - - asset: fonts/FontAwesome5_Regular.ttf - - family: FontAwesome5_Brands - fonts: - - asset: fonts/FontAwesome5_Brands.ttf - - family: FontAwesome5_Solid - fonts: - - asset: fonts/FontAwesome5_Solid.ttf - - family: WeatherIcons - fonts: - - asset: fonts/weathericons.ttf + - family: Ionicons + fonts: + - asset: fonts/Ionicons.ttf + - family: AntDesign + fonts: + - asset: fonts/AntDesign.ttf + - family: FontAwesome + fonts: + - asset: fonts/FontAwesome.ttf + - family: MaterialIcons + fonts: + - asset: fonts/MaterialIcons.ttf + - family: Entypo + fonts: + - asset: fonts/Entypo.ttf + - family: EvilIcons + fonts: + - asset: fonts/EvilIcons.ttf + - family: Feather + fonts: + - asset: fonts/Feather.ttf + - family: Foundation + fonts: + - asset: fonts/Foundation.ttf + - family: MaterialCommunityIcons + fonts: + - asset: fonts/MaterialCommunityIcons.ttf + - family: Octicons + fonts: + - asset: fonts/Octicons.ttf + - family: SimpleLineIcons + fonts: + - asset: fonts/SimpleLineIcons.ttf + - family: Zocial + fonts: + - asset: fonts/Zocial.ttf + - family: FontAwesome5 + fonts: + - asset: fonts/FontAwesome5_Regular.ttf + - family: FontAwesome5_Brands + fonts: + - asset: fonts/FontAwesome5_Brands.ttf + - family: FontAwesome5_Solid + fonts: + - asset: fonts/FontAwesome5_Solid.ttf + - family: WeatherIcons + fonts: + - asset: fonts/weathericons.ttf # To add assets to your package, add an assets section, like this: # assets: diff --git a/test/flutter_icons_test.dart b/test/flutter_icons_test.dart index 6935c5d..bdd86a7 100644 --- a/test/flutter_icons_test.dart +++ b/test/flutter_icons_test.dart @@ -1,6 +1,4 @@ -import 'dart:async'; import 'dart:io'; -import 'file:///Users/makisu/flutter-icons/test/a.dart'; //void main() async { // File file = File("././lib/src/a.dart"); // if (!file.existsSync()) @@ -43,13 +41,15 @@ import 'file:///Users/makisu/flutter-icons/test/a.dart'; // file.writeAsStringSync(allStr); //} -String toCamelName(String name)=>name.split("_").map((e)=>"${e.substring(0,1).toUpperCase()}${ - e.substring(1) -}").toList().join(""); +String toCamelName(String name) => name + .split("_") + .map((e) => "${e.substring(0, 1).toUpperCase()}${e.substring(1)}") + .toList() + .join(""); -String toName(String name){ +String toName(String name) { String _name = toCamelName(name); - return "${_name.substring(0,1).toLowerCase()}${_name.substring(1)}"; + return "${_name.substring(0, 1).toLowerCase()}${_name.substring(1)}"; } //void main(){ @@ -72,27 +72,26 @@ String toName(String name){ // } //} -void main(){ - Map _gly = _fontAwesome5_meta; +void main() { + Map _gly = _fontAwesome5_meta; List keys = _gly.keys.toList(); - for(int i=0;i obj = _gly[keys[i]]; - for(int j=0;j> _fontAwesome5_meta = { "brands": [ "500px", @@ -2957,5 +2956,3 @@ const Map _fontAwesome5 = { "youtube-square": 62513, "zhihu": 63039 }; - -