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": { "@customizeCollectionsNavBarDescription": {
"description": "Instruction to customize navigation bar buttons in the Collections page" "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": "Unauthenticated access. Please sign-in again if the problem continues",
"@errorUnauthenticated": { "@errorUnauthenticated": {

View file

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

View file

@ -5,12 +5,29 @@ class _NewButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return HomeCollectionsNavBarButton( 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), icon: const Icon(Icons.add_outlined),
label: L10n.global().createCollectionTooltip, label: L10n.global().createCollectionTooltip,
isMinimized: true, isMinimized: true,
isUseTooltipWhenMinimized: false, isUseTooltipWhenMinimized: false,
onPressed: () {}, 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/bloc_util.dart';
import 'package:nc_photos/controller/pref_controller.dart'; import 'package:nc_photos/controller/pref_controller.dart';
import 'package:nc_photos/exception_event.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/snack_bar_manager.dart';
import 'package:nc_photos/widget/draggable.dart' as my; import 'package:nc_photos/widget/draggable.dart' as my;
import 'package:nc_photos/widget/home_collections.dart'; import 'package:nc_photos/widget/home_collections.dart';

View file

@ -15,6 +15,35 @@ class _DemoButton extends StatelessWidget {
final Widget icon; 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 { class _DemoLivePhotoButton extends StatelessWidget {
const _DemoLivePhotoButton(); const _DemoLivePhotoButton();

View file

@ -41,13 +41,7 @@ class _DemoView extends StatelessWidget {
child: _DemoButtonDelegate(e), child: _DemoButtonDelegate(e),
), ),
)), )),
IgnorePointer( const _DemoMoreButton(),
ignoring: true,
child: IconButton(
onPressed: () {},
icon: Icon(Icons.adaptive.more),
),
),
], ],
); );
if (buttons.isEmpty) { 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/bloc_util.dart';
import 'package:nc_photos/controller/pref_controller.dart'; import 'package:nc_photos/controller/pref_controller.dart';
import 'package:nc_photos/exception_event.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/snack_bar_manager.dart';
import 'package:nc_photos/theme.dart'; import 'package:nc_photos/theme.dart';
import 'package:nc_photos/widget/draggable.dart' as my; import 'package:nc_photos/widget/draggable.dart' as my;