我想知道是否可以使用共享功能与其他人共享整个应用程序屏幕。在这种情况下,当该人通过whatsapp共享它时,当接收者按下共享内容时,将在我的应用程序(安装在他的设备上)上为他打开相同的屏幕。我有这个课程,是我应用程序中的屏幕,我想与其他人共享所有内容,就像您与某人共享instagram内容时一样。预先感谢您的帮助!
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:e_ai_casimiro/capas/diversos_capa.dart';
import 'package:share/share.dart';
import 'package:e_ai_casimiro/images/diversos_images.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class DiversosContact extends StatelessWidget {
final DocumentSnapshot diversos;
DiversosContact(this.diversos);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
}),
title: Image.asset("images/eaicasimiro2.png"),
centerTitle: true,
backgroundColor: Colors.purple[900],
actions: <Widget>[
IconButton(
icon: Icon(Icons.share),
onPressed: () {
Share.share();
})
],
),
backgroundColor: Colors.blueGrey[100],
body: SingleChildScrollView(
child: Column(children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
child: GestureDetector(
child: Stack(children: <Widget>[
ShaderMask(
child: Image.network(diversos.data["capa"]),
shaderCallback: (Rect bounds) {
return LinearGradient(
begin: FractionalOffset.center,
end: FractionalOffset.bottomCenter,
colors: [
Colors.grey.withOpacity(0.0),
Colors.black,
]).createShader(bounds);
},
blendMode: BlendMode.srcATop,
),
Positioned(
bottom: 10.0,
left: 15.0,
child: Text(
diversos.data["name"],
style: TextStyle(
fontSize: 35.0,
fontWeight: FontWeight.normal,
color: Colors.white),
),
)
]),
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DiversosCapa(diversos)));
},
),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Card(
elevation: 1.0,
child: GestureDetector(
child: Container(
height: 70.0,
width: 390.0,
color: Colors.white,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 15.0, horizontal: 15.0),
child: Center(
child: Text(
"Imagens",
style: TextStyle(
fontSize: 30.0, fontWeight:
FontWeight.bold),
),
),
),
),
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
DiversosImages(diversos)));
},
)),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Card(
elevation: 1.0,
child: GestureDetector(
child: Container(
height: 70.0,
width: 390.0,
color: Colors.white,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 15.0, horizontal: 15.0),
child: Center(
child: Text(
"WhatsApp",
style: TextStyle(
fontSize: 30.0, fontWeight:
FontWeight.bold),
),
),
),
),
onTap: () {
_callWhatsApp(context, diversos);
},
)),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Card(
elevation: 1.0,
child: GestureDetector(
child: Container(
height: 70.0,
width: 390.0,
color: Colors.white,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 15.0, horizontal: 15.0),
child: Center(
child: Text(
"Ligar",
style: TextStyle(
fontSize: 30.0, fontWeight:
FontWeight.bold),
),
),
),
),
onTap: () => launch("tel:" + diversos["telephone"]),
)),
),
]),
),
);
}
}
void _callWhatsApp(BuildContext context, DocumentSnapshot diversos)
async {
var whatsappUrl = "whatsapp://send?phone=" + diversos["phone"];
await launch(whatsappUrl);
}