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

clients/bitwindow: add subtitle to all cards #381

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
16 changes: 10 additions & 6 deletions clients/bitwindow/lib/pages/overview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class TransactionsView extends StatelessWidget {
SailRawCard(
bottomPadding: false,
title: 'Latest Transactions',
subtitle: 'View the latest transactions on the sidechain',
child: SizedBox(
height: 300,
child: LatestTransactionTable(
Expand All @@ -126,7 +127,8 @@ class TransactionsView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SailRawCard(
title: 'Latest blocks',
title: 'Latest Blocks',
subtitle: 'View the latest blocks on the blockchain',
bottomPadding: false,
child: SizedBox(
height: 300,
Expand Down Expand Up @@ -467,9 +469,9 @@ class CoinNewsView extends StatelessWidget {
child: SailRow(
spacing: SailStyleValues.padding08,
children: [
SailText.primary15(
'Coin News',
bold: true,
CardHeader(
title: 'Coin News',
subtitle: 'Stay up-to-date on the latest world developments',
),
Expanded(child: Container()),
QtButton(
Expand Down Expand Up @@ -566,6 +568,7 @@ class CoinNewsView extends StatelessWidget {
await widgetDialog(
context: context,
title: 'Broadcast News',
subtitle: 'Broadcast News to the whole world, in the list you prefer.',
child: BroadcastNewsView(),
);
}
Expand All @@ -574,6 +577,7 @@ class CoinNewsView extends StatelessWidget {
await widgetDialog(
context: context,
title: 'Create Topic',
subtitle: 'Create a new topic, that you and others can subscribe to, and post news for.',
child: CreateTopicView(),
);
}
Expand All @@ -582,6 +586,7 @@ class CoinNewsView extends StatelessWidget {
await widgetDialog(
context: context,
title: 'Graffitti Explorer',
subtitle: 'List all previous OP_RETURN messages found in the blockchain.',
maxWidth: MediaQuery.of(context).size.width - 100,
child: GraffittiExplorerView(),
);
Expand Down Expand Up @@ -916,8 +921,7 @@ class GraffittiExplorerView extends StatelessWidget {
onPressed: () => newGraffittiDialog(context),
size: ButtonSize.small,
),
SizedBox(
height: 500,
Expanded(
child: GraffittiTable(
entries: viewModel.entries,
onSort: viewModel.onSort,
Expand Down
2 changes: 2 additions & 0 deletions clients/bitwindow/lib/pages/sidechains_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SidechainsList extends ViewModelWidget<SidechainsViewModel> {
Widget build(BuildContext context, SidechainsViewModel viewModel) {
return SailRawCard(
title: 'Sidechains',
subtitle: 'List of sidechains and their current status',
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -508,6 +509,7 @@ class MakeDepositsView extends ViewModelWidget<SidechainsViewModel> {
Expanded(
child: SailRawCard(
title: 'Your Recent Deposits',
subtitle: 'Recent deposits to sidechains, coming from your onchain-wallet.',
shadowSize: ShadowSize.none,
padding: false,
child: RecentDepositsTable(),
Expand Down
6 changes: 5 additions & 1 deletion clients/bitwindow/lib/pages/wallet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SendTab extends ViewModelWidget<SendPageViewModel> {
Widget build(BuildContext context, SendPageViewModel viewModel) {
return SailRawCard(
title: 'Send Bitcoin',
subtitle: 'Send bitcoin to bitcoin-addresses. No sidechains involved.',
child: Column(
children: [
Row(
Expand Down Expand Up @@ -527,6 +528,7 @@ class ReceiveTab extends StatelessWidget {
Expanded(
child: SailRawCard(
title: 'Receive Bitcoin',
subtitle: 'Receive bitcoin to your bitcoin-wallet. No sidechains involved.',
child: SailColumn(
spacing: SailStyleValues.padding16,
mainAxisSize: MainAxisSize.min,
Expand Down Expand Up @@ -714,7 +716,9 @@ class _TransactionTableState extends State<TransactionTable> {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return SailRawCard(
title: 'Your Wallet Transaction History',
title: 'Wallet Transaction History',
subtitle:
'List of transactions for your bitcoin-wallet. Contains send, receive and sidechain-interaction transactions.',
bottomPadding: false,
child: Column(
children: [
Expand Down
2 changes: 1 addition & 1 deletion clients/sail_ui/lib/style/color_scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class SailColorScheme {
static const redLight = Color(0xffFD7979);
static const black = Color(0xff000000);
static const blackLighter = Color.fromARGB(255, 31, 31, 31);
static const blackLightest = Color(0xff20272D);
static const blackLightest = Color(0xff64748B);
static const purple = Color(0xffBB87FC);
static const greenLight = Color(0xff79FD7E);
static const green = Color(0xff2AB517);
Expand Down
12 changes: 9 additions & 3 deletions clients/sail_ui/lib/widgets/containers/sail_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:sail_ui/sail_ui.dart';

class SailRawCard extends StatelessWidget {
final String? title;
final String? subtitle;
final Widget? header;
final VoidCallback? onPressed;
final bool padding;
Expand All @@ -16,6 +17,7 @@ class SailRawCard extends StatelessWidget {
const SailRawCard({
super.key,
this.title,
this.subtitle,
this.header,
this.onPressed,
this.padding = true,
Expand All @@ -32,6 +34,10 @@ class SailRawCard extends StatelessWidget {
Widget build(BuildContext context) {
final theme = SailTheme.of(context);

if ((title != null) != (subtitle != null)) {
throw ArgumentError('Title and subtitle must be set together. Got title: $title and subtitle: $subtitle');
}

return SailShadow(
shadowSize: shadowSize,
child: Material(
Expand All @@ -55,9 +61,9 @@ class SailRawCard extends StatelessWidget {
children: [
if (header != null) header!,
if (title != null)
SailText.primary15(
title!,
bold: true,
CardHeader(
title: title!,
subtitle: subtitle,
),
if (title != null) const SailSpacing(SailStyleValues.padding16),
Flexible(
Expand Down
50 changes: 33 additions & 17 deletions clients/sail_ui/lib/widgets/containers/sail_dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,38 @@ Future<T?> widgetDialog<T>({
);
}

class CardHeader extends StatelessWidget {
final String title;
final String? subtitle;

const CardHeader({
super.key,
required this.title,
this.subtitle,
});

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

return SailColumn(
spacing: 0,
mainAxisSize: MainAxisSize.min,
children: [
SailText.primary20(
title,
bold: true,
),
if (subtitle != null)
SailText.primary12(
subtitle!,
color: theme.colors.textTertiary,
),
],
);
}
}

enum DialogType { info, error, success }

class DialogHeader extends StatelessWidget {
Expand All @@ -129,26 +161,10 @@ class DialogHeader extends StatelessWidget {

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

return SailRow(
spacing: SailStyleValues.padding08,
children: [
SailColumn(
spacing: 0,
mainAxisSize: MainAxisSize.min,
children: [
SailText.primary15(
title,
bold: true,
),
if (subtitle != null)
SailText.primary10(
subtitle!,
color: theme.colors.textSecondary,
),
],
),
CardHeader(title: title, subtitle: subtitle),
Expanded(child: Container()),
SailScaleButton(
onPressed: onClose,
Expand Down
2 changes: 2 additions & 0 deletions clients/sail_ui/lib/widgets/core/sail_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class SailText {
bool italic = false,
Color? color,
bool monospace = false,
TextOverflow overflow = TextOverflow.ellipsis,
}) {
return Builder(
builder: (context) {
Expand All @@ -202,6 +203,7 @@ class SailText {
fontWeight: bold ? SailStyleValues.boldWeight : null,
fontStyle: italic ? FontStyle.italic : FontStyle.normal,
fontFamily: monospace ? 'SourceCodePro' : 'Inter',
overflow: overflow,
),
textAlign: textAlign,
);
Expand Down
Loading