28 lines
759 B
Dart
28 lines
759 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../l10n/app_localizations.dart';
|
|
|
|
Future<bool> confirmDuplicateTabName(BuildContext context, String name) async {
|
|
final l10n = AppLocalizations.of(context);
|
|
|
|
final confirmed = await showDialog<bool>(
|
|
context: context,
|
|
builder: (dialogContext) => AlertDialog(
|
|
title: Text(l10n.duplicateTabName),
|
|
content: Text(l10n.duplicateTabNameDescription(name)),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(dialogContext, false),
|
|
child: Text(l10n.cancel),
|
|
),
|
|
FilledButton(
|
|
onPressed: () => Navigator.pop(dialogContext, true),
|
|
child: Text(l10n.confirm),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
return confirmed == true;
|
|
}
|