|
|
@@ -113,158 +113,170 @@ class _StakingScreenState extends ConsumerState<StakingScreen> {
|
|
|
final pageBody = ListView(
|
|
|
padding: const EdgeInsets.only(bottom: 32),
|
|
|
children: [
|
|
|
- _HeroSection(
|
|
|
- l10n: l10n,
|
|
|
- rulesText: rulesText,
|
|
|
- loadingRules: state.isLoadingConfig,
|
|
|
- ),
|
|
|
- IdoOverviewCards(
|
|
|
- teamNum: state.teamNum,
|
|
|
- lockedTotal: state.lockedTotal,
|
|
|
- loading: state.isLoadingOverview,
|
|
|
- ),
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- l10n.financeJoinPresale,
|
|
|
- style: TextStyle(
|
|
|
- color: _financePrimaryText(context),
|
|
|
- fontSize: 22,
|
|
|
- fontWeight: FontWeight.w600,
|
|
|
- ),
|
|
|
- ),
|
|
|
- const SizedBox(height: 24),
|
|
|
- _LabelRow(
|
|
|
- label: l10n.financeSubscribeQty,
|
|
|
- actionLabel: l10n.goSpotTrade,
|
|
|
- onAction:
|
|
|
- config == null ? null : () => _goToSpotTrade(config),
|
|
|
- ),
|
|
|
- const SizedBox(height: 12),
|
|
|
- _LabelRow(label: l10n.financeCorrespondingPrice),
|
|
|
- const SizedBox(height: 12),
|
|
|
- _AvailableMetaRow(
|
|
|
- l10n: l10n,
|
|
|
- amount: _fmtAmount(state.fundingAvailable),
|
|
|
- unit: displayUnit,
|
|
|
- loading: state.isRefreshingBalance,
|
|
|
- onFillAll: state.isRefreshingBalance
|
|
|
- ? null
|
|
|
- : () => _fillAllAmount(state.fundingAvailable),
|
|
|
- ),
|
|
|
- const SizedBox(height: 12),
|
|
|
- _UnitPriceMetaRow(
|
|
|
- l10n: l10n,
|
|
|
- unitPrice: unitPrice,
|
|
|
- ),
|
|
|
- const SizedBox(height: 12),
|
|
|
- _FieldInput(
|
|
|
- controller: _amountController,
|
|
|
- suffix: displayUnit,
|
|
|
- onChanged: (_) => setState(() {}),
|
|
|
+ _HeroSection(
|
|
|
+ l10n: l10n,
|
|
|
+ rulesText: rulesText,
|
|
|
+ loadingRules: state.isLoadingConfig,
|
|
|
+ ),
|
|
|
+ IdoOverviewCards(
|
|
|
+ teamNum: state.teamNum,
|
|
|
+ lockedTotal: state.lockedTotal,
|
|
|
+ loading: state.isLoadingOverview,
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 0),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ l10n.financeJoinPresale,
|
|
|
+ style: TextStyle(
|
|
|
+ color: _financePrimaryText(context),
|
|
|
+ fontSize: 22,
|
|
|
+ fontWeight: FontWeight.w600,
|
|
|
),
|
|
|
- const SizedBox(height: 12),
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: _FieldInput(
|
|
|
- readOnly: true,
|
|
|
- value: _priceUsdtText(unitPrice),
|
|
|
- suffix: 'USDT',
|
|
|
- ),
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 24),
|
|
|
+ _LabelRow(
|
|
|
+ label: l10n.financeSubscribeQty,
|
|
|
+ actionLabel: l10n.goSpotTrade,
|
|
|
+ onAction: config == null ? null : () => _goToSpotTrade(config),
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 12),
|
|
|
+ _LabelRow(label: l10n.financeCorrespondingPrice),
|
|
|
+ const SizedBox(height: 12),
|
|
|
+ _AvailableMetaRow(
|
|
|
+ l10n: l10n,
|
|
|
+ amount: _fmtAmount(state.fundingAvailable),
|
|
|
+ unit: displayUnit,
|
|
|
+ loading: state.isRefreshingBalance,
|
|
|
+ onFillAll: state.isRefreshingBalance
|
|
|
+ ? null
|
|
|
+ : () => _fillAllAmount(state.fundingAvailable),
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 12),
|
|
|
+ _FieldInput(
|
|
|
+ controller: _amountController,
|
|
|
+ suffix: displayUnit,
|
|
|
+ onChanged: (_) => setState(() {}),
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 12),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: _FieldInput(
|
|
|
+ readOnly: true,
|
|
|
+ value: _priceUsdtText(unitPrice),
|
|
|
+ suffix: 'USDT',
|
|
|
),
|
|
|
- const SizedBox(width: 12),
|
|
|
+ ),
|
|
|
+ const SizedBox(width: 12),
|
|
|
+ if (false)
|
|
|
_TransferButton(
|
|
|
label: l10n.stakingTransfer,
|
|
|
onPressed: () => _openSpotFundTransfer(isLoggedIn),
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
- const SizedBox(height: 32),
|
|
|
- Center(
|
|
|
- child: ConstrainedBox(
|
|
|
- constraints: const BoxConstraints(maxWidth: 360),
|
|
|
- child: SizedBox(
|
|
|
- width: double.infinity,
|
|
|
- height: 48,
|
|
|
- child: ElevatedButton(
|
|
|
- onPressed: state.isSubmitting ||
|
|
|
- config == null ||
|
|
|
- state.isLoadingConfig
|
|
|
- ? null
|
|
|
- : () => _submitStake(isLoggedIn),
|
|
|
- style: ElevatedButton.styleFrom(
|
|
|
- backgroundColor: AppColors.brand,
|
|
|
- foregroundColor: Colors.black,
|
|
|
- disabledBackgroundColor:
|
|
|
- AppColors.brand.withAlpha(128),
|
|
|
- shape: const StadiumBorder(),
|
|
|
- elevation: 0,
|
|
|
- ),
|
|
|
- child: state.isSubmitting
|
|
|
- ? const SizedBox(
|
|
|
- width: 18,
|
|
|
- height: 18,
|
|
|
- child: CircularProgressIndicator(
|
|
|
- strokeWidth: 2,
|
|
|
- ),
|
|
|
- )
|
|
|
- : Text(
|
|
|
- l10n.financeConfirmPresale,
|
|
|
- style: const TextStyle(
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: FontWeight.w600,
|
|
|
- ),
|
|
|
- ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 20),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ _UnitPriceMetaRow(
|
|
|
+ l10n: l10n,
|
|
|
+ unitPrice: unitPrice,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 20),
|
|
|
+ // const SizedBox(height: 32),
|
|
|
+ Center(
|
|
|
+ child: ConstrainedBox(
|
|
|
+ constraints: const BoxConstraints(maxWidth: 360),
|
|
|
+ child: SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ height: 48,
|
|
|
+ child: ElevatedButton(
|
|
|
+ onPressed: state.isSubmitting ||
|
|
|
+ config == null ||
|
|
|
+ state.isLoadingConfig
|
|
|
+ ? null
|
|
|
+ : () => _submitStake(isLoggedIn),
|
|
|
+ style: ElevatedButton.styleFrom(
|
|
|
+ backgroundColor: AppColors.brand,
|
|
|
+ foregroundColor: Colors.black,
|
|
|
+ disabledBackgroundColor: AppColors.brand.withAlpha(128),
|
|
|
+ shape: const StadiumBorder(),
|
|
|
+ elevation: 0,
|
|
|
),
|
|
|
+ child: state.isSubmitting
|
|
|
+ ? const SizedBox(
|
|
|
+ width: 18,
|
|
|
+ height: 18,
|
|
|
+ child: CircularProgressIndicator(
|
|
|
+ strokeWidth: 2,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Text(
|
|
|
+ l10n.financeConfirmPresale,
|
|
|
+ style: const TextStyle(
|
|
|
+ fontSize: 16,
|
|
|
+ fontWeight: FontWeight.w600,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
- const SizedBox(height: 20),
|
|
|
- Text(
|
|
|
- state.isLoadingConfig
|
|
|
- ? l10n.financeEstimatedUnlockLine('—')
|
|
|
- : l10n.financeEstimatedUnlockLine(unlockText),
|
|
|
- textAlign: TextAlign.center,
|
|
|
- style: TextStyle(
|
|
|
- color: _financeSecondaryText(context),
|
|
|
- fontSize: 13,
|
|
|
+ ),
|
|
|
+ const SizedBox(height: 20),
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment:CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment:MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ state.isLoadingConfig
|
|
|
+ ? l10n.financeEstimatedUnlockLine('—')
|
|
|
+ : l10n.financeEstimatedUnlockLine(unlockText),
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(
|
|
|
+ color: _financeSecondaryText(context),
|
|
|
+ fontSize: 13,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- if (!isLoggedIn) ...[
|
|
|
- const SizedBox(height: 12),
|
|
|
- Wrap(
|
|
|
- alignment: WrapAlignment.center,
|
|
|
- crossAxisAlignment: WrapCrossAlignment.center,
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- l10n.financeLoginToStake,
|
|
|
- style: TextStyle(
|
|
|
- color: _financeSecondaryText(context),
|
|
|
- fontSize: 12,
|
|
|
- ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ if (!isLoggedIn) ...[
|
|
|
+ const SizedBox(height: 12),
|
|
|
+ Wrap(
|
|
|
+ alignment: WrapAlignment.center,
|
|
|
+ crossAxisAlignment: WrapCrossAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ l10n.financeLoginToStake,
|
|
|
+ style: TextStyle(
|
|
|
+ color: _financeSecondaryText(context),
|
|
|
+ fontSize: 12,
|
|
|
),
|
|
|
- GestureDetector(
|
|
|
- onTap: () => context.push(
|
|
|
- '/login?redirect=${Uri.encodeComponent('/finance/ido')}',
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- l10n.login,
|
|
|
- style: const TextStyle(
|
|
|
- color: AppColors.brand,
|
|
|
- fontSize: 12,
|
|
|
- ),
|
|
|
+ ),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () => context.push(
|
|
|
+ '/login?redirect=${Uri.encodeComponent('/finance/ido')}',
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ l10n.login,
|
|
|
+ style: const TextStyle(
|
|
|
+ color: AppColors.brand,
|
|
|
+ fontSize: 12,
|
|
|
),
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
],
|
|
|
- ),
|
|
|
+ ],
|
|
|
),
|
|
|
+ ),
|
|
|
],
|
|
|
);
|
|
|
|
|
|
@@ -364,6 +376,7 @@ class _StakingScreenState extends ConsumerState<StakingScreen> {
|
|
|
String pad(int n) {
|
|
|
return n.toString().padLeft(2, '0');
|
|
|
}
|
|
|
+
|
|
|
return '${date.year}/${pad(date.month)}/${pad(date.day)} '
|
|
|
'${pad(date.hour)}:${pad(date.minute)}:${pad(date.second)}';
|
|
|
}
|
|
|
@@ -658,7 +671,9 @@ class _UnitPriceMetaRow extends StatelessWidget {
|
|
|
NumberFormat('#,##0.0000', 'en_US').format(unitPrice.toDouble()),
|
|
|
),
|
|
|
style: TextStyle(
|
|
|
- color: _financeSecondaryText(context),
|
|
|
+ color: _financeIsDark(context)
|
|
|
+ ? const Color(0xFFF0B90B)
|
|
|
+ : _financeSecondaryText(context),
|
|
|
fontSize: 13,
|
|
|
),
|
|
|
);
|