Skip to content

Commit

Permalink
Merge branch 'master' into profile-keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
justinenerio authored May 3, 2024
2 parents 0b82239 + 243cae2 commit 45911f1
Show file tree
Hide file tree
Showing 20 changed files with 548 additions and 204 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ jobs:

- name: Analyze
run: |
pip3 install networkx graphviz pydot pydotplus
melos exec -c 1 ${{ env.SCOPE }} -- make flutter_analyze
melos exec -c 1 ${{ env.SCOPE }} -- make deps_graph_all
melos exec -c 1 ${{ env.SCOPE }} -- make deps_graph_features
- name: Test
run: melos exec -c 1 ${{ env.SCOPE }} --dir-exists="test" -- make flutter_test
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,3 @@ ifndef VERSION
endif
dart run drift_dev schema dump lib/data/db/db.dart moor_schemas/moor_schema_v$(VERSION).json

deps_graph_all:
lakos lib -i "{**.freezed.dart,**.g.dart,storybook/**,data/**,di.config.dart,di.dart,gen/**,l10n/gen/**,routing.dart,di.dart,generated_plugin_registrant.dart}" --metrics > deps.dot

deps_graph_features:
lakos lib/features -i "{**.freezed.dart,**.g.dart,**/src/**}" --metrics > features.dot
13 changes: 13 additions & 0 deletions packages/espressocash_app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 1.115.0

