Skip to content

Commit

Permalink
tabs/console: make ether console slightly better
Browse files Browse the repository at this point in the history
  • Loading branch information
octobocto committed Nov 11, 2023
1 parent 7f797df commit 55fe2fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/widgets/containers/tabs/console.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ class ResultView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleValueContainer(
width: 95,
width: 0,
icon: result.error == null
? SailSVG.icon(SailSVGAsset.iconConfirmed, width: 13)
: SailSVG.icon(SailSVGAsset.iconFailed, width: 13),
copyable: true,
label: result.command.split(' ').first,
value: result.error ?? result.success,
customCopyValue: result.error ?? result.success,
value: '> ${result.command}\n${result.error ?? result.success}',
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ import 'package:sail_ui/widgets/core/sail_snackbar.dart';
import 'package:sail_ui/widgets/core/sail_text.dart';

class SingleValueContainer extends StatelessWidget {
final String label;
final String? label;
final dynamic value;
final double width;
final String? trailingText;
final Widget? icon;
final bool copyable;
final String? customCopyValue;

const SingleValueContainer({
super.key,
required this.label,
required this.value,
required this.width,
this.label,
this.trailingText,
this.icon,
this.copyable = true,
this.customCopyValue,
});

@override
Expand All @@ -33,16 +35,17 @@ class SingleValueContainer extends StatelessWidget {
const SizedBox(
width: 13,
),
SizedBox(
width: width,
child: SailText.secondary12(label),
),
if (label != null)
SizedBox(
width: width,
child: SailText.secondary12(label!),
),
Expanded(
child: SailScaleButton(
onPressed: copyable
? () {
Clipboard.setData(ClipboardData(text: value.toString()));
showSnackBar(context, 'Copied $label');
Clipboard.setData(ClipboardData(text: customCopyValue ?? value.toString()));
showSnackBar(context, 'Copied ${label ?? customCopyValue ?? value.toString()}');
}
: null,
child: SailText.primary12(value.toString()),
Expand Down

0 comments on commit 55fe2fb

Please sign in to comment.