Fixed bugs: overflows on location view, made location view scrollable
This commit is contained in:
@@ -67,8 +67,12 @@ class _AddLocationBySearchFormState extends State<AddLocationBySearchForm> {
|
||||
children: [_singleResult(name: "No result")],
|
||||
);
|
||||
}
|
||||
Iterable<LocationModel> locationsToShow = _locations!;
|
||||
if (locationsToShow.length > 3) {
|
||||
locationsToShow = _locations!.getRange(0, 3);
|
||||
}
|
||||
return Column(children: [
|
||||
for (LocationModel location in _locations!.getRange(0, 3))
|
||||
for (LocationModel location in locationsToShow)
|
||||
_singleResult(name: location.name, location: location)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -45,26 +45,27 @@ class AddLocationsFormState extends State<AddLocationsForm> {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: Column(children: [
|
||||
Flexible(
|
||||
flex: 4,
|
||||
child: TextFormField(
|
||||
//Location Name
|
||||
onSaved: (input) {
|
||||
newLocationName = input;
|
||||
},
|
||||
controller: locationFormController,
|
||||
validator: ((value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please enter a name for the new location";
|
||||
}
|
||||
if (widget.savedLocations.contains(value)) {
|
||||
return "Location name already in use";
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
decoration: const InputDecoration(
|
||||
border: UnderlineInputBorder(), labelText: "Location Name"),
|
||||
)),
|
||||
// Flexible(
|
||||
// flex: 4,
|
||||
// child:
|
||||
TextFormField(
|
||||
//Location Name
|
||||
onSaved: (input) {
|
||||
newLocationName = input;
|
||||
},
|
||||
controller: locationFormController,
|
||||
validator: ((value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Please enter a name for the new location";
|
||||
}
|
||||
if (widget.savedLocations.contains(value)) {
|
||||
return "Location name already in use";
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
decoration: const InputDecoration(
|
||||
border: UnderlineInputBorder(), labelText: "Location Name"),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
|
||||
@@ -13,8 +13,11 @@ class ManageSingleLocation extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(children: [
|
||||
Text(name, style: Theme.of(context).textTheme.headline5),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 12),
|
||||
child: Text(name,
|
||||
style: Theme.of(context).textTheme.headline5))),
|
||||
GestureDetector(
|
||||
onTap: () => delete(name),
|
||||
child: const Icon(Icons.delete_sharp))
|
||||
|
||||
Reference in New Issue
Block a user