mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
refactor: remove deprecated approute
This commit is contained in:
parent
d018a4bec1
commit
be08de5ef0
@ -1,5 +1,4 @@
|
|||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:fluffychat/utils/app_route.dart';
|
|
||||||
import 'package:fluffychat/views/image_view.dart';
|
import 'package:fluffychat/views/image_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@ -235,8 +234,8 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
if (!widget.tapToView) return;
|
if (!widget.tapToView) return;
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
AppRoute(
|
MaterialPageRoute(
|
||||||
ImageView(widget.event, onLoaded: () {
|
builder: (_) => ImageView(widget.event, onLoaded: () {
|
||||||
// If the original file didn't load yet, we want to do that now.
|
// 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,
|
// 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
|
// waiting for it to load, and then hitting back. This ensures that we always
|
||||||
|
@ -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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'matrix_file_extension.dart';
|
import 'matrix_file_extension.dart';
|
||||||
import 'app_route.dart';
|
|
||||||
import '../views/image_view.dart';
|
import '../views/image_view.dart';
|
||||||
|
|
||||||
extension LocalizedBody on Event {
|
extension LocalizedBody on Event {
|
||||||
@ -12,9 +11,7 @@ extension LocalizedBody on Event {
|
|||||||
if (!downloadOnly &&
|
if (!downloadOnly &&
|
||||||
[MessageTypes.Image, MessageTypes.Sticker].contains(messageType)) {
|
[MessageTypes.Image, MessageTypes.Sticker].contains(messageType)) {
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
AppRoute(
|
MaterialPageRoute(builder: (_) => ImageView(this)),
|
||||||
ImageView(this),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user