mirror of
https://github.com/OpenFlutter/fluwx.git
synced 2025-08-06 14:50:30 +08:00
51 lines
1.1 KiB
Dart
51 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:fluwx/fluwx.dart' as fluwx;
|
|
|
|
class LaunchMiniProgramPage extends StatefulWidget {
|
|
@override
|
|
_LaunchMiniProgramPageState createState() => _LaunchMiniProgramPageState();
|
|
}
|
|
|
|
class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> {
|
|
String _result = "无";
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
fluwx.responseFromLaunchMiniProgram.listen((data) {
|
|
setState(() {
|
|
_result = "${data.extMsg}";
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
_result = null;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Launch MiniProgrom"),
|
|
),
|
|
body: Column(
|
|
children: <Widget>[
|
|
OutlineButton(
|
|
onPressed: () {
|
|
fluwx.launchMiniProgram(username: "gh_d43f693ca31f").then((data) {
|
|
print(data);
|
|
});
|
|
},
|
|
child: const Text("Launch MiniProgrom"),
|
|
),
|
|
const Text("响应结果;"),
|
|
Text(_result)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|