I'm trying to have a row that contains a textfield and a iconButton like the one below.
body: Column(
children: <Widget>[
Flexible(
child: new FlutterMap(
mapController: mapController,
options: new MapOptions(
center: new LatLng(47.10347, 5.48075),
zoom: 5.0,
plugins: [
new SearchBarPlugin(),
],
),
layers: [
new TileLayerOptions(
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c'],
),
new SearchBarPluginOptions(
TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Saisissez votre recherche',
),
),
IconButton(
icon: Icon(
Icons.my_location,
color: Color.fromRGBO(0, 178, 169, 1.0),
),
onPressed: () {},
)),
],
),
),
],
),
class SearchBarPluginOptions extends LayerOptions {
final TextField textField;
final IconButton iconButton;
SearchBarPluginOptions(this.textField, this.iconButton);
}
class SearchBarPlugin implements MapPlugin {
@override
Widget createLayer(LayerOptions options, MapState mapState) {
if (options is SearchBarPluginOptions) {
return Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(255, 255, 255, 0.9),
borderRadius: BorderRadius.circular(25.0),
),
margin: EdgeInsets.all(15.0),
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: options.textField,
),
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(255, 255, 255, 0.9),
borderRadius: BorderRadius.circular(25.0),
),
margin: EdgeInsets.all(15.0),
child: options.iconButton,
),
],
);
}
throw ("Unknown options type for MyCustom plugin: $options");
}
@override
bool supportsLayer(LayerOptions options) {
return options is SearchBarPluginOptions;
}
}
I have the following errors.
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown during performLayout():
flutter: BoxConstraints forces an infinite width.
I don't know if it's a bug or a parameter that's missing on my side.
I'm trying to have a row that contains a textfield and a iconButton like the one below.
I have the following errors.
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown during performLayout():
flutter: BoxConstraints forces an infinite width.
I don't know if it's a bug or a parameter that's missing on my side.