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';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class Link extends StatelessWidget {
|
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 uri;
|
||||||
|
final String? label;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text(uri,
|
child: Text(label ?? uri,
|
||||||
style: const TextStyle(decoration: TextDecoration.underline)),
|
style: const TextStyle(decoration: TextDecoration.underline)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
launch(uri);
|
launch(uri);
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:desktopapp/widgets/components/link.dart' as link;
|
||||||
|
|
||||||
class Step3 extends StatelessWidget {
|
class Step3 extends StatelessWidget {
|
||||||
const Step3({Key? key}) : super(key: key);
|
const Step3({Key? key}) : super(key: key);
|
||||||
|
|
||||||
Widget buildContent(BuildContext context, SharedPreferences prefs) {
|
Widget buildContent(BuildContext context, SharedPreferences prefs) {
|
||||||
|
var clientId = prefs.getString('client_id');
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
child: Text('Étape 3:Authorisation de l\'application',
|
child: Text('Étape 3:Authorisation de l\'application',
|
||||||
style: TextStyle(fontSize: 20)),
|
style: TextStyle(fontSize: 20)),
|
||||||
),
|
),
|
||||||
const Text(
|
link.Link(
|
||||||
'Pour pouvoir utiliser l\'application, il faut récupérer les clefs associées à l\'application créée juste avant.'),
|
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
|
..headers.contentType = ContentType.text
|
||||||
..write('You can close tab now')
|
..write('You can close tab now')
|
||||||
..close();
|
..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
|
@override
|
||||||
|
|
Loading…
Reference in a new issue