Warn user when they try to remove a fixed button

This commit is contained in:
Ming Ming 2024-10-27 01:56:09 +08:00
parent 6f148e57d1
commit 78c02fd280
7 changed files with 87 additions and 26 deletions

View file

@ -1517,6 +1517,10 @@
"@customizeCollectionsNavBarDescription": {
"description": "Instruction to customize navigation bar buttons in the Collections page"
},
"customizeButtonsUnsupportedWarning": "This button cannot be customized",
"@customizeButtonsUnsupportedWarning": {
"description": "Some button can't be removed. This message will be shown instead when user try to do so"
},
"errorUnauthenticated": "Unauthenticated access. Please sign-in again if the problem continues",
"@errorUnauthenticated": {

View file

@ -267,6 +267,7 @@
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning",
"errorUnauthenticated",
"errorDisconnected",
"errorLocked",
@ -284,7 +285,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"de": [
@ -294,7 +296,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"el": [
@ -449,7 +452,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"es": [
@ -459,7 +463,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"fi": [
@ -505,7 +510,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"fr": [
@ -551,7 +557,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"it": [
@ -602,7 +609,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"nl": [
@ -990,6 +998,7 @@
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning",
"errorUnauthenticated",
"errorDisconnected",
"errorLocked",
@ -1047,7 +1056,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"pt": [
@ -1113,7 +1123,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"ru": [
@ -1159,7 +1170,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"tr": [
@ -1169,7 +1181,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"zh": [
@ -1246,7 +1259,8 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
],
"zh_Hant": [
@ -1417,6 +1431,7 @@
"alternativeSignIn",
"livePhotoTooltip",
"dragAndDropRearrangeButtons",
"customizeCollectionsNavBarDescription"
"customizeCollectionsNavBarDescription",
"customizeButtonsUnsupportedWarning"
]
}

View file

@ -5,12 +5,29 @@ class _NewButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return HomeCollectionsNavBarButton(
icon: const Icon(Icons.add_outlined),
label: L10n.global().createCollectionTooltip,
isMinimized: true,
isUseTooltipWhenMinimized: false,
onPressed: () {},
return GestureDetector(
onTap: () {
SnackBarManager().showSnackBar(SnackBar(
content: Text(L10n.global().customizeButtonsUnsupportedWarning),
duration: k.snackBarDurationNormal,
));
},
onLongPress: () {
SnackBarManager().showSnackBar(SnackBar(
content: Text(L10n.global().customizeButtonsUnsupportedWarning),
duration: k.snackBarDurationNormal,
));
},
child: AbsorbPointer(
absorbing: true,
child: HomeCollectionsNavBarButton(
icon: const Icon(Icons.add_outlined),
label: L10n.global().createCollectionTooltip,
isMinimized: true,
isUseTooltipWhenMinimized: false,
onPressed: () {},
),
),
);
}
}

View file

@ -9,6 +9,7 @@ import 'package:nc_photos/app_localizations.dart';
import 'package:nc_photos/bloc_util.dart';
import 'package:nc_photos/controller/pref_controller.dart';
import 'package:nc_photos/exception_event.dart';
import 'package:nc_photos/k.dart' as k;
import 'package:nc_photos/snack_bar_manager.dart';
import 'package:nc_photos/widget/draggable.dart' as my;
import 'package:nc_photos/widget/home_collections.dart';

View file

@ -15,6 +15,35 @@ class _DemoButton extends StatelessWidget {
final Widget icon;
}
class _DemoMoreButton extends StatelessWidget {
const _DemoMoreButton();
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
SnackBarManager().showSnackBar(SnackBar(
content: Text(L10n.global().customizeButtonsUnsupportedWarning),
duration: k.snackBarDurationNormal,
));
},
onLongPress: () {
SnackBarManager().showSnackBar(SnackBar(
content: Text(L10n.global().customizeButtonsUnsupportedWarning),
duration: k.snackBarDurationNormal,
));
},
child: AbsorbPointer(
absorbing: true,
child: IconButton(
onPressed: () {},
icon: Icon(Icons.adaptive.more),
),
),
);
}
}
class _DemoLivePhotoButton extends StatelessWidget {
const _DemoLivePhotoButton();

View file

@ -41,13 +41,7 @@ class _DemoView extends StatelessWidget {
child: _DemoButtonDelegate(e),
),
)),
IgnorePointer(
ignoring: true,
child: IconButton(
onPressed: () {},
icon: Icon(Icons.adaptive.more),
),
),
const _DemoMoreButton(),
],
);
if (buttons.isEmpty) {

View file

@ -10,6 +10,7 @@ import 'package:nc_photos/app_localizations.dart';
import 'package:nc_photos/bloc_util.dart';
import 'package:nc_photos/controller/pref_controller.dart';
import 'package:nc_photos/exception_event.dart';
import 'package:nc_photos/k.dart' as k;
import 'package:nc_photos/snack_bar_manager.dart';
import 'package:nc_photos/theme.dart';
import 'package:nc_photos/widget/draggable.dart' as my;