class _MyHomePageState extends State<MyHomePage> {
String walletAddress = ''; // Variable to hold the wallet address
@override
Widget build(BuildContext context) {
// Determine the text content based on walletAddress
String buttonText = walletAddress.isEmpty ? 'Create' : 'Transfer';
return Scaffold(
appBar: AppBar(
title: const Text('FuseBox Mobile App'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
onTap: () async {
print("OKKK");
const apiKey = 'API_KEY';
final privateKey = EthPrivateKey.fromHex(
'EOA_PRIVATE_KEY’);
final fuseSDK = await FuseSDK.init(apiKey, privateKey);
String address = fuseSDK.wallet.getSender();
print('Smart contract wallet address: $address');
setState(() {
// Update the walletAddress variable with the obtained address
walletAddress = address;
});
},
child: Container(
height: 45,
width: 130,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xff9DCEFF), Color(0xff92A3FD)]),
borderRadius: BorderRadius.circular(50)),
child: Center(
child: Text(
buttonText,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 14),
),
),
),
),
const SizedBox(
height: 15,
),
Container(
height:50,
width: 300,
decoration: BoxDecoration(
color: Colors.green, borderRadius: BorderRadius.circular(4)),
child: Center(
child: Text(
'SCW: $walletAddress',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w100,
fontSize: 12),
),
),
),
],
),
),
);
}
}