refactor view body

This commit is contained in:
sneurlax 2024-01-24 12:09:51 -06:00
parent ec9cec5d21
commit 4aed72874b

View file

@ -78,15 +78,61 @@ class _NewWalletRecoveryPhraseWarningViewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
return MasterScaffold(
isDesktop: isDesktop,
appBar: _buildAppBar(context),
body: _buildBody(context),
);
}
Widget _buildAppBar(BuildContext context) {
return isDesktop
? const DesktopAppBar(
isCompactHeight: false,
leading: AppBarBackButton(),
trailing: ExitToMyStackButton(),
)
: AppBar(
leading: const AppBarBackButton(),
actions: [
Padding(
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
right: 10,
),
child: AppBarIconButton(
semanticsLabel:
"Question Button. Opens A Dialog For Recovery Phrase Explanation.",
icon: SvgPicture.asset(
Assets.svg.circleQuestion,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
onPressed: () async {
await showDialog<void>(
context: context,
builder: (context) =>
const RecoveryPhraseExplanationDialog(),
);
},
),
)
],
);
}
Widget _buildBody(BuildContext context) {
final options = ref.read(pNewWalletOptions.state).state; final options = ref.read(pNewWalletOptions.state).state;
final seedCount = options?.mnemonicWordsCount ?? final seedCount = options?.mnemonicWordsCount ??
Constants.defaultSeedPhraseLengthFor(coin: coin); Constants.defaultSeedPhraseLengthFor(coin: coin);
return MasterScaffold( return ConditionalParent(
isDesktop: isDesktop,
appBar: _buildAppBar(context),
body: ConditionalParent(
condition: !isDesktop, condition: !isDesktop,
builder: (child) => LayoutBuilder( builder: (child) => LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
@ -615,46 +661,5 @@ class _NewWalletRecoveryPhraseWarningViewState
], ],
), ),
), ),
);
}
Widget _buildAppBar(BuildContext context) {
return isDesktop
? const DesktopAppBar(
isCompactHeight: false,
leading: AppBarBackButton(),
trailing: ExitToMyStackButton(),
)
: AppBar(
leading: const AppBarBackButton(),
actions: [
Padding(
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
right: 10,
),
child: AppBarIconButton(
semanticsLabel:
"Question Button. Opens A Dialog For Recovery Phrase Explanation.",
icon: SvgPicture.asset(
Assets.svg.circleQuestion,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
),
onPressed: () async {
await showDialog<void>(
context: context,
builder: (context) =>
const RecoveryPhraseExplanationDialog(),
);
},
),
)
],
);
} }
} }