address_form 0.0.2 address_form: ^0.0.2 copied to clipboard
A drop-in address form with autocomplete and validation.
example/lib/main.dart
import 'package:address_form/address_form.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.green, scaffoldBackgroundColor: Colors.white),
home: const MyHomePage(title: 'Address Form'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final mainKey = GlobalKey<AddressFormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
AddressForm(
apiKey: "",
mainKey: mainKey,
key: mainKey,
)
],
)),
);
}
}