diff --git a/example/pubspec.lock b/example/pubspec.lock index e69de29b..1e3c35cb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -0,0 +1,264 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.2" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.13" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "0.18.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + getwidget: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "1.1.3" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.8" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.1+1" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.4" + platform_detect: + dependency: transitive + description: + name: platform_detect + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.5" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.17" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.3" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+7" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.8" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3+2" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.0" +sdks: + dart: ">=2.9.0-14.0.dev <3.0.0" + flutter: ">=1.18.0-6.0.pre <2.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 3aa763ea..5069cf9b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,9 +11,9 @@ dependencies: sdk: flutter getwidget: path: ../ - cupertino_icons: ^0.1.2 - flutter_svg: ^0.18.0 - url_launcher: ^5.4.1 + cupertino_icons: ^0.1.3 + flutter_svg: ^0.18.1 + url_launcher: ^5.5.3 dev_dependencies: flutter_test: diff --git a/lib/components/accordian/gf_accordian.dart b/lib/components/accordian/gf_accordian.dart index 84fb3c32..6a2594ee 100644 --- a/lib/components/accordian/gf_accordian.dart +++ b/lib/components/accordian/gf_accordian.dart @@ -95,12 +95,10 @@ class _GFAccordionState extends State @override void initState() { showAccordion = widget.showAccordion; - animationController = AnimationController( - duration: const Duration(seconds: 2), - ); + animationController = + AnimationController(duration: const Duration(seconds: 2), vsync: this); controller = AnimationController( - duration: const Duration(milliseconds: 300), - ); + duration: const Duration(milliseconds: 300), vsync: this); offset = Tween( begin: const Offset(0, -0.06), end: Offset.zero, diff --git a/lib/components/alert/gf_alert.dart b/lib/components/alert/gf_alert.dart index 13f062d8..da62957c 100644 --- a/lib/components/alert/gf_alert.dart +++ b/lib/components/alert/gf_alert.dart @@ -67,8 +67,7 @@ class _GFAlertState extends State with TickerProviderStateMixin { @override void initState() { animationController = AnimationController( - duration: const Duration(milliseconds: 300), - ); + duration: const Duration(milliseconds: 300), vsync: this); animation = CurvedAnimation( parent: animationController, curve: Curves.fastOutSlowIn, diff --git a/lib/components/animation/gf_animation.dart b/lib/components/animation/gf_animation.dart index f006e3ed..27959dc8 100644 --- a/lib/components/animation/gf_animation.dart +++ b/lib/components/animation/gf_animation.dart @@ -118,7 +118,8 @@ class _GFAnimationState extends State if (widget.type == GFAnimationType.rotateTransition) { controller = widget.controller ?? AnimationController( - duration: widget.duration ?? const Duration(seconds: 2)); + duration: widget.duration ?? const Duration(seconds: 2), + vsync: this); animation = widget.turnsAnimation ?? Tween(begin: 0, end: 20).animate(controller); if (widget.turnsAnimation == null) { @@ -127,15 +128,16 @@ class _GFAnimationState extends State } else if (widget.type == GFAnimationType.scaleTransition) { controller = widget.controller ?? AnimationController( - duration: widget.duration ?? const Duration(seconds: 2)); + duration: widget.duration ?? const Duration(seconds: 2), + vsync: this); animation = widget.scaleAnimation ?? CurvedAnimation( parent: controller, curve: widget.curve ?? Curves.ease); controller.forward(); } else if (widget.type == GFAnimationType.slideTransition) { controller = AnimationController( - duration: widget.duration ?? const Duration(seconds: 2), - )..repeat(reverse: true); + duration: widget.duration ?? const Duration(seconds: 2), vsync: this) + ..repeat(reverse: true); offsetAnimation = Tween( begin: Offset.zero, end: const Offset(1.5, 0), diff --git a/lib/components/bottom_sheet/gf_bottom_sheet.dart b/lib/components/bottom_sheet/gf_bottom_sheet.dart index 0834a9eb..ac4c97b9 100644 --- a/lib/components/bottom_sheet/gf_bottom_sheet.dart +++ b/lib/components/bottom_sheet/gf_bottom_sheet.dart @@ -16,7 +16,6 @@ class GFBottomSheet extends StatefulWidget { super(key: key) { controller.height = minContentHeight; controller.smoothness = 500; -// controller == null ? controller = GFBottomSheetController() : Container(); } /// [minContentHeight] controls the minimum height of the content body. @@ -60,7 +59,7 @@ class _GFBottomSheetState extends State Function _controllerListener; void _onVerticalDragUpdate(data) { - _setNativeSmoothness(); + _setSmoothness(); if (((widget.controller.height - data.delta.dy) > widget.minContentHeight) && ((widget.controller.height - data.delta.dy) < @@ -71,8 +70,7 @@ class _GFBottomSheetState extends State } void _onVerticalDragEnd(data) { - _setUsersSmoothness(); - + _setSmoothness(); if (isDragDirectionUp && widget.controller.value) { _showBottomSheet(); } else if (!isDragDirectionUp && !widget.controller.value) { @@ -91,6 +89,7 @@ class _GFBottomSheetState extends State @override void initState() { super.initState(); + widget.controller.value = showBottomSheet; _controllerListener = () { widget.controller.value ? _showBottomSheet() : _hideBottomSheet(); @@ -100,6 +99,11 @@ class _GFBottomSheetState extends State @override Widget build(BuildContext context) { + final BottomSheetThemeData bottomSheetTheme = + Theme.of(context).bottomSheetTheme; + final double elevation = + widget.elevation ?? bottomSheetTheme.elevation ?? 0; + final Widget bottomSheet = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -118,11 +122,10 @@ class _GFBottomSheetState extends State duration: Duration(milliseconds: widget.controller.smoothness), height: widget.controller.height, child: GestureDetector( - onVerticalDragUpdate: _onVerticalDragUpdate, - onVerticalDragEnd: _onVerticalDragEnd, - onTap: _onTap, - child: widget.contentBody, - ), + onVerticalDragUpdate: _onVerticalDragUpdate, + onVerticalDragEnd: _onVerticalDragEnd, + onTap: _onTap, + child: widget.contentBody), ), ), widget.stickyFooter != null @@ -147,7 +150,7 @@ class _GFBottomSheetState extends State ], ); return Material( - elevation: widget.elevation, + elevation: elevation, child: bottomSheet, ); } @@ -166,11 +169,7 @@ class _GFBottomSheetState extends State super.dispose(); } - void _setUsersSmoothness() { - widget.controller.smoothness = 500; - } - - void _setNativeSmoothness() { + void _setSmoothness() { widget.controller.smoothness = 500; } } diff --git a/lib/components/carousel/gf_items_carousel.dart b/lib/components/carousel/gf_items_carousel.dart index 87e10542..f65efce4 100644 --- a/lib/components/carousel/gf_items_carousel.dart +++ b/lib/components/carousel/gf_items_carousel.dart @@ -82,8 +82,8 @@ class _GFItemsCarouselState extends State void initState() { offset = 0; animationController = AnimationController( - duration: const Duration(milliseconds: dragAnimationDuration), - ); + duration: const Duration(milliseconds: dragAnimationDuration), + vsync: this); Future.delayed(Duration.zero, () { setState(() { final double localWidth = MediaQuery.of(context).size.width; @@ -131,8 +131,8 @@ class _GFItemsCarouselState extends State } animationController = AnimationController( - duration: const Duration(milliseconds: dragAnimationDuration), - ); + duration: const Duration(milliseconds: dragAnimationDuration), + vsync: this); final Tween tween = Tween(begin: offset, end: calculateOffset(0.5 * dx)); @@ -162,8 +162,8 @@ class _GFItemsCarouselState extends State final double beginAnimation = offset; final double endAnimation = size * (offset / size).round().toDouble(); animationController = AnimationController( - duration: const Duration(milliseconds: shiftAnimationDuration), - ); + duration: const Duration(milliseconds: shiftAnimationDuration), + vsync: this); final Tween tween = Tween(begin: beginAnimation, end: endAnimation); final Animation animation = tween.animate(animationController); animation.addListener(() { diff --git a/lib/components/loader/gf_loader.dart b/lib/components/loader/gf_loader.dart index c398d4cf..769e6426 100644 --- a/lib/components/loader/gf_loader.dart +++ b/lib/components/loader/gf_loader.dart @@ -71,9 +71,7 @@ class _GFLoaderState extends State void initState() { super.initState(); - controller = AnimationController( - duration: widget.duration, - ); + controller = AnimationController(duration: widget.duration, vsync: this); loaderanimation1 = Tween(begin: 0, end: 1).animate( CurvedAnimation( diff --git a/lib/components/progress_bar/gf_progress_bar.dart b/lib/components/progress_bar/gf_progress_bar.dart index 136f2ce3..5da517f8 100644 --- a/lib/components/progress_bar/gf_progress_bar.dart +++ b/lib/components/progress_bar/gf_progress_bar.dart @@ -130,7 +130,8 @@ class _GFProgressBarState extends State super.initState(); if (widget.animation) { _animationController = AnimationController( - duration: Duration(milliseconds: widget.animationDuration)); + duration: Duration(milliseconds: widget.animationDuration), + vsync: this); _animation = Tween(begin: 0, end: widget.percentage).animate(_animationController) ..addListener(() { @@ -145,7 +146,8 @@ class _GFProgressBarState extends State if (widget.animation) { circularAnimationController = AnimationController( - duration: Duration(milliseconds: widget.animationDuration)); + duration: Duration(milliseconds: widget.animationDuration), + vsync: this); circularAnimation = Tween(begin: 0, end: widget.percentage) .animate(circularAnimationController) ..addListener(() { diff --git a/lib/components/shimmer/gf_shimmer.dart b/lib/components/shimmer/gf_shimmer.dart index 66737f7f..40acda88 100644 --- a/lib/components/shimmer/gf_shimmer.dart +++ b/lib/components/shimmer/gf_shimmer.dart @@ -65,7 +65,7 @@ class _GFShimmerState extends State void initState() { super.initState(); _count = 0; - _controller = AnimationController(duration: widget.duration) + _controller = AnimationController(duration: widget.duration, vsync: this) ..addStatusListener((AnimationStatus status) { if (status != AnimationStatus.completed) { return; diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index f406616b..cb53d23e 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -69,9 +69,8 @@ class _GFToastState extends State with TickerProviderStateMixin { @override void initState() { - animationController = AnimationController( - duration: widget.duration, - ); + animationController = + AnimationController(duration: widget.duration, vsync: this); animation = CurvedAnimation( parent: animationController, curve: Curves.easeIn, @@ -79,9 +78,9 @@ class _GFToastState extends State with TickerProviderStateMixin { if (mounted) { animationController.forward(); - fadeanimationController = AnimationController( - duration: widget.animationDuration, - )..addListener(() => setState(() {})); + fadeanimationController = + AnimationController(duration: widget.animationDuration, vsync: this) + ..addListener(() => setState(() {})); fadeanimation = Tween( begin: 0, end: 1, diff --git a/lib/components/toggle/gf_toggle.dart b/lib/components/toggle/gf_toggle.dart index aef51bcb..248e9bfa 100644 --- a/lib/components/toggle/gf_toggle.dart +++ b/lib/components/toggle/gf_toggle.dart @@ -89,7 +89,7 @@ class _GFToggleState extends State with TickerProviderStateMixin { setState(() { isOn = widget.value ?? false; }); - controller = AnimationController(duration: widget.duration); + controller = AnimationController(duration: widget.duration, vsync: this); offset = (isOn ? Tween( begin: const Offset(1, 0), diff --git a/lib/getwidget.dart b/lib/getwidget.dart index 651ec4e4..69e3ab12 100644 --- a/lib/getwidget.dart +++ b/lib/getwidget.dart @@ -40,8 +40,6 @@ export 'package:getwidget/components/toast/gf_toast.dart'; export 'package:getwidget/components/toggle/gf_toggle.dart'; export 'package:getwidget/components/typography/gf_typography.dart'; - - export 'colors/gf_color.dart'; export 'direction/gf_shimmer_direction.dart'; export 'position/gf_position.dart'; diff --git a/pubspec.lock b/pubspec.lock index e69de29b..9477cdd7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -0,0 +1,146 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.2" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.13" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.8" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.5" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.17" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" +sdks: + dart: ">=2.9.0-14.0.dev <3.0.0"