in form_app/lib/src/form_widgets.dart [25:158]
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Form widgets'),
),
body: Form(
key: _formKey,
child: Scrollbar(
child: Align(
alignment: Alignment.topCenter,
child: Card(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
...[
TextFormField(
decoration: const InputDecoration(
filled: true,
hintText: 'Enter a title...',
labelText: 'Title',
),
onChanged: (value) {
setState(() {
title = value;
});
},
),
TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
filled: true,
hintText: 'Enter a description...',
labelText: 'Description',
),
onChanged: (value) {
description = value;
},
maxLines: 5,
),
_FormDatePicker(
date: date,
onChanged: (value) {
setState(() {
date = value;
});
},
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Estimated value',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
Text(
intl.NumberFormat.currency(
symbol: "\$", decimalDigits: 0)
.format(maxValue),
style: Theme.of(context).textTheme.subtitle1,
),
Slider(
min: 0,
max: 500,
divisions: 500,
value: maxValue,
onChanged: (value) {
setState(() {
maxValue = value;
});
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Checkbox(
value: brushedTeeth,
onChanged: (checked) {
setState(() {
brushedTeeth = checked;
});
},
),
Text('Brushed Teeth',
style: Theme.of(context).textTheme.subtitle1),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('Enable feature',
style: Theme.of(context).textTheme.bodyText1),
Switch(
value: enableFeature,
onChanged: (enabled) {
setState(() {
enableFeature = enabled;
});
},
),
],
),
].expand(
(widget) => [
widget,
const SizedBox(
height: 24,
)
],
)
],
),
),
),
),
),
),
),
);
}