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
2 changes: 1 addition & 1 deletion lib/feature/root/domain/root_tab_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RootTabService {
final currentTab = RootTab.getByRoute(_router.currentRoutes.firstOrNull);
final isTabUpdated = currentTab != tab;

if (isTabUpdated) {
if (!isTabUpdated) {
_scrollTabToTopSubject.add(tab);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:nekoton_repository/nekoton_repository.dart';
import 'package:ui_components_lib/components/common/default_sliver_app_bar.dart';
import 'package:ui_components_lib/ui_components_lib.dart';
import 'package:ui_components_lib/v2/ui_components_lib_v2.dart';

Expand Down Expand Up @@ -82,87 +83,100 @@ class _Body extends StatelessWidget {
return CustomScrollView(
controller: controller,
slivers: [
SliverToBoxAdapter(
child: Stack(
children: [
const _Background(),
Column(
mainAxisSize: MainAxisSize.min,
children: [
const DefaultAppBar(),
ValueListenableBuilder(
valueListenable: contractName,
builder: (_, contractName, __) => Text(
contractName,
style: theme.textStyles.labelSmall.copyWith(
color: theme.colors.content3,
),
),
),
const SizedBox(height: DimensSizeV2.d12),
StateNotifierBuilder(
listenableState: tokenBalance,
builder: (_, tokenBalance) {
if (tokenBalance == null) return const SizedBox.shrink();
return AmountWidget.fromMoney(
amount: tokenBalance,
includeSymbol: false,
style: theme.textStyles.headingXLarge,
);
},
),
const SizedBox(height: DimensSizeV2.d4),
StateNotifierBuilder(
listenableState: fiatBalance,
builder: (_, fiatBalance) {
if (fiatBalance == null) return const SizedBox.shrink();
return AmountWidget.dollars(
amount: fiatBalance,
style: theme.textStyles.labelXSmall,
);
},
),
const SizedBox(height: DimensSizeV2.d16),
SizedBox(
height: DimensSizeV2.d74,
child: SeparatedRow(
separator: VerticalDivider(
width: DimensStroke.small,
thickness: DimensStroke.small,
color: theme.colors.borderAlpha,
),
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
WalletActionButton(
label: LocaleKeys.receiveWord.tr(),
icon: LucideIcons.arrowDown,
onPressed: () =>
showReceiveFundsSheet(context, owner),
),
DoubleSourceBuilder(
firstSource: canSend,
secondSource: tokenBalance,
builder: (_, canSend, tokenBalance) {
if (canSend != true || tokenBalance == null) {
return const SizedBox.shrink();
}
ValueListenableBuilder(
valueListenable: contractName,
builder: (_, contractName, __) {
return DefaultSliverAppBar(
title: contractName,
flexibleSpace: FlexibleSpaceBar(
background: Stack(
fit: StackFit.expand,
children: [
const _Background(),
SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 72), // Space for AppBar
const SizedBox(height: DimensSizeV2.d12),
Text(
contractName,
style: theme.textStyles.labelSmall.copyWith(
color: theme.colors.content3,
),
),
StateNotifierBuilder(
listenableState: tokenBalance,
builder: (_, tokenBalance) {
if (tokenBalance == null) {
return const SizedBox.shrink();
}

return WalletActionButton(
label: LocaleKeys.sendWord.tr(),
icon: LucideIcons.arrowUp,
onPressed: onSend,
);
},
),
],
return AmountWidget.fromMoney(
amount: tokenBalance,
includeSymbol: false,
style: theme.textStyles.headingXLarge,
);
},
),
const SizedBox(height: DimensSizeV2.d4),
StateNotifierBuilder(
listenableState: fiatBalance,
builder: (_, fiatBalance) {
if (fiatBalance == null) {
return const SizedBox.shrink();
}
return AmountWidget.dollars(
amount: fiatBalance,
style: theme.textStyles.labelXSmall,
);
},
),
const SizedBox(height: DimensSizeV2.d16),
SizedBox(
height: DimensSizeV2.d74,
child: SeparatedRow(
separator: VerticalDivider(
width: DimensStroke.small,
thickness: DimensStroke.small,
color: theme.colors.borderAlpha,
),
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
WalletActionButton(
label: LocaleKeys.receiveWord.tr(),
icon: LucideIcons.arrowDown,
onPressed: () =>
showReceiveFundsSheet(context, owner),
),
DoubleSourceBuilder(
firstSource: canSend,
secondSource: tokenBalance,
builder: (_, canSend, tokenBalance) {
if (canSend != true ||
tokenBalance == null) {
return const SizedBox.shrink();
}

return WalletActionButton(
label: LocaleKeys.sendWord.tr(),
icon: LucideIcons.arrowUp,
onPressed: onSend,
);
},
),
],
),
),
],
),
),
),
const SizedBox(height: DimensSizeV2.d48),
],
],
),
),
],
),
);
},
),
DecoratedSliver(
decoration: BoxDecoration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:app/utils/utils.dart';
import 'package:elementary_helper/elementary_helper.dart';
import 'package:flutter/material.dart';
import 'package:nekoton_repository/nekoton_repository.dart';
import 'package:ui_components_lib/components/common/default_sliver_app_bar.dart';
import 'package:ui_components_lib/ui_components_lib.dart';
import 'package:ui_components_lib/v2/ui_components_lib_v2.dart';

Expand Down Expand Up @@ -73,55 +74,65 @@ class _Body extends StatelessWidget {
return CustomScrollView(
controller: controller,
slivers: [
SliverToBoxAdapter(
child: Stack(
children: [
const _Background(),
Column(
mainAxisSize: MainAxisSize.min,
children: [
const DefaultAppBar(),
Text(
symbol,
style: theme.textStyles.labelSmall.copyWith(
color: theme.colors.content3,
),
DefaultSliverAppBar(
title: symbol,
flexibleSpace: FlexibleSpaceBar(
background: Stack(
fit: StackFit.expand,
children: [
const _Background(),
SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 72),
Text(
symbol,
style: theme.textStyles.labelSmall.copyWith(
color: theme.colors.content3,
),
),
const SizedBox(height: DimensSizeV2.d12),
StateNotifierBuilder(
listenableState: tokenBalanceState,
builder: (_, tokenBalance) {
if (tokenBalance == null) {
return const SizedBox.shrink();
}
return AmountWidget.fromMoney(
amount: tokenBalance,
includeSymbol: false,
style: theme.textStyles.headingXLarge,
);
},
),
const SizedBox(height: DimensSizeV2.d4),
StateNotifierBuilder(
listenableState: fiatBalanceState,
builder: (_, fiatBalance) {
if (fiatBalance == null) {
return const SizedBox.shrink();
}
return AmountWidget.dollars(
amount: fiatBalance,
style: theme.textStyles.labelXSmall,
);
},
),
const SizedBox(height: DimensSizeV2.d16),
if (error == null)
WalletAccountActions(
account: account,
allowStake: false,
sendSpecified: true,
padding: EdgeInsets.zero,
),
const SizedBox(height: DimensSizeV2.d48),
],
),
const SizedBox(height: DimensSizeV2.d12),
StateNotifierBuilder(
listenableState: tokenBalanceState,
builder: (_, tokenBalance) {
if (tokenBalance == null) return const SizedBox.shrink();
return AmountWidget.fromMoney(
amount: tokenBalance,
includeSymbol: false,
style: theme.textStyles.headingXLarge,
);
},
),
const SizedBox(height: DimensSizeV2.d4),
StateNotifierBuilder(
listenableState: fiatBalanceState,
builder: (_, fiatBalance) {
if (fiatBalance == null) return const SizedBox.shrink();
return AmountWidget.dollars(
amount: fiatBalance,
style: theme.textStyles.labelXSmall,
);
},
),
const SizedBox(height: DimensSizeV2.d16),
if (error == null)
WalletAccountActions(
account: account,
allowStake: false,
sendSpecified: true,
padding: EdgeInsets.zero,
),
const SizedBox(height: DimensSizeV2.d48),
],
),
],
),
],
),
),
),
DecoratedSliver(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:ui_components_lib/components/button/app_bar_back_button.dart';
import 'package:ui_components_lib/components/common/default_app_bar.dart';
import 'package:ui_components_lib/v2/dimens_v2.dart';
import 'package:ui_components_lib/v2/theme_style_v2.dart';

typedef IsColapsed = bool Function(SliverConstraints);

class DefaultSliverAppBar extends StatelessWidget {
const DefaultSliverAppBar({
required this.title,
this.isCollapsed = defaultIsCollapsed,
this.flexibleSpace,
super.key,
});

final IsColapsed isCollapsed;
final String title;
final Widget? flexibleSpace;

@override
Widget build(BuildContext context) {
final theme = context.themeStyleV2;

return SliverLayoutBuilder(
builder: (context, constraints) {
// Calculate if we're in collapsed state
final isCollapsed = this.isCollapsed(constraints);

return SliverAppBar(
expandedHeight: 320,
collapsedHeight: defaultAppBarHeight,
toolbarHeight: defaultAppBarHeight,
pinned: true,
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor:
isCollapsed ? theme.colors.background0 : Colors.transparent,
surfaceTintColor: Colors.transparent,
leading: Container(
margin: const EdgeInsets.only(
left: DimensSizeV2.d16,
top: DimensSizeV2.d12,
bottom: DimensSizeV2.d12,
),
child: AppBarBackButton(
onPressed: () => Navigator.of(context).maybePop(),
),
),
leadingWidth: DimensSizeV2.d64,
title: AnimatedOpacity(
opacity: isCollapsed ? 1.0 : 0.0,
duration: const Duration(milliseconds: 200),
child: Text(
title,
style: theme.textStyles.headingMedium,
),
),
centerTitle: true,
flexibleSpace: flexibleSpace,
);
},
);
}

static bool defaultIsCollapsed(SliverConstraints constraints) {
return constraints.scrollOffset > 200;
}
}
Loading