Bug fixes & improvements on Flutter plugin example app (#359)

* 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
This commit is contained in:
Erdem Yerebasmaz
2024-07-08 12:38:38 +03:00
committed by GitHub
parent 1a539d3de0
commit 015fb1f307
11 changed files with 172 additions and 15 deletions

View File

@@ -19,9 +19,6 @@ class Balance extends StatelessWidget {
return const Center(child: Text('Loading...'));
}
if (walletInfoSnapshot.requireData.balanceSat != BigInt.zero) {
return const Center(child: Text('No balance.'));
}
final walletInfo = walletInfoSnapshot.data!;
return Center(

View File

@@ -30,7 +30,7 @@ class PaymentList extends StatelessWidget {
);
}
final paymentList = paymentsSnapshot.data!;
List<Payment> paymentList = paymentsSnapshot.data!.reversed.toList();
return RefreshIndicator(
onRefresh: () async {

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_breez_liquid_example/routes/home/widgets/qr_scan/scan_overlay.dart';
import 'package:flutter_breez_liquid_example/routes/home/widgets/qr_scan/scanner_button_widgets.dart';
import 'package:flutter_breez_liquid_example/routes/home/widgets/qr_scan/scanner_error_widget.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
@@ -82,6 +83,7 @@ class _BarcodeScannerState extends State<BarcodeScanner> with WidgetsBindingObse
var scanWindowDimension = MediaQuery.of(context).size.width - 72;
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: [
MobileScanner(
scanWindow: Rect.fromCenter(
@@ -98,6 +100,18 @@ class _BarcodeScannerState extends State<BarcodeScanner> with WidgetsBindingObse
},
fit: BoxFit.cover,
),
Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 40),
child: CancelScanButton(controller: controller),
)
],
),
),
],
),
);

View File

@@ -128,3 +128,40 @@ class ToggleFlashlightButton extends StatelessWidget {
);
}
}
class CancelScanButton extends StatelessWidget {
const CancelScanButton({required this.controller, super.key});
final MobileScannerController controller;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(12.0),
),
border: Border.all(
color: Colors.white.withOpacity(0.8),
),
),
child: TextButton(
style: TextButton.styleFrom(
padding: const EdgeInsets.only(
right: 35,
left: 35,
),
),
onPressed: () async {
controller.stop().then((_) => Navigator.of(context).pop());
},
child: const Text(
"CANCEL",
style: TextStyle(
color: Colors.white,
),
),
),
);
}
}

View File

@@ -60,10 +60,14 @@ class _ReceivePaymentDialogState extends State<ReceivePaymentDialog> {
if (invoice != null) ...[
AspectRatio(
aspectRatio: 1,
child: QrImageView(
embeddedImage: const AssetImage("assets/icons/app_icon.png"),
data: invoice!.toUpperCase(),
size: 200.0,
child: SizedBox(
width: 200.0,
height: 200.0,
child: QrImageView(
embeddedImage: const AssetImage("assets/icons/app_icon.png"),
data: invoice!.toUpperCase(),
size: 200.0,
),
),
),
if (payerAmountSat != null && feesSat != null) ...[