Skip to content

armgit / ente

Public Imported from GitHub
0

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

use new component

AmanRajSinghMourya476449d83264
diff --git a/mobile/apps/photos/lib/ui/components/info_item_widget.dart b/mobile/apps/photos/lib/ui/components/info_item_widget.dart
index a821833673..b41ac3da43 100644
--- a/mobile/apps/photos/lib/ui/components/info_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/info_item_widget.dart
@@ -1,4 +1,6 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/loading_widget.dart";
import 'package:photos/ui/components/buttons/icon_button_widget.dart';
@@ -14,6 +16,7 @@ class InfoItemWidget extends StatelessWidget {
final bool hasChipButtons;
final bool biggerSpinner;
final VoidCallback? onTap;
+ final bool useMenuStyle;
const InfoItemWidget({
this.leadingIcon,
this.leadingIconWidget,
@@ -24,11 +27,16 @@ class InfoItemWidget extends StatelessWidget {
this.hasChipButtons = false,
this.biggerSpinner = false,
this.onTap,
+ this.useMenuStyle = false,
super.key,
}) : assert(leadingIcon != null || leadingIconWidget != null);
@override
Widget build(BuildContext context) {
+ if (useMenuStyle) {
+ return _buildMenuStyle(context);
+ }
+
final children = <Widget>[];
if (title != null) {
children.addAll([
@@ -120,4 +128,126 @@ class InfoItemWidget extends StatelessWidget {
],
);
}
+
+ Widget _buildMenuStyle(BuildContext context) {
+ final colors = context.componentColors;
+ final leading = leadingIconWidget ?? Icon(leadingIcon);
+
+ return Material(
+ color: colors.fillLight,
+ borderRadius: BorderRadius.circular(Radii.button),
+ clipBehavior: Clip.antiAlias,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ InkWell(
+ onTap: onTap,
+ borderRadius: BorderRadius.circular(Radii.button),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 54),
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.md,
+ 9,
+ Spacing.md,
+ 9,
+ ),
+ child: Row(
+ children: [
+ SizedBox.square(
+ dimension: 36,
+ child: Center(
+ child: IconTheme.merge(
+ data: IconThemeData(
+ color: colors.textLight,
+ size: IconSizes.small,
+ ),
+ child: leading,
+ ),
+ ),
+ ),
+ const SizedBox(width: Spacing.md),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ if (title != null) ...[
+ Text(
+ title!,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyles.body.copyWith(
+ color: colors.textBase,
+ ),
+ ),
+ const SizedBox(height: Spacing.xs),
+ ],
+ FutureBuilder<List<Widget>>(
+ future: subtitleSection,
+ builder: (context, snapshot) {
+ final Widget child;
+ if (snapshot.hasData) {
+ final subtitle = snapshot.data!;
+ child = subtitle.isEmpty
+ ? const SizedBox.shrink()
+ : Wrap(
+ runSpacing: Spacing.sm,
+ spacing: hasChipButtons
+ ? Spacing.sm
+ : Spacing.md,
+ children: subtitle,
+ );
+ } else {
+ child = EnteLoadingWidget(
+ padding: biggerSpinner ? 6 : 3,
+ size: biggerSpinner ? 20 : 11,
+ color: colors.strokeFaint,
+ alignment: biggerSpinner
+ ? Alignment.center
+ : Alignment.centerLeft,
+ );
+ }
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeInOutExpo,
+ child: child,
+ );
+ },
+ ),
+ ],
+ ),
+ ),
+ if (editOnTap != null) ...[
+ const SizedBox(width: Spacing.md),
+ IconButtonComponent(
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedEdit03,
+ size: IconSizes.small,
+ color: colors.textLight,
+ ),
+ variant: IconButtonComponentVariant.secondary,
+ shouldSurfaceExecutionStates: false,
+ onTap: editOnTap,
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
+ ),
+ if (endSection != null)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Spacing.md,
+ 0,
+ Spacing.md,
+ Spacing.md,
+ ),
+ child: endSection!,
+ ),
+ ],
+ ),
+ );
+ }
}