Skip to content

Commit edfc04a

Browse files
committed
Some UI improvements to Dropdown
1 parent 3974987 commit edfc04a

File tree

4 files changed

+85
-79
lines changed

4 files changed

+85
-79
lines changed

.idea/workspace.xml

Lines changed: 42 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/ios/Runner/Base.lproj/Main.storyboard

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<scenes>
812
<!--Flutter View Controller-->
@@ -14,9 +18,9 @@
1418
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
1519
</layoutGuides>
1620
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
17-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
21+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1822
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
23+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2024
</view>
2125
</viewController>
2226
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>

lib/src/form_builder.dart

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ class _FormBuilderState extends State<FormBuilder> {
166166
break;
167167

168168
case FormBuilderInput.TYPE_TYPE_AHEAD:
169-
final TextEditingController _typeAheadController = TextEditingController();
169+
final TextEditingController _typeAheadController =
170+
TextEditingController();
170171
formControlsList.add(TypeAheadFormField(
171172
initialValue: formControl.value,
172173
textFieldConfiguration: TextFieldConfiguration(
@@ -210,40 +211,30 @@ class _FormBuilderState extends State<FormBuilder> {
210211
formData[formControl.attribute] = value;
211212
},
212213
builder: (FormFieldState<dynamic> field) {
213-
return Container(
214-
padding: EdgeInsets.only(top: 10.0),
215-
child: Column(
216-
crossAxisAlignment: CrossAxisAlignment.start,
217-
children: <Widget>[
218-
Text(
219-
formControl.label,
220-
style: TextStyle(color: Colors.grey),
221-
),
222-
DropdownButton(
223-
isExpanded: true,
224-
hint: Text(formControl.hint ?? ''),
225-
items: formControls[count].options.map((option) {
226-
return DropdownMenuItem(
227-
child: Text(option.label ?? option.value),
228-
value: option.value,
229-
);
230-
}).toList(),
231-
value: field.value,
232-
onChanged: (value) {
233-
setState(() {
234-
formControls[count].value = value;
235-
});
236-
field.didChange(value);
237-
},
238-
),
239-
field.hasError
240-
? Text(
241-
field.errorText,
242-
style:
243-
TextStyle(color: Theme.of(context).errorColor),
244-
)
245-
: SizedBox(),
246-
],
214+
return InputDecorator(
215+
decoration: InputDecoration(
216+
labelText: formControl.label,
217+
helperText: formControl.hint,
218+
errorText: field.errorText,
219+
contentPadding: EdgeInsets.only(top: 10.0, bottom: 0.0),
220+
border: InputBorder.none,
221+
),
222+
child: DropdownButton(
223+
isExpanded: true,
224+
hint: Text(formControl.hint ?? ''),
225+
items: formControls[count].options.map((option) {
226+
return DropdownMenuItem(
227+
child: Text(option.label ?? option.value),
228+
value: option.value,
229+
);
230+
}).toList(),
231+
value: field.value,
232+
onChanged: (value) {
233+
setState(() {
234+
formControls[count].value = value;
235+
});
236+
field.didChange(value);
237+
},
247238
),
248239
);
249240
},

0 commit comments

Comments
 (0)