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

ci: update to flutter latest stable and enforce infos #364

Merged
merged 11 commits into from
Dec 19, 2024
8 changes: 2 additions & 6 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Analyze

on:
push:
branches:
- main
pull_request:
branches:
- main
Expand All @@ -15,8 +12,8 @@ jobs:
strategy:
matrix:
analyze_mode:
- { name: "Infos allowed, Warnings fatal", mode: "--no-fatal-infos", allow_failure: false }
- { name: "Warnings allowed, Infos fatal: allow failure", mode: "--no-fatal-warnings", allow_failure: true }
- { name: "Warnings fatal, Infos allowed", mode: "--no-fatal-infos", allow_failure: false }
- { name: "Infos fatal, Warnings allowed", mode: "--no-fatal-warnings", allow_failure: false }

steps:
- name: Checkout Repository
Expand All @@ -26,7 +23,6 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.24.5

- name: Install dependencies
run: flutter pub get
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.24.5
architecture: x64

- run: flutter pub get
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Analyze](https://github.com/SatoshiPortal/bullbitcoin-mobile/actions/workflows/analyze.yml/badge.svg)](https://github.com/SatoshiPortal/bullbitcoin-mobile/actions/workflows/analyze.yml) [![Build](https://github.com/SatoshiPortal/bullbitcoin-mobile/actions/workflows/build.yml/badge.svg)](https://github.com/SatoshiPortal/bullbitcoin-mobile/actions/workflows/build.yml)

# About Bull Bitcoin Mobile

Bull Bitcoin Mobile is a self-custodial Bitcoin and Liquid Network which offers non-custodial atomic swaps across Bitcoin, Lightning and Liquid. The wallet philosophy is to provide advanced features that give users the maximum control, while still being easy to use for beginners. Our goal is to make sure that anyone can take self-custody of their Bitcoin, even in a high fee environment. Our driving principle is to create a user experience which nudges the user into implementing best practices.
Expand Down
5 changes: 2 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ include: package:lint/analysis_options.yaml

linter:
rules:
sort_constructors_first: true
prefer_single_quotes: true
avoid_classes_with_only_static_members: false
avoid_dynamic_calls: false
no_wildcard_variable_uses: false


analyzer:
exclude:
- lib/**/*.g.dart
- lib/**/*.freezed.dart
# - test/
- test/
- maintainance/**
- pubspec.yaml

18 changes: 9 additions & 9 deletions lib/_model/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,18 @@ class Wallet with _$Wallet {
switch (type) {
case BBWalletType.main:
if (baseWalletType == BaseWalletType.Bitcoin) {
str = 'Secure' + ':' + id.substring(0, 5);
str = 'Secure:${id.substring(0, 5)}';
} else {
str = 'Instant' + ':' + id.substring(0, 5);
str = 'Instant:${id.substring(0, 5)}';
}
case BBWalletType.xpub:
str = 'Xpub' + ':' + id.substring(0, 5);
str = 'Xpub:${id.substring(0, 5)}';
case BBWalletType.words:
str = 'Imported' + ':' + id.substring(0, 5);
str = 'Imported:${id.substring(0, 5)}';
case BBWalletType.coldcard:
str = 'Coldcard' + ':' + id.substring(0, 5);
str = 'Coldcard:${id.substring(0, 5)}';
case BBWalletType.descriptors:
str = 'Imported Descriptor' + ':' + id.substring(0, 5);
str = 'Imported Descriptor:${id.substring(0, 5)}';
}

return str;
Expand All @@ -355,11 +355,11 @@ class Wallet with _$Wallet {
str = 'Instant Payments Wallet';
}
case BBWalletType.xpub:
str = 'Xpub' + ':' + id.substring(0, 5);
str = 'Xpub:${id.substring(0, 5)}';
case BBWalletType.coldcard:
str = 'Coldcard' + ':' + id.substring(0, 5);
str = 'Coldcard:${id.substring(0, 5)}';
case BBWalletType.descriptors:
str = 'Imported Descriptor' + ':' + id.substring(0, 5);
str = 'Imported Descriptor:${id.substring(0, 5)}';
}

return str;
Expand Down
8 changes: 6 additions & 2 deletions lib/_pkg/deep_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ bool? isTestnetAddress(String address) {
if (address.startsWith('2') ||
address.startsWith('m') ||
address.startsWith('n') ||
address.startsWith('tb1')) return true;
address.startsWith('tb1')) {
return true;
}

if (address.startsWith('1') ||
address.startsWith('3') ||
address.startsWith('bc1')) return false;
address.startsWith('bc1')) {
return false;
}

return null;
}
10 changes: 7 additions & 3 deletions lib/_pkg/wallet/bdk/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class BDKTransactions {
if (serdBdkTx.output == null) throw 'No output object';
final scriptPubkeyString = serdBdkTx.output
?.firstWhere(
(output) => output.value == amountChange,
(output) => output.value == amountChange.toInt(),
)
.scriptPubkey;

Expand Down Expand Up @@ -323,7 +323,9 @@ class BDKTransactions {
try {
if (serdBdkTx.output == null) throw 'No output object';
final scriptPubkeyString = serdBdkTx.output
?.firstWhere((output) => output.value == amountReceived)
?.firstWhere(
(output) => output.value == amountReceived.toInt(),
)
.scriptPubkey;

if (scriptPubkeyString == null) {
Expand Down Expand Up @@ -393,7 +395,9 @@ class BDKTransactions {
// This check is to eliminate sent RBF duplicates
if (transactions.any((t) {
return t.rbfTxIds.any((ids) => ids == tx.txid);
})) continue;
})) {
continue;
}

// TODO: Merged above two into single iteration;
//if (transactions.any((t) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/_ui/atoms/bb_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BBFormField extends StatelessWidget {
Widget build(BuildContext context) {
final borderColor = selected
? context.colour.primary
: context.colour.onPrimaryContainer.withOpacity(0.2);
: context.colour.onPrimaryContainer.withValues(alpha: 0.2);

// TODO: Ideally move this to theme file
final InputDecoration decoration = InputDecoration(
Expand Down
2 changes: 1 addition & 1 deletion lib/_ui/bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BottomBar extends StatelessWidget {
style: TextButton.styleFrom(
foregroundColor: pageIdx == i
? context.colour.onPrimary
: context.colour.onPrimary.withOpacity(0.5),
: context.colour.onPrimary.withValues(alpha: 0.5),
textStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
Expand Down
6 changes: 3 additions & 3 deletions lib/_ui/bottom_wallet_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class WalletActionButtons extends StatelessWidget {
color,
color,
color,
color.withOpacity(0.9),
color.withOpacity(0.5),
color.withOpacity(0.0),
color.withValues(alpha: 0.9),
color.withValues(alpha: 0.5),
color.withValues(alpha: 0.0),
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
Expand Down
4 changes: 2 additions & 2 deletions lib/_ui/components/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ class BBButton extends StatelessWidget {
boxShadow: [
BoxShadow(
color: !disabled
? Colors.black.withOpacity(0.1)
: Colors.grey.withOpacity(0.1),
? Colors.black.withValues(alpha: 0.1)
: Colors.grey.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
Expand Down
5 changes: 3 additions & 2 deletions lib/_ui/components/controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class BBDropDown<T> extends StatelessWidget {
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
color: Colors.black.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
Expand Down Expand Up @@ -236,7 +236,8 @@ class BBSwitch extends StatelessWidget {
activeColor: context.colour.primaryContainer,
activeTrackColor: context.colour.onPrimaryContainer,
inactiveTrackColor: context.colour.surface,
inactiveThumbColor: context.colour.onPrimaryContainer.withOpacity(0.4),
inactiveThumbColor:
context.colour.onPrimaryContainer.withValues(alpha: 0.4),
value: value,
onChanged: onChanged,
);
Expand Down
7 changes: 5 additions & 2 deletions lib/_ui/components/indicators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class BBLoadingRow extends StatefulWidget {
State<BBLoadingRow> createState() => _BBLoadingRowState();
}

class _BBLoadingRowState extends State<BBLoadingRow> with SingleTickerProviderStateMixin {
class _BBLoadingRowState extends State<BBLoadingRow>
with SingleTickerProviderStateMixin {
late AnimationController _animationController;
final Cubic firstCurve = Curves.easeInCubic;
final Cubic seconCurve = Curves.easeOutCubic;
Expand Down Expand Up @@ -92,7 +93,9 @@ class DashBox extends StatelessWidget {
child: Container(
width: width,
decoration: BoxDecoration(
color: isOn ? context.colour.error : context.colour.surface.withOpacity(0.4),
color: isOn
? context.colour.error
: context.colour.surface.withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(1),
),
),
Expand Down
33 changes: 19 additions & 14 deletions lib/_ui/components/text_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class _BBTextInputState extends State<BBTextInput> {
suffixIcon: widget.rightIcon,
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
// suffix: widget.rightIcon,
border: OutlineInputBorder(
Expand All @@ -160,7 +160,7 @@ class _BBTextInputState extends State<BBTextInput> {
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
focusedBorder: OutlineInputBorder(
Expand Down Expand Up @@ -190,7 +190,7 @@ class _BBTextInputState extends State<BBTextInput> {
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
counterText: '',
border: OutlineInputBorder(
Expand All @@ -199,7 +199,8 @@ class _BBTextInputState extends State<BBTextInput> {
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color:
context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
focusedBorder: OutlineInputBorder(
Expand All @@ -211,7 +212,8 @@ class _BBTextInputState extends State<BBTextInput> {
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color:
context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
labelStyle: context.font.labelSmall,
Expand All @@ -235,7 +237,7 @@ class _BBTextInputState extends State<BBTextInput> {
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
suffixIcon: IconButton(
icon: Padding(
Expand All @@ -250,7 +252,8 @@ class _BBTextInputState extends State<BBTextInput> {
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color:
context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
focusedBorder: OutlineInputBorder(
Expand Down Expand Up @@ -280,7 +283,7 @@ class _BBTextInputState extends State<BBTextInput> {
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
suffixIcon: widget.rightIcon,
// IconButton(
Expand All @@ -296,7 +299,8 @@ class _BBTextInputState extends State<BBTextInput> {
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color:
context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
focusedBorder: OutlineInputBorder(
Expand Down Expand Up @@ -328,15 +332,16 @@ class _BBTextInputState extends State<BBTextInput> {
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: context.colour.onPrimaryContainer.withOpacity(0.2),
color:
context.colour.onPrimaryContainer.withValues(alpha: 0.2),
),
),
focusedBorder: OutlineInputBorder(
Expand Down Expand Up @@ -401,7 +406,7 @@ class _BBTextInputState extends State<BBTextInput> {
// _editingController.text = widget.value!;

// final borderColor =
// widget.selected ? context.colour.primary : context.colour.onPrimaryContainer.withOpacity(0.2);
// widget.selected ? context.colour.primary : context.colour.onPrimaryContainer.withValues(alpha:0.2);

// return TextField(
// key: widget.uiKey,
Expand Down Expand Up @@ -501,7 +506,7 @@ class _BBAmountInputState2 extends State<BBAmountInput> {

final borderColor = widget.selected
? context.colour.primary
: context.colour.onPrimaryContainer.withOpacity(0.2);
: context.colour.onPrimaryContainer.withValues(alpha: 0.2);

return SizedBox(
height: 60,
Expand Down Expand Up @@ -540,7 +545,7 @@ class _BBAmountInputState2 extends State<BBAmountInput> {
decoration: InputDecoration(
hintText: widget.hint,
hintStyle: TextStyle(
color: context.colour.onPrimaryContainer.withOpacity(0.5),
color: context.colour.onPrimaryContainer.withValues(alpha: 0.5),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
Expand Down
2 changes: 1 addition & 1 deletion lib/_ui/molecules/wallet/wallet_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class WalletCard extends StatelessWidget {
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
color.withOpacity(0.73),
color.withValues(alpha: 0.73),
color,
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/_ui/page_template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class StackedPage extends StatelessWidget {
child: Container(
width: double.infinity,
height: 72,
color: context.colour.primaryContainer.withOpacity(0.95),
color: context.colour.primaryContainer.withValues(alpha: 0.95),
padding:
const EdgeInsets.only(bottom: 16, top: 8, left: 16, right: 16),
alignment: Alignment.bottomCenter,
Expand Down
2 changes: 1 addition & 1 deletion lib/_ui/warning.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class WarningBanner extends StatelessWidget {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: context.colour.error.withOpacity(0.2),
color: context.colour.error.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(10),
),
child: Row(
Expand Down
Loading
Loading