mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 05:45:10 +00:00
refactor: Update FutureLoadingDialog
This commit is contained in:
parent
072c4db616
commit
f028b12185
5 changed files with 19 additions and 47 deletions
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart' show IterableExtension;
|
||||
|
@ -6,7 +5,6 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||
|
@ -191,19 +189,12 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
|||
this.reactionEntry,
|
||||
});
|
||||
|
||||
Future<bool?> show(BuildContext context) => PlatformInfos.isCupertinoStyle
|
||||
? showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) => this,
|
||||
barrierDismissible: true,
|
||||
useRootNavigator: false,
|
||||
)
|
||||
: showDialog(
|
||||
context: context,
|
||||
builder: (context) => this,
|
||||
barrierDismissible: true,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
Future<bool?> show(BuildContext context) => showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (context) => this,
|
||||
barrierDismissible: true,
|
||||
useRootNavigator: false,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -228,14 +219,9 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
|||
|
||||
final title = Center(child: Text(reactionEntry!.key!));
|
||||
|
||||
return PlatformInfos.isCupertinoStyle
|
||||
? CupertinoAlertDialog(
|
||||
title: title,
|
||||
content: body,
|
||||
)
|
||||
: AlertDialog(
|
||||
title: title,
|
||||
content: body,
|
||||
);
|
||||
return AlertDialog.adaptive(
|
||||
title: title,
|
||||
content: body,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
@ -14,7 +13,7 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
|
||||
class KeyVerificationDialog extends StatefulWidget {
|
||||
Future<void> show(BuildContext context) => showDialog(
|
||||
Future<void> show(BuildContext context) => showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (context) => this,
|
||||
barrierDismissible: false,
|
||||
|
@ -342,23 +341,8 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
);
|
||||
break;
|
||||
}
|
||||
if ({TargetPlatform.iOS, TargetPlatform.macOS}
|
||||
.contains(Theme.of(context).platform)) {
|
||||
return CupertinoAlertDialog(
|
||||
title: title,
|
||||
content: SizedBox(
|
||||
height: 256,
|
||||
width: 256,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
children: [body],
|
||||
),
|
||||
),
|
||||
actions: buttons,
|
||||
);
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
return AlertDialog.adaptive(
|
||||
title: title,
|
||||
content: SizedBox(
|
||||
height: 256,
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:developer';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:async/async.dart' as async;
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
|
@ -10,7 +11,7 @@ import 'package:fluffychat/utils/size_string.dart';
|
|||
import 'matrix_file_extension.dart';
|
||||
|
||||
extension LocalizedBody on Event {
|
||||
Future<LoadingDialogResult<MatrixFile?>> _getFile(BuildContext context) =>
|
||||
Future<async.Result<MatrixFile?>> _getFile(BuildContext context) =>
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: downloadAndDecryptAttachment,
|
||||
|
|
|
@ -66,7 +66,7 @@ packages:
|
|||
source: hosted
|
||||
version: "2.4.2"
|
||||
async:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: async
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
|
@ -739,10 +739,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: future_loading_dialog
|
||||
sha256: "6227dddb32ad5c7d233a54668f862acb4beb5a5e0dde072de372347cc0799e63"
|
||||
sha256: "2718b1a308db452da32ab9bca9ad496ff92b683e217add9e92cf50520f90537e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.4"
|
||||
version: "0.3.0"
|
||||
geolocator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -11,6 +11,7 @@ dependencies:
|
|||
adaptive_dialog: ^1.9.0+2
|
||||
animations: ^2.0.7
|
||||
archive: ^3.3.9
|
||||
async: ^2.11.0
|
||||
badges: ^3.1.1
|
||||
blurhash_dart: ^1.1.0
|
||||
callkeep: ^0.3.2
|
||||
|
@ -49,7 +50,7 @@ dependencies:
|
|||
flutter_typeahead: ^4.3.2
|
||||
flutter_web_auth_2: ^3.0.3
|
||||
flutter_webrtc: ^0.9.37
|
||||
future_loading_dialog: ^0.2.3
|
||||
future_loading_dialog: ^0.3.0
|
||||
geolocator: ^7.6.2
|
||||
go_router: ^12.0.1
|
||||
hive: ^2.2.3
|
||||
|
|
Loading…
Reference in a new issue