Skip to content

Commit 191391c

Browse files
committed
Fix build errors in AudioInput and CameraInput after merging IAnyInput changes from main
1 parent 67d5de4 commit 191391c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/Ivy/Widgets/AudioInput.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ internal AudioInput() { }
4040
[Prop] public string? Invalid { get; set; }
4141
[Prop] public bool Nullable { get; set; }
4242

43+
[Prop] public bool AutoFocus { get; set; }
44+
4345
[Event] public EventHandler<Event<IAnyInput>>? OnBlur { get; set; }
4446
[Event] public EventHandler<Event<IAnyInput>>? OnFocus { get; set; }
4547

@@ -114,4 +116,9 @@ public static AudioInput OnFocus(this AudioInput widget, Action onFocus)
114116
{
115117
return widget with { OnFocus = new(_ => { onFocus(); return ValueTask.CompletedTask; }) };
116118
}
119+
120+
public static AudioInput AutoFocus(this AudioInput widget, bool autoFocus = true)
121+
{
122+
return widget with { AutoFocus = autoFocus };
123+
}
117124
}

src/Ivy/Widgets/CameraInput.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.CompilerServices;
12
using Ivy.Core;
23

34
// ReSharper disable once CheckNamespace
@@ -27,6 +28,8 @@ internal CameraInput() { }
2728
[Event] public EventHandler<Event<IAnyInput>>? OnBlur { get; set; }
2829
[Event] public EventHandler<Event<IAnyInput>>? OnFocus { get; set; }
2930

31+
[Prop] public bool AutoFocus { get; set; }
32+
3033
public Type[] SupportedStateTypes() => [];
3134
}
3235

@@ -40,4 +43,27 @@ public static CameraInput Disabled(this CameraInput widget, bool disabled = true
4043

4144
public static CameraInput FacingMode(this CameraInput widget, string facingMode)
4245
=> widget with { FacingMode = facingMode };
46+
47+
public static CameraInput AutoFocus(this CameraInput widget, bool autoFocus = true)
48+
=> widget with { AutoFocus = autoFocus };
49+
50+
[OverloadResolutionPriority(1)]
51+
public static CameraInput OnBlur(this CameraInput widget, Func<Event<IAnyInput>, ValueTask> onBlur)
52+
=> widget with { OnBlur = new(onBlur) };
53+
54+
public static CameraInput OnBlur(this CameraInput widget, Action<Event<IAnyInput>> onBlur)
55+
=> widget with { OnBlur = new(onBlur.ToValueTask()) };
56+
57+
public static CameraInput OnBlur(this CameraInput widget, Action onBlur)
58+
=> widget with { OnBlur = new(_ => { onBlur(); return ValueTask.CompletedTask; }) };
59+
60+
[OverloadResolutionPriority(1)]
61+
public static CameraInput OnFocus(this CameraInput widget, Func<Event<IAnyInput>, ValueTask> onFocus)
62+
=> widget with { OnFocus = new(onFocus) };
63+
64+
public static CameraInput OnFocus(this CameraInput widget, Action<Event<IAnyInput>> onFocus)
65+
=> widget with { OnFocus = new(onFocus.ToValueTask()) };
66+
67+
public static CameraInput OnFocus(this CameraInput widget, Action onFocus)
68+
=> widget with { OnFocus = new(_ => { onFocus(); return ValueTask.CompletedTask; }) };
4369
}

0 commit comments

Comments
 (0)