Skip to content

Commit

Permalink
Merge pull request #404 from focustree/update-wallet-kit-packages
Browse files Browse the repository at this point in the history
update packages for wallet kit
  • Loading branch information
PaulRbl authored Oct 4, 2024
2 parents 42dfe39 + cba5e22 commit a3ab174
Show file tree
Hide file tree
Showing 23 changed files with 152 additions and 104 deletions.
2 changes: 1 addition & 1 deletion examples/nft_marketplace/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies:
flutter_dotenv: ^5.1.0
riverpod_annotation: ^2.3.5
riverpod: ^2.5.1
go_router: ^9.1.1
go_router: ^14.2.9

dev_dependencies:
flutter_test:
Expand Down
4 changes: 2 additions & 2 deletions examples/wallet_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies:
secure_store:
cupertino_icons: ^1.0.2
hooks_riverpod: ^2.3.6
flutter_hooks: ^0.18.6
go_router: ^9.0.3
flutter_hooks: ^0.20.5
go_router: ^14.2.9
hive_flutter: ^1.1.0

dev_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions packages/starknet_provider/lib/src/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ abstract class Provider implements ReadProvider {

class JsonRpcProvider extends JsonRpcReadProvider implements Provider {
const JsonRpcProvider({
required Uri nodeUri,
}) : super(nodeUri: nodeUri);
required super.nodeUri,
});

execute(List<Call> calls) async {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
package io.flutter.plugins;

import io.flutter.plugin.common.PluginRegistry;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;

import io.flutter.embedding.engine.FlutterEngine;

/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
}
}

private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
try {
flutterEngine.getPlugins().add(new com.example.secure_store.SecureStorePlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin secure_store, com.example.secure_store.SecureStorePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.webviewflutter.WebViewFlutterPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin webview_flutter_android, io.flutter.plugins.webviewflutter.WebViewFlutterPlugin", e);
}
registry.registrarFor(key);
return false;
}
}
4 changes: 2 additions & 2 deletions packages/wallet_kit/android/local.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sdk.dir=/Users/gabin/Library/Android/sdk
flutter.sdk=/Users/gabin/development/flutter
sdk.dir=/Users/paulreboullet/Library/Android/sdk
flutter.sdk=/usr/local/Caskroom/flutter/3.7.7/flutter
28 changes: 28 additions & 0 deletions packages/wallet_kit/ios/Runner/GeneratedPluginRegistrant.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,37 @@

#import "GeneratedPluginRegistrant.h"

#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
#import <path_provider_foundation/PathProviderPlugin.h>
#else
@import path_provider_foundation;
#endif

#if __has_include(<pointer_interceptor_ios/PointerInterceptorIosPlugin.h>)
#import <pointer_interceptor_ios/PointerInterceptorIosPlugin.h>
#else
@import pointer_interceptor_ios;
#endif

#if __has_include(<secure_store/SecureStorePlugin.h>)
#import <secure_store/SecureStorePlugin.h>
#else
@import secure_store;
#endif

#if __has_include(<webview_flutter_wkwebview/FLTWebViewFlutterPlugin.h>)
#import <webview_flutter_wkwebview/FLTWebViewFlutterPlugin.h>
#else
@import webview_flutter_wkwebview;
#endif

@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
[PointerInterceptorIosPlugin registerWithRegistrar:[registry registrarForPlugin:@"PointerInterceptorIosPlugin"]];
[SecureStorePlugin registerWithRegistrar:[registry registrarForPlugin:@"SecureStorePlugin"]];
[FLTWebViewFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTWebViewFlutterPlugin"]];
}

@end
20 changes: 10 additions & 10 deletions packages/wallet_kit/lib/ui/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:wallet_kit/ui/index.dart';

class PrimaryButton extends CustomButton {
PrimaryButton({
const PrimaryButton({
Key? key,
required String label,
void Function()? onPressed,
Expand All @@ -20,7 +20,7 @@ class PrimaryButton extends CustomButton {
}

class SecondaryButton extends CustomButton {
SecondaryButton({
const SecondaryButton({
Key? key,
required String label,
void Function()? onPressed,
Expand All @@ -43,7 +43,8 @@ class CustomIconButton extends StatelessWidget {
final double touchableArea;
final VoidCallback onPressed;

CustomIconButton({
const CustomIconButton({
super.key,
required this.icon,
required this.iconSize,
this.scaleFactor = 1.5,
Expand Down Expand Up @@ -105,19 +106,18 @@ class CustomButton extends HookWidget {
child: TextButton(
style: style ??
ButtonStyle(
minimumSize: MaterialStateProperty.all<Size>(
minimumSize: WidgetStateProperty.all<Size>(
const Size(0, primaryButtonHeight)),
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
backgroundColor: WidgetStateProperty.resolveWith<Color>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return Colors.grey[100]!;
}
return backgroundColor;
},
),
foregroundColor:
MaterialStateProperty.resolveWith<Color>((states) {
if (states.contains(MaterialState.disabled)) {
foregroundColor: WidgetStateProperty.resolveWith<Color>((states) {
if (states.contains(WidgetState.disabled)) {
return Colors.grey[400]!;
}
return textColor;
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet_kit/lib/ui/icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CustomIcon extends StatelessWidget {
final String? semanticLabel;
final TextDirection? textDirection;

CustomIcon(
const CustomIcon(
this.icon, {
Key? key,
this.size = 16,
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet_kit/lib/ui/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TextInput extends StatelessWidget {
final bool enabled;
final String? hintText;

TextInput({
const TextInput({
Key? key,
this.controller,
this.validator,
Expand Down
4 changes: 2 additions & 2 deletions packages/wallet_kit/lib/ui/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Layout extends StatelessWidget {
final CrossAxisAlignment crossAxisAlignment;
final MainAxisAlignment mainAxisAlignment;

Layout({
const Layout({
Key? key,
this.appBar,
this.topBar,
Expand Down Expand Up @@ -157,12 +157,12 @@ class Layout2 extends StatelessWidget {
verticalDirection: verticalDirection,
textDirection: textDirection,
textBaseline: textBaseline,
children: children,
top: top,
bottom: keyboardHeight > 0 ? bottom + keyboardHeight + 32 : bottom,
verticalSpacing: verticalSpacing,
sideMargin: sideMargin,
maxWidth: maxWidth,
children: children,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet_kit/lib/ui/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final walletThemeData = ThemeData(
labelSmall: baseTextStyle,
),
colorScheme: ColorScheme.fromSeed(seedColor: Colors.lightBlue)
.copyWith(background: backgrounColor),
.copyWith(surface: backgrounColor),
appBarTheme: const AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
Expand Down
8 changes: 4 additions & 4 deletions packages/wallet_kit/lib/ui/top_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TopBar extends StatelessWidget {
constraints: const BoxConstraints(minHeight: 56),
child: Stack(
children: [
Positioned(child: backButton, left: 0, top: 0),
Positioned(left: 0, top: 0, child: backButton),
Container(
color: Colors.red,
child: Center(
Expand All @@ -44,10 +44,10 @@ class TopBar extends StatelessWidget {
),
),
Positioned(
child: Container(
child: rightButton ?? Container(), color: Colors.green),
right: 0,
top: 0),
top: 0,
child: Container(
color: Colors.green, child: rightButton ?? Container())),
],
),
),
Expand Down
4 changes: 1 addition & 3 deletions packages/wallet_kit/lib/utils/debug_print.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'package:flutter/foundation.dart';

void debugPrint(String message) {
if (!kReleaseMode) {
print(message);
}
if (!kReleaseMode) {}
}
10 changes: 6 additions & 4 deletions packages/wallet_kit/lib/wallet_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ class WalletKit {
this.getPassword =
getPassword ?? (BuildContext context) => showPasswordModal(context);
provider = JsonRpcProvider(nodeUri: Uri.parse(rpc));
this.chainId = chainId != null ? Felt.fromHexString(chainId) :(await provider.chainId()).when(
result: (result) => Felt.fromHexString(result),
error: (error) => throw Exception(error),
);
this.chainId = chainId != null
? Felt.fromHexString(chainId)
: (await provider.chainId()).when(
result: (result) => Felt.fromHexString(result),
error: (error) => throw Exception(error),
);
this.accountClassHash = Felt.fromHexString(accountClassHash);
this.defaultMaxFee = Felt.fromDouble(defaultMaxFee * 1e18);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class CopyToClipboardButton extends StatelessWidget {
return TextButton.icon(
onPressed: () {
Clipboard.setData(ClipboardData(text: seedPhrase)).then((_) {
// ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Secret recovery phrase copied to clipboard"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class ConfirmPasswordScren extends HookConsumerWidget {
seedPhrase: 'daf',
);
isLoading.value = false;
// ignore: use_build_context_synchronously
Navigator.of(context).popUntil((route) => route.isFirst);
}
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ProtectWalletScreen extends HookConsumerWidget {
seedPhrase: seedPhrase,
);
isLoading.value = false;
// ignore: use_build_context_synchronously
Navigator.of(context).popUntil((route) => route.isFirst);
},
),
Expand All @@ -51,6 +52,7 @@ class ProtectWalletScreen extends HookConsumerWidget {
seedPhrase: seedPhrase,
);
isLoading.value = false;
// ignore: use_build_context_synchronously
Navigator.of(context).popUntil((route) => route.isFirst);
},
label: "Protect with password",
Expand Down
1 change: 1 addition & 0 deletions packages/wallet_kit/lib/widgets/icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class WalletTypeIcon extends StatelessWidget {
"packages/wallet_kit/assets/images/wallets/${type.name}.svg",
width: width,
fit: fit,
// ignore: deprecated_member_use
color: color,
alignment: alignment,
matchTextDirection: matchTextDirection,
Expand Down
Loading

0 comments on commit a3ab174

Please sign in to comment.