Reputation: 1811
import 'package:flutter/material.dart';
import 'package:share/share.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Stop addiction',
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: Scaffold(
appBar: AppBar(backgroundColor:Colors.black,
title: Text('stop addiction',style:TextStyle(color:Colors.red),),centerTitle: true,actions: <Widget>[
IconButton(icon: Icon(Icons.share,color:Colors.white70,), onPressed:Share.share('check out my website https://example.com');)
],
),
body: _blank()
),
);
}
}
Questions:
Upvotes: 0
Views: 43
Reputation: 11651
The code should be
IconButton(icon: Icon(Icons.share,color:Colors.white70,), onPressed:() => Share.share('check out my website https://example.com')/*semicolon removed here*/)
And, remove the semicolon
Upvotes: 1