1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#![allow(unused_imports)]
use std::time::Duration;
use crate::{
elements::{Element, InkWellElement},
foundation::{colorspace::Color, Id, Key, ValueChanged, WidgetProperties},
painting::{EdgeInsetsGeometry, NoneEdgeInsetsGeometry, NoneShapeBorder, ShapeBorder, BorderRadius, BoxShape},
services::MouseCursor,
ui::{Brightness, Clip, VoidCallback},
widgets::{FocusNode, NoneWidget, Widget},
};
use super::{ButtonTextTheme, MaterialTapTargetSize, VisualDensity, MaterialStateProperty, InteractiveInkFeatureFactory};
pub struct InkWell {
// True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
pub autofocus: bool,
// The clipping radius of the containing rect. This is effective only if customBorder is null.
pub border_radius: Option<BorderRadius>,
// If true, this widget may request the primary focus.
pub can_request_focus: bool,
// The widget below this widget in the tree.
pub child: Box<dyn Widget>,
// Whether this ink response should be clipped its bounds.
pub contained_ink_well: bool,
// The custom clip border which overrides borderRadius.
pub custom_border: Box<dyn ShapeBorder>,
// Whether detected gestures should provide acoustic and/or haptic feedback.
pub enable_feedback: bool,
// Whether to exclude the gestures introduced by this widget from the semantics tree.
pub exclude_from_semantics: bool,
// The color of the ink response when the parent widget is focused.
// If this property is null then the focus color of the theme, ThemeData.focusColor, will be used.
pub focus_color: Option<Color>,
// An optional focus node to use as the focus node for this widget.
pub focus_node: Option<FocusNode>,
// The highlight color of the ink response when pressed.
// If this property is null then the highlight color of the theme, ThemeData.highlightColor, will be used.
pub highlight_color: Option<Color>,
// The shape (e.g., circle, rectangle) to use for the highlight drawn around this part of the material when pressed, hovered over, or focused.
pub highlight_shape: Option<BoxShape>,
// The color of the ink response when a pointer is hovering over it.
// If this property is null then the hover color of the theme, ThemeData.hoverColor, will be used.
pub hover_color: Option<Color>,
// Controls how one widget replaces another widget in the tree.
pub key: Key,
// The cursor for a mouse pointer when it enters or is hovering over the widget.
pub mouse_cursor: Option<MouseCursor>,
// Called when the user double taps this part of the material.
// pub on_double_tap: Option<GestureTapCallback>,
// Handler called when the focus changes.
// pub on_focus_change: Box<dyn ValueChanged<bool>>,
// Called when this part of the material either becomes highlighted or stops being highlighted.
// pub on_highlight_changed: Box<dyn ValueChanged<bool>>,
// Called when a pointer enters or exits the ink response area.
// pub on_hover: Box<dyn ValueChanged<bool>>,
// Called when the user long-presses on this part of the material.
// pub on_long_press: Option<GestureLongPressCallback>,
// Called when the user taps this part of the material.
// pub on_tap: Option<GestureTapCallback>,
// Called when the user cancels a tap that was started on this part of the material.
// pub on_tap_cancel: Option<GestureTapCallback>,
// Called when the user taps down this part of the material.
// pub on_tap_down: Option<GestureTapDownCallback>,
// Defines the ink response focus, hover, and splash colors.
pub overlay_color: Option<MaterialStateProperty<Option<Color>>>,
// The radius of the ink splash.
pub radius: Option<f32>,
// The splash color of the ink response. If this property is null then the splash color of the theme, ThemeData.splashColor, will be used.
pub splash_color: Color,
// Defines the appearance of the splash.
pub splash_factory: Option<InteractiveInkFeatureFactory>,
}
impl Default for InkWell {
fn default() -> Self {
Self {
autofocus: Default::default(),
border_radius: Default::default(),
can_request_focus: Default::default(),
child: box NoneWidget,
contained_ink_well: Default::default(),
custom_border: box NoneShapeBorder,
enable_feedback: Default::default(),
exclude_from_semantics: Default::default(),
focus_color: Default::default(),
focus_node: Default::default(),
highlight_color: Default::default(),
highlight_shape: Default::default(),
hover_color: Default::default(),
key: Default::default(),
mouse_cursor: Default::default(),
// on_double_tap: Default::default(),
// on_focus_change: Default::default(),
// on_highlight_changed: Default::default(),
// on_hover: Default::default(),
// on_long_press: Default::default(),
// on_tap: Default::default(),
// on_tap_cancel: Default::default(),
// on_tap_down: Default::default(),
overlay_color: Default::default(),
radius: Default::default(),
splash_color: Default::default(),
splash_factory: Default::default(),
}
}
}
impl Widget for InkWell {
fn create_element(&self) -> Box<dyn Element> {
box InkWellElement::new(self)
}
}
impl WidgetProperties for InkWell {
fn key(&self) -> &Key {
&self.key
}
fn x(&self) -> f32 {
// self.x
0.0
}
fn y(&self) -> f32 {
// self.y
0.0
}
fn w(&self) -> f32 {
// self.w
0.0
}
fn h(&self) -> f32 {
// self.h
0.0
}
fn w_min(&self) -> f32 {
// self.w_min
0.0
}
fn h_min(&self) -> f32 {
// self.h_min
0.0
}
fn w_max(&self) -> f32 {
// self.w_max
0.0
}
fn h_max(&self) -> f32 {
// self.h_max
0.0
}
fn parent(&self) -> Option<Id> {
// self.parent
None
}
fn depth(&self) -> f32 {
// self.depth
0.0
}
fn visible(&self) -> bool {
// self.visible
true
}
fn mouse_input(&self) -> bool {
// self.mouse_input
true
}
fn key_input(&self) -> bool {
// self.key_input
true
}
fn renderable(&self) -> bool {
// self.renderable
true
}
fn internal_visible(&self) -> bool {
// self.internal_visible
true
}
}