- **REFACTOR**: restructure qr_scanner.
- **REFACTOR**: break outgoing_direct_payments -> wallet_flow.
- **REFACTOR**: break fees -> ramp.
- **REFACTOR**: break balances -> conversion_rates.
- **REFACTOR**: break conversion_rates -> wallet_flow.
- **REFACTOR**: break activities -> authenticated.
- **REFACTOR**: restructure accounts.
- **REFACTOR**: remove nested dependency (#1401).
- **FEAT**: update pay verification interval on opened request (#1410).
- **FEAT**: show add cash notice on zero balance (#1388).

## 1.114.0

- **REFACTOR**: remove go_router (#1399).
Expand Down
6 changes: 6 additions & 0 deletions packages/espressocash_app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ flutter_test:

deps_cycles:
python3 ./tool/cycles.py deps.dot --only-shortest

deps_graph_all:
lakos lib -i "{**.freezed.dart,**.g.dart,storybook/**,data/**,di.config.dart,di.dart,gen/**,l10n/gen/**,routing.dart,di.dart,generated_plugin_registrant.dart}" --metrics > deps.dot

deps_graph_features:
dcm as lib/features --exclude="" --modules="/features/" > features.dot && python3 ./tool/cycles.py features.dot --only-shortest && echo "No cycles"
18 changes: 7 additions & 11 deletions packages/espressocash_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ PODS:
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
- MLImage (= 1.0.0-beta5)
- MLKitCommon (~> 11.0)
- mobile_scanner (5.0.0):
- mobile_scanner (5.0.2):
- Flutter
- GoogleMLKit/BarcodeScanning (~> 6.0.0)
- nanopb (2.30909.1):
Expand All @@ -168,13 +168,11 @@ PODS:
- Ramp
- rive_common (0.0.1):
- Flutter
- Sentry/HybridSDK (8.21.0):
- SentryPrivate (= 8.21.0)
- sentry_flutter (8.0.0):
- Sentry/HybridSDK (8.25.0)
- sentry_flutter (8.1.0):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.21.0)
- SentryPrivate (8.21.0)
- Sentry/HybridSDK (= 8.25.0)
- share (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand Down Expand Up @@ -257,7 +255,6 @@ SPEC REPOS:
- OrderedSet
- PromisesObjC
- Sentry
- SentryPrivate
- sqlite3

EXTERNAL SOURCES:
Expand Down Expand Up @@ -351,7 +348,7 @@ SPEC CHECKSUMS:
MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b
MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1
MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1
mobile_scanner: 43a31484164e3a7f816c15765d5bf88bc35ff942
mobile_scanner: cfc76f77dca7e074fc9ca5993e3e7c35901c8b34
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
Expand All @@ -361,9 +358,8 @@ SPEC CHECKSUMS:
Ramp: 3f843fb75cac12ad40842afa3226bae36dc93521
ramp_flutter: aac85dee8bc93b5f7563c909ba15a37727fe3fe8
rive_common: 8630be7f6385198f9d31a5bc8cd7f6ccccedf5a1
Sentry: ebc12276bd17613a114ab359074096b6b3725203
sentry_flutter: 4ce59806771a82cc2d2a4657b320c9801530db62
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
Sentry: cd86fc55628f5b7c572cabe66cc8f95a9d2f165a
sentry_flutter: ca7760fc008dc3bc2981730dc0c1d2f892178370
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import 'dart:math';
import 'package:flutter/material.dart';

import '../../../di.dart';
import '../../../gen/assets.gen.dart';
import '../../../ui/colors.dart';
import '../../../ui/icon_button.dart';
import '../../../ui/navigation_bar/navigation_bar.dart';
import '../../../ui/page_fade_wrapper.dart';
import '../../../ui/theme.dart';
import '../../../ui/value_stream_builder.dart';
import '../../activities/services/tx_updater.dart';
import '../../activities/widgets/recent_activity.dart';
import '../../currency/models/currency.dart';
import '../../profile/screens/profile_screen.dart';
import '../../wallet_flow/widgets/launch_qr_scanner_flow.dart';
import '../../conversion_rates/services/watch_user_fiat_balance.dart';
import '../widgets/home_add_cash.dart';
import '../widgets/home_app_bar.dart';
import '../widgets/home_carousel.dart';
import '../widgets/investment_header.dart';
import '../widgets/refresh_balance_wrapper.dart';

class MainScreen extends StatefulWidget {
class MainScreen extends StatelessWidget {
const MainScreen({
super.key,
required this.onSendMoneyPressed,
Expand All @@ -29,96 +28,83 @@ class MainScreen extends StatefulWidget {
final VoidCallback onTransactionsPressed;

@override
State<MainScreen> createState() => _MainScreenState();
Widget build(BuildContext context) => CpTheme.dark(
child: ValueStreamBuilder<bool>(
create: () =>
sl<WatchUserFiatBalance>().call().map((it) => it.isZero),
builder: (context, isZeroAmount) => isZeroAmount
? const HomeAddCashContent()
: _MainContent(
onSendMoneyPressed: onSendMoneyPressed,
onTransactionsPressed: onTransactionsPressed,
),
),
);
}

class _MainScreenState extends State<MainScreen> {
Future<void> _handleScanPressed() =>
context.launchQrScannerFlow(cryptoCurrency: Currency.usdc);
class _MainContent extends StatelessWidget {
const _MainContent({
required this.onSendMoneyPressed,
required this.onTransactionsPressed,
});

final VoidCallback onSendMoneyPressed;
final VoidCallback onTransactionsPressed;

@override
Widget build(BuildContext context) => CpTheme.dark(
child: PageFadeWrapper(
child: Container(
padding: const EdgeInsets.only(bottom: cpNavigationBarheight),
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
CpColors.darkSplashBackgroundColor,
CpColors.dashboardBackgroundColor,
],
stops: [0.49, 0.51],
),
Widget build(BuildContext context) => PageFadeWrapper(
child: Container(
padding: const EdgeInsets.only(bottom: cpNavigationBarheight),
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
CpColors.darkSplashBackgroundColor,
CpColors.dashboardBackgroundColor,
],
stops: [0.49, 0.51],
),
child: RefreshBalancesWrapper(
builder: (context, onRefresh) => RefreshIndicator(
displacement: 80,
onRefresh: () => Future.wait([
onRefresh(),
sl<TxUpdater>().call(),
]),
color: CpColors.primaryColor,
backgroundColor: Colors.white,
child: CustomScrollView(
slivers: [
SliverAppBar(
leading: Center(
child: CpIconButton(
icon: Assets.icons.qrScanner.svg(),
variant: CpIconButtonVariant.black,
onPressed: _handleScanPressed,
),
),
shape: const Border(),
title: Center(
child: Assets.images.logo.image(height: 32),
),
pinned: true,
snap: false,
floating: false,
elevation: 0,
backgroundColor: CpColors.darkBackground,
actions: [
CpIconButton(
icon: Assets.icons.settingsButtonIcon
.svg(color: Colors.white),
variant: CpIconButtonVariant.black,
onPressed: () => ProfileScreen.push(context),
),
const SizedBox(width: 12),
],
toolbarHeight: kToolbarHeight + 12,
),
SliverToBoxAdapter(
child: InvestmentHeader(
onSendMoneyPressed: widget.onSendMoneyPressed,
),
),
child: RefreshBalancesWrapper(
builder: (context, onRefresh) => RefreshIndicator(
displacement: 80,
onRefresh: () => Future.wait([
onRefresh(),
sl<TxUpdater>().call(),
]),
color: CpColors.primaryColor,
backgroundColor: Colors.white,
child: CustomScrollView(
slivers: [
const HomeAppBar(),
SliverToBoxAdapter(
child: InvestmentHeader(
onSendMoneyPressed: onSendMoneyPressed,
),
SliverToBoxAdapter(
child: HomeCarouselWidget(
onSendMoneyPressed: widget.onSendMoneyPressed,
),
),
SliverToBoxAdapter(
child: HomeCarouselWidget(
onSendMoneyPressed: onSendMoneyPressed,
),
SliverToBoxAdapter(
child: RecentActivityWidget(
onSendMoneyPressed: widget.onSendMoneyPressed,
onTransactionsPressed: widget.onTransactionsPressed,
),
),
SliverToBoxAdapter(
child: RecentActivityWidget(
onSendMoneyPressed: onSendMoneyPressed,
onTransactionsPressed: onTransactionsPressed,
),
SliverToBoxAdapter(
child: SizedBox(
height: max(
0,
MediaQuery.paddingOf(context).bottom -
cpNavigationBarheight +
16,
),
),
SliverToBoxAdapter(
child: SizedBox(
height: max(
0,
MediaQuery.paddingOf(context).bottom -
cpNavigationBarheight +
16,
),
),
],
),
),
],
),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:dfunc/dfunc.dart';
import 'package:flutter/material.dart';

import '../../../di.dart';
import '../../../l10n/device_locale.dart';
import '../../../ui/value_stream_builder.dart';
import '../../conversion_rates/services/watch_user_fiat_balance.dart';
import '../../conversion_rates/widgets/extensions.dart';
import '../../currency/models/amount.dart';
import '../../tokens/token.dart';
import '../../tokens/widgets/token_icon.dart';

class BalanceAmount extends StatelessWidget {
const BalanceAmount({super.key});

@override
Widget build(BuildContext context) => ValueStreamBuilder<Amount>(
create: () => sl<WatchUserFiatBalance>().call(),
builder: (context, amount) {
final formattedAmount = amount.format(
DeviceLocale.localeOf(context),
roundInteger: amount.isZero,
);

return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
FittedBox(
child: Text(
formattedAmount,
style: const TextStyle(
fontSize: 48,
fontWeight: FontWeight.bold,
color: Colors.white,
letterSpacing: -1,
),
),
).let((it) => amount.isZero ? it : Flexible(child: it)),
const SizedBox(width: 8),
const TokenIcon(token: Token.usdc, size: 30),
],
);
},
);
}
Loading

0 comments on commit 45911f1

Please sign in to comment.