refactor: remove deprecated approute

This commit is contained in:
Christian Pauly 2021-01-17 07:51:58 +01:00
parent d018a4bec1
commit be08de5ef0
3 changed files with 3 additions and 42 deletions

View File

@ -1,5 +1,4 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/image_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
@ -235,8 +234,8 @@ class _ImageBubbleState extends State<ImageBubble> {
onTap: () {
if (!widget.tapToView) return;
Navigator.of(context).push(
AppRoute(
ImageView(widget.event, onLoaded: () {
MaterialPageRoute(
builder: (_) => ImageView(widget.event, onLoaded: () {
// If the original file didn't load yet, we want to do that now.
// This is so that the original file displays after going on the image viewer,
// waiting for it to load, and then hitting back. This ensures that we always

View File

@ -1,35 +0,0 @@
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class AppRoute extends PageRouteBuilder {
static Route defaultRoute(BuildContext context, Widget page) {
return context != null &&
!AdaptivePageLayout.of(context).columnMode(context)
? CupertinoPageRoute(
builder: (BuildContext context) => page,
)
: AppRoute(page);
}
final Widget page;
AppRoute(this.page)
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) =>
page,
transitionsBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) =>
FadeTransition(
opacity: animation,
child: child,
),
);
}

View File

@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'matrix_file_extension.dart';
import 'app_route.dart';
import '../views/image_view.dart';
extension LocalizedBody on Event {
@ -12,9 +11,7 @@ extension LocalizedBody on Event {
if (!downloadOnly &&
[MessageTypes.Image, MessageTypes.Sticker].contains(messageType)) {
await Navigator.of(context).push(
AppRoute(
ImageView(this),
),
MaterialPageRoute(builder: (_) => ImageView(this)),
);
return;
}