mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 22:36:24 +00:00
e0e1487643
The transaction component's `reset` functionality was meant ot reset a form when the modal was closed. It was difficult to manage and added extra overhead for each additional transaction modal created. Instead of using reset functions, we can use Loaders to load and destroy the modal's as they are opened and closed. We do not need to keep them in memory and then also reset their functions. It creates a smaller memory footprint to destroy the object and reload on open. feat: load gas prediction prices asynchronously
69 lines
1.6 KiB
QML
69 lines
1.6 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import "../imports"
|
|
|
|
StackView {
|
|
id: root
|
|
default property list<FormGroup> groups
|
|
property int currentIdx: 0
|
|
property bool isLastGroup: currentIdx === groups.length - 1
|
|
property bool isFirstGroup: currentIdx === 0
|
|
signal groupActivated(Item group)
|
|
property alias currentGroup: root.currentItem
|
|
readonly property string uuid: Utils.uuid()
|
|
|
|
property var next: function() {
|
|
if (groups && groups.length <= currentIdx + 1) {
|
|
return
|
|
}
|
|
const group = groups[++currentIdx]
|
|
this.push(group, StackView.Immediate)
|
|
}
|
|
property var back: function() {
|
|
if (currentIdx <= 0) {
|
|
return
|
|
}
|
|
this.pop()
|
|
currentIdx--
|
|
}
|
|
|
|
initialItem: groups[currentIdx]
|
|
anchors.fill: parent
|
|
|
|
// The below transitions are pointless, but without them,
|
|
// the final input in the final TransactionFormGroup will
|
|
// not be able to receive focus! Seems like a Qt bug...
|
|
pushEnter: Transition {
|
|
PropertyAnimation {
|
|
property: "opacity"
|
|
from: 1
|
|
to:1
|
|
duration: 1
|
|
}
|
|
}
|
|
pushExit: Transition {
|
|
PropertyAnimation {
|
|
property: "opacity"
|
|
from: 1
|
|
to:1
|
|
duration: 1
|
|
}
|
|
}
|
|
popEnter: Transition {
|
|
PropertyAnimation {
|
|
property: "opacity"
|
|
from: 1
|
|
to:1
|
|
duration: 1
|
|
}
|
|
}
|
|
popExit: Transition {
|
|
PropertyAnimation {
|
|
property: "opacity"
|
|
from: 1
|
|
to:1
|
|
duration: 1
|
|
}
|
|
}
|
|
}
|