Change report view to WebView
This commit is contained in:
parent
3c984c445c
commit
b9edfd1016
2 changed files with 21 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ class BlockReportModal extends StatelessWidget {
|
|||
width: double.infinity,
|
||||
child: ReportButton(
|
||||
userLogin: userLogin,
|
||||
name: name,
|
||||
displayName: name,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,22 +1,37 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class ReportButton extends StatelessWidget {
|
||||
final String userLogin;
|
||||
final String? name;
|
||||
final String displayName;
|
||||
|
||||
const ReportButton({
|
||||
Key? key,
|
||||
required this.userLogin,
|
||||
this.name,
|
||||
required this.displayName,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return OutlinedButton.icon(
|
||||
icon: const Icon(Icons.report),
|
||||
onPressed: () => launch('https://www.twitch.tv/$userLogin/report'),
|
||||
label: Text(name == null ? 'Report' : 'Report $name'),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Report'),
|
||||
),
|
||||
body: WebView(
|
||||
initialUrl: 'https://www.twitch.tv/$userLogin/report',
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
label: Text('Report $displayName'),
|
||||
style: OutlinedButton.styleFrom(primary: Colors.red),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue