mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
refactor desktop step item
This commit is contained in:
parent
2654d50e40
commit
648c896b9e
5 changed files with 74 additions and 53 deletions
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/step_one_item.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
@ -41,7 +41,7 @@ class DesktopStep1 extends ConsumerWidget {
|
|||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
StepOneItem(
|
||||
DesktopStepItem(
|
||||
label: "Exchange",
|
||||
value: ref.watch(currentExchangeNameStateProvider.state).state,
|
||||
),
|
||||
|
@ -49,7 +49,7 @@ class DesktopStep1 extends ConsumerWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
StepOneItem(
|
||||
DesktopStepItem(
|
||||
label: "You send",
|
||||
value:
|
||||
"${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}",
|
||||
|
@ -58,7 +58,7 @@ class DesktopStep1 extends ConsumerWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
StepOneItem(
|
||||
DesktopStepItem(
|
||||
label: "You receive",
|
||||
value:
|
||||
"~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}",
|
||||
|
@ -67,7 +67,7 @@ class DesktopStep1 extends ConsumerWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
StepOneItem(
|
||||
DesktopStepItem(
|
||||
label: model.rateType == ExchangeRateType.estimated
|
||||
? "Estimated rate"
|
||||
: "Fixed rate",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/step_one_item.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
|
@ -25,7 +25,7 @@ class DesktopStep3 extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "Exchange",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -33,7 +33,7 @@ class DesktopStep3 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "You send",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -41,7 +41,7 @@ class DesktopStep3 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "You receive",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -49,7 +49,7 @@ class DesktopStep3 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "Rate",
|
||||
value: "lol",
|
||||
),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/step_one_item.dart';
|
||||
import 'package:stackwallet/pages_desktop_specific/desktop_exchange/exchange_steps/subwidgets/desktop_step_item.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
|
@ -32,7 +32,7 @@ class DesktopStep4 extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "Exchange",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -40,7 +40,7 @@ class DesktopStep4 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "You send",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -48,7 +48,7 @@ class DesktopStep4 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "You receive",
|
||||
value: "lol",
|
||||
),
|
||||
|
@ -56,7 +56,7 @@ class DesktopStep4 extends StatelessWidget {
|
|||
height: 1,
|
||||
color: Theme.of(context).extension<StackColors>()!.background,
|
||||
),
|
||||
const StepOneItem(
|
||||
const DesktopStepItem(
|
||||
label: "Rate",
|
||||
value: "lol",
|
||||
),
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
|
||||
class DesktopStepItem extends StatelessWidget {
|
||||
const DesktopStepItem(
|
||||
{Key? key,
|
||||
required this.label,
|
||||
required this.value,
|
||||
this.padding = const EdgeInsets.all(16),
|
||||
this.vertical = false})
|
||||
: super(key: key);
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
final EdgeInsets padding;
|
||||
final bool vertical;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: ConditionalParent(
|
||||
condition: vertical,
|
||||
builder: (child) => Column(
|
||||
children: [
|
||||
child,
|
||||
const SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context),
|
||||
),
|
||||
if (!vertical)
|
||||
Text(
|
||||
value,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
||||
class StepOneItem extends StatelessWidget {
|
||||
const StepOneItem({
|
||||
Key? key,
|
||||
required this.label,
|
||||
required this.value,
|
||||
this.padding = const EdgeInsets.all(16),
|
||||
}) : super(key: key);
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
final EdgeInsets padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: padding,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context),
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: STextStyles.desktopTextExtraExtraSmall(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue