Skip to content

Commit

Permalink
Merge pull request #262 from WalletConnect/chore/wallet_app_bug_fixes
Browse files Browse the repository at this point in the history
Bug fixes for Sample Wallet
  • Loading branch information
quetool committed Feb 7, 2024
2 parents ddc27c5 + 014f858 commit 25a3828
Show file tree
Hide file tree
Showing 20 changed files with 572 additions and 332 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.0-beta02

- Improvements on example wallet

## 2.2.0-beta01

- Added Smart Contract interactions to SignEngine
Expand Down
9 changes: 5 additions & 4 deletions example/dapp/lib/widgets/session_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ class SessionWidgetState extends State<SessionWidget> {
child: ElevatedButton(
onPressed: () async {
await widget.web3App.disconnectSession(
topic: widget.session.topic,
reason: Errors.getSdkError(
Errors.USER_DISCONNECTED,
));
topic: widget.session.topic,
reason: Errors.getSdkError(
Errors.USER_DISCONNECTED,
),
);
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ class BottomSheetListenerState extends State<BottomSheetListener> {
maxHeight: MediaQuery.of(context).size.height * 0.9,
),
builder: (context) {
if (item.closeAfter > 0) {
Future.delayed(Duration(seconds: item.closeAfter), () {
Navigator.pop(context);
});
}
return Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(
StyleConstants.linear16,
),
Radius.circular(StyleConstants.linear16),
),
),
padding: EdgeInsets.only(
Expand All @@ -62,7 +65,23 @@ class BottomSheetListenerState extends State<BottomSheetListener> {
margin: const EdgeInsets.all(
StyleConstants.linear16,
),
child: item.widget,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
padding: const EdgeInsets.all(0.0),
visualDensity: VisualDensity.compact,
onPressed: () => Navigator.pop(context),
icon: const Icon(Icons.close_sharp),
),
],
),
Flexible(child: item.widget),
],
),
);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ class BottomSheetService extends IBottomSheetService {
@override
Future<dynamic> queueBottomSheet({
required Widget widget,
int closeAfter = 0,
}) async {
// Create the bottom sheet queue item
final completer = Completer<dynamic>();
final queueItem = BottomSheetQueueItem(
widget: widget,
completer: completer,
closeAfter: closeAfter,
);

// If the current sheet it null, set it to the queue item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ import 'package:flutter/material.dart';
class BottomSheetQueueItem {
final Widget widget;
final Completer<dynamic> completer;
final int closeAfter;

BottomSheetQueueItem({
required this.widget,
required this.completer,
this.closeAfter = 0,
});
}

abstract class IBottomSheetService {
abstract final ValueNotifier<BottomSheetQueueItem?> currentSheet;

Future<dynamic> queueBottomSheet({required Widget widget});
Future<dynamic> queueBottomSheet({
required Widget widget,
int closeAfter = 0,
});

void showNext();
}
Loading

0 comments on commit 25a3828

Please sign in to comment.