Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for Sample Wallet #262

Merged
merged 1 commit into from
Feb 7, 2024
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
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
Loading