mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-22 08:24:21 +01:00
* Remove unneeded resource files from iOS Project * Remove breez_liquid_sdk.h * Remove outdated method to enforce bundling on AppDelegate * Add NSCameraUsageDescription to be able to scan QR codes on example app * Do not show "No Balance" text when balance is 0 * Wait for reconnect attempt on startup * Add a cancel button to mobile scanner * Bound size of QR image view * Reverse the payment list
53 lines
1.8 KiB
Dart
53 lines
1.8 KiB
Dart
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...'));
|
|
}
|
|
|
|
final walletInfo = walletInfoSnapshot.data!;
|
|
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
"${walletInfo.balanceSat} sats",
|
|
style: Theme.of(context).textTheme.headlineLarge?.copyWith(color: Colors.blue),
|
|
),
|
|
if (walletInfo.pendingReceiveSat != BigInt.zero) ...[
|
|
Text(
|
|
"Pending Receive: ${walletInfo.pendingReceiveSat} sats",
|
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(color: Colors.blueGrey),
|
|
),
|
|
],
|
|
if (walletInfo.pendingSendSat != BigInt.zero) ...[
|
|
Text(
|
|
"Pending Send: ${walletInfo.pendingSendSat} sats",
|
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(color: Colors.blueGrey),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|