kopo 0.1.2 kopo: ^0.1.2 copied to clipboard
find Korea Postal address
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:kopo/kopo.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: 'Kopo Demo',
home: RootPage(),
);
}
}
class RootPage extends StatefulWidget {
@override
_RootPageState createState() => _RootPageState();
}
class _RootPageState extends State<RootPage> {
String addressJSON = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Kopo Demo'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
FlatButton(
child: Text('find Korea Postal address'),
onPressed: () async {
KopoModel model = await Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => Kopo(),
),
);
print(model.toJson());
setState(() {
addressJSON =
'${model.address} ${model.buildingName}${model.apartment == 'Y' ? '아파트' : ''} ${model.zonecode} ';
});
},
),
Text('$addressJSON'),
],
),
);
}
}