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:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
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:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.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/avatar.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||||
|
@ -191,19 +189,12 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
||||||
this.reactionEntry,
|
this.reactionEntry,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<bool?> show(BuildContext context) => PlatformInfos.isCupertinoStyle
|
Future<bool?> show(BuildContext context) => showAdaptiveDialog(
|
||||||
? showCupertinoDialog(
|
context: context,
|
||||||
context: context,
|
builder: (context) => this,
|
||||||
builder: (context) => this,
|
barrierDismissible: true,
|
||||||
barrierDismissible: true,
|
useRootNavigator: false,
|
||||||
useRootNavigator: false,
|
);
|
||||||
)
|
|
||||||
: showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => this,
|
|
||||||
barrierDismissible: true,
|
|
||||||
useRootNavigator: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -228,14 +219,9 @@ class _AdaptableReactorsDialog extends StatelessWidget {
|
||||||
|
|
||||||
final title = Center(child: Text(reactionEntry!.key!));
|
final title = Center(child: Text(reactionEntry!.key!));
|
||||||
|
|
||||||
return PlatformInfos.isCupertinoStyle
|
return AlertDialog.adaptive(
|
||||||
? CupertinoAlertDialog(
|
title: title,
|
||||||
title: title,
|
content: body,
|
||||||
content: body,
|
);
|
||||||
)
|
|
||||||
: AlertDialog(
|
|
||||||
title: title,
|
|
||||||
content: body,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ import 'package:matrix/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
|
|
||||||
class KeyVerificationDialog extends StatefulWidget {
|
class KeyVerificationDialog extends StatefulWidget {
|
||||||
Future<void> show(BuildContext context) => showDialog(
|
Future<void> show(BuildContext context) => showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => this,
|
builder: (context) => this,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
|
@ -342,23 +341,8 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
||||||
);
|
);
|
||||||
break;
|
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,
|
title: title,
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: 256,
|
height: 256,
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:developer';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:async/async.dart' as async;
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ import 'package:fluffychat/utils/size_string.dart';
|
||||||
import 'matrix_file_extension.dart';
|
import 'matrix_file_extension.dart';
|
||||||
|
|
||||||
extension LocalizedBody on Event {
|
extension LocalizedBody on Event {
|
||||||
Future<LoadingDialogResult<MatrixFile?>> _getFile(BuildContext context) =>
|
Future<async.Result<MatrixFile?>> _getFile(BuildContext context) =>
|
||||||
showFutureLoadingDialog(
|
showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: downloadAndDecryptAttachment,
|
future: downloadAndDecryptAttachment,
|
||||||
|
|
|
@ -66,7 +66,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.2"
|
version: "2.4.2"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||||
|
@ -739,10 +739,10 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: future_loading_dialog
|
name: future_loading_dialog
|
||||||
sha256: "6227dddb32ad5c7d233a54668f862acb4beb5a5e0dde072de372347cc0799e63"
|
sha256: "2718b1a308db452da32ab9bca9ad496ff92b683e217add9e92cf50520f90537e"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.4"
|
version: "0.3.0"
|
||||||
geolocator:
|
geolocator:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -11,6 +11,7 @@ dependencies:
|
||||||
adaptive_dialog: ^1.9.0+2
|
adaptive_dialog: ^1.9.0+2
|
||||||
animations: ^2.0.7
|
animations: ^2.0.7
|
||||||
archive: ^3.3.9
|
archive: ^3.3.9
|
||||||
|
async: ^2.11.0
|
||||||
badges: ^3.1.1
|
badges: ^3.1.1
|
||||||
blurhash_dart: ^1.1.0
|
blurhash_dart: ^1.1.0
|
||||||
callkeep: ^0.3.2
|
callkeep: ^0.3.2
|
||||||
|
@ -49,7 +50,7 @@ dependencies:
|
||||||
flutter_typeahead: ^4.3.2
|
flutter_typeahead: ^4.3.2
|
||||||
flutter_web_auth_2: ^3.0.3
|
flutter_web_auth_2: ^3.0.3
|
||||||
flutter_webrtc: ^0.9.37
|
flutter_webrtc: ^0.9.37
|
||||||
future_loading_dialog: ^0.2.3
|
future_loading_dialog: ^0.3.0
|
||||||
geolocator: ^7.6.2
|
geolocator: ^7.6.2
|
||||||
go_router: ^12.0.1
|
go_router: ^12.0.1
|
||||||
hive: ^2.2.3
|
hive: ^2.2.3
|
||||||
|
|
Loading…
Reference in a new issue