utxo details desktop styled

This commit is contained in:
julian 2023-03-14 08:40:09 -06:00
parent 34c7f9f183
commit 3421c45e64

View file

@ -20,7 +20,8 @@ import 'package:stackwallet/widgets/custom_buttons/simple_edit_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/icon_widgets/utxo_status_icon.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
class UtxoDetailsView extends ConsumerStatefulWidget {
const UtxoDetailsView({
@ -40,7 +41,6 @@ class UtxoDetailsView extends ConsumerStatefulWidget {
class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
final isDesktop = Util.isDesktop;
static const double _spacing = 12;
late Stream<UTXO?> streamUTXO;
UTXO? utxo;
@ -133,7 +133,13 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
),
),
),
child: ConditionalParent(
child: StreamBuilder<UTXO?>(
stream: streamUTXO,
builder: (context, snapshot) {
if (snapshot.hasData) {
utxo = snapshot.data!;
}
return ConditionalParent(
condition: isDesktop,
builder: (child) {
return DesktopDialog(
@ -158,28 +164,76 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
),
],
),
child,
IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.only(
left: 32,
right: 32,
bottom: 32,
top: 10,
),
child: Column(
children: [
IntrinsicHeight(
child: RoundedContainer(
padding: EdgeInsets.zero,
color: Colors.transparent,
borderColor: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
child: child,
),
),
const SizedBox(
height: 20,
),
SecondaryButton(
buttonHeight: ButtonHeight.l,
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
],
),
),
),
],
),
);
},
child: StreamBuilder<UTXO?>(
stream: streamUTXO,
builder: (context, snapshot) {
if (snapshot.hasData) {
utxo = snapshot.data!;
}
return Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (!isDesktop)
const SizedBox(
height: 10,
),
RoundedWhiteContainer(
RoundedContainer(
padding: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
if (isDesktop)
UTXOStatusIcon(
blocked: utxo!.isBlocked,
status: confirmed
? UTXOStatusIconStatus.confirmed
: UTXOStatusIconStatus.unconfirmed,
background: Theme.of(context)
.extension<StackColors>()!
.popupBG,
selected: false,
width: 32,
height: 32,
),
if (isDesktop)
const SizedBox(
width: 16,
),
Text(
"${Format.satoshisToAmount(
utxo!.value,
@ -189,6 +243,8 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
)} ${coin.ticker}",
style: STextStyles.pageTitleH2(context),
),
],
),
Text(
utxo!.isBlocked
? "Frozen"
@ -210,10 +266,14 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
RoundedWhiteContainer(
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -252,10 +312,14 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
RoundedWhiteContainer(
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -290,12 +354,15 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
if (label != null && label!.value.isNotEmpty) const _Div(),
if (label != null && label!.value.isNotEmpty)
const SizedBox(
height: _spacing,
),
if (label != null && label!.value.isNotEmpty)
RoundedWhiteContainer(
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -330,10 +397,14 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
RoundedWhiteContainer(
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -368,10 +439,14 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
RoundedWhiteContainer(
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -394,25 +469,33 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
const _Div(),
if (utxo!.isBlocked)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
RoundedWhiteContainer(
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context)
.extension<StackColors>()!
.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Freeze reason",
style: STextStyles.w500_14(context).copyWith(
style:
STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
@ -441,24 +524,42 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
],
),
),
const SizedBox(
height: _spacing,
),
if (!isDesktop) const _Div(),
],
),
if (!isDesktop) const Spacer(),
if (!isDesktop)
SecondaryButton(
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
if (!isDesktop)
const SizedBox(
height: 16,
),
],
),
);
},
),
),
}),
);
}
}
class _Div extends StatelessWidget {
const _Div({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
if (Util.isDesktop) {
return Container(
width: double.infinity,
height: 1.0,
color: Theme.of(context).extension<StackColors>()!.textFieldDefaultBG,
);
} else {
return const SizedBox(
height: 12,
);
}
}
}