mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-25 10:50:40 +01:00
feat: Cupertino style record dialog
This commit is contained in:
parent
ca3d409714
commit
493987fe74
@ -1,6 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
@ -81,9 +83,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
(maxDecibalWidth / 4).toDouble();
|
(maxDecibalWidth / 4).toDouble();
|
||||||
final time =
|
final time =
|
||||||
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
'${_duration.inMinutes.toString().padLeft(2, '0')}:${(_duration.inSeconds % 60).toString().padLeft(2, '0')}';
|
||||||
print('Decibal width: $decibalWidth');
|
final content = error
|
||||||
return AlertDialog(
|
|
||||||
content: error
|
|
||||||
? Text(L10n.of(context).oopsSomethingWentWrong)
|
? Text(L10n.of(context).oopsSomethingWentWrong)
|
||||||
: Row(
|
: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -111,8 +111,37 @@ class _RecordingDialogState extends State<RecordingDialog> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
);
|
||||||
|
if (PlatformInfos.isCupertinoStyle) {
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
content: content,
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
||||||
|
child: Text(
|
||||||
|
L10n.of(context).cancel.toUpperCase(),
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
Theme.of(context).textTheme.bodyText2.color.withAlpha(150),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
),
|
||||||
|
),
|
||||||
|
if (error != true)
|
||||||
|
CupertinoDialogAction(
|
||||||
|
onPressed: () async {
|
||||||
|
_recorderSubscription?.cancel();
|
||||||
|
await _audioRecorder.stop();
|
||||||
|
Navigator.of(context, rootNavigator: false)
|
||||||
|
.pop<String>(_recordedPath);
|
||||||
|
},
|
||||||
|
child: Text(L10n.of(context).send.toUpperCase()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return AlertDialog(
|
||||||
|
content: content,
|
||||||
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user