mirror of
https://github.com/localsend/localsend.git
synced 2026-04-29 03:23:09 -04:00
46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:localsend_app/gen/strings.g.dart';
|
|
import 'package:localsend_app/util/platform_check.dart';
|
|
import 'package:localsend_app/widget/dialogs/custom_bottom_sheet.dart';
|
|
import 'package:routerino/routerino.dart';
|
|
|
|
class CannotOpenFileDialog extends StatelessWidget {
|
|
final String path;
|
|
|
|
const CannotOpenFileDialog({required this.path, super.key});
|
|
|
|
static void open(BuildContext context, String path) {
|
|
if (checkPlatformIsDesktop()) {
|
|
showDialog(
|
|
context: context,
|
|
builder: (_) => AlertDialog(
|
|
title: Text(t.dialogs.cannotOpenFile.title),
|
|
content: Text(t.dialogs.cannotOpenFile.content(file: path)),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => context.pop(),
|
|
child: Text(t.general.close),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
} else {
|
|
context.pushBottomSheet(() => CannotOpenFileDialog(path: path));
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CustomBottomSheet(
|
|
title: t.dialogs.cannotOpenFile.title,
|
|
description: t.dialogs.cannotOpenFile.content(file: path),
|
|
child: Center(
|
|
child: ElevatedButton(
|
|
onPressed: () => context.popUntilRoot(),
|
|
child: Text(t.general.close),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|