From 536a4a6e9035ddc314dfa16bf3815ffbce31054a Mon Sep 17 00:00:00 2001 From: Aryan Date: Thu, 13 Apr 2023 11:26:52 +0530 Subject: [PATCH] Replaced Scrollable.of with Scrollable.maybeOf --- lib/src/widgets/gap.dart | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/src/widgets/gap.dart b/lib/src/widgets/gap.dart index bba3b90..0bcecd1 100644 --- a/lib/src/widgets/gap.dart +++ b/lib/src/widgets/gap.dart @@ -71,18 +71,10 @@ class Gap extends StatelessWidget { @override Widget build(BuildContext context) { - ScrollableState? scrollableState; - try { - // TODO: call Scrollable.maybeOf when available on stable. - scrollableState = Scrollable.of(context); - // ignore: avoid_catches_without_on_clauses - } catch (e) { - scrollableState = null; - } + final ScrollableState? scrollableState = Scrollable.maybeOf(context); final AxisDirection? axisDirection = scrollableState?.axisDirection; - final Axis? fallbackDirection = - axisDirection == null ? null : axisDirectionToAxis(axisDirection); + final Axis? fallbackDirection = axisDirection == null ? null : axisDirectionToAxis(axisDirection); return _RawGap( mainAxisExtent, @@ -210,8 +202,7 @@ class _RawGap extends LeafRenderObjectWidget { void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties.add(DoubleProperty('mainAxisExtent', mainAxisExtent)); - properties.add( - DoubleProperty('crossAxisExtent', crossAxisExtent, defaultValue: 0)); + properties.add(DoubleProperty('crossAxisExtent', crossAxisExtent, defaultValue: 0)); properties.add(ColorProperty('color', color)); properties.add(EnumProperty('fallbackDirection', fallbackDirection)); }