Copy to clipbaord
This commit is contained in:
parent
e325d8be9d
commit
fc99295017
|
|
@ -0,0 +1,31 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
|
|
||||||
|
class CopyToClipboard extends StatelessWidget {
|
||||||
|
const CopyToClipboard({
|
||||||
|
Key key,
|
||||||
|
this.value,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
|
return InkWell(
|
||||||
|
child: Text(value),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: value));
|
||||||
|
showToast(
|
||||||
|
localization.copiedToClipboard.replaceFirst(
|
||||||
|
':value',
|
||||||
|
value.replaceAll('\n', ' '),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/blank_screen.dart';
|
import 'package:invoiceninja_flutter/ui/app/blank_screen.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/buttons/app_text_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/buttons/app_text_button.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/copy_to_clipboard.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
|
@ -95,7 +96,7 @@ class ViewScaffold extends StatelessWidget {
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
leading: leading,
|
leading: leading,
|
||||||
automaticallyImplyLeading: isMobile(context),
|
automaticallyImplyLeading: isMobile(context),
|
||||||
title: Text(title),
|
title: CopyToClipboard(value: title),
|
||||||
bottom: appBarBottom,
|
bottom: appBarBottom,
|
||||||
actions: entity.isNew
|
actions: entity.isNew
|
||||||
? []
|
? []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue