import 'package:flutter/material.dart'; class IndexPage extends StatefulWidget { IndexPage( {Key? key, required this.uuid, required this.wallet, required this.setWallet}) : super(key: key); final String uuid; String wallet; final Function setWallet; @override _IndexPageState createState() => _IndexPageState(); } class _IndexPageState extends State { late String wallet; @override void initState() { super.initState(); wallet = widget.wallet; } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(wallet), ), // Get wallet list from api and display here body: Center( child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ TextButton( onPressed: () => setWallet('wallet1'), child: Text('Wallet 1')), TextButton( onPressed: () => setWallet('wallet2'), child: Text('Wallet 2')), TextButton( onPressed: () => setWallet('wallet3'), child: Text('Wallet 3')), ], ); }, ), ), ); } void setWallet(String s) { setState(() { wallet = s; }); widget.setWallet(s); } }