Skip to content

Commit 6cdd405

Browse files
committed
chore: Improved some dialogs.
1 parent 4cbbdca commit 6cdd405

File tree

5 files changed

+57
-43
lines changed

5 files changed

+57
-43
lines changed

lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import 'package:open_authenticator/model/crypto.dart';
1818
import 'package:open_authenticator/model/settings/show_intro.dart';
1919
import 'package:open_authenticator/model/settings/theme.dart';
2020
import 'package:open_authenticator/model/totp/repository.dart';
21-
import 'package:open_authenticator/pages/contributor_plan_fallback_paywall.dart';
21+
import 'package:open_authenticator/pages/contributor_plan_paywall/page.dart';
2222
import 'package:open_authenticator/pages/home.dart';
2323
import 'package:open_authenticator/pages/intro/page.dart';
2424
import 'package:open_authenticator/pages/scan.dart';
@@ -231,8 +231,8 @@ class OpenAuthenticatorApp extends ConsumerWidget {
231231
),
232232
);
233233
},
234-
ContributorPlanFallbackPaywallPage.name: (_) => const _RouteWidget(
235-
child: ContributorPlanFallbackPaywallPage(),
234+
ContributorPlanPaywallPage.name: (_) => const _RouteWidget(
235+
child: ContributorPlanPaywallPage(),
236236
),
237237
}
238238
: {},

lib/utils/jovial_svg.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class JovialSvgUtils {
2525
siCompactBuilder.si.writeToFile(outputSink);
2626
return true;
2727
} catch (ex, stacktrace) {
28-
handleException(ex, stacktrace);
28+
handleException(ex, stacktrace, sendToCrashlytics: false);
2929
} finally {
3030
await ioSink.close();
3131
}

lib/widgets/dialog/app_dialog.dart

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class AppDialog extends StatelessWidget {
5555
/// The content padding.
5656
final EdgeInsets? contentPadding;
5757

58+
/// Whether to put the content in a [ListView] instead of a [Column].
59+
final bool scrollable;
60+
5861
/// Creates a new app dialog instance.
5962
const AppDialog({
6063
super.key,
@@ -65,6 +68,7 @@ class AppDialog extends StatelessWidget {
6568
this.borderRadius = 28,
6669
this.displayCloseButton,
6770
this.contentPadding,
71+
this.scrollable = true,
6872
});
6973

7074
@override
@@ -89,6 +93,19 @@ class AppDialog extends StatelessWidget {
8993
child: this.children[i],
9094
),
9195
];
96+
children = [
97+
if (title != null)
98+
Transform.translate(
99+
offset: Offset(0, -1),
100+
child: _AppDialogTitle(
101+
title: title!,
102+
ellipsisTitleOnOverflow: ellipsisTitleOnOverflow,
103+
displayCloseButton: displayCloseButton,
104+
borderRadius: borderRadius,
105+
),
106+
),
107+
...children,
108+
];
92109
Widget dialog = AlertDialog(
93110
shape: RoundedRectangleBorder(
94111
borderRadius: BorderRadius.all(
@@ -98,22 +115,15 @@ class AppDialog extends StatelessWidget {
98115
contentPadding: EdgeInsets.zero,
99116
content: SizedBox(
100117
width: MediaQuery.sizeOf(context).width,
101-
child: ListView(
102-
shrinkWrap: true,
103-
children: [
104-
if (title != null)
105-
Transform.translate(
106-
offset: Offset(0, -1),
107-
child: _AppDialogTitle(
108-
title: title!,
109-
ellipsisTitleOnOverflow: ellipsisTitleOnOverflow,
110-
displayCloseButton: displayCloseButton,
111-
borderRadius: borderRadius,
112-
),
118+
child: scrollable
119+
? ListView(
120+
shrinkWrap: true,
121+
children: children,
122+
)
123+
: Column(
124+
mainAxisSize: MainAxisSize.min,
125+
children: children,
113126
),
114-
...children,
115-
],
116-
),
117127
),
118128
actions: actions,
119129
);

lib/widgets/scan/scanner_error_widget.dart

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,31 @@ class ScannerErrorWidget extends StatelessWidget {
1717
Widget build(BuildContext context) => ColoredBox(
1818
color: Colors.black,
1919
child: Center(
20-
child: Column(
21-
mainAxisSize: MainAxisSize.min,
22-
children: [
23-
const Padding(
24-
padding: EdgeInsets.only(bottom: 20),
25-
child: Icon(
26-
Icons.error,
27-
color: Colors.white,
20+
child: Padding(
21+
padding: EdgeInsets.all(20),
22+
child: Column(
23+
mainAxisSize: MainAxisSize.min,
24+
children: [
25+
const Padding(
26+
padding: EdgeInsets.only(bottom: 20),
27+
child: Icon(
28+
Icons.error,
29+
color: Colors.white,
30+
),
2831
),
29-
),
30-
Text(
31-
switch (error.errorCode) {
32-
MobileScannerErrorCode.controllerUninitialized => translations.error.scan.controllerUninitialized(exception: error.errorDetails?.details ?? error.errorCode),
33-
MobileScannerErrorCode.permissionDenied => translations.error.scan.accessDeniedDialog.message(exception: error.errorDetails?.details ?? error.errorCode),
34-
MobileScannerErrorCode.unsupported => translations.error.scan.unsupported(exception: error.errorDetails?.details ?? error.errorCode),
35-
_ => translations.error.generic.withException(exception: error.errorDetails?.details ?? error.errorCode),
36-
},
37-
style: const TextStyle(
38-
color: Colors.white,
32+
Text(
33+
switch (error.errorCode) {
34+
MobileScannerErrorCode.controllerUninitialized => translations.error.scan.controllerUninitialized(exception: error.errorDetails?.details ?? error.errorCode),
35+
MobileScannerErrorCode.permissionDenied => translations.error.scan.accessDeniedDialog.message(exception: error.errorDetails?.details ?? error.errorCode),
36+
MobileScannerErrorCode.unsupported => translations.error.scan.unsupported(exception: error.errorDetails?.details ?? error.errorCode),
37+
_ => translations.error.generic.withException(exception: error.errorDetails?.details ?? error.errorCode),
38+
},
39+
style: const TextStyle(
40+
color: Colors.white,
41+
),
3942
),
40-
),
41-
],
43+
],
44+
),
4245
),
4346
),
4447
);

lib/widgets/waiting_overlay.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Future<T> showWaitingOverlay<T>(
1212
String? timeoutMessage,
1313
bool Function()? onCancel,
1414
}) async {
15-
OverlayEntry entry = OverlayEntry(builder: (context) {
16-
return Stack(
15+
OverlayEntry entry = OverlayEntry(
16+
builder: (context) => Stack(
1717
children: [
1818
const ModalBarrier(
1919
dismissible: false,
@@ -26,8 +26,8 @@ Future<T> showWaitingOverlay<T>(
2626
onCancel: onCancel,
2727
),
2828
],
29-
);
30-
});
29+
),
30+
);
3131
Overlay.of(context).insert(entry);
3232
if (future != null) {
3333
try {
@@ -77,6 +77,7 @@ class _WaitingDialogState extends State<_WaitingDialog> {
7777
Widget build(BuildContext context) => PopScope(
7878
canPop: false,
7979
child: AppDialog(
80+
scrollable: false,
8081
actions: widget.onCancel == null
8182
? null
8283
: [

0 commit comments

Comments
 (0)