20 lines
699 B
Dart
20 lines
699 B
Dart
|
import 'package:wonders/common_libs.dart';
|
||
|
import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration_config.dart';
|
||
|
|
||
|
/// Utility class that wraps a normal [Hero] widget, but respects WonderIllustrationConfig.enableHero setting
|
||
|
class WonderHero extends StatelessWidget {
|
||
|
const WonderHero(this.config, this.tag, {Key? key, required this.child}) : super(key: key);
|
||
|
final WonderIllustrationConfig config;
|
||
|
final Widget child;
|
||
|
final String tag;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) => config.enableHero
|
||
|
? Hero(
|
||
|
createRectTween: (begin, end) => RectTween(begin: begin!, end: end!),
|
||
|
tag: tag,
|
||
|
child: child,
|
||
|
)
|
||
|
: child;
|
||
|
}
|