Files
fluwx/example/lib/send_auth.dart
2018-09-06 17:54:18 +08:00

56 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:fluwx/fluwx.dart';
class SendAuthPage extends StatefulWidget {
@override
_SendAuthPageState createState() => _SendAuthPageState();
}
class _SendAuthPageState extends State<SendAuthPage> {
Fluwx _fluwx;
String _result = "";
@override
void initState() {
super.initState();
_fluwx = new Fluwx();
_fluwx.response.listen((data) {
setState(() {
_result = data.toString();
});
});
}
@override
void dispose() {
super.dispose();
_result = null;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Send Auth"),
),
body: Column(
children: <Widget>[
OutlineButton(
onPressed: () {
_fluwx
.sendAuth(new WeChatSendAuthModel(
scope: "snsapi_userinfo", state: "wechat_sdk_demo_test"))
.then((data) {
print("-------->$data");
});
},
child: const Text("send auth"),
),
const Text("响应结果;"),
Text(_result)
],
),
);
}
}