ReactiveTextField.copyable constructor

ReactiveTextField.copyable({
  1. Key? key,
  2. required String text,
  3. String? label,
})

ReactiveTextField with trailing copy button.

Implementation

factory ReactiveTextField.copyable({
  Key? key,
  required String text,
  String? label,
}) => ReactiveTextField(
  key: key,
  state: TextFieldState(text: text, editable: false),
  label: label,
  floatingLabelBehavior: FloatingLabelBehavior.always,
  trailing: WidgetButton(
    onPressed: () {},
    onPressedWithDetails: (u) {
      PlatformUtils.copy(text: text);
      MessagePopup.success('label_copied'.l10n, at: u.globalPosition);
    },
    child: Center(child: SvgIcon(SvgIcons.copy)),
  ),
);