mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-24 19:25:52 +00:00
lock send/receive height to fit
This commit is contained in:
parent
a6a7d56647
commit
2a27776acf
3 changed files with 721 additions and 613 deletions
|
@ -209,6 +209,8 @@ class MyWallet extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MyWalletState extends State<MyWallet> {
|
class _MyWalletState extends State<MyWallet> {
|
||||||
|
int _selectedIndex = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
|
@ -225,47 +227,44 @@ class _MyWalletState extends State<MyWallet> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16,
|
height: 16,
|
||||||
),
|
),
|
||||||
Expanded(
|
Container(
|
||||||
child: RoundedWhiteContainer(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.all(0),
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
child: DefaultTabController(
|
borderRadius: BorderRadius.vertical(
|
||||||
length: 2,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
TabBar(
|
|
||||||
indicatorColor: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorBlue,
|
|
||||||
labelStyle: STextStyles.desktopTextExtraSmall(context),
|
|
||||||
labelColor: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorBlue,
|
|
||||||
unselectedLabelColor: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textSubtitle1,
|
|
||||||
labelPadding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 6,
|
|
||||||
),
|
|
||||||
splashBorderRadius: BorderRadius.vertical(
|
|
||||||
top: Radius.circular(
|
top: Radius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
tabs: const [
|
|
||||||
Tab(text: "Send"),
|
|
||||||
Tab(text: "Receive"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
Expanded(
|
child: SendReceiveTabMenu(
|
||||||
child: TabBarView(
|
onChanged: (index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
borderRadius: BorderRadius.vertical(
|
||||||
|
bottom: Radius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: IndexedStack(
|
||||||
|
index: _selectedIndex,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
key: const Key("desktopSendViewPortKey"),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: DesktopSend(
|
child: DesktopSend(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
key: const Key("desktopReceiveViewPortKey"),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: DesktopReceive(
|
child: DesktopReceive(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
|
@ -274,6 +273,127 @@ class _MyWalletState extends State<MyWallet> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SendReceiveTabMenu extends StatefulWidget {
|
||||||
|
const SendReceiveTabMenu({
|
||||||
|
Key? key,
|
||||||
|
this.initialIndex = 0,
|
||||||
|
this.onChanged,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final int initialIndex;
|
||||||
|
final void Function(int)? onChanged;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SendReceiveTabMenu> createState() => _SendReceiveTabMenuState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SendReceiveTabMenuState extends State<SendReceiveTabMenu> {
|
||||||
|
late int _selectedIndex;
|
||||||
|
|
||||||
|
void _onChanged(int newIndex) {
|
||||||
|
if (_selectedIndex != newIndex) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = newIndex;
|
||||||
|
});
|
||||||
|
widget.onChanged?.call(_selectedIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_selectedIndex = widget.initialIndex;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => _onChanged(0),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Send",
|
||||||
|
style: STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: _selectedIndex == 0
|
||||||
|
? Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorBlue
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 19,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 2,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: _selectedIndex == 0
|
||||||
|
? Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorBlue
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => _onChanged(1),
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Receive",
|
||||||
|
style: STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
|
color: _selectedIndex == 1
|
||||||
|
? Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorBlue
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 19,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 2,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: _selectedIndex == 1
|
||||||
|
? Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorBlue
|
||||||
|
: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -199,15 +199,11 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
||||||
height: 32,
|
height: 32,
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: SizedBox(
|
|
||||||
width: 200,
|
|
||||||
height: 200,
|
|
||||||
child: QrImage(
|
child: QrImage(
|
||||||
data: "${coin.uriScheme}:$receivingAddress",
|
data: "${coin.uriScheme}:$receivingAddress",
|
||||||
size: MediaQuery.of(context).size.width / 2,
|
size: 200,
|
||||||
foregroundColor: Theme.of(context)
|
foregroundColor:
|
||||||
.extension<StackColors>()!
|
Theme.of(context).extension<StackColors>()!.accentColorDark,
|
||||||
.accentColorDark),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
|
@ -541,8 +541,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return Column(
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -613,8 +612,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
ConnectionState.done &&
|
ConnectionState.done &&
|
||||||
snapshot.hasData) {
|
snapshot.hasData) {
|
||||||
if (ref
|
if (ref
|
||||||
.read(
|
.read(publicPrivateBalanceStateProvider
|
||||||
publicPrivateBalanceStateProvider
|
|
||||||
.state)
|
.state)
|
||||||
.state ==
|
.state ==
|
||||||
"Private") {
|
"Private") {
|
||||||
|
@ -691,9 +689,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||||
final firoWallet = ref.read(provider).wallet as FiroWallet;
|
final firoWallet = ref.read(provider).wallet as FiroWallet;
|
||||||
if (ref
|
if (ref.read(publicPrivateBalanceStateProvider.state).state ==
|
||||||
.read(publicPrivateBalanceStateProvider.state)
|
|
||||||
.state ==
|
|
||||||
"Private") {
|
"Private") {
|
||||||
cryptoAmountController.text =
|
cryptoAmountController.text =
|
||||||
(await firoWallet.availablePrivateBalance())
|
(await firoWallet.availablePrivateBalance())
|
||||||
|
@ -820,8 +816,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
|
|
||||||
final amountString = Format.localizedStringAsFixed(
|
final amountString = Format.localizedStringAsFixed(
|
||||||
value: _amountToSend!,
|
value: _amountToSend!,
|
||||||
locale:
|
locale: ref.read(localeServiceChangeNotifierProvider).locale,
|
||||||
ref.read(localeServiceChangeNotifierProvider).locale,
|
|
||||||
decimalPlaces: Constants.decimalPlaces,
|
decimalPlaces: Constants.decimalPlaces,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1001,8 +996,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
final results =
|
final results =
|
||||||
AddressUtils.parseUri(qrResult.rawContent);
|
AddressUtils.parseUri(qrResult.rawContent);
|
||||||
|
|
||||||
Logging.instance.log(
|
Logging.instance.log("qrResult parsed: $results",
|
||||||
"qrResult parsed: $results",
|
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
|
|
||||||
if (results.isNotEmpty &&
|
if (results.isNotEmpty &&
|
||||||
|
@ -1095,9 +1089,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
error,
|
error,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: STextStyles.label(context).copyWith(
|
style: STextStyles.label(context).copyWith(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.extension<StackColors>()!
|
Theme.of(context).extension<StackColors>()!.textError,
|
||||||
.textError,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1166,7 +1159,6 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
: null,
|
: null,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue