Skip to content
Open
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
44 changes: 43 additions & 1 deletion packages/pos_client/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
include: package:flutter_lints/flutter.yaml
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:lints/recommended.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
non_constant_identifier_names: false
constant_identifier_names: false
avoid_print: true
prefer_single_quotes: true
sort_pub_dependencies: true
avoid_unnecessary_containers: true
cancel_subscriptions: true
prefer_const_constructors: true
prefer_const_literals_to_create_immutables: true
avoid_field_initializers_in_const_classes: true

analyzer:
exclude:
- '**.freezed.dart'
- '**.g.dart'
- '**/*.freezed.dart'
- '**/*.g.dart'
- '**/generated_plugin_registrant.dart'
errors:
invalid_annotation_target: ignore
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
26 changes: 22 additions & 4 deletions packages/pos_client/example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,40 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
include: package:lints/recommended.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
non_constant_identifier_names: false
constant_identifier_names: false
avoid_print: true
prefer_single_quotes: true
sort_pub_dependencies: true
avoid_unnecessary_containers: true
cancel_subscriptions: true
prefer_const_constructors: true
# prefer_const_literals_to_create_immutables: true
avoid_field_initializers_in_const_classes: true

analyzer:
exclude:
- '**.freezed.dart'
- '**.g.dart'
- '**/*.freezed.dart'
- '**/*.g.dart'
- '**/generated_plugin_registrant.dart'
errors:
invalid_annotation_target: ignore
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
2 changes: 1 addition & 1 deletion packages/pos_client/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter/foundation.dart' show kIsWeb;

void main() {
runApp(ProviderScope(child: const MyApp()));
runApp(const ProviderScope(child: MyApp()));
}

class MyApp extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,55 +196,61 @@ enum SupportedNetwork {
PosNetwork get posNetwork {
switch (this) {
case SupportedNetwork.ethereum:
return PosNetwork(name: 'Ethereum', chainId: 'eip155:1');
return const PosNetwork(name: 'Ethereum', chainId: 'eip155:1');
case SupportedNetwork.polygon:
return PosNetwork(name: 'Polygon', chainId: 'eip155:137');
return const PosNetwork(name: 'Polygon', chainId: 'eip155:137');
case SupportedNetwork.binanceSmartChain:
return PosNetwork(name: 'BNB Smart Chain', chainId: 'eip155:56');
return const PosNetwork(name: 'BNB Smart Chain', chainId: 'eip155:56');
case SupportedNetwork.avalanche:
return PosNetwork(name: 'Avalanche', chainId: 'eip155:43114');
return const PosNetwork(name: 'Avalanche', chainId: 'eip155:43114');
case SupportedNetwork.arbitrum:
return PosNetwork(name: 'Arbitrum One', chainId: 'eip155:42161');
return const PosNetwork(name: 'Arbitrum One', chainId: 'eip155:42161');
case SupportedNetwork.optimism:
return PosNetwork(name: 'Optimism', chainId: 'eip155:10');
return const PosNetwork(name: 'Optimism', chainId: 'eip155:10');
case SupportedNetwork.base:
return PosNetwork(name: 'Base', chainId: 'eip155:8453');
return const PosNetwork(name: 'Base', chainId: 'eip155:8453');
case SupportedNetwork.fantom:
return PosNetwork(name: 'Fantom', chainId: 'eip155:250');
return const PosNetwork(name: 'Fantom', chainId: 'eip155:250');
case SupportedNetwork.cronos:
return PosNetwork(name: 'Cronos', chainId: 'eip155:25');
return const PosNetwork(name: 'Cronos', chainId: 'eip155:25');
case SupportedNetwork.polygonZkEVM:
return PosNetwork(name: 'Polygon zkEVM', chainId: 'eip155:1101');
return const PosNetwork(name: 'Polygon zkEVM', chainId: 'eip155:1101');
case SupportedNetwork.sepolia:
return PosNetwork(name: 'Sepolia ETH', chainId: 'eip155:11155111');
return const PosNetwork(
name: 'Sepolia ETH',
chainId: 'eip155:11155111',
);
case SupportedNetwork.gnosis:
return PosNetwork(name: 'Gnosis Chain', chainId: 'eip155:100');
return const PosNetwork(name: 'Gnosis Chain', chainId: 'eip155:100');
case SupportedNetwork.zkSyncEra:
return PosNetwork(name: 'zkSync Era', chainId: 'eip155:324');
return const PosNetwork(name: 'zkSync Era', chainId: 'eip155:324');
case SupportedNetwork.mantle:
return PosNetwork(name: 'Mantle', chainId: 'eip155:5000');
return const PosNetwork(name: 'Mantle', chainId: 'eip155:5000');
case SupportedNetwork.klaytn:
return PosNetwork(name: 'Klaytn Mainnet', chainId: 'eip155:8217');
return const PosNetwork(name: 'Klaytn Mainnet', chainId: 'eip155:8217');
case SupportedNetwork.celo:
return PosNetwork(name: 'Celo', chainId: 'eip155:42220');
return const PosNetwork(name: 'Celo', chainId: 'eip155:42220');
case SupportedNetwork.linea:
return PosNetwork(name: 'Linea', chainId: 'eip155:59144');
return const PosNetwork(name: 'Linea', chainId: 'eip155:59144');
case SupportedNetwork.baseSepolia:
return PosNetwork(name: 'Base Sepolia', chainId: 'eip155:84531');
return const PosNetwork(name: 'Base Sepolia', chainId: 'eip155:84531');
case SupportedNetwork.solana:
return PosNetwork(
return const PosNetwork(
name: 'Solana',
chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
);
case SupportedNetwork.solanaDevnet:
return PosNetwork(
return const PosNetwork(
name: 'Solana Devnet',
chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
);
case SupportedNetwork.tron:
return PosNetwork(name: 'Tron', chainId: 'tron:0x2b6653dc');
return const PosNetwork(name: 'Tron', chainId: 'tron:0x2b6653dc');
case SupportedNetwork.tronTestnet:
return PosNetwork(name: 'Tron Testnet', chainId: 'tron:0xcd8690dc');
return const PosNetwork(
name: 'Tron Testnet',
chainId: 'tron:0xcd8690dc',
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import 'package:pos_client/pos_client.dart';
/// Reown POS plugin instance
final posClilentProvider = Provider<IPosClient>((ref) {
// [PosClient SDK API] 1. Construct your RoenPos instance
final metadata = Metadata(
final metadata = const Metadata(
merchantName: 'DTC Pay',
description: 'Secure Crypto Payment Terminal',
url: 'https://appkit-lab.reown.com',
logoIcon: 'https://avatars.githubusercontent.com/u/179229932',
);
return PosClient(
projectId: '50f81661a58229027394e0a19e9db752',
deviceId: "sample_pos_device_${DateTime.now().microsecondsSinceEpoch}",
deviceId: 'sample_pos_device_${DateTime.now().microsecondsSinceEpoch}',
metadata: metadata,
);
});
6 changes: 3 additions & 3 deletions packages/pos_client/example/lib/screens/amount_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _AmountScreenState extends ConsumerState<AmountScreen> {
void _navigateToTokenScreen() {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => TokenScreen()),
MaterialPageRoute(builder: (context) => const TokenScreen()),
);
}

Expand Down Expand Up @@ -171,7 +171,7 @@ class _AmountScreenState extends ConsumerState<AmountScreen> {
),
),
const SizedBox(height: 10),
SizedBox(
const SizedBox(
width: double.infinity,
height: 56,
child: DtcRestartButton(),
Expand All @@ -184,7 +184,7 @@ class _AmountScreenState extends ConsumerState<AmountScreen> {
),
),
),
bottomNavigationBar: DtcFooter(),
bottomNavigationBar: const DtcFooter(),
);
}
}
12 changes: 6 additions & 6 deletions packages/pos_client/example/lib/screens/network_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _NetworkScreenState extends ConsumerState<NetworkScreen> {
return AlertDialog(
title: Text('${event.runtimeType}'),
content: Text(event.message),
actions: [DtcRestartButton()],
actions: [const DtcRestartButton()],
);
},
);
Expand All @@ -59,7 +59,7 @@ class _NetworkScreenState extends ConsumerState<NetworkScreen> {
posInstance.createPaymentIntent(paymentIntents: [paymentInfo]);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PaymentScreen()),
MaterialPageRoute(builder: (context) => const PaymentScreen()),
);
}

