Share Text
Step 1 We cannot directly remove the time stamp from Share Text but using the intl.dart package we can easily filter the date stamp from time stamp. So open your flutter project’s pubspec.yaml in code .
Step 2dependencies: flutter: sdk: flutter share: ^0.6.5+4 google_fonts: ^1.1.0
flutter pub get
import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:share/share.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Share Files', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.deepOrange, visualDensity: VisualDensity.comfortable, brightness: Brightness.dark, textTheme: GoogleFonts.montserratTextTheme( Theme.of(context).textTheme ) ), home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { String text = ''; String subject = ''; share(BuildContext context) { final RenderBox box = context.findRenderObject(); Share.share(text, subject: subject, sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Share Demo', home: Scaffold( appBar: AppBar( backgroundColor: Colors.green, title: const Text('Share Demo'), ), body: Container( padding: EdgeInsets.all(25.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ TextField( decoration: const InputDecoration( enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), borderSide: BorderSide(color: Colors.black26), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), borderSide: BorderSide(color: Colors.grey), ), contentPadding: EdgeInsets.all(4), labelText: ' Text', hintText: 'Enter some text or link to share', ), maxLines: 2, onChanged: (String txt) { setState(() { text = txt; }); }, ), SizedBox(height: 30,), TextField( decoration: const InputDecoration( enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), borderSide: BorderSide(color: Colors.black26), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), borderSide: BorderSide(color: Colors.grey), ), contentPadding: EdgeInsets.all(4), labelText: ' Text', hintText: 'Enter some subject to share', ), maxLines: 2, onChanged: (String txt) { setState(() { subject = txt; }); }, ), SizedBox( height: 20, ), Builder( builder: (BuildContext context) { return RaisedButton( child: const Text('Share'), color: Colors.green, onPressed: text.isEmpty ? null : () { share(context); }, ); }, ), ], ), ), ), ); } }