@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Google Maps'),
),
body: Column(
children: [
Row(
children: [
TextFormField(),
IconButton(onPressed: () {}, icon: Icon(Icons.search))
],
)
],
),
GoogleMap(
mapType: MapType.normal,
markers: _markers,
initialCameraPosition: CameraPosition(target: _kGooglePlex, zoom: 14),
onMapCreated: _onMapCreated,
)
);
}
I was following a tutorial video however when I add a column to add a search bar to try google places API, the Google Map part of the code triggered a too many positional argument, I am still new in flutter so I have no idea how to fix this.
Adding a search bar on the google map so I could try the google places API
CodePudding user response:
You need to place widget inside childred
.
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Google Maps'),
),
body: Column(
children: [
Row(
children: [
TextFormField(),
IconButton(onPressed: () {}, icon: Icon(Icons.search))
],
),
GoogleMap( //inside column
mapType: MapType.normal,
markers: _markers,
initialCameraPosition:
CameraPosition(target: _kGooglePlex, zoom: 14),
onMapCreated: _onMapCreated,
)
],
),
);
}
Find more about Column
CodePudding user response:
You can use Flutter Typeahead field for Google Place search field.. I hope it's help you :}