Expand Down Expand Up @@ -165,15 +165,15 @@ class _NetworkScreenState extends ConsumerState<NetworkScreen> {
trailing:
network.chainId ==
paymentInfo.token.network.chainId
? Icon(Icons.check)
? const Icon(Icons.check)
: null,
),
),
);
},
itemCount: avaibleNetworks.length,
separatorBuilder: (BuildContext context, int index) {
return SizedBox.square(dimension: 12.0);
return const SizedBox.square(dimension: 12.0);
},
),
),
Expand Down Expand Up @@ -204,7 +204,7 @@ class _NetworkScreenState extends ConsumerState<NetworkScreen> {
),
),
const SizedBox(height: 10),
SizedBox(
const SizedBox(
width: double.infinity,
height: 56,
child: DtcRestartButton(),
Expand All @@ -217,7 +217,7 @@ class _NetworkScreenState extends ConsumerState<NetworkScreen> {
),
),
),
bottomNavigationBar: DtcFooter(),
bottomNavigationBar: const DtcFooter(),
);
}
}
18 changes: 9 additions & 9 deletions packages/pos_client/example/lib/screens/payment_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
child: Column(
children: [
// Screen header
DtcHeader(
const DtcHeader(
title: 'Scan to Pay',
description: 'Step 5: Customer scans QR',
),
Expand Down Expand Up @@ -92,7 +92,7 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
// Payment Details Card
_PaymentInfoWidget(),
const SizedBox(height: 24),
SizedBox(
const SizedBox(
width: double.infinity,
height: 56,
child: DtcRestartButton(),
Expand All @@ -105,7 +105,7 @@ class _PaymentScreenState extends ConsumerState<PaymentScreen> {
),
),
),
bottomNavigationBar: DtcFooter(),
bottomNavigationBar: const DtcFooter(),
);
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> {
@override
Widget build(BuildContext context) {
if (_eventsPool.isEmpty) {
return SizedBox.shrink();
return const SizedBox.shrink();
}
final currentEvent = _eventsPool.last;
return Column(
Expand Down Expand Up @@ -234,7 +234,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> {
),
Visibility(
visible: isLoading && !isFailed,
child: SizedBox.square(
child: const SizedBox.square(
dimension: 8,
child: CircularProgressIndicator(
strokeWidth: 2.0,
Expand All @@ -247,7 +247,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> {
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
Expand Down Expand Up @@ -277,7 +277,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> {
return AlertDialog(
title: Text(title),
content: Text(message),
actions: [DtcRestartButton()],
actions: [const DtcRestartButton()],
);
},
);
Expand All @@ -293,7 +293,7 @@ class _PaymentInfoWidget extends ConsumerWidget {
children: [
Text(
'\$${paymentInfo.amount}',
style: TextStyle(
style: const TextStyle(
color: Colors.black,
fontSize: 24,
fontWeight: FontWeight.bold,
Expand All @@ -303,7 +303,7 @@ class _PaymentInfoWidget extends ConsumerWidget {
const SizedBox(height: 8),
Text(
'${paymentInfo.token.symbol.toUpperCase()} on ${paymentInfo.token.network.name}',
style: TextStyle(
style: const TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.normal,
Expand Down
Loading