diff --git a/lib/src/extensions/context_ext.dart b/lib/src/extensions/context_ext.dart index a114065..219a632 100644 --- a/lib/src/extensions/context_ext.dart +++ b/lib/src/extensions/context_ext.dart @@ -223,7 +223,7 @@ extension VxContextExtensions on BuildContext { /// /// A color that contrasts with the [primaryColor]. /// - Color get backgroundColor => theme.colorScheme.background; + Color get backgroundColor => theme.colorScheme.surface; /// /// The default color of [MaterialType.canvas] [Material]. diff --git a/lib/src/flutter/bottom_sheet.dart b/lib/src/flutter/bottom_sheet.dart index 4bcba45..dc46b8b 100644 --- a/lib/src/flutter/bottom_sheet.dart +++ b/lib/src/flutter/bottom_sheet.dart @@ -29,8 +29,7 @@ mixin VxBottomSheet { : null, isScrollControlled: true, isDismissible: isDismissible, - backgroundColor: - backgroundColor ?? Theme.of(context).colorScheme.background, + backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.surface, builder: (BuildContext context) { return SafeArea( bottom: isSafeAreaFromBottom, @@ -79,8 +78,7 @@ mixin VxBottomSheet { : null, isScrollControlled: true, isDismissible: isDismissible, - backgroundColor: - backgroundColor ?? Theme.of(context).colorScheme.background, + backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.surface, builder: (BuildContext context) { return SafeArea( bottom: isSafeAreaFromBottom, diff --git a/lib/src/flutter/dialog.dart b/lib/src/flutter/dialog.dart index c49a0ff..5b04d3d 100644 --- a/lib/src/flutter/dialog.dart +++ b/lib/src/flutter/dialog.dart @@ -241,7 +241,7 @@ class _VxDialog extends StatelessWidget { child: Container( height: 42, decoration: BoxDecoration( - color: cancelBgColor ?? Theme.of(context).colorScheme.background, + color: cancelBgColor ?? Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical( bottom: Radius.circular(_circular), ), @@ -257,7 +257,7 @@ class _VxDialog extends StatelessWidget { onTap: () => onCancel(context), child: Container( decoration: BoxDecoration( - color: cancelBgColor ?? Theme.of(context).colorScheme.background, + color: cancelBgColor ?? Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(_circular), ), @@ -277,7 +277,7 @@ class _VxDialog extends StatelessWidget { onTap: () => onConfirm(context), child: Container( decoration: BoxDecoration( - color: confirmBgColor ?? Theme.of(context).colorScheme.background, + color: confirmBgColor ?? Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.only(bottomRight: Radius.circular(_circular)), ), @@ -365,7 +365,7 @@ class VxTimerButtonState extends State { Widget child = Container( height: 42, decoration: BoxDecoration( - color: widget.bgColor ?? Theme.of(context).colorScheme.background, + color: widget.bgColor ?? Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.vertical( bottom: Radius.circular(_circular), ), diff --git a/lib/src/flutter/drawer.dart b/lib/src/flutter/drawer.dart index b6f04ef..bea5db6 100644 --- a/lib/src/flutter/drawer.dart +++ b/lib/src/flutter/drawer.dart @@ -69,34 +69,33 @@ mixin VxDrawer { VoidCallback? hide; - OverlayEntry? overlayEntry = OverlayEntry( - builder: (BuildContext context) => _VxDrawer( - key: key, - type: type, - maskTap: hide, - showMask: showMask, - child: child, - ), - ); - overlayState.insert(overlayEntry); + OverlayEntry? overlayEntry; - final ModalRoute? route = ModalRoute.of(context); - Future backClose() { + void backClose(bool shouldPop) { hide!(); - return Future.value(false); } - // TODO(iampawan): Not sure how to change it to use `PopEntry` - route?.addScopedWillPopCallback(backClose); - hide = () async { - // TODO(iampawan): Not sure how to change it to use `PopEntry` - route?.removeScopedWillPopCallback(backClose); await key.currentState?.reverseAnimation(); overlayEntry?.remove(); overlayEntry = null; }; + overlayEntry = OverlayEntry( + builder: (BuildContext context) => PopScope( + onPopInvoked: backClose, + child: _VxDrawer( + key: key, + type: type, + maskTap: hide, + showMask: showMask, + child: child, + ), + ), + ); + + overlayState.insert(overlayEntry!); + if (autoHide) { Future.delayed( const Duration(milliseconds: 2000), diff --git a/lib/src/flutter/hover.dart b/lib/src/flutter/hover.dart index 66f373a..c74c6d3 100644 --- a/lib/src/flutter/hover.dart +++ b/lib/src/flutter/hover.dart @@ -28,8 +28,8 @@ class _HoverToggleState extends State with MaterialStateMixin { size: widget.size, child: MouseRegion( cursor: isHovered ? SystemMouseCursors.click : MouseCursor.defer, - onEnter: (_) => setMaterialState(MaterialState.hovered, true), - onExit: (_) => setMaterialState(MaterialState.hovered, false), + onEnter: (_) => setMaterialState(WidgetState.hovered, true), + onExit: (_) => setMaterialState(WidgetState.hovered, false), child: widget.mode == VxHoverMode.replace ? _buildReplaceableChildren() : _buildChildrenStack(), diff --git a/lib/src/flutter/timeline/timeline_widget.dart b/lib/src/flutter/timeline/timeline_widget.dart index 69bdca9..bc88fd6 100644 --- a/lib/src/flutter/timeline/timeline_widget.dart +++ b/lib/src/flutter/timeline/timeline_widget.dart @@ -75,10 +75,10 @@ class VxTimelineState extends State firstElement: index == 0, lastElement: widget.timelineList.length == index + 1, controller: controller, - headingColor: widget.headingColor ?? - Theme.of(context).colorScheme.onBackground, + headingColor: + widget.headingColor ?? Theme.of(context).colorScheme.onSurface, descriptionColor: widget.descriptionColor ?? - Theme.of(context).colorScheme.onBackground, + Theme.of(context).colorScheme.onSurface, hideLauncher: !widget.showTrailing, trailing: widget.customTrailing, ), diff --git a/lib/src/flutter/toast.dart b/lib/src/flutter/toast.dart index 4f860f2..2782cc5 100644 --- a/lib/src/flutter/toast.dart +++ b/lib/src/flutter/toast.dart @@ -241,7 +241,7 @@ class _VxToastViewState extends State<_VxToastView> CircularProgressIndicator( strokeWidth: 3.0, valueColor: AlwaysStoppedAnimation( - Theme.of(context).colorScheme.background, + Theme.of(context).colorScheme.surface, ), ), const SizedBox(height: 8),