Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Move name banner to top

laurenspriem8f0dc8b8dcfb
diff --git a/mobile/lib/ui/viewer/people/cluster_page.dart b/mobile/lib/ui/viewer/people/cluster_page.dart
index 34e42bfaac..8185228c64 100644
--- a/mobile/lib/ui/viewer/people/cluster_page.dart
+++ b/mobile/lib/ui/viewer/people/cluster_page.dart
@@ -153,6 +153,50 @@ class _ClusterPageState extends State<ClusterPage> {
),
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),
+ );
+ } else if (result != null && result is PersonEntity) {
+ Navigator.pop(context);
+ // ignore: unawaited_futures
+ routeToPage(context, PeoplePage(person: result));
+ }
+ } else {
+ showShortToast(context, "No personID or clusterID");
+ }
+ },
+ ),
+ )
+ : const SizedBox.shrink(),
Expanded(
child: SelectionState(
selectedFiles: _selectedFiles,
@@ -169,53 +213,6 @@ class _ClusterPageState extends State<ClusterPage> {
),
),
),
- showNamingBanner
- ? SafeArea(
- child: 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),
- );
- } else if (result != null &&
- result is PersonEntity) {
- Navigator.pop(context);
- // ignore: unawaited_futures
- routeToPage(context, PeoplePage(person: result));
- }
- } else {
- showShortToast(context, "No personID or clusterID");
- }
- },
- ),
- ),
- )
- : const SizedBox.shrink(),
],
),
),
diff --git a/mobile/lib/ui/viewer/people/people_banner.dart b/mobile/lib/ui/viewer/people/people_banner.dart
index e602d9aceb..01aeab6361 100644
--- a/mobile/lib/ui/viewer/people/people_banner.dart
+++ b/mobile/lib/ui/viewer/people/people_banner.dart
@@ -34,7 +34,7 @@ class PeopleBanner extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final backgroundColor = colorScheme.backgroundElevated2;
+ Color backgroundColor = colorScheme.backgroundElevated2;
final TextStyle mainTextStyle = textTheme.bodyBold;
final TextStyle subTextStyle = textTheme.miniMuted;
late final Widget startWidget;
@@ -55,6 +55,7 @@ class PeopleBanner extends StatelessWidget {
break;
case PeopleBannerType.addName:
assert(faceWidget != null);
+ backgroundColor = colorScheme.backgroundElevated;
startWidget = SizedBox(
width: 56,
height: 56,
@@ -68,67 +69,72 @@ class PeopleBanner extends StatelessWidget {
roundedActionIcon = false;
}
- return SafeArea(
- child: RepaintBoundary(
- child: Center(
- child: GestureDetector(
- onTap: onTap,
- child: Container(
- decoration: BoxDecoration(
- boxShadow: Theme.of(context).colorScheme.enteTheme.shadowMenu,
- color: backgroundColor,
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 2),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- startWidget,
- const SizedBox(width: 12),
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- text,
- style: mainTextStyle,
- textAlign: TextAlign.left,
- ),
- subText != null
- ? const SizedBox(height: 6)
- : const SizedBox.shrink(),
- subText != null
- ? Text(
- subText!,
- style: subTextStyle,
- )
- : const SizedBox.shrink(),
- ],
+ final Widget banner = Center(
+ child: GestureDetector(
+ onTap: onTap,
+ child: Container(
+ decoration: BoxDecoration(
+ boxShadow: Theme.of(context).colorScheme.enteTheme.shadowMenu,
+ color: backgroundColor,
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 2, vertical: 2),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ startWidget,
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ text,
+ style: mainTextStyle,
+ textAlign: TextAlign.left,
),
- ),
- const SizedBox(width: 12),
- IconButtonWidget(
- icon: actionIcon,
- iconButtonType: IconButtonType.primary,
- iconColor: colorScheme.strokeBase,
- defaultColor: colorScheme.fillFaint,
- pressedColor: colorScheme.fillMuted,
- roundedIcon: roundedActionIcon,
- onTap: onTap,
- ),
- const SizedBox(width: 6),
- ],
+ subText != null
+ ? const SizedBox(height: 6)
+ : const SizedBox.shrink(),
+ subText != null
+ ? Text(
+ subText!,
+ style: subTextStyle,
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
+ ),
+ const SizedBox(width: 12),
+ IconButtonWidget(
+ icon: actionIcon,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorScheme.strokeBase,
+ defaultColor: colorScheme.fillFaint,
+ pressedColor: colorScheme.fillMuted,
+ roundedIcon: roundedActionIcon,
+ onTap: onTap,
),
- ),
+ const SizedBox(width: 6),
+ ],
),
),
- ).animate(onPlay: (controller) => controller.repeat()).shimmer(
- duration: 1000.ms,
- delay: 3200.ms,
- size: 0.6,
- ),
+ ),
),
- );
+ ).animate(onPlay: (controller) => controller.repeat()).shimmer(
+ duration: 1000.ms,
+ delay: 3200.ms,
+ size: 0.6,
+ );
+
+ if (type == PeopleBannerType.suggestion) {
+ return SafeArea(
+ top: false,
+ child: RepaintBoundary(child: banner),
+ );
+ } else {
+ return RepaintBoundary(child: banner);
+ }
}
}