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
use crate::{
elements::{Element, TextFieldElement},
foundation::{colorspace::Color, Id, Key, ValueChanged, WidgetProperties},
gestures::DragStartBehavior,
painting::TextStyle,
services::{MouseCursor, TextInputType},
ui::{
BoxHeightStyle, BoxWidthStyle, Brightness, Radius, TextAlign, TextDirection, VoidCallback,
},
widgets::{FocusNode, Widget, TextEditingController},
};
use super::InputDecoration;
pub struct TextField {
pub key: Key,
pub controller: TextEditingController,
pub focus_node: FocusNode,
pub decoration: InputDecoration,
pub keyboard_type: TextInputType,
// pub text_input_action: TextInputAction,
// pub text_capitalization: TextCapitalization,
pub style: TextStyle,
// pub strut_style: StrutStyle,
pub text_align: TextAlign,
// pub text_align_vertical: TextAlignVertical,
pub text_direction: TextDirection,
pub read_only: bool,
// pub toolbar_options: ToolbarOptions,
pub show_cursor: bool,
pub autofocus: bool,
pub obscuring_character: String,
pub obscure_text: bool,
pub autocorrect: bool,
// pub smart_dashes_type: SmartDashesType,
// pub smart_quotes_type: SmartQuotesType,
pub enable_suggestions: bool,
pub max_lines: i32,
pub min_lines: i32,
pub expands: bool,
pub max_length: i32,
// @Deprecated("Use maxLengthEnforcement parameter which provides more specific ' 'behavior related to the maxLength limit. ")
pub max_length_enforced: bool,
// pub max_length_enforcement: MaxLengthEnforcement,
pub on_changed: Option<ValueChanged<String>>,
pub on_editing_complete: Option<VoidCallback>,
pub on_submitted: Option<ValueChanged<String>>,
// pub on_app_private_command: AppPrivateCommandCallback,
// pub input_formatters: Vec<TextInputFormatter>,
pub enabled: bool,
pub cursor_width: f32,
pub cursor_height: f32,
pub cursor_radius: Radius,
pub cursor_color: Color,
pub selection_height_style: BoxHeightStyle,
pub selection_width_style: BoxWidthStyle,
pub keyboard_appearance: Brightness,
// pub scroll_padding: EdgeInsets,
pub drag_start_behavior: DragStartBehavior,
pub enable_interactive_selection: bool,
// pub selection_controls: TextSelectionControls,
// pub on_tap: GestureTapCallback,
pub mouse_cursor: MouseCursor,
// pub build_counter: InputCounterWidgetBuilder,
// pub scroll_controller: ScrollController,
// pub scroll_physics: ScrollPhysics,
pub autofill_hints: Vec<String>,
pub restoration_id: String,
pub enable_ime_personalized_learning: bool,
}
impl Default for TextField {
fn default() -> Self {
Self {
key: Default::default(),
controller: Default::default(),
focus_node: Default::default(),
decoration: Default::default(),
keyboard_type: Default::default(),
// text_input_action: Default::default(),
// text_capitalization: Default::default(),
style: Default::default(),
// strut_style: Default::default(),
text_align: Default::default(),
// text_align_vertical: Default::default(),
text_direction: Default::default(),
read_only: Default::default(),
// toolbar_options: Default::default(),
show_cursor: Default::default(),
autofocus: Default::default(),
obscuring_character: Default::default(),
obscure_text: Default::default(),
autocorrect: Default::default(),
// smart_dashes_type: Default::default(),
// smart_quotes_type: Default::default(),
enable_suggestions: Default::default(),
max_lines: Default::default(),
min_lines: Default::default(),
expands: Default::default(),
max_length: Default::default(),
max_length_enforced: Default::default(),
// max_length_enforcement: Default::default(),
on_changed: Default::default(),
on_editing_complete: Default::default(),
on_submitted: Default::default(),
// on_app_private_command: Default::default(),
// input_formatters: Default::default(),
enabled: Default::default(),
cursor_width: Default::default(),
cursor_height: Default::default(),
cursor_radius: Default::default(),
cursor_color: Default::default(),
selection_height_style: Default::default(),
selection_width_style: Default::default(),
keyboard_appearance: Default::default(),
// scroll_padding: Default::default(),
drag_start_behavior: Default::default(),
enable_interactive_selection: Default::default(),
// selection_controls: Default::default(),
// on_tap: Default::default(),
mouse_cursor: Default::default(),
// build_counter: Default::default(),
// scroll_controller: Default::default(),
// scroll_physics: Default::default(),
autofill_hints: Default::default(),
restoration_id: Default::default(),
enable_ime_personalized_learning: Default::default(),
}
}
}
impl Widget for TextField {
fn create_element(&self) -> Box<dyn Element> {
box TextFieldElement::new(self)
}
}
impl WidgetProperties for TextField {
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
}
}