mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 11:29:23 +00:00
67 lines
1.4 KiB
Dart
67 lines
1.4 KiB
Dart
/*
|
|
* This file is part of Stack Wallet.
|
|
*
|
|
* Copyright (c) 2023 Cypher Stack
|
|
* All Rights Reserved.
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
*
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class FadeStack extends StatefulWidget {
|
|
final int index;
|
|
final List<Widget> children;
|
|
|
|
const FadeStack({
|
|
super.key,
|
|
required this.index,
|
|
required this.children,
|
|
});
|
|
|
|
@override
|
|
FadeStackState createState() => FadeStackState();
|
|
}
|
|
|
|
class FadeStackState extends State<FadeStack>
|
|
with SingleTickerProviderStateMixin {
|
|
late final AnimationController animationController;
|
|
|
|
@override
|
|
void didUpdateWidget(FadeStack oldWidget) {
|
|
if (widget.index != oldWidget.index) {
|
|
animationController.forward(from: 0.0);
|
|
}
|
|
super.didUpdateWidget(oldWidget);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
animationController = AnimationController(
|
|
vsync: this,
|
|
duration: const Duration(
|
|
milliseconds: 250,
|
|
),
|
|
);
|
|
animationController.forward();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
animationController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FadeTransition(
|
|
opacity: animationController,
|
|
child: IndexedStack(
|
|
index: widget.index,
|
|
children: widget.children,
|
|
),
|
|
);
|
|
}
|
|
}
|