mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-24 01:08:09 +08:00
46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
/*
|
|
* SPDX-FileCopyrightText: 2020-2021 Roland Fredenhagen <important@van-fredenhagen.de>
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class HeroDialogRoute<T> extends PageRoute<T> {
|
|
HeroDialogRoute({required this.builder}) : super();
|
|
|
|
final WidgetBuilder builder;
|
|
|
|
@override
|
|
bool get opaque => false;
|
|
|
|
@override
|
|
bool get barrierDismissible => true;
|
|
|
|
@override
|
|
Duration get transitionDuration => const Duration(milliseconds: 200);
|
|
|
|
@override
|
|
bool get maintainState => true;
|
|
|
|
@override
|
|
Color get barrierColor => Colors.black54;
|
|
|
|
@override
|
|
Widget buildTransitions(BuildContext context, Animation<double> animation,
|
|
Animation<double> secondaryAnimation, Widget child) {
|
|
return FadeTransition(
|
|
opacity: CurvedAnimation(parent: animation, curve: Curves.easeOut),
|
|
child: child);
|
|
}
|
|
|
|
@override
|
|
Widget buildPage(BuildContext context, Animation<double> animation,
|
|
Animation<double> secondaryAnimation) {
|
|
return builder(context);
|
|
}
|
|
|
|
@override
|
|
String get barrierLabel => "close preview";
|
|
}
|