Add link
This commit is contained in:
parent
0d412f2a5a
commit
a3b25c3ee1
2 changed files with 21 additions and 5 deletions
|
@ -2,16 +2,17 @@ import 'package:flutter/material.dart';
|
|||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class Link extends StatelessWidget {
|
||||
const Link({Key? key, required this.uri}) : super(key: key);
|
||||
const Link({Key? key, required this.uri, this.label}) : super(key: key);
|
||||
|
||||
final String uri;
|
||||
final String? label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
child: Text(uri,
|
||||
child: Text(label ?? uri,
|
||||
style: const TextStyle(decoration: TextDecoration.underline)),
|
||||
onTap: () {
|
||||
launch(uri);
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:desktopapp/widgets/components/link.dart' as link;
|
||||
|
||||
class Step3 extends StatelessWidget {
|
||||
const Step3({Key? key}) : super(key: key);
|
||||
|
||||
Widget buildContent(BuildContext context, SharedPreferences prefs) {
|
||||
var clientId = prefs.getString('client_id');
|
||||
return Column(children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
child: Text('Étape 3:Authorisation de l\'application',
|
||||
style: TextStyle(fontSize: 20)),
|
||||
),
|
||||
const Text(
|
||||
'Pour pouvoir utiliser l\'application, il faut récupérer les clefs associées à l\'application créée juste avant.'),
|
||||
link.Link(
|
||||
uri:
|
||||
'https://streamlabs.com/api/v1.0/authorize?redirect_uri=http://localhost:1234/&client_id=$clientId&response_type=code&scope=alerts.create',
|
||||
label: 'Cliquez ici pour vous connecter à Streamlabs',
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -36,6 +40,17 @@ class Step3 extends StatelessWidget {
|
|||
..headers.contentType = ContentType.text
|
||||
..write('You can close tab now')
|
||||
..close();
|
||||
|
||||
// SEND TOKEN ASK TO API
|
||||
// POST https://streamlabs.com/api/v1.0/token
|
||||
// {
|
||||
// "grant_type": "authorization_code",
|
||||
// "code": "CODE",
|
||||
// "redirect_uri": "http://localhost:1234/",
|
||||
// "client_id": "CLIENT_ID",
|
||||
// "client_secret": "CLIENT_SECRET"
|
||||
// }
|
||||
// SAVE RESPONSE TOKEN AS CREDENTIALS IN SHARED PREFERENCES
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue