diff --git a/CHANGELOG.md b/CHANGELOG.md index ac07159..e37cde6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ ## [0.0.1] - TODO: Add release date. * TODO: Describe initial release. + +Updated to null safety!! \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100644 index 0000000..2bb4405 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=E:\FlutterSDK\flutter" +export "FLUTTER_APPLICATION_PATH=C:\Users\my pc\Desktop\wa\cs\CustomSwitch\example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/lib/main.dart b/example/lib/main.dart index 07c259a..8484994 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -8,22 +8,18 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, - theme: ThemeData( - primarySwatch: Colors.deepOrange - ), + theme: ThemeData(primarySwatch: Colors.deepOrange), home: HomeScreen(), ); } } - class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State { - bool status = false; @override @@ -37,7 +33,6 @@ class _HomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ CustomSwitch( - activeColor: Colors.pinkAccent, value: status, onChanged: (value) { print("VALUE : $value"); @@ -45,12 +40,21 @@ class _HomeScreenState extends State { status = value; }); }, + key: null, + activeText: 'On', + activeTextColor: Colors.white, + activeColor: Colors.pinkAccent, + inactiveColor: Colors.grey, + inactiveText: 'Off', + inactiveTextColor: Colors.white, + ), + SizedBox( + height: 12.0, ), - SizedBox(height: 12.0,), - Text('Value : $status', style: TextStyle( - color: Colors.black, - fontSize: 20.0 - ),) + Text( + 'Value : $status', + style: TextStyle(color: Colors.black, fontSize: 20.0), + ) ], ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 5607628..0737eee 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,35 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.3" custom_switch: dependency: "direct main" description: @@ -43,6 +57,13 @@ packages: relative: true source: path version: "0.0.1" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -59,35 +80,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -99,55 +106,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.4.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.15.1 <3.0.0" diff --git a/lib/custom_switch.dart b/lib/custom_switch.dart index c9cf4bf..2e18917 100644 --- a/lib/custom_switch.dart +++ b/lib/custom_switch.dart @@ -6,23 +6,23 @@ class CustomSwitch extends StatefulWidget { final bool value; final ValueChanged onChanged; final Color activeColor; - final Color inactiveColor = Colors.grey; - final String activeText = 'On'; - final String inactiveText = 'Off'; - final Color activeTextColor = Colors.white70; - final Color inactiveTextColor = Colors.white70; + final Color inactiveColor; + final String activeText; + final String inactiveText; + final Color activeTextColor; + final Color inactiveTextColor; const CustomSwitch({ - Key key, - this.value, - this.onChanged, - this.activeColor, - this.inactiveColor, - this.activeText, - this.inactiveText, - this.activeTextColor, - this.inactiveTextColor}) - : super(key: key); + required Key key, + required this.value, + required this.onChanged, + required this.activeColor, + required this.inactiveColor, + required this.activeText, + required this.inactiveText, + required this.activeTextColor, + required this.inactiveTextColor, + }) : super(key: key); @override _CustomSwitchState createState() => _CustomSwitchState(); @@ -30,8 +30,8 @@ class CustomSwitch extends StatefulWidget { class _CustomSwitchState extends State with SingleTickerProviderStateMixin { - Animation _circleAnimation; - AnimationController _animationController; + late Animation _circleAnimation; + late AnimationController _animationController; @override void initState() { diff --git a/pubspec.lock b/pubspec.lock index 2e19e22..b735f5b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,28 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -45,35 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -85,55 +92,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.4.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.15.1 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 060c2e8..e51328d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,10 @@ name: custom_switch description: Beautiful Custom Switch created with Flutter. version: 0.0.1 -author: Mohak Gupta homepage: https://github.com/mohak1283/CustomSwitch environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.15.1 <3.0.0" dependencies: flutter: