fix: basics
This commit is contained in:
@@ -28,6 +28,7 @@ enum ButtonAction {
|
||||
|
||||
class ButtonWidget extends StatelessWidget {
|
||||
final IconData? icon;
|
||||
final Widget? iconWidget;
|
||||
final String? labelText;
|
||||
final ButtonType buttonType;
|
||||
final FutureVoidCallback? onTap;
|
||||
@@ -70,6 +71,7 @@ class ButtonWidget extends StatelessWidget {
|
||||
required this.buttonType,
|
||||
this.buttonSize = ButtonSize.large,
|
||||
this.icon,
|
||||
this.iconWidget,
|
||||
this.labelText,
|
||||
this.onTap,
|
||||
this.shouldStickToDarkTheme = false,
|
||||
@@ -142,6 +144,7 @@ class ButtonWidget extends StatelessWidget {
|
||||
onTap: onTap,
|
||||
labelText: labelText,
|
||||
icon: icon,
|
||||
iconWidget: iconWidget,
|
||||
buttonAction: buttonAction,
|
||||
shouldSurfaceExecutionStates: shouldSurfaceExecutionStates,
|
||||
progressStatus: progressStatus,
|
||||
@@ -156,6 +159,7 @@ class ButtonChildWidget extends StatefulWidget {
|
||||
final ButtonType buttonType;
|
||||
final String? labelText;
|
||||
final IconData? icon;
|
||||
final Widget? iconWidget;
|
||||
final bool isDisabled;
|
||||
final ButtonSize buttonSize;
|
||||
final ButtonAction? buttonAction;
|
||||
@@ -176,6 +180,7 @@ class ButtonChildWidget extends StatefulWidget {
|
||||
this.onTap,
|
||||
this.labelText,
|
||||
this.icon,
|
||||
this.iconWidget,
|
||||
this.buttonAction,
|
||||
super.key,
|
||||
});
|
||||
@@ -272,7 +277,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
|
||||
),
|
||||
),
|
||||
widget.icon == null
|
||||
? const SizedBox.shrink()
|
||||
? widget.iconWidget ?? const SizedBox.shrink()
|
||||
: Icon(
|
||||
widget.icon,
|
||||
size: 20,
|
||||
@@ -297,13 +302,16 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
widget.icon == null
|
||||
? const SizedBox.shrink()
|
||||
? widget.iconWidget ??
|
||||
const SizedBox.shrink()
|
||||
: Icon(
|
||||
widget.icon,
|
||||
size: 20,
|
||||
color: iconColor,
|
||||
),
|
||||
widget.icon == null || widget.labelText == null
|
||||
widget.icon == null &&
|
||||
widget.iconWidget == null ||
|
||||
widget.labelText == null
|
||||
? const SizedBox.shrink()
|
||||
: const SizedBox(width: 8),
|
||||
widget.labelText == null
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import 'package:photos/models/collection/collection.dart';
|
||||
import "package:photos/ui/collections/album/smart_album_people.dart";
|
||||
import "package:photos/ui/components/buttons/button_widget.dart";
|
||||
import "package:photos/ui/components/models/button_type.dart";
|
||||
import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
|
||||
import "package:photos/utils/dialog_util.dart";
|
||||
import "package:photos/utils/navigation_util.dart";
|
||||
|
||||
class EmptyAlbumState extends StatelessWidget {
|
||||
final Collection c;
|
||||
@@ -39,20 +41,48 @@ class EmptyAlbumState extends StatelessWidget {
|
||||
child: Image.asset('assets/loading_photos_background.png'),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: ButtonWidget(
|
||||
buttonType: ButtonType.primary,
|
||||
buttonSize: ButtonSize.small,
|
||||
labelText: S.of(context).addPhotos,
|
||||
icon: Icons.add_photo_alternate_outlined,
|
||||
shouldSurfaceExecutionStates: false,
|
||||
onTap: () async {
|
||||
try {
|
||||
await showAddPhotosSheet(context, c);
|
||||
} catch (e) {
|
||||
await showGenericErrorDialog(context: context, error: e);
|
||||
}
|
||||
},
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
ButtonWidget(
|
||||
buttonType: ButtonType.primary,
|
||||
buttonSize: ButtonSize.large,
|
||||
labelText: S.of(context).addPhotos,
|
||||
icon: Icons.add_photo_alternate_outlined,
|
||||
shouldSurfaceExecutionStates: false,
|
||||
onTap: () async {
|
||||
try {
|
||||
await showAddPhotosSheet(context, c);
|
||||
} catch (e) {
|
||||
await showGenericErrorDialog(
|
||||
context: context,
|
||||
error: e,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
ButtonWidget(
|
||||
buttonType: ButtonType.neutral,
|
||||
buttonSize: ButtonSize.large,
|
||||
iconWidget: Image.asset(
|
||||
'assets/auto-add-people.png',
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: isLightMode ? Colors.white : Colors.black,
|
||||
),
|
||||
labelText: S.of(context).autoAddPeople,
|
||||
shouldSurfaceExecutionStates: false,
|
||||
onTap: () async {
|
||||
await routeToPage(
|
||||
context,
|
||||
SmartAlbumPeople(collectionId: c.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -29,6 +29,7 @@ import 'package:photos/services/collections_service.dart';
|
||||
import "package:photos/services/files_service.dart";
|
||||
import "package:photos/states/location_screen_state.dart";
|
||||
import "package:photos/theme/colors.dart";
|
||||
import "package:photos/theme/ente_theme.dart";
|
||||
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
|
||||
import "package:photos/ui/cast/auto.dart";
|
||||
import "package:photos/ui/cast/choose.dart";
|
||||
@@ -539,6 +540,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||
(value?[widget.collection!.id]?.personIDs.isEmpty ?? true)
|
||||
? "assets/auto-add-people.png"
|
||||
: "assets/edit-auto-add-people.png",
|
||||
color: EnteTheme.isDark(context) ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
if (galleryType.canDelete())
|
||||
@@ -621,7 +623,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||
collectionId: widget.collection!.id,
|
||||
),
|
||||
);
|
||||
setState(() {});
|
||||
} else if (value == AlbumPopupAction.freeUpSpace) {
|
||||
await _deleteBackedUpFiles(context);
|
||||
} else if (value == AlbumPopupAction.setCover) {
|
||||
|
||||
Reference in New Issue
Block a user