π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] PeopleBanner widget
laurenspriemcb51e3e5b5ca
diff --git a/mobile/lib/ui/components/buttons/icon_button_widget.dart b/mobile/lib/ui/components/buttons/icon_button_widget.dartindex 258b339d7a..3e51f87898 100644--- a/mobile/lib/ui/components/buttons/icon_button_widget.dart+++ b/mobile/lib/ui/components/buttons/icon_button_widget.dart@@ -17,6 +17,7 @@ class IconButtonWidget extends StatefulWidget {final Color? pressedColor;final Color? iconColor;final double size;+ final bool roundedIcon;const IconButtonWidget({required this.icon,required this.iconButtonType,@@ -26,6 +27,7 @@ class IconButtonWidget extends StatefulWidget {this.pressedColor,this.iconColor,this.size = 24,+ this.roundedIcon = true,super.key,});@@ -68,22 +70,31 @@ class _IconButtonWidgetState extends State<IconButtonWidget> {Widget _iconButton(EnteColorScheme colorTheme) {return Padding(padding: const EdgeInsets.all(4.0),- child: AnimatedContainer(- duration: const Duration(milliseconds: 20),- padding: const EdgeInsets.all(8),- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(widget.size),- color: iconStateColor,- ),- child: Icon(- widget.icon,- color: widget.iconColor ??- (widget.iconButtonType == IconButtonType.secondary- ? colorTheme.strokeMuted- : colorTheme.strokeBase),- size: widget.size,- ),- ),+ child: widget.roundedIcon+ ? AnimatedContainer(+ duration: const Duration(milliseconds: 20),+ padding: const EdgeInsets.all(8),+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(widget.size),+ color: iconStateColor,+ ),+ child: Icon(+ widget.icon,+ color: widget.iconColor ??+ (widget.iconButtonType == IconButtonType.secondary+ ? colorTheme.strokeMuted+ : colorTheme.strokeBase),+ size: widget.size,+ ),+ )+ : Icon(+ widget.icon,+ color: widget.iconColor ??+ (widget.iconButtonType == IconButtonType.secondary+ ? colorTheme.strokeMuted+ : colorTheme.strokeBase),+ size: widget.size,+ ),);}diff --git a/mobile/lib/ui/viewer/people/people_banner.dart b/mobile/lib/ui/viewer/people/people_banner.dartnew file mode 100644index 0000000000..5efc9b957c--- /dev/null+++ b/mobile/lib/ui/viewer/people/people_banner.dart@@ -0,0 +1,134 @@+import "package:flutter/material.dart";+import "package:flutter_animate/flutter_animate.dart";+import "package:photos/ente_theme_data.dart";+import "package:photos/theme/colors.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/theme/text_style.dart";+import "package:photos/ui/components/buttons/icon_button_widget.dart";+import "package:photos/ui/viewer/search/result/person_face_widget.dart";++enum PeopleBannerType {+ addName,+ suggestion,+}++class PeopleBanner extends StatelessWidget {+ final PeopleBannerType type;+ final IconData? startIcon;+ final PersonFaceWidget? faceWidget;+ final IconData actionIcon;+ final String text;+ final String? subText;+ final GestureTapCallback onTap;++ const PeopleBanner({+ Key? key,+ required this.type,+ this.startIcon,+ this.faceWidget,+ required this.actionIcon,+ required this.text,+ required this.onTap,+ this.subText,+ }) : super(key: key);++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final backgroundColor = colorScheme.backgroundElevated2;+ final TextStyle mainTextStyle = darkTextTheme.bodyBold;+ final TextStyle subTextStyle = darkTextTheme.miniMuted;+ const EnteColorScheme strokeColorScheme = darkScheme;+ late final Widget startWidget;+ late final bool roundedActionIcon;+ switch (type) {+ case PeopleBannerType.suggestion:+ assert(startIcon != null);+ startWidget = Padding(+ padding:+ const EdgeInsets.only(top: 10, bottom: 10, left: 6, right: 4),+ child: Icon(+ startIcon!,+ size: 40,+ color: colorScheme.primary500,+ ),+ );+ roundedActionIcon = true;+ break;+ case PeopleBannerType.addName:+ assert(faceWidget != null);+ startWidget = SizedBox(+ width: 56,+ height: 56,+ child: ClipRRect(+ borderRadius: const BorderRadius.all(+ Radius.circular(4),+ ),+ child: faceWidget!,+ ),+ );+ roundedActionIcon = false;+ }++ return 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(),+ ],+ ),+ ),+ const SizedBox(width: 12),+ IconButtonWidget(+ icon: actionIcon,+ iconButtonType: IconButtonType.primary,+ iconColor: strokeColorScheme.strokeBase,+ defaultColor: strokeColorScheme.fillFaint,+ pressedColor: strokeColorScheme.fillMuted,+ roundedIcon: roundedActionIcon,+ onTap: onTap,+ ),+ const SizedBox(width: 6),+ ],+ ),+ ),+ ),+ ),+ ).animate(onPlay: (controller) => controller.repeat()).shimmer(+ duration: 1000.ms,+ delay: 3200.ms,+ size: 0.6,+ ),+ );+ }+}