Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Make PeopleBanner UI better and minimal

ashilkn68fa42961187
diff --git a/mobile/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/lib/ui/viewer/people/cluster_app_bar.dart
index 878cb7abe6..8ea245f1a2 100644
--- a/mobile/lib/ui/viewer/people/cluster_app_bar.dart
+++ b/mobile/lib/ui/viewer/people/cluster_app_bar.dart
@@ -95,6 +95,9 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
overflow: TextOverflow.ellipsis,
),
actions: _getDefaultActions(context),
+ scrolledUnderElevation: 4,
+ shadowColor: Colors.black.withOpacity(0.15),
+ surfaceTintColor: Colors.transparent,
);
}
diff --git a/mobile/lib/ui/viewer/people/cluster_page.dart b/mobile/lib/ui/viewer/people/cluster_page.dart
index 7b3e8d1b28..e7fe6e0b07 100644
--- a/mobile/lib/ui/viewer/people/cluster_page.dart
+++ b/mobile/lib/ui/viewer/people/cluster_page.dart
@@ -59,11 +59,6 @@ class _ClusterPageState extends State<ClusterPage> {
late final StreamSubscription<LocalPhotosUpdatedEvent> _filesUpdatedEvent;
late final StreamSubscription<PeopleChangedEvent> _peopleChangedEvent;
- bool get showNamingBanner =>
- (!userDismissedNamingBanner && widget.showNamingBanner);
-
- bool userDismissedNamingBanner = false;
-
@override
void initState() {
super.initState();
@@ -138,6 +133,46 @@ class _ClusterPageState extends State<ClusterPage> {
selectedFiles: _selectedFiles,
enableFileGrouping: widget.enableGrouping,
initialFiles: [widget.searchResult.first],
+ header: widget.showNamingBanner
+ ? PeopleBanner(
+ type: PeopleBannerType.addName,
+ faceWidget: PersonFaceWidget(
+ files.first,
+ clusterID: widget.clusterID,
+ ),
+ actionIcon: Icons.add_outlined,
+ text: S.of(context).addAName,
+ subText: S.of(context).findPeopleByName,
+ onTap: () async {
+ if (widget.personID == null) {
+ final result = await showAssignPersonAction(
+ context,
+ clusterID: widget.clusterID,
+ );
+ if (result != null && result is (PersonEntity, EnteFile)) {
+ Navigator.pop(context);
+ // ignore: unawaited_futures
+ routeToPage(
+ context,
+ PeoplePage(person: result.$1, searchResult: null),
+ );
+ } else if (result != null && result is PersonEntity) {
+ Navigator.pop(context);
+ // ignore: unawaited_futures
+ routeToPage(
+ context,
+ PeoplePage(
+ person: result,
+ searchResult: null,
+ ),
+ );
+ }
+ } else {
+ showShortToast(context, "No personID or clusterID");
+ }
+ },
+ )
+ : null,
);
return GalleryFilesState(
child: Scaffold(
@@ -151,75 +186,21 @@ class _ClusterPageState extends State<ClusterPage> {
key: ValueKey(files.length),
),
),
- body: Column(
- children: [
- showNamingBanner
- ? Dismissible(
- key: const Key("namingBanner"),
- direction: DismissDirection.horizontal,
- onDismissed: (direction) {
- setState(() {
- userDismissedNamingBanner = true;
- });
- },
- child: PeopleBanner(
- type: PeopleBannerType.addName,
- faceWidget: PersonFaceWidget(
- files.first,
- clusterID: widget.clusterID,
- ),
- actionIcon: Icons.add_outlined,
- text: S.of(context).addAName,
- subText: S.of(context).findPeopleByName,
- onTap: () async {
- if (widget.personID == null) {
- final result = await showAssignPersonAction(
- context,
- clusterID: widget.clusterID,
- );
- if (result != null &&
- result is (PersonEntity, EnteFile)) {
- Navigator.pop(context);
- // ignore: unawaited_futures
- routeToPage(
- context,
- PeoplePage(person: result.$1, searchResult: null),
- );
- } else if (result != null && result is PersonEntity) {
- Navigator.pop(context);
- // ignore: unawaited_futures
- routeToPage(
- context,
- PeoplePage(
- person: result,
- searchResult: null,
- ),
- );
- }
- } else {
- showShortToast(context, "No personID or clusterID");
- }
- },
- ),
- )
- : const SizedBox.shrink(),
- Expanded(
- child: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- ClusterPage.overlayType,
- _selectedFiles,
- clusterID: widget.clusterID,
- ),
- ],
+ body: Expanded(
+ child: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ ClusterPage.overlayType,
+ _selectedFiles,
+ clusterID: widget.clusterID,
),
- ),
+ ],
),
- ],
+ ),
),
),
);
diff --git a/mobile/lib/ui/viewer/people/people_banner.dart b/mobile/lib/ui/viewer/people/people_banner.dart
index eee5d377bf..7a27990935 100644
--- a/mobile/lib/ui/viewer/people/people_banner.dart
+++ b/mobile/lib/ui/viewer/people/people_banner.dart
@@ -1,5 +1,4 @@
import "package:flutter/material.dart";
-import "package:flutter_animate/flutter_animate.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/viewer/search/result/person_face_widget.dart";
@@ -19,7 +18,7 @@ class PeopleBanner extends StatelessWidget {
final GestureTapCallback onTap;
const PeopleBanner({
- Key? key,
+ super.key,
required this.type,
this.startIcon,
this.faceWidget,
@@ -27,7 +26,7 @@ class PeopleBanner extends StatelessWidget {
required this.text,
required this.onTap,
this.subText,
- }) : super(key: key);
+ });
@override
Widget build(BuildContext context) {
@@ -71,19 +70,19 @@ class PeopleBanner extends StatelessWidget {
final Widget banner = Center(
child: GestureDetector(
onTap: onTap,
- child: Container(
- decoration: BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: Colors.black.withOpacity(0.1),
- offset: const Offset(0, 2),
- blurRadius: 4,
+ child: Padding(
+ padding: const EdgeInsets.all(4),
+ child: Container(
+ decoration: BoxDecoration(
+ color: backgroundColor,
+ border: Border.all(
+ color: colorScheme.strokeFaint,
+ width: 1,
),
- ],
- color: backgroundColor,
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 2),
+ borderRadius: const BorderRadius.all(
+ Radius.circular(5),
+ ),
+ ),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -127,11 +126,7 @@ class PeopleBanner extends StatelessWidget {
),
),
),
- ).animate(onPlay: (controller) => controller.repeat()).shimmer(
- duration: 1000.ms,
- delay: 3200.ms,
- size: 0.6,
- );
+ );
if (type == PeopleBannerType.suggestion) {
return SafeArea(