firewallet-mobile/lib/home.dart

65 lines
1.5 KiB
Dart
Raw Normal View History

2024-06-03 14:08:57 +10:00
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<IndexPage> {
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: <Widget>[
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);
}
}