Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into my_accou…
Browse files Browse the repository at this point in the history
…nt_822_account_page
  • Loading branch information
digitalheartxs committed Sep 24, 2024
2 parents 4928a96 + 8981f16 commit e100011
Show file tree
Hide file tree
Showing 29 changed files with 1,010 additions and 133 deletions.
100 changes: 100 additions & 0 deletions catalyst_voices/lib/pages/account/creation/task_picture.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
import 'package:catalyst_voices_brands/catalyst_voices_brands.dart';
import 'package:flutter/material.dart';

enum TaskPictureType {
normal,
success,
error;

Color _foregroundColor(ThemeData theme) {
return switch (this) {
// TODO(damian-molinski): Color should come from colors scheme
TaskPictureType.normal => const Color(0xFF0C288D),
TaskPictureType.success => theme.colors.successContainer!,
TaskPictureType.error => theme.colors.errorContainer!,
};
}

Color _backgroundColor(ThemeData theme) {
return switch (this) {
// TODO(damian-molinski): Color should come from colors scheme
TaskPictureType.normal => const Color(0xFFCCE2FF),
TaskPictureType.success => theme.colors.success!,
TaskPictureType.error => theme.colorScheme.error,
};
}
}

class TaskKeychainPicture extends StatelessWidget {
final TaskPictureType type;

const TaskKeychainPicture({
super.key,
this.type = TaskPictureType.normal,
});

@override
Widget build(BuildContext context) {
return TaskPicture(
child: TaskPictureIconBox(
type: type,
child: VoicesAssets.images.keychain.buildIcon(allowSize: false),
),
);
}
}

class TaskPicture extends StatelessWidget {
final Widget child;

const TaskPicture({
super.key,
required this.child,
});

@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.topRight,
children: [
CatalystImage.asset(VoicesAssets.images.taskIllustration.path),
child,
],
);
}
}

