wallet card redesign
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
||||
class BalanceCopyState {
|
||||
final String label;
|
||||
final String payload;
|
||||
|
||||
const BalanceCopyState({required this.label, required this.payload});
|
||||
|
||||
bool get canCopy => payload.trim().isNotEmpty;
|
||||
}
|
||||
|
||||
class BalanceSourceCopyController {
|
||||
const BalanceSourceCopyController();
|
||||
|
||||
BalanceCopyState wallet(String? depositAddress) {
|
||||
return BalanceCopyState(
|
||||
label: 'Copy Deposit Address',
|
||||
payload: depositAddress?.trim() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
BalanceCopyState ledger(String? accountCode) {
|
||||
return BalanceCopyState(
|
||||
label: 'Copy Deposit Address',
|
||||
payload: accountCode?.trim() ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> copy(BalanceCopyState state) async {
|
||||
if (!state.canCopy) return false;
|
||||
await Clipboard.setData(ClipboardData(text: state.payload));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user