Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/redeem_ecash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ class _EcashRedeemPromptState extends State<EcashRedeemPrompt> {
],
],
],
const SizedBox(height: 16),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/scan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ class _ScanQRPageState extends State<ScanQRPage> {
amount: field0,
);
},
heightFactor: 0.5,
fitContent: true,
);
invoicePaidToastVisible.value = true;
widget.onPay(chosenFederation!, false);
Expand Down
26 changes: 22 additions & 4 deletions lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Future<T?> showAppModalBottomSheet<T>({
required Future<Widget> Function() childBuilder,
double? heightFactor,
String? errorMessage,
// Size the sheet to its content, capped at [heightFactor] of the screen
// (default 0.9), instead of a fixed fraction.
bool fitContent = false,
}) {
final childFuture = childBuilder();
return showModalBottomSheet<T>(
Expand All @@ -65,10 +68,23 @@ Future<T?> showAppModalBottomSheet<T>({
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
builder: (context) {
Widget sized(Widget child) =>
fitContent
? ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
MediaQuery.sizeOf(context).height * (heightFactor ?? 0.9),
),
child: child,
)
: FractionallySizedBox(
heightFactor: heightFactor ?? 0.8,
child: child,
);

return SafeArea(
child: FractionallySizedBox(
heightFactor: heightFactor ?? 0.8,
child: Padding(
child: sized(
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
Expand All @@ -86,12 +102,14 @@ Future<T?> showAppModalBottomSheet<T>({
),
),
// Async content
Expanded(
Flexible(
fit: fitContent ? FlexFit.loose : FlexFit.tight,
child: FutureBuilder<Widget>(
future: childFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(
heightFactor: 1,
child: Padding(
padding: EdgeInsets.all(24.0),
child: CircularProgressIndicator(),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/transaction_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class _TransactionDetailsState extends State<TransactionDetails> {
amount: amount,
);
},
heightFactor: 0.33,
fitContent: true,
);
invoicePaidToastVisible.value = true;
}
Expand Down
Loading