class TaskPictureIconBox extends StatelessWidget {
final TaskPictureType type;
final Widget child;

const TaskPictureIconBox({
super.key,
this.type = TaskPictureType.normal,
required this.child,
});

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

final foregroundColor = type._foregroundColor(theme);
final backgroundColor = type._backgroundColor(theme);

final iconThemeData = IconThemeData(color: foregroundColor);

return IconTheme(
data: iconThemeData,
child: Container(
constraints: BoxConstraints.tight(const Size.square(125)),
decoration: BoxDecoration(
color: backgroundColor,
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: child,
),
);
}
}
23 changes: 1 addition & 22 deletions catalyst_voices/lib/pages/workspace/workspace_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:catalyst_voices/pages/workspace/proposal_navigation_panel.dart';
import 'package:catalyst_voices/pages/workspace/proposal_segment_controller.dart';
import 'package:catalyst_voices/pages/workspace/proposal_setup_panel.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text2.dart';
import 'package:catalyst_voices/pages/workspace/sample_rich_text3.dart';
import 'package:catalyst_voices/widgets/widgets.dart';
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,31 +15,12 @@ final _proposalNavigation = WorkspaceProposalNavigation(
WorkspaceProposalSetup(
id: _setupSegmentId,
steps: [
const WorkspaceProposalSegmentStep(
id: 0,
title: 'Title',
description: 'F14 / Promote Social Entrepreneurs and a '
'longer title up-to 60 characters',
isEditable: true,
),
WorkspaceProposalSegmentStep(
id: 1,
id: 0,
title: 'Rich text',
document: Document.fromJson(sampleRichText),
isEditable: true,
),
WorkspaceProposalSegmentStep(
id: 2,
title: 'Other topic',
document: Document.fromJson(sampleRichText2),
isEditable: false,
),
WorkspaceProposalSegmentStep(
id: 3,
title: 'Other topic',
document: Document.fromJson(sampleRichText3),
isEditable: false,
),
],
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class _Editor extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: ResizableBoxParent(
minHeight: 320,
minHeight: 470,
resizableVertically: true,
resizableHorizontally: false,
child: DecoratedBox(
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extension SvgGenImageExt on SvgGenImage {
String? semanticsLabel,
bool excludeFromSemantics = false,
double? size,
bool allowSize = true,
BoxFit fit = BoxFit.contain,
Alignment alignment = Alignment.center,
bool matchTextDirection = false,
Expand All @@ -105,6 +106,7 @@ extension SvgGenImageExt on SvgGenImage {
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
size: size,
allowSize: allowSize,
fit: fit,
alignment: alignment,
matchTextDirection: matchTextDirection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class CatalystSvgIcon extends StatelessWidget {
/// See [SvgPicture.width] and [SvgPicture.height]
final double? size;

/// Whether [size] can be applied to final widget.
final bool allowSize;

/// See [SvgPicture.fit]
final BoxFit fit;

Expand Down Expand Up @@ -54,6 +57,7 @@ class CatalystSvgIcon extends StatelessWidget {
this.bytesLoader, {
super.key,
this.size,
this.allowSize = true,
this.fit = BoxFit.contain,
this.alignment = Alignment.center,
this.matchTextDirection = false,
Expand All @@ -77,6 +81,7 @@ class CatalystSvgIcon extends StatelessWidget {
String? package = 'catalyst_voices_assets',
SvgTheme? theme,
this.size,
this.allowSize = true,
this.fit = BoxFit.contain,
this.alignment = Alignment.center,
this.matchTextDirection = false,
Expand All @@ -101,7 +106,7 @@ class CatalystSvgIcon extends StatelessWidget {

@override
Widget build(BuildContext context) {
final effectiveSize = size ?? IconTheme.of(context).size;
final effectiveSize = allowSize ? size ?? IconTheme.of(context).size : null;
final effectiveColorFilter = allowColorFilter
? _colorFilter ?? IconTheme.of(context).asColorFilter()
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ Future<void> main() async {
}
Transaction _buildUnsignedTx({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress changeAddress,
}) {
const txBuilderConfig = TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 15,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class _WalletDetailsState extends State<_WalletDetails> {
List<ShelleyAddress>? _rewardAddresses;
List<ShelleyAddress>? _unusedAddresses;
List<ShelleyAddress>? _usedAddresses;
List<TransactionUnspentOutput>? _utxos;
Set<TransactionUnspentOutput>? _utxos;
PubDRepKey? _pubDRepKey;
List<PubStakeKey>? _registeredPubStakeKeys;
List<PubStakeKey>? _unregisteredPubStakeKeys;
Expand Down Expand Up @@ -450,7 +450,7 @@ String _formatBalance(Balance? balance) {
return buffer.toString();
}

String _formatUtxos(List<TransactionUnspentOutput>? utxos) {
String _formatUtxos(Set<TransactionUnspentOutput>? utxos) {
if (utxos == null) {
return '---';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Future<void> _signAndSubmitRbacTx({
}

Future<X509MetadataEnvelope<RegistrationData>> _buildMetadataEnvelope({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress rewardAddress,
}) async {
final seed = List.generate(
Expand Down Expand Up @@ -152,7 +152,7 @@ Future<X509MetadataEnvelope<RegistrationData>> _buildMetadataEnvelope({
}

Transaction _buildUnsignedRbacTx({
required List<TransactionUnspentOutput> inputs,
required Set<TransactionUnspentOutput> inputs,
required ShelleyAddress changeAddress,
required ShelleyAddress rewardAddress,
required AuxiliaryData auxiliaryData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Future<void> _signAndSubmitTx({
}

Transaction _buildUnsignedTx({
required List<TransactionUnspentOutput> utxos,
required Set<TransactionUnspentOutput> utxos,
required ShelleyAddress changeAddress,
}) {
/* cSpell:disable */
Expand Down Expand Up @@ -81,9 +81,10 @@ Transaction _buildUnsignedTx({

TransactionBuilderConfig _buildTransactionBuilderConfig() {
return const TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 15,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ abstract interface class CardanoWalletApi {
/// specified in amount, and if this cannot be attained,
/// null shall be returned. The results can be further paginated by
/// [paginate] if it is not null.
Future<List<TransactionUnspentOutput>> getUtxos({
Future<Set<TransactionUnspentOutput>> getUtxos({
Balance? amount,
Paginate? paginate,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
}

@override
Future<List<TransactionUnspentOutput>> getUtxos({
Future<Set<TransactionUnspentOutput>> getUtxos({
Balance? amount,
Paginate? paginate,
}) async {
Expand All @@ -183,7 +183,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
paginate != null ? JSPaginate.fromDart(paginate) : makeUndefined(),
);

if (utxos == null) return [];
if (utxos == null) return {};

return await utxos.toDart.then(
(array) => array.toDart
Expand All @@ -192,7 +192,7 @@ class JSCardanoWalletApiProxy implements CardanoWalletApi {
cbor.decode(hex.decode(item.toDart)),
),
)
.toList(),
.toSet(),
);
} catch (ex) {
throw _mapApiException(ex) ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ import 'package:convert/convert.dart';
/* cSpell:disable */
void main() {
const txBuilderConfig = TransactionBuilderConfig(
feeAlgo: LinearFee(
constant: Coin(155381),
coefficient: Coin(44),
feeAlgo: TieredFee(
constant: 155381,
coefficient: 44,
refScriptByteCost: 0,
),
maxTxSize: 16384,
maxValueSize: 5000,
Expand Down
Loading

0 comments on commit e100011

Please sign in to comment.