Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iampawan committed May 21, 2024
1 parent 9c5fa96 commit 82934e7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 33 deletions.
2 changes: 1 addition & 1 deletion lib/src/extensions/context_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
6 changes: 2 additions & 4 deletions lib/src/flutter/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions lib/src/flutter/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
Expand All @@ -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),
),
Expand All @@ -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)),
),
Expand Down Expand Up @@ -365,7 +365,7 @@ class VxTimerButtonState extends State<VxTimerButton> {
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),
),
Expand Down
35 changes: 17 additions & 18 deletions lib/src/flutter/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> 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),
Expand Down
4 changes: 2 additions & 2 deletions lib/src/flutter/hover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class _HoverToggleState extends State<VxHoverToggle> 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(),
Expand Down
6 changes: 3 additions & 3 deletions lib/src/flutter/timeline/timeline_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ class VxTimelineState extends State<VxTimeline>
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,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/flutter/toast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 82934e7

Please sign in to comment.