2020-01-17 10:08:12 +00:00
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
import 'package:fluffychat/components/matrix.dart';
|
2020-01-20 12:46:39 +00:00
|
|
|
import 'package:fluffychat/i18n/i18n.dart';
|
2020-01-17 10:08:12 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
|
|
|
|
class ContentWebView extends StatelessWidget {
|
|
|
|
final MxContent content;
|
|
|
|
|
|
|
|
const ContentWebView(this.content);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final String url = content.getDownloadLink(Matrix.of(context).client);
|
|
|
|
print(url);
|
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(
|
2020-01-20 12:46:39 +00:00
|
|
|
I18n.of(context).contentViewer,
|
2020-01-17 10:08:12 +00:00
|
|
|
),
|
|
|
|
actions: <Widget>[
|
|
|
|
IconButton(
|
|
|
|
icon: Icon(
|
|
|
|
Icons.file_download,
|
|
|
|
),
|
|
|
|
onPressed: () => launch(url),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
body: WebView(
|
|
|
|
initialUrl: url,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|