form_builder_map_field 1.0.0-alpha.1 form_builder_map_field: ^1.0.0-alpha.1 copied to clipboard
Location Input Field for flutter_form_builder package. Used to select coodinates on a map.
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_map_field/form_builder_map_field.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'FormBuilderMapField Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
GlobalKey<FormBuilderState> _formKey = GlobalKey();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('FormBuilderMapField Example'),
),
body: FormBuilder(
key: _formKey,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Container(
child: FormBuilderLocationField(
name: 'coordinates',
decoration: InputDecoration(labelText: 'Select Location'),
markerIconColor: Colors.red,
markerIconSize: 50,
onChanged: (val) {
print(val);
},
),
),
],
),
),
),
);
}
}