Update example app on Flutter plugin (#220)

* Update example app on Flutter plugin

* Expose `empty_wallet_cache` through Dart bindings (#224)
This commit is contained in:
Erdem Yerebasmaz
2024-05-24 12:12:29 +03:00
committed by GitHub
parent c7b46314f4
commit 7b1b78a2d9
38 changed files with 1821 additions and 167 deletions

View File

@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter_breez_liquid/flutter_breez_liquid.dart';
class Balance extends StatelessWidget {
final Stream<GetInfoResponse> walletInfoStream;
const Balance({super.key, required this.walletInfoStream});
@override
Widget build(BuildContext context) {
return StreamBuilder<GetInfoResponse>(
stream: walletInfoStream,
builder: (context, walletInfoSnapshot) {
if (walletInfoSnapshot.hasError) {
return Center(child: Text('Error: ${walletInfoSnapshot.error}'));
}
if (!walletInfoSnapshot.hasData) {
return const Center(child: Text('Loading...'));
}
if (walletInfoSnapshot.requireData.balanceSat.isNaN) {
return const Center(child: Text('No balance.'));
}
final walletInfo = walletInfoSnapshot.data!;
return Center(
child: Text(
"${walletInfo.balanceSat} sats",
style: Theme.of(context).textTheme.headlineLarge?.copyWith(color: Colors.blue),
),
);
},
);
}
}