2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-11-30 21:15:06 +00:00
|
|
|
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,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|