check share plugin usage (#567)

* replace share plugin with share_plus

* fix share button on receive screen

* add share button for btc, ltc wallets
This commit is contained in:
Serhii 2022-10-26 18:05:08 +03:00 committed by GitHub
parent 95ecf4ef56
commit 4f2cf983de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 29 deletions

View file

@ -15,6 +15,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:keyboard_actions/keyboard_actions.dart'; import 'package:keyboard_actions/keyboard_actions.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:share_plus/share_plus.dart';
class AddressPage extends BasePage { class AddressPage extends BasePage {
AddressPage({ AddressPage({
@ -85,6 +86,26 @@ class AddressPage extends BasePage {
], begin: Alignment.topRight, end: Alignment.bottomLeft)), ], begin: Alignment.topRight, end: Alignment.bottomLeft)),
child: scaffold); child: scaffold);
@override
Widget? trailing(BuildContext context) {
final shareImage =
Image.asset('assets/images/share.png',
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!);
return !addressListViewModel.hasAddressList ? Material(
color: Colors.transparent,
child: IconButton(
padding: EdgeInsets.zero,
constraints: BoxConstraints(),
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
iconSize: 25,
onPressed: () => Share.share(addressListViewModel.address.address),
icon: shareImage,
),
) : null;
}
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
autorun((_) async { autorun((_) async {

View file

@ -6,7 +6,7 @@ import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
// import 'package:esys_flutter_share/esys_flutter_share.dart'; import 'package:share_plus/share_plus.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/di.dart';
@ -92,23 +92,17 @@ class ReceivePage extends BasePage {
Image.asset('assets/images/share.png', Image.asset('assets/images/share.png',
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!); color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!);
return SizedBox( return Material(
height: 20.0, color: Colors.transparent,
width: 20.0, child: IconButton(
child: ButtonTheme( padding: EdgeInsets.zero,
minWidth: double.minPositive, constraints: BoxConstraints(),
child: TextButton( highlightColor: Colors.transparent,
// FIX-ME: Style splashColor: Colors.transparent,
//highlightColor: Colors.transparent, iconSize: 25,
//splashColor: Colors.transparent, onPressed: () => Share.share(addressListViewModel.address.address),
//padding: EdgeInsets.all(0), icon: shareImage
onPressed: () { )
// FIX-ME: Share esys_flutter_share.dart
// Share.text(S.current.share_address,
// addressListViewModel.address.address, 'text/plain')
},
child: shareImage),
),
); );
} }

View file

@ -6,7 +6,7 @@ import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
// import 'package:esys_flutter_share/esys_flutter_share.dart'; import 'package:share_plus/share_plus.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -159,13 +159,8 @@ class WalletSeedPage extends BasePage {
child: Container( child: Container(
padding: EdgeInsets.only(right: 8.0), padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton( child: PrimaryButton(
onPressed: () { onPressed: () =>
// FIX-ME: Share esys_flutter_share Share.share(walletSeedViewModel.seed),
// Share.text(
// S.of(context).seed_share,
// walletSeedViewModel.seed,
// 'text/plain')
},
text: S.of(context).save, text: S.of(context).save,
color: Colors.green, color: Colors.green,
textColor: Colors.white), textColor: Colors.white),

View file

@ -25,9 +25,7 @@ dependencies:
mobx: ^2.0.7+4 mobx: ^2.0.7+4
flutter_mobx: ^2.0.6+1 flutter_mobx: ^2.0.6+1
flutter_slidable: ^2.0.0 flutter_slidable: ^2.0.0
share: ^2.0.1 share_plus: ^4.0.10
# share_plus: ^4.0.10
# esys_flutter_share: ^1.0.2
# date_range_picker: ^1.0.6 # date_range_picker: ^1.0.6
#https://api.flutter.dev/flutter/material/showDateRangePicker.html #https://api.flutter.dev/flutter/material/showDateRangePicker.html
dio: ^4.0.6 dio: ^4.0.6