π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Setup common UI components
vishnukvmd490759243b87
diff --git a/mobile/packages/ui/analysis_options.yaml b/mobile/packages/ui/analysis_options.yamlnew file mode 100644index 0000000000..609eb5d8aa--- /dev/null+++ b/mobile/packages/ui/analysis_options.yaml@@ -0,0 +1,10 @@+include: package:flutter_lints/flutter.yaml++linter:+ rules:+ - always_declare_return_types+ - always_put_required_named_parameters_first+ - avoid_print+ - prefer_const_constructors+ - prefer_const_literals_to_create_immutables+ - use_key_in_widget_constructorsdiff --git a/mobile/packages/ui/lib/components/action_sheet_widget.dart b/mobile/packages/ui/lib/components/action_sheet_widget.dartnew file mode 100644index 0000000000..fbb34337a5--- /dev/null+++ b/mobile/packages/ui/lib/components/action_sheet_widget.dart@@ -0,0 +1,221 @@+import 'dart:ui';++import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/components/buttons/models/button_result.dart';+import 'package:ente_ui/components/components_constants.dart';+import 'package:ente_ui/components/separators.dart';+import 'package:ente_ui/theme/colors.dart';+import 'package:ente_ui/theme/effects.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';+import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';++enum ActionSheetType {+ defaultActionSheet,+ iconOnly,+}++///Returns null if dismissed+Future<ButtonResult?> showActionSheet({+ required BuildContext context,+ required List<ButtonWidget> buttons,+ ActionSheetType actionSheetType = ActionSheetType.defaultActionSheet,+ bool enableDrag = true,+ bool isDismissible = true,+ bool isCheckIconGreen = false,+ String? title,+ Widget? bodyWidget,+ String? body,+ String? bodyHighlight,+}) {+ return showMaterialModalBottomSheet(+ backgroundColor: Colors.transparent,+ barrierColor: backdropFaintDark,+ useRootNavigator: true,+ context: context,+ isDismissible: isDismissible,+ enableDrag: enableDrag,+ builder: (_) {+ return ActionSheetWidget(+ title: title,+ bodyWidget: bodyWidget,+ body: body,+ bodyHighlight: bodyHighlight,+ actionButtons: buttons,+ actionSheetType: actionSheetType,+ isCheckIconGreen: isCheckIconGreen,+ );+ },+ );+}++class ActionSheetWidget extends StatelessWidget {+ final String? title;+ final Widget? bodyWidget;+ final String? body;+ final String? bodyHighlight;+ final List<ButtonWidget> actionButtons;+ final ActionSheetType actionSheetType;+ final bool isCheckIconGreen;++ const ActionSheetWidget({+ required this.actionButtons,+ required this.actionSheetType,+ required this.isCheckIconGreen,+ this.title,+ this.bodyWidget,+ this.body,+ this.bodyHighlight,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final isTitleAndBodyNull =+ title == null && bodyWidget == null && body == null;+ final blur = MediaQuery.of(context).platformBrightness == Brightness.light+ ? blurMuted+ : blurBase;+ final extraWidth = MediaQuery.of(context).size.width - restrictedMaxWidth;+ final double? horizontalPadding = extraWidth > 0 ? extraWidth / 2 : null;+ return Padding(+ padding: EdgeInsets.fromLTRB(+ horizontalPadding ?? 12,+ 12,+ horizontalPadding ?? 12,+ 32,+ ),+ child: Container(+ decoration: BoxDecoration(boxShadow: shadowMenuLight),+ child: ClipRRect(+ borderRadius: const BorderRadius.all(Radius.circular(8)),+ child: BackdropFilter(+ filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),+ child: Container(+ color: backdropMutedDark,+ child: Padding(+ padding: EdgeInsets.fromLTRB(+ 24,+ 24,+ 24,+ isTitleAndBodyNull ? 24 : 28,+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ isTitleAndBodyNull+ ? const SizedBox.shrink()+ : Padding(+ padding: const EdgeInsets.only(bottom: 36),+ child: ContentContainerWidget(+ title: title,+ bodyWidget: bodyWidget,+ body: body,+ bodyHighlight: bodyHighlight,+ actionSheetType: actionSheetType,+ isCheckIconGreen: isCheckIconGreen,+ ),+ ),+ ActionButtons(+ actionButtons,+ ),+ ],+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }+}++class ContentContainerWidget extends StatelessWidget {+ final String? title;+ final Widget? bodyWidget;+ final String? body;+ final String? bodyHighlight;+ final ActionSheetType actionSheetType;+ final bool isCheckIconGreen;++ const ContentContainerWidget({+ required this.actionSheetType,+ required this.isCheckIconGreen,+ this.title,+ this.bodyWidget,+ this.body,+ this.bodyHighlight,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final bool bodyMissing = body == null && bodyWidget == null;+ debugPrint("body missing $bodyMissing");+ return Column(+ mainAxisSize: MainAxisSize.min,+ //todo: set cross axis to center when icon should be shown in place of body+ crossAxisAlignment: actionSheetType == ActionSheetType.defaultActionSheet+ ? CrossAxisAlignment.stretch+ : CrossAxisAlignment.center,+ children: [+ title == null+ ? const SizedBox.shrink()+ : Text(+ title!,+ style: textTheme.largeBold+ .copyWith(color: textBaseDark), //constant color+ ),+ title == null || bodyMissing+ ? const SizedBox.shrink()+ : const SizedBox(height: 19),+ actionSheetType == ActionSheetType.defaultActionSheet+ ? bodyMissing+ ? const SizedBox.shrink()+ : (bodyWidget != null+ ? bodyWidget!+ : Text(+ body!,+ style: textTheme.body+ .copyWith(color: textMutedDark), //constant color+ ))+ : Icon(+ Icons.check_outlined,+ size: 48,+ color: isCheckIconGreen+ ? getEnteColorScheme(context).primary700+ : strokeBaseDark,+ ),+ actionSheetType == ActionSheetType.defaultActionSheet &&+ bodyHighlight != null+ ? Padding(+ padding: const EdgeInsets.only(top: 19.0),+ child: Text(+ bodyHighlight!,+ style: textTheme.body+ .copyWith(color: textBaseDark), //constant color+ ),+ )+ : const SizedBox.shrink(),+ ],+ );+ }+}++class ActionButtons extends StatelessWidget {+ final List<Widget> actionButtons;+ const ActionButtons(this.actionButtons, {super.key});++ @override+ Widget build(BuildContext context) {+ final actionButtonsWithSeparators = actionButtons;+ return Column(+ children:+ //Separator height is 8pts in figma. -2pts here as the action+ //buttons are 2pts extra in height in code compared to figma because+ //of the border(1pt top + 1pt bottom) of action buttons.+ addSeparators(actionButtonsWithSeparators, const SizedBox(height: 6)),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/button_widget.dart b/mobile/packages/ui/lib/components/buttons/button_widget.dartnew file mode 100644index 0000000000..29efd4c99c--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/button_widget.dart@@ -0,0 +1,529 @@+import 'package:ente_base/typedefs.dart';+import 'package:ente_ui/components/buttons/models/button_result.dart';+import 'package:ente_ui/components/buttons/models/button_type.dart';+import 'package:ente_ui/components/buttons/models/custom_button_style.dart';+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/models/execution_states.dart';+import 'package:ente_ui/theme/colors.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/theme/text_style.dart';+import 'package:ente_ui/utils/dialog_util.dart';+import 'package:flutter/material.dart';+import 'package:flutter/scheduler.dart';+import 'package:ente_utils/debouncer.dart';++enum ButtonSize { small, large }++enum ButtonAction { first, second, third, fourth, cancel, error }++class ButtonWidget extends StatelessWidget {+ final IconData? icon;+ final String? labelText;+ final ButtonType buttonType;+ final FutureVoidCallback? onTap;+ final bool isDisabled;+ final ButtonSize buttonSize;++ ///Setting this flag to true will show a success confirmation as a 'check'+ ///icon once the onTap(). This is expected to be used only if time taken to+ ///execute onTap() takes less than debouce time.+ final bool shouldShowSuccessConfirmation;++ ///Setting this flag to false will restrict the loading and success states of+ ///the button from surfacing on the UI. The ExecutionState of the button will+ ///change irrespective of the value of this flag. Only that it won't be+ ///surfaced on the UI+ final bool shouldSurfaceExecutionStates;++ /// iconColor should only be specified when we do not want to honor the default+ /// iconColor based on buttonType. Most of the items, default iconColor is what+ /// we need unless we want to pop out the icon in a non-primary button type+ final Color? iconColor;++ ///Button action will only work if isInAlert is true+ final ButtonAction? buttonAction;++ ///setting this flag to true will make the button appear like how it would+ ///on dark theme irrespective of the app's theme.+ final bool shouldStickToDarkTheme;++ ///isInAlert is to dismiss the alert if the action on the button is completed.+ ///This should be set to true if the alert which uses this button needs to+ ///return the Button's action.+ final bool isInAlert;++ /// progressStatus can be used to display information about the action+ /// progress when ExecutionState is in Progress.+ final ValueNotifier<String>? progressStatus;++ const ButtonWidget({+ super.key,+ required this.buttonType,+ this.buttonSize = ButtonSize.large,+ this.icon,+ this.labelText,+ this.onTap,+ this.shouldStickToDarkTheme = false,+ this.isDisabled = false,+ this.buttonAction,+ this.isInAlert = false,+ this.iconColor,+ this.shouldSurfaceExecutionStates = true,+ this.progressStatus,+ this.shouldShowSuccessConfirmation = false,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme =+ shouldStickToDarkTheme ? darkScheme : getEnteColorScheme(context);+ final inverseColorScheme = shouldStickToDarkTheme+ ? lightScheme+ : getEnteColorScheme(context, inverse: true);+ final textTheme =+ shouldStickToDarkTheme ? darkTextTheme : getEnteTextTheme(context);+ final inverseTextTheme = shouldStickToDarkTheme+ ? lightTextTheme+ : getEnteTextTheme(context, inverse: true);+ final buttonStyle = CustomButtonStyle(+ //Dummy default values since we need to keep these properties non-nullable+ defaultButtonColor: Colors.transparent,+ defaultBorderColor: Colors.transparent,+ defaultIconColor: Colors.transparent,+ defaultLabelStyle: textTheme.body,+ );+ buttonStyle.defaultButtonColor = buttonType.defaultButtonColor(colorScheme);+ buttonStyle.pressedButtonColor = buttonType.pressedButtonColor(colorScheme);+ buttonStyle.disabledButtonColor =+ buttonType.disabledButtonColor(colorScheme, buttonSize);+ buttonStyle.defaultBorderColor =+ buttonType.defaultBorderColor(colorScheme, buttonSize);+ buttonStyle.pressedBorderColor = buttonType.pressedBorderColor(+ colorScheme: colorScheme,+ buttonSize: buttonSize,+ );+ buttonStyle.disabledBorderColor =+ buttonType.disabledBorderColor(colorScheme, buttonSize);+ buttonStyle.defaultIconColor = iconColor ??+ buttonType.defaultIconColor(+ colorScheme: colorScheme,+ inverseColorScheme: inverseColorScheme,+ );+ buttonStyle.pressedIconColor =+ buttonType.pressedIconColor(colorScheme, buttonSize);+ buttonStyle.disabledIconColor =+ buttonType.disabledIconColor(colorScheme, buttonSize);+ buttonStyle.defaultLabelStyle = buttonType.defaultLabelStyle(+ textTheme: textTheme,+ inverseTextTheme: inverseTextTheme,+ );+ buttonStyle.pressedLabelStyle =+ buttonType.pressedLabelStyle(textTheme, colorScheme, buttonSize);+ buttonStyle.disabledLabelStyle =+ buttonType.disabledLabelStyle(textTheme, colorScheme);+ buttonStyle.checkIconColor = buttonType.checkIconColor(colorScheme);++ return ButtonChildWidget(+ buttonStyle: buttonStyle,+ buttonType: buttonType,+ isDisabled: isDisabled,+ buttonSize: buttonSize,+ isInAlert: isInAlert,+ onTap: onTap,+ labelText: labelText,+ icon: icon,+ buttonAction: buttonAction,+ shouldSurfaceExecutionStates: shouldSurfaceExecutionStates,+ progressStatus: progressStatus,+ shouldShowSuccessConfirmation: shouldShowSuccessConfirmation,+ );+ }+}++class ButtonChildWidget extends StatefulWidget {+ final CustomButtonStyle buttonStyle;+ final FutureVoidCallback? onTap;+ final ButtonType buttonType;+ final String? labelText;+ final IconData? icon;+ final bool isDisabled;+ final ButtonSize buttonSize;+ final ButtonAction? buttonAction;+ final bool isInAlert;+ final bool shouldSurfaceExecutionStates;+ final ValueNotifier<String>? progressStatus;+ final bool shouldShowSuccessConfirmation;++ const ButtonChildWidget({+ super.key,+ required this.buttonStyle,+ required this.buttonType,+ required this.isDisabled,+ required this.buttonSize,+ required this.isInAlert,+ required this.shouldSurfaceExecutionStates,+ required this.shouldShowSuccessConfirmation,+ this.progressStatus,+ this.onTap,+ this.labelText,+ this.icon,+ this.buttonAction,+ });++ @override+ State<ButtonChildWidget> createState() => _ButtonChildWidgetState();+}++class _ButtonChildWidgetState extends State<ButtonChildWidget> {+ late Color buttonColor;+ late Color borderColor;+ late Color iconColor;+ late TextStyle labelStyle;+ late Color checkIconColor;+ late Color loadingIconColor;+ ValueNotifier<String>? progressStatus;++ ///This is used to store the width of the button in idle state (small button)+ ///to be used as width for the button when the loading/succes states comes.+ double? widthOfButton;+ final _debouncer = Debouncer(const Duration(milliseconds: 300));+ ExecutionState executionState = ExecutionState.idle;+ Exception? _exception;++ @override+ void initState() {+ _setButtonTheme();+ super.initState();+ }++ @override+ void didUpdateWidget(covariant ButtonChildWidget oldWidget) {+ _setButtonTheme();+ super.didUpdateWidget(oldWidget);+ }++ @override+ Widget build(BuildContext context) {+ if (executionState == ExecutionState.successful) {+ Future.delayed(Duration(seconds: widget.isInAlert ? 1 : 2), () {+ setState(() {+ executionState = ExecutionState.idle;+ });+ });+ }+ return GestureDetector(+ onTap: _shouldRegisterGestures ? _onTap : null,+ onTapDown: _shouldRegisterGestures ? _onTapDown : null,+ onTapUp: _shouldRegisterGestures ? _onTapUp : null,+ onTapCancel: _shouldRegisterGestures ? _onTapCancel : null,+ child: Container(+ decoration: BoxDecoration(+ borderRadius: const BorderRadius.all(Radius.circular(4)),+ border: widget.buttonType == ButtonType.tertiaryCritical+ ? Border.all(color: borderColor)+ : null,+ ),+ child: AnimatedContainer(+ duration: const Duration(milliseconds: 16),+ width: widget.buttonSize == ButtonSize.large ? double.infinity : null,+ decoration: BoxDecoration(+ borderRadius: const BorderRadius.all(Radius.circular(4)),+ color: buttonColor,+ ),+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 16),+ child: AnimatedSwitcher(+ duration: const Duration(milliseconds: 175),+ switchInCurve: Curves.easeInOutExpo,+ switchOutCurve: Curves.easeInOutExpo,+ child: executionState == ExecutionState.idle ||+ !widget.shouldSurfaceExecutionStates+ ? widget.buttonType.hasTrailingIcon+ ? Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ widget.labelText == null+ ? const SizedBox.shrink()+ : Flexible(+ child: Padding(+ padding: widget.icon == null+ ? const EdgeInsets.symmetric(+ horizontal: 8,+ )+ : const EdgeInsets.only(right: 16),+ child: Text(+ widget.labelText!,+ overflow: TextOverflow.ellipsis,+ maxLines: 2,+ style: labelStyle,+ ),+ ),+ ),+ widget.icon == null+ ? const SizedBox.shrink()+ : Icon(+ widget.icon,+ size: 20,+ color: iconColor,+ ),+ ],+ )+ : Builder(+ builder: (context) {+ SchedulerBinding.instance.addPostFrameCallback(+ (timeStamp) {+ final box =+ context.findRenderObject() as RenderBox;+ widthOfButton = box.size.width;+ },+ );+ return Row(+ mainAxisSize:+ widget.buttonSize == ButtonSize.large+ ? MainAxisSize.max+ : MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ widget.icon == null+ ? const SizedBox.shrink()+ : Icon(+ widget.icon,+ size: 20,+ color: iconColor,+ ),+ widget.icon == null || widget.labelText == null+ ? const SizedBox.shrink()+ : const SizedBox(width: 8),+ widget.labelText == null+ ? const SizedBox.shrink()+ : Flexible(+ child: Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: 8,+ ),+ child: Text(+ widget.labelText!,+ style: labelStyle,+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ ),+ ),+ ),+ ],+ );+ },+ )+ : executionState == ExecutionState.inProgress+ ? SizedBox(+ width: widthOfButton,+ child: Row(+ mainAxisAlignment: MainAxisAlignment.center,+ mainAxisSize: MainAxisSize.min,+ children: [+ progressStatus == null+ ? const SizedBox.shrink()+ : ValueListenableBuilder<String>(+ valueListenable: progressStatus!,+ builder: (+ BuildContext context,+ String value,+ Widget? child,+ ) {+ return Padding(+ padding:+ const EdgeInsets.only(right: 8.0),+ child: Text(+ value,+ style: lightTextTheme.smallBold,+ ),+ );+ },+ ),+ EnteLoadingWidget(+ padding: 3,+ color: loadingIconColor,+ ),+ ],+ ),+ )+ : executionState == ExecutionState.successful+ ? SizedBox(+ width: widthOfButton,+ child: Icon(+ Icons.check_outlined,+ size: 20,+ color: checkIconColor,+ ),+ )+ : const SizedBox.shrink(), //fallback+ ),+ ),+ ),+ ),+ );+ }++ void _setButtonTheme() {+ progressStatus = widget.progressStatus;+ checkIconColor = widget.buttonStyle.checkIconColor ??+ widget.buttonStyle.defaultIconColor;+ loadingIconColor = widget.buttonStyle.defaultIconColor;+ if (widget.isDisabled) {+ buttonColor = widget.buttonStyle.disabledButtonColor ??+ widget.buttonStyle.defaultButtonColor;+ borderColor = widget.buttonStyle.disabledBorderColor ??+ widget.buttonStyle.defaultBorderColor;+ iconColor = widget.buttonStyle.disabledIconColor ??+ widget.buttonStyle.defaultIconColor;+ labelStyle = widget.buttonStyle.disabledLabelStyle ??+ widget.buttonStyle.defaultLabelStyle;+ } else {+ buttonColor = widget.buttonStyle.defaultButtonColor;+ borderColor = widget.buttonStyle.defaultBorderColor;+ iconColor = widget.buttonStyle.defaultIconColor;+ labelStyle = widget.buttonStyle.defaultLabelStyle;+ }+ }++ bool get _shouldRegisterGestures =>+ !widget.isDisabled && executionState == ExecutionState.idle;++ void _onTap() async {+ if (widget.onTap != null) {+ _debouncer.run(+ () => Future(() {+ setState(() {+ executionState = ExecutionState.inProgress;+ });+ }),+ );+ await widget.onTap!.call().then(+ (value) {+ _exception = null;+ },+ onError: (error, stackTrace) {+ executionState = ExecutionState.error;+ _exception = error as Exception;+ _debouncer.cancelDebounce();+ },+ );+ widget.shouldShowSuccessConfirmation && _debouncer.isActive()+ ? executionState = ExecutionState.successful+ : null;+ _debouncer.cancelDebounce();+ if (executionState == ExecutionState.successful) {+ setState(() {});+ }++ // when the time taken by widget.onTap is approximately equal to the debounce+ // time, the callback is getting executed when/after the if condition+ // below is executing/executed which results in execution state stuck at+ // idle state. This Future is for delaying the execution of the if+ // condition so that the calback in the debouncer finishes execution before.+ await Future.delayed(const Duration(milliseconds: 5));+ }+ if (executionState == ExecutionState.inProgress ||+ executionState == ExecutionState.error) {+ if (executionState == ExecutionState.inProgress) {+ if (mounted) {+ setState(() {+ executionState = ExecutionState.successful;+ Future.delayed(+ Duration(+ seconds: widget.shouldSurfaceExecutionStates+ ? (widget.isInAlert ? 1 : 2)+ : 0,+ ), () {+ widget.isInAlert+ ? _popWithButtonAction(+ context,+ buttonAction: widget.buttonAction,+ )+ : null;+ if (mounted) {+ setState(() {+ executionState = ExecutionState.idle;+ });+ }+ });+ });+ }+ }+ if (executionState == ExecutionState.error) {+ setState(() {+ executionState = ExecutionState.idle;+ widget.isInAlert+ ? Future.delayed(+ const Duration(seconds: 0),+ () => _popWithButtonAction(+ context,+ buttonAction: ButtonAction.error,+ exception: _exception,+ ),+ )+ : null;+ });+ }+ } else {+ if (widget.isInAlert) {+ Future.delayed(+ Duration(seconds: widget.shouldShowSuccessConfirmation ? 1 : 0),+ () =>+ _popWithButtonAction(context, buttonAction: widget.buttonAction),+ );+ }+ }+ }++ void _popWithButtonAction(+ BuildContext context, {+ required ButtonAction? buttonAction,+ Exception? exception,+ }) {+ if (Navigator.of(context).canPop()) {+ Navigator.of(context).pop(ButtonResult(widget.buttonAction, exception));+ } else if (exception != null) {+ //This is to show the execution was unsuccessful if the dialog is manually+ //closed before the execution completes.+ showGenericErrorDialog(+ context: context,+ error: exception,+ );+ }+ }++ void _onTapDown(details) {+ setState(() {+ buttonColor = widget.buttonStyle.pressedButtonColor ??+ widget.buttonStyle.defaultButtonColor;+ borderColor = widget.buttonStyle.pressedBorderColor ??+ widget.buttonStyle.defaultBorderColor;+ iconColor = widget.buttonStyle.pressedIconColor ??+ widget.buttonStyle.defaultIconColor;+ labelStyle = widget.buttonStyle.pressedLabelStyle ??+ widget.buttonStyle.defaultLabelStyle;+ });+ }++ void _onTapUp(details) {+ Future.delayed(+ const Duration(milliseconds: 84),+ () => setState(() {+ setAllStylesToDefault();+ }),+ );+ }++ void _onTapCancel() {+ setState(() {+ setAllStylesToDefault();+ });+ }++ void setAllStylesToDefault() {+ buttonColor = widget.buttonStyle.defaultButtonColor;+ borderColor = widget.buttonStyle.defaultBorderColor;+ iconColor = widget.buttonStyle.defaultIconColor;+ labelStyle = widget.buttonStyle.defaultLabelStyle;+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/dynamic_fab.dart b/mobile/packages/ui/lib/components/buttons/dynamic_fab.dartnew file mode 100644index 0000000000..1ff4aab191--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/dynamic_fab.dart@@ -0,0 +1,92 @@+import 'dart:math' as math;++import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++class DynamicFAB extends StatelessWidget {+ final bool? isKeypadOpen;+ final bool? isFormValid;+ final String? buttonText;+ final Function? onPressedFunction;++ const DynamicFAB({+ super.key,+ this.isKeypadOpen,+ this.buttonText,+ this.isFormValid,+ this.onPressedFunction,+ });++ @override+ Widget build(BuildContext context) {+ if (isKeypadOpen!) {+ return Container(+ decoration: BoxDecoration(+ boxShadow: [+ BoxShadow(+ color: getEnteColorScheme(context).alternativeColor,+ spreadRadius: 200,+ blurRadius: 100,+ offset: const Offset(0, 230),+ ),+ ],+ ),+ width: double.infinity,+ child: Row(+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ FloatingActionButton(+ heroTag: 'FAB',+ backgroundColor:+ getEnteColorScheme(context).dynamicFABBackgroundColor,+ foregroundColor: getEnteColorScheme(context).dynamicFABTextColor,+ onPressed: isFormValid!+ ? onPressedFunction as void Function()?+ : () {+ FocusScope.of(context).unfocus();+ },+ child: Transform.rotate(+ angle: isFormValid! ? 0 : math.pi / 2,+ child: const Icon(+ Icons.chevron_right,+ size: 36,+ ),+ ), //keypad down here+ ),+ ],+ ),+ );+ } else {+ return Container(+ width: double.infinity,+ height: 56,+ padding: const EdgeInsets.symmetric(horizontal: 20),+ child: OutlinedButton(+ onPressed:+ isFormValid! ? onPressedFunction as void Function()? : null,+ child: Text(buttonText!,+ style: isFormValid!+ ? getEnteTextTheme(context).body+ : getEnteTextTheme(context).bodyFaint),+ ),+ );+ }+ }+}++class NoScalingAnimation extends FloatingActionButtonAnimator {+ @override+ Offset getOffset({Offset? begin, required Offset end, double? progress}) {+ return end;+ }++ @override+ Animation<double> getRotationAnimation({required Animation<double> parent}) {+ return Tween<double>(begin: 1.0, end: 1.0).animate(parent);+ }++ @override+ Animation<double> getScaleAnimation({required Animation<double> parent}) {+ return Tween<double>(begin: 1.0, end: 1.0).animate(parent);+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/gradient_button.dart b/mobile/packages/ui/lib/components/buttons/gradient_button.dartnew file mode 100644index 0000000000..b98c7894ef--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/gradient_button.dart@@ -0,0 +1,81 @@+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++class GradientButton extends StatelessWidget {+ final Function? onTap;++ // text is ignored if child is specified+ final String text;++ // nullable+ final IconData? iconData;++ // padding between the text and icon+ final double paddingValue;++ const GradientButton({+ super.key,+ this.onTap,+ this.text = '',+ this.iconData,+ this.paddingValue = 0.0,+ });++ @override+ Widget build(BuildContext context) {+ Widget buttonContent;+ if (iconData == null) {+ buttonContent = Text(+ text,+ style: const TextStyle(+ color: Colors.white,+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter-SemiBold',+ fontSize: 18,+ ),+ );+ } else {+ buttonContent = Row(+ mainAxisAlignment: MainAxisAlignment.center,+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ Icon(+ iconData,+ size: 20,+ color: Colors.white,+ ),+ const Padding(padding: EdgeInsets.symmetric(horizontal: 6)),+ Text(+ text,+ style: const TextStyle(+ color: Colors.white,+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter-SemiBold',+ fontSize: 18,+ ),+ ),+ ],+ );+ }+ return InkWell(+ onTap: onTap as void Function()?,+ child: Container(+ height: 56,+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: const Alignment(0.1, -0.9),+ end: const Alignment(-0.6, 0.9),+ colors: onTap != null+ ? getEnteColorScheme(context).gradientButtonBgColors+ : [+ getEnteColorScheme(context).fillMuted,+ getEnteColorScheme(context).fillMuted,+ ],+ ),+ borderRadius: BorderRadius.circular(24),+ ),+ child: Center(child: buttonContent),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/icon_button_widget.dart b/mobile/packages/ui/lib/components/buttons/icon_button_widget.dartnew file mode 100644index 0000000000..922e69e7f0--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/icon_button_widget.dart@@ -0,0 +1,109 @@+import 'package:ente_ui/theme/colors.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++enum IconButtonType {+ primary,+ secondary,+ rounded,+}++class IconButtonWidget extends StatefulWidget {+ final IconButtonType iconButtonType;+ final IconData icon;+ final bool disableGestureDetector;+ final VoidCallback? onTap;+ final Color? defaultColor;+ final Color? pressedColor;+ final Color? iconColor;+ const IconButtonWidget({+ super.key,+ required this.icon,+ required this.iconButtonType,+ this.disableGestureDetector = false,+ this.onTap,+ this.defaultColor,+ this.pressedColor,+ this.iconColor,+ });++ @override+ State<IconButtonWidget> createState() => _IconButtonWidgetState();+}++class _IconButtonWidgetState extends State<IconButtonWidget> {+ Color? iconStateColor;+ @override+ void didChangeDependencies() {+ setState(() {+ iconStateColor = null;+ });+ super.didChangeDependencies();+ }++ @override+ Widget build(BuildContext context) {+ final bool hasPressedState = widget.onTap != null;+ final colorTheme = getEnteColorScheme(context);+ iconStateColor ??+ (iconStateColor = widget.defaultColor ??+ (widget.iconButtonType == IconButtonType.rounded+ ? colorTheme.fillFaint+ : null));+ return widget.disableGestureDetector+ ? _iconButton(colorTheme)+ : GestureDetector(+ onTapDown: hasPressedState ? _onTapDown : null,+ onTapUp: hasPressedState ? _onTapUp : null,+ onTapCancel: hasPressedState ? _onTapCancel : null,+ onTap: widget.onTap,+ child: _iconButton(colorTheme),+ );+ }++ 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(20),+ color: iconStateColor,+ ),+ child: Icon(+ widget.icon,+ color: widget.iconColor ??+ (widget.iconButtonType == IconButtonType.secondary+ ? colorTheme.strokeMuted+ : colorTheme.strokeBase),+ size: 24,+ ),+ ),+ );+ }++ _onTapDown(details) {+ final colorTheme = getEnteColorScheme(context);+ setState(() {+ iconStateColor = widget.pressedColor ??+ (widget.iconButtonType == IconButtonType.rounded+ ? colorTheme.fillMuted+ : colorTheme.fillFaint);+ });+ }++ _onTapUp(details) {+ Future.delayed(const Duration(milliseconds: 100), () {+ setState(() {+ iconStateColor = null;+ });+ });+ }++ _onTapCancel() {+ setState(() {+ iconStateColor = null;+ });+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/models/button_result.dart b/mobile/packages/ui/lib/components/buttons/models/button_result.dartnew file mode 100644index 0000000000..7560768dc1--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/models/button_result.dart@@ -0,0 +1,11 @@+import 'package:ente_ui/components/buttons/button_widget.dart';++class ButtonResult {+ ///action can be null when action for the button that is returned when popping+ ///the widget (dialog, actionSheet) which uses a ButtonWidget isn't+ ///relevant/useful and so is not assigned a value when an instance of+ ///ButtonWidget is created.+ final ButtonAction? action;+ final Exception? exception;+ ButtonResult([this.action, this.exception]);+}diff --git a/mobile/packages/ui/lib/components/buttons/models/button_type.dart b/mobile/packages/ui/lib/components/buttons/models/button_type.dartnew file mode 100644index 0000000000..a6cb8d95eb--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/models/button_type.dart@@ -0,0 +1,205 @@+import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/theme/colors.dart';+import 'package:ente_ui/theme/text_style.dart';+import 'package:flutter/material.dart';++enum ButtonType {+ primary,+ secondary,+ neutral,+ trailingIcon,+ critical,+ tertiaryCritical,+ trailingIconPrimary,+ trailingIconSecondary,+ tertiary;++ bool get isPrimary =>+ this == ButtonType.primary || this == ButtonType.trailingIconPrimary;++ bool get hasTrailingIcon =>+ this == ButtonType.trailingIcon ||+ this == ButtonType.trailingIconPrimary ||+ this == ButtonType.trailingIconSecondary;++ bool get isSecondary =>+ this == ButtonType.secondary || this == ButtonType.trailingIconSecondary;++ bool get isCritical =>+ this == ButtonType.critical || this == ButtonType.tertiaryCritical;++ bool get isNeutral =>+ this == ButtonType.neutral || this == ButtonType.trailingIcon;++ Color defaultButtonColor(EnteColorScheme colorScheme) {+ if (isPrimary) {+ return colorScheme.primary400;+ }+ if (isSecondary) {+ return colorScheme.fillFaint;+ }+ if (this == ButtonType.neutral || this == ButtonType.trailingIcon) {+ return colorScheme.fillBase;+ }+ if (this == ButtonType.critical) {+ return colorScheme.warning700;+ }+ if (this == ButtonType.tertiaryCritical) {+ return Colors.transparent;+ }+ return Colors.transparent;+ }++ //Returning null to fallback to default color+ Color? pressedButtonColor(EnteColorScheme colorScheme) {+ if (isPrimary) {+ return colorScheme.primary700;+ }+ if (isSecondary) {+ return colorScheme.fillFaintPressed;+ }+ if (isNeutral) {+ return colorScheme.fillBasePressed;+ }+ if (this == ButtonType.critical) {+ return colorScheme.warning800;+ }+ return null;+ }++ //Returning null to fallback to default color+ Color? disabledButtonColor(+ EnteColorScheme colorScheme,+ ButtonSize buttonSize,+ ) {+ if (buttonSize == ButtonSize.small &&+ (this == ButtonType.primary ||+ this == ButtonType.neutral ||+ this == ButtonType.critical)) {+ return colorScheme.fillMuted;+ }+ if (isPrimary || this == ButtonType.critical || isNeutral) {+ return colorScheme.fillFaint;+ }+ return null;+ }++ Color defaultBorderColor(EnteColorScheme colorScheme, ButtonSize buttonSize) {+ if (this == ButtonType.tertiaryCritical && buttonSize == ButtonSize.large) {+ return colorScheme.warning700;+ }+ return Colors.transparent;+ }++ //Returning null to fallback to default color+ Color? pressedBorderColor({+ required EnteColorScheme colorScheme,+ required ButtonSize buttonSize,+ }) {+ if (this == ButtonType.tertiaryCritical && buttonSize == ButtonSize.large) {+ return colorScheme.warning700;+ }+ return null;+ }++ //Returning null to fallback to default color+ Color? disabledBorderColor(+ EnteColorScheme colorScheme,+ ButtonSize buttonSize,+ ) {+ if (this == ButtonType.tertiaryCritical && buttonSize == ButtonSize.large) {+ return colorScheme.strokeMuted;+ }+ return null;+ }++ Color defaultIconColor({+ required EnteColorScheme colorScheme,+ required EnteColorScheme inverseColorScheme,+ }) {+ if (isPrimary || this == ButtonType.critical) {+ return strokeBaseDark;+ }+ if (this == ButtonType.neutral || this == ButtonType.trailingIcon) {+ return inverseColorScheme.strokeBase;+ }+ if (this == ButtonType.tertiaryCritical) {+ return colorScheme.warning500;+ }+ //fallback+ return colorScheme.strokeBase;+ }++ //Returning null to fallback to default color+ Color? pressedIconColor(EnteColorScheme colorScheme, ButtonSize buttonSize) {+ if (this == ButtonType.tertiaryCritical) {+ return colorScheme.warning700;+ }+ if (this == ButtonType.tertiary && buttonSize == ButtonSize.small) {+ return colorScheme.fillBasePressed;+ }+ return null;+ }++ //Returning null to fallback to default color+ Color? disabledIconColor(EnteColorScheme colorScheme, ButtonSize buttonSize) {+ if (isPrimary ||+ isSecondary ||+ isNeutral ||+ buttonSize == ButtonSize.small) {+ return colorScheme.strokeMuted;+ }+ if (isCritical) {+ return colorScheme.strokeFaint;+ }+ return null;+ }++ TextStyle defaultLabelStyle({+ required EnteTextTheme textTheme,+ required EnteTextTheme inverseTextTheme,+ }) {+ if (isPrimary || this == ButtonType.critical) {+ return textTheme.bodyBold.copyWith(color: textBaseDark);+ }+ if (this == ButtonType.neutral || this == ButtonType.trailingIcon) {+ return inverseTextTheme.bodyBold;+ }+ if (this == ButtonType.tertiaryCritical) {+ return textTheme.bodyBold.copyWith(color: warning500);+ }+ //fallback+ return textTheme.bodyBold;+ }++ //Returning null to fallback to default color+ TextStyle? pressedLabelStyle(+ EnteTextTheme textTheme,+ EnteColorScheme colorScheme,+ ButtonSize buttonSize,+ ) {+ if (this == ButtonType.tertiaryCritical) {+ return textTheme.bodyBold.copyWith(color: colorScheme.warning700);+ }+ if (this == ButtonType.tertiary && buttonSize == ButtonSize.small) {+ return textTheme.bodyBold.copyWith(color: colorScheme.fillBasePressed);+ }+ return null;+ }++ //Returning null to fallback to default color+ TextStyle? disabledLabelStyle(+ EnteTextTheme textTheme,+ EnteColorScheme colorScheme,+ ) {+ return textTheme.bodyBold.copyWith(color: colorScheme.textFaint);+ }++ //Returning null to fallback to default color+ Color? checkIconColor(EnteColorScheme colorScheme) {+ if (isSecondary) {+ return colorScheme.primary500;+ }+ return null;+ }+}diff --git a/mobile/packages/ui/lib/components/buttons/models/custom_button_style.dart b/mobile/packages/ui/lib/components/buttons/models/custom_button_style.dartnew file mode 100644index 0000000000..e30504ab3b--- /dev/null+++ b/mobile/packages/ui/lib/components/buttons/models/custom_button_style.dart@@ -0,0 +1,33 @@+import 'package:flutter/material.dart';++class CustomButtonStyle {+ Color defaultButtonColor;+ Color? pressedButtonColor;+ Color? disabledButtonColor;+ Color defaultBorderColor;+ Color? pressedBorderColor;+ Color? disabledBorderColor;+ Color defaultIconColor;+ Color? pressedIconColor;+ Color? disabledIconColor;+ TextStyle defaultLabelStyle;+ TextStyle? pressedLabelStyle;+ TextStyle? disabledLabelStyle;+ Color? checkIconColor;++ CustomButtonStyle({+ required this.defaultButtonColor,+ this.pressedButtonColor,+ this.disabledButtonColor,+ required this.defaultBorderColor,+ this.pressedBorderColor,+ this.disabledBorderColor,+ required this.defaultIconColor,+ this.pressedIconColor,+ this.disabledIconColor,+ required this.defaultLabelStyle,+ this.pressedLabelStyle,+ this.disabledLabelStyle,+ this.checkIconColor,+ });+}diff --git a/mobile/packages/ui/lib/components/captioned_text_widget.dart b/mobile/packages/ui/lib/components/captioned_text_widget.dartnew file mode 100644index 0000000000..f4d6eb423a--- /dev/null+++ b/mobile/packages/ui/lib/components/captioned_text_widget.dart@@ -0,0 +1,57 @@+import '../theme/ente_theme.dart';+import 'package:flutter/material.dart';++class CaptionedTextWidget extends StatelessWidget {+ final String title;+ final String? subTitle;+ final TextStyle? textStyle;+ final bool makeTextBold;+ final Color? textColor;+ const CaptionedTextWidget({+ required this.title,+ this.subTitle,+ this.textStyle,+ this.makeTextBold = false,+ this.textColor,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final enteColorScheme = getEnteColorScheme(context);+ final enteTextTheme = getEnteTextTheme(context);++ return Flexible(+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 2),+ child: Row(+ children: [+ Flexible(+ child: RichText(+ text: TextSpan(+ style: textStyle ??+ (makeTextBold+ ? enteTextTheme.bodyBold.copyWith(color: textColor)+ : enteTextTheme.body.copyWith(color: textColor)),+ children: [+ TextSpan(+ text: title,+ ),+ subTitle != null+ ? TextSpan(+ text: ' \u2022 $subTitle',+ style: enteTextTheme.small.copyWith(+ color: enteColorScheme.textMuted,+ ),+ )+ : const TextSpan(text: ''),+ ],+ ),+ ),+ ),+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/components_constants.dart b/mobile/packages/ui/lib/components/components_constants.dartnew file mode 100644index 0000000000..2f8cbf52b1--- /dev/null+++ b/mobile/packages/ui/lib/components/components_constants.dart@@ -0,0 +1,4 @@+const double mobileSmallThreshold = 336;++//Screen width of iPhone 14 pro max in points is taken as maximum+const double restrictedMaxWidth = 430;diff --git a/mobile/packages/ui/lib/components/developer_settings_widget.dart b/mobile/packages/ui/lib/components/developer_settings_widget.dartnew file mode 100644index 0000000000..408c4d7111--- /dev/null+++ b/mobile/packages/ui/lib/components/developer_settings_widget.dart@@ -0,0 +1,32 @@+import 'package:ente_configuration/base_configuration.dart';+import 'package:ente_configuration/constants.dart';+import 'package:ente_strings/ente_strings.dart';+import 'package:flutter/material.dart';++class DeveloperSettingsWidget extends StatelessWidget {+ final BaseConfiguration configuration;++ const DeveloperSettingsWidget(+ this.configuration, {+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final endpoint = configuration.getHttpEndpoint();+ if (endpoint != kDefaultProductionEndpoint) {+ final endpointURI = Uri.parse(endpoint);+ return Padding(+ padding: const EdgeInsets.only(bottom: 20),+ child: Text(+ context.strings.customEndpoint(+ "${endpointURI.host}:${endpointURI.port}",+ ),+ style: Theme.of(context).textTheme.bodySmall,+ ),+ );+ } else {+ return const SizedBox.shrink();+ }+ }+}diff --git a/mobile/packages/ui/lib/components/dialog_widget.dart b/mobile/packages/ui/lib/components/dialog_widget.dartnew file mode 100644index 0000000000..53be98c476--- /dev/null+++ b/mobile/packages/ui/lib/components/dialog_widget.dart@@ -0,0 +1,291 @@+import 'dart:math';++import 'package:ente_base/typedefs.dart';+import 'package:ente_strings/ente_strings.dart';+import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/components/buttons/models/button_result.dart';+import 'package:ente_ui/components/buttons/models/button_type.dart';+import 'package:ente_ui/components/components_constants.dart';+import 'package:ente_ui/components/separators.dart';+import 'package:ente_ui/components/text_input_widget.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showDialogWidget({+ required BuildContext context,+ required String title,+ String? body,+ required List<ButtonWidget> buttons,+ IconData? icon,+ bool isDismissible = true,+ bool useRootNavigator = false,+}) {+ return showDialog(+ useRootNavigator: useRootNavigator,+ barrierDismissible: isDismissible,+ barrierColor: getEnteColorScheme(context).backdropFaint,+ context: context,+ builder: (context) {+ final widthOfScreen = MediaQuery.of(context).size.width;+ final isMobileSmall = widthOfScreen <= mobileSmallThreshold;+ return Padding(+ padding: EdgeInsets.symmetric(horizontal: isMobileSmall ? 8 : 0),+ child: Dialog(+ insetPadding: EdgeInsets.zero,+ child: DialogWidget(+ title: title,+ body: body,+ buttons: buttons,+ icon: icon,+ ),+ ),+ );+ },+ );+}++class DialogWidget extends StatelessWidget {+ final String title;+ final String? body;+ final List<ButtonWidget> buttons;+ final IconData? icon;+ const DialogWidget({+ required this.title,+ this.body,+ required this.buttons,+ this.icon,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final widthOfScreen = MediaQuery.of(context).size.width;+ final isMobileSmall = widthOfScreen <= mobileSmallThreshold;+ final colorScheme = getEnteColorScheme(context);+ return Container(+ width: min(widthOfScreen, 320),+ padding: isMobileSmall+ ? const EdgeInsets.all(0)+ : const EdgeInsets.fromLTRB(6, 8, 6, 6),+ decoration: BoxDecoration(+ color: colorScheme.backgroundElevated,+ boxShadow: getEnteShadowFloat(context),+ borderRadius: const BorderRadius.all(Radius.circular(8)),+ ),+ child: Material(+ color: Colors.transparent,+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: SingleChildScrollView(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ContentContainer(+ title: title,+ body: body,+ icon: icon,+ ),+ const SizedBox(height: 36),+ Actions(buttons),+ ],+ ),+ ),+ ),+ ),+ );+ }+}++class ContentContainer extends StatelessWidget {+ final String title;+ final String? body;+ final IconData? icon;+ const ContentContainer({+ required this.title,+ this.body,+ this.icon,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ icon == null+ ? const SizedBox.shrink()+ : Row(+ children: [+ Icon(+ icon,+ size: 32,+ ),+ ],+ ),+ icon == null ? const SizedBox.shrink() : const SizedBox(height: 19),+ Text(title, style: textTheme.largeBold),+ body != null ? const SizedBox(height: 19) : const SizedBox.shrink(),+ body != null+ ? Text(+ body!,+ style: textTheme.body.copyWith(color: colorScheme.textMuted),+ )+ : const SizedBox.shrink(),+ ],+ );+ }+}++class Actions extends StatelessWidget {+ final List<ButtonWidget> buttons;+ const Actions(this.buttons, {super.key});++ @override+ Widget build(BuildContext context) {+ return Column(+ children: addSeparators(+ buttons,+ const SizedBox(+ // In figma this white space is of height 8pts. But the Button+ // component has 1pts of invisible border by default in code. So two+ // 1pts borders will visually make the whitespace 8pts.+ // Height of button component in figma = 48, in code = 50 (2pts for+ // top + bottom border)+ height: 6,+ ),+ ),+ );+ }+}++class TextInputDialog extends StatefulWidget {+ final String title;+ final String? body;+ final String submitButtonLabel;+ final IconData? icon;+ final String? label;+ final String? message;+ final FutureVoidCallbackParamStr onSubmit;+ final String? hintText;+ final IconData? prefixIcon;+ final String? initialValue;+ final Alignment? alignMessage;+ final int? maxLength;+ final bool showOnlyLoadingState;+ final TextCapitalization? textCapitalization;+ final bool alwaysShowSuccessState;+ final bool isPasswordInput;+ const TextInputDialog({+ required this.title,+ this.body,+ required this.submitButtonLabel,+ required this.onSubmit,+ this.icon,+ this.label,+ this.message,+ this.hintText,+ this.prefixIcon,+ this.initialValue,+ this.alignMessage,+ this.maxLength,+ this.textCapitalization,+ this.showOnlyLoadingState = false,+ this.alwaysShowSuccessState = false,+ this.isPasswordInput = false,+ super.key,+ });++ @override+ State<TextInputDialog> createState() => _TextInputDialogState();+}++class _TextInputDialogState extends State<TextInputDialog> {+ //the value of this ValueNotifier has no significance+ final _submitNotifier = ValueNotifier(false);++ @override+ void dispose() {+ _submitNotifier.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final widthOfScreen = MediaQuery.of(context).size.width;+ final isMobileSmall = widthOfScreen <= mobileSmallThreshold;+ final colorScheme = getEnteColorScheme(context);+ return Container(+ width: min(widthOfScreen, 320),+ padding: isMobileSmall+ ? const EdgeInsets.all(0)+ : const EdgeInsets.fromLTRB(6, 8, 6, 6),+ decoration: BoxDecoration(+ color: colorScheme.backgroundElevated,+ boxShadow: getEnteShadowFloat(context),+ borderRadius: const BorderRadius.all(Radius.circular(8)),+ ),+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ContentContainer(+ title: widget.title,+ body: widget.body,+ icon: widget.icon,+ ),+ Padding(+ padding: const EdgeInsets.only(top: 19),+ child: TextInputWidget(+ label: widget.label,+ message: widget.message,+ hintText: widget.hintText,+ prefixIcon: widget.prefixIcon,+ initialValue: widget.initialValue,+ alignMessage: widget.alignMessage,+ autoFocus: true,+ maxLength: widget.maxLength,+ submitNotifier: _submitNotifier,+ onSubmit: widget.onSubmit,+ popNavAfterSubmission: true,+ showOnlyLoadingState: widget.showOnlyLoadingState,+ textCapitalization: widget.textCapitalization,+ alwaysShowSuccessState: widget.alwaysShowSuccessState,+ isPasswordInput: widget.isPasswordInput,+ ),+ ),+ const SizedBox(height: 36),+ Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Expanded(+ child: ButtonWidget(+ buttonType: ButtonType.secondary,+ buttonSize: ButtonSize.small,+ labelText: context.strings.cancel,+ isInAlert: true,+ ),+ ),+ const SizedBox(width: 8),+ Expanded(+ child: ButtonWidget(+ buttonSize: ButtonSize.small,+ buttonType: ButtonType.neutral,+ labelText: widget.submitButtonLabel,+ onTap: () async {+ _submitNotifier.value = !_submitNotifier.value;+ },+ ),+ ),+ ],+ ),+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/dialogs.dart b/mobile/packages/ui/lib/components/dialogs.dartnew file mode 100644index 0000000000..1bb7071eef--- /dev/null+++ b/mobile/packages/ui/lib/components/dialogs.dart@@ -0,0 +1,124 @@+import 'package:ente_base/typedefs.dart';+import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/components/buttons/models/button_result.dart';+import 'package:ente_ui/components/buttons/models/button_type.dart';+import 'package:ente_ui/components/dialog_widget.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++enum DialogUserChoice { firstChoice, secondChoice }++enum ActionType {+ confirm,+ critical,+}++// if dialog is dismissed by tapping outside, this will return null+Future<DialogUserChoice?> showChoiceDialogOld<T>(+ BuildContext context,+ String title,+ String content, {+ String firstAction = 'Ok',+ Color? firstActionColor,+ String secondAction = 'Cancel',+ Color? secondActionColor,+ ActionType actionType = ActionType.confirm,+}) {+ final AlertDialog alert = AlertDialog(+ title: Text(+ title,+ style: TextStyle(+ color: actionType == ActionType.critical+ ? Colors.red+ : getEnteColorScheme(context).primary500,+ ),+ ),+ content: Text(+ content,+ style: const TextStyle(+ height: 1.4,+ ),+ ),+ actions: [+ TextButton(+ child: Text(+ firstAction,+ style: TextStyle(+ color: firstActionColor ??+ (actionType == ActionType.critical+ ? Colors.red+ : getEnteColorScheme(context).surface),+ ),+ ),+ onPressed: () {+ Navigator.of(context, rootNavigator: true)+ .pop(DialogUserChoice.firstChoice);+ },+ ),+ TextButton(+ child: Text(+ secondAction,+ style: TextStyle(+ color: secondActionColor ??+ getEnteColorScheme(context).alternativeColor,+ ),+ ),+ onPressed: () {+ Navigator.of(context, rootNavigator: true)+ .pop(DialogUserChoice.secondChoice);+ },+ ),+ ],+ );++ return showDialog<DialogUserChoice>(+ context: context,+ builder: (BuildContext context) {+ return alert;+ },+ barrierColor: Colors.black87,+ );+}++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showChoiceDialog(+ BuildContext context, {+ required String title,+ String? body,+ required String firstButtonLabel,+ String secondButtonLabel = "Cancel",+ ButtonType firstButtonType = ButtonType.neutral,+ ButtonType secondButtonType = ButtonType.secondary,+ ButtonAction firstButtonAction = ButtonAction.first,+ ButtonAction secondButtonAction = ButtonAction.cancel,+ FutureVoidCallback? firstButtonOnTap,+ FutureVoidCallback? secondButtonOnTap,+ bool isCritical = false,+ IconData? icon,+ bool isDismissible = true,+}) async {+ final buttons = [+ ButtonWidget(+ buttonType: isCritical ? ButtonType.critical : firstButtonType,+ labelText: firstButtonLabel,+ isInAlert: true,+ onTap: firstButtonOnTap,+ buttonAction: firstButtonAction,+ ),+ ButtonWidget(+ buttonType: secondButtonType,+ labelText: secondButtonLabel,+ isInAlert: true,+ onTap: secondButtonOnTap,+ buttonAction: secondButtonAction,+ ),+ ];+ return showDialogWidget(+ context: context,+ title: title,+ body: body,+ buttons: buttons,+ icon: icon,+ isDismissible: isDismissible,+ );+}diff --git a/mobile/packages/ui/lib/components/divider_widget.dart b/mobile/packages/ui/lib/components/divider_widget.dartnew file mode 100644index 0000000000..c4a3374abb--- /dev/null+++ b/mobile/packages/ui/lib/components/divider_widget.dart@@ -0,0 +1,69 @@+import '../theme/ente_theme.dart';+import 'package:flutter/material.dart';++enum DividerType {+ solid,+ menu,+ menuNoIcon,+ bottomBar,+}++class DividerWidget extends StatelessWidget {+ final DividerType dividerType;+ final Color bgColor;+ final bool divColorHasBlur;+ final EdgeInsets? padding;+ const DividerWidget({+ super.key,+ required this.dividerType,+ this.bgColor = Colors.transparent,+ this.divColorHasBlur = true,+ this.padding,+ });++ @override+ Widget build(BuildContext context) {+ final dividerColor = divColorHasBlur+ ? getEnteColorScheme(context).blurStrokeFaint+ : getEnteColorScheme(context).strokeFaint;++ if (dividerType == DividerType.solid) {+ return Container(+ color: getEnteColorScheme(context).strokeFaint,+ width: double.infinity,+ height: 1,+ );+ }+ if (dividerType == DividerType.bottomBar) {+ return Container(+ color: dividerColor,+ width: double.infinity,+ height: 1,+ );+ }++ return Container(+ color: bgColor,+ padding: padding ?? EdgeInsets.zero,+ child: Row(+ children: [+ SizedBox(+ width: dividerType == DividerType.menu+ ? 48+ : dividerType == DividerType.menuNoIcon+ ? 16+ : 0,+ height: 1,+ ),+ Expanded(+ child: Container(+ color: dividerColor,+ height: 1,+ width: double.infinity,+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/loading_widget.dart b/mobile/packages/ui/lib/components/loading_widget.dartnew file mode 100644index 0000000000..999f0aa3c2--- /dev/null+++ b/mobile/packages/ui/lib/components/loading_widget.dart@@ -0,0 +1,33 @@+import '../theme/ente_theme.dart';+import 'package:flutter/material.dart';++class EnteLoadingWidget extends StatelessWidget {+ final Color? color;+ final double size;+ final double padding;+ final Alignment alignment;+ const EnteLoadingWidget({+ this.color,+ this.size = 14,+ this.padding = 5,+ this.alignment = Alignment.center,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ return Align(+ alignment: alignment,+ child: Padding(+ padding: EdgeInsets.all(padding),+ child: SizedBox.fromSize(+ size: Size.square(size),+ child: CircularProgressIndicator(+ strokeWidth: 2,+ color: color ?? getEnteColorScheme(context).strokeBase,+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/menu_item_child_widgets.dart b/mobile/packages/ui/lib/components/menu_item_child_widgets.dartnew file mode 100644index 0000000000..67b2937ed0--- /dev/null+++ b/mobile/packages/ui/lib/components/menu_item_child_widgets.dart@@ -0,0 +1,173 @@+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/models/execution_states.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++class TrailingWidget extends StatefulWidget {+ final ValueNotifier executionStateNotifier;+ final IconData? trailingIcon;+ final Color? trailingIconColor;+ final Widget? trailingWidget;+ final bool trailingIconIsMuted;+ final double trailingExtraMargin;+ final bool showExecutionStates;+ const TrailingWidget({+ super.key,+ required this.executionStateNotifier,+ this.trailingIcon,+ this.trailingIconColor,+ this.trailingWidget,+ required this.trailingIconIsMuted,+ required this.trailingExtraMargin,+ required this.showExecutionStates,+ });+ @override+ State<TrailingWidget> createState() => _TrailingWidgetState();+}++class _TrailingWidgetState extends State<TrailingWidget> {+ Widget? trailingWidget;+ @override+ void initState() {+ widget.showExecutionStates+ ? widget.executionStateNotifier.addListener(_executionStateListener)+ : null;+ super.initState();+ }++ @override+ void dispose() {+ widget.executionStateNotifier.removeListener(_executionStateListener);+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ if (trailingWidget == null || !widget.showExecutionStates) {+ _setTrailingIcon();+ }+ return AnimatedSwitcher(+ duration: const Duration(milliseconds: 175),+ switchInCurve: Curves.easeInExpo,+ switchOutCurve: Curves.easeOutExpo,+ child: trailingWidget,+ );+ }++ void _executionStateListener() {+ final colorScheme = getEnteColorScheme(context);+ setState(() {+ if (widget.executionStateNotifier.value == ExecutionState.idle) {+ _setTrailingIcon();+ } else if (widget.executionStateNotifier.value ==+ ExecutionState.inProgress) {+ trailingWidget = EnteLoadingWidget(+ color: colorScheme.strokeMuted,+ );+ } else if (widget.executionStateNotifier.value ==+ ExecutionState.successful) {+ trailingWidget = Icon(+ Icons.check_outlined,+ size: 22,+ color: colorScheme.primary500,+ );+ } else {+ trailingWidget = const SizedBox.shrink();+ }+ });+ }++ void _setTrailingIcon() {+ if (widget.trailingIcon != null) {+ trailingWidget = Padding(+ padding: EdgeInsets.only(+ right: widget.trailingExtraMargin,+ ),+ child: Icon(+ widget.trailingIcon,+ color: widget.trailingIconIsMuted+ ? getEnteColorScheme(context).strokeMuted+ : widget.trailingIconColor,+ ),+ );+ } else {+ trailingWidget = widget.trailingWidget ?? const SizedBox.shrink();+ }+ }+}++class ExpansionTrailingIcon extends StatelessWidget {+ final bool isExpanded;+ final IconData? trailingIcon;+ final Color? trailingIconColor;+ const ExpansionTrailingIcon({+ super.key,+ required this.isExpanded,+ this.trailingIcon,+ this.trailingIconColor,+ });++ @override+ Widget build(BuildContext context) {+ return AnimatedOpacity(+ duration: const Duration(milliseconds: 100),+ curve: Curves.easeInOut,+ opacity: isExpanded ? 0 : 1,+ child: AnimatedSwitcher(+ transitionBuilder: (child, animation) {+ return ScaleTransition(scale: animation, child: child);+ },+ duration: const Duration(milliseconds: 200),+ switchInCurve: Curves.easeOut,+ child: isExpanded+ ? const SizedBox.shrink()+ : Icon(+ trailingIcon,+ color: trailingIconColor,+ ),+ ),+ );+ }+}++class LeadingWidget extends StatelessWidget {+ final IconData? leadingIcon;+ final Color? leadingIconColor;++ final Widget? leadingIconWidget;+ // leadIconSize deafult value is 20.+ final double leadingIconSize;+ const LeadingWidget({+ super.key,+ required this.leadingIconSize,+ this.leadingIcon,+ this.leadingIconColor,+ this.leadingIconWidget,+ });++ @override+ Widget build(BuildContext context) {+ return Padding(+ padding: const EdgeInsets.only(right: 10),+ child: SizedBox(+ height: leadingIconSize,+ width: leadingIconSize,+ child: leadingIcon == null+ ? (leadingIconWidget != null+ ? FittedBox(+ fit: BoxFit.contain,+ child: leadingIconWidget,+ )+ : const SizedBox.shrink())+ : FittedBox(+ fit: BoxFit.contain,+ child: Icon(+ leadingIcon,+ color: leadingIconColor ??+ getEnteColorScheme(context).strokeBase,+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/menu_item_widget.dart b/mobile/packages/ui/lib/components/menu_item_widget.dartnew file mode 100644index 0000000000..1c1d97ec8e--- /dev/null+++ b/mobile/packages/ui/lib/components/menu_item_widget.dart@@ -0,0 +1,291 @@+import 'package:ente_base/typedefs.dart';+import 'package:ente_ui/components/menu_item_child_widgets.dart';+import 'package:ente_ui/models/execution_states.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_utils/debouncer.dart';+import 'package:flutter/material.dart';++class MenuItemWidget extends StatefulWidget {+ final Widget captionedTextWidget;+ final bool isExpandable;++ /// leading icon can be passed without specifing size of icon,+ /// this component sets size to 20x20 irrespective of passed icon's size+ final IconData? leadingIcon;+ final Color? leadingIconColor;++ final Widget? leadingIconWidget;++ // leadIconSize deafult value is 20.+ final double leadingIconSize;++ /// trailing icon can be passed without size as default size set by+ /// flutter is what this component expects+ final IconData? trailingIcon;+ final Color? trailingIconColor;+ final Widget? trailingWidget;+ final bool trailingIconIsMuted;++ /// If provided, add this much extra spacing to the right of the trailing icon.+ final double trailingExtraMargin;+ final FutureVoidCallback? onTap;+ final VoidCallback? onDoubleTap;+ final Color? menuItemColor;+ final bool alignCaptionedTextToLeft;++ // singleBorderRadius is applied to the border when it's a standalone menu item.+ // Widget will apply singleBorderRadius if value of both isTopBorderRadiusRemoved+ // and isBottomBorderRadiusRemoved is false. Otherwise, multipleBorderRadius will+ // be applied+ final double singleBorderRadius;+ final double multipleBorderRadius;+ final Color? pressedColor;+ final ExpansibleController? expandableController;+ final bool isBottomBorderRadiusRemoved;+ final bool isTopBorderRadiusRemoved;++ /// disable gesture detector if not used+ final bool isGestureDetectorDisabled;++ ///Success state will not be shown if this flag is set to true, only idle and+ ///loading state+ final bool showOnlyLoadingState;++ final bool surfaceExecutionStates;++ ///To show success state even when execution time < debouce time, set this+ ///flag to true. If the loading state needs to be shown and success state not,+ ///set the showOnlyLoadingState flag to true, setting this flag to false won't+ ///help.+ final bool alwaysShowSuccessState;++ const MenuItemWidget({+ required this.captionedTextWidget,+ this.isExpandable = false,+ this.leadingIcon,+ this.leadingIconColor,+ this.leadingIconSize = 20.0,+ this.leadingIconWidget,+ this.trailingIcon,+ this.trailingIconColor,+ this.trailingWidget,+ this.trailingIconIsMuted = false,+ this.trailingExtraMargin = 0.0,+ this.onTap,+ this.onDoubleTap,+ this.menuItemColor,+ this.alignCaptionedTextToLeft = false,+ this.singleBorderRadius = 4.0,+ this.multipleBorderRadius = 8.0,+ this.pressedColor,+ this.expandableController,+ this.isBottomBorderRadiusRemoved = false,+ this.isTopBorderRadiusRemoved = false,+ this.isGestureDetectorDisabled = false,+ this.showOnlyLoadingState = false,+ this.surfaceExecutionStates = true,+ this.alwaysShowSuccessState = false,+ super.key,+ });++ @override+ State<MenuItemWidget> createState() => _MenuItemWidgetState();+}++class _MenuItemWidgetState extends State<MenuItemWidget> {+ final _debouncer = Debouncer(const Duration(milliseconds: 300));+ ValueNotifier<ExecutionState> executionStateNotifier =+ ValueNotifier(ExecutionState.idle);++ Color? menuItemColor;+ late double borderRadius;++ @override+ void initState() {+ menuItemColor = widget.menuItemColor;+ borderRadius =+ (widget.isBottomBorderRadiusRemoved || widget.isTopBorderRadiusRemoved)+ ? widget.multipleBorderRadius+ : widget.singleBorderRadius;+ if (widget.expandableController != null) {+ widget.expandableController!.addListener(() {+ setState(() {});+ });+ }+ super.initState();+ }++ @override+ void didChangeDependencies() {+ menuItemColor = widget.menuItemColor;+ super.didChangeDependencies();+ }++ @override+ void didUpdateWidget(covariant MenuItemWidget oldWidget) {+ menuItemColor = widget.menuItemColor;+ super.didUpdateWidget(oldWidget);+ }++ @override+ void dispose() {+ if (widget.expandableController != null) {+ widget.expandableController!.dispose();+ }+ executionStateNotifier.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ return widget.isExpandable || widget.isGestureDetectorDisabled+ ? menuItemWidget(context)+ : GestureDetector(+ onTap: _onTap,+ onDoubleTap: widget.onDoubleTap,+ onTapDown: _onTapDown,+ onTapUp: _onTapUp,+ onTapCancel: _onCancel,+ child: menuItemWidget(context),+ );+ }++ Widget menuItemWidget(BuildContext context) {+ final circularRadius = Radius.circular(borderRadius);+ final isExpanded = widget.expandableController?.isExpanded;+ final bottomBorderRadius =+ (isExpanded != null && isExpanded) || widget.isBottomBorderRadiusRemoved+ ? const Radius.circular(0)+ : circularRadius;+ final topBorderRadius = widget.isTopBorderRadiusRemoved+ ? const Radius.circular(0)+ : circularRadius;+ return AnimatedContainer(+ duration: const Duration(milliseconds: 20),+ width: double.infinity,+ padding: const EdgeInsets.only(left: 16, right: 12),+ decoration: BoxDecoration(+ borderRadius: BorderRadius.only(+ topLeft: topBorderRadius,+ topRight: topBorderRadius,+ bottomLeft: bottomBorderRadius,+ bottomRight: bottomBorderRadius,+ ),+ color: menuItemColor,+ ),+ child: Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ widget.alignCaptionedTextToLeft && widget.leadingIcon == null+ ? const SizedBox.shrink()+ : LeadingWidget(+ leadingIconSize: widget.leadingIconSize,+ leadingIcon: widget.leadingIcon,+ leadingIconColor: widget.leadingIconColor,+ leadingIconWidget: widget.leadingIconWidget,+ ),+ widget.captionedTextWidget,+ if (widget.expandableController != null)+ ExpansionTrailingIcon(+ isExpanded: isExpanded!,+ trailingIcon: widget.trailingIcon,+ trailingIconColor: widget.trailingIconColor,+ )+ else+ TrailingWidget(+ executionStateNotifier: executionStateNotifier,+ trailingIcon: widget.trailingIcon,+ trailingIconColor: widget.trailingIconColor,+ trailingWidget: widget.trailingWidget,+ trailingIconIsMuted: widget.trailingIconIsMuted,+ trailingExtraMargin: widget.trailingExtraMargin,+ showExecutionStates: widget.surfaceExecutionStates,+ key: ValueKey(widget.trailingIcon.hashCode),+ ),+ ],+ ),+ );+ }++ Future<void> _onTap() async {+ if (executionStateNotifier.value == ExecutionState.inProgress ||+ executionStateNotifier.value == ExecutionState.successful) {+ return;+ }+ _debouncer.run(+ () => Future(+ () {+ executionStateNotifier.value = ExecutionState.inProgress;+ },+ ),+ );+ await widget.onTap?.call().then(+ (value) {+ widget.alwaysShowSuccessState+ ? executionStateNotifier.value = ExecutionState.successful+ : null;+ },+ onError: (error, stackTrace) => _debouncer.cancelDebounce(),+ );+ _debouncer.cancelDebounce();+ if (widget.alwaysShowSuccessState) {+ Future.delayed(const Duration(seconds: 2), () {+ executionStateNotifier.value = ExecutionState.idle;+ });+ return;+ }+ if (executionStateNotifier.value == ExecutionState.inProgress) {+ if (widget.showOnlyLoadingState) {+ executionStateNotifier.value = ExecutionState.idle;+ } else {+ executionStateNotifier.value = ExecutionState.successful;+ Future.delayed(const Duration(seconds: 2), () {+ executionStateNotifier.value = ExecutionState.idle;+ });+ }+ }+ }++ void _onTapDown(details) {+ if (executionStateNotifier.value == ExecutionState.inProgress ||+ executionStateNotifier.value == ExecutionState.successful) {+ return;+ }+ setState(() {+ if (widget.pressedColor == null) {+ hasPassedGestureCallbacks()+ ? menuItemColor = getEnteColorScheme(context).fillFaintPressed+ : menuItemColor = widget.menuItemColor;+ } else {+ menuItemColor = widget.pressedColor;+ }+ });+ }++ bool hasPassedGestureCallbacks() {+ return widget.onDoubleTap != null || widget.onTap != null;+ }++ void _onTapUp(details) {+ if (executionStateNotifier.value == ExecutionState.inProgress ||+ executionStateNotifier.value == ExecutionState.successful) {+ return;+ }+ Future.delayed(+ const Duration(milliseconds: 100),+ () => setState(() {+ menuItemColor = widget.menuItemColor;+ }),+ );+ }++ void _onCancel() {+ if (executionStateNotifier.value == ExecutionState.inProgress ||+ executionStateNotifier.value == ExecutionState.successful) {+ return;+ }+ setState(() {+ menuItemColor = widget.menuItemColor;+ });+ }+}diff --git a/mobile/packages/ui/lib/components/progress_dialog.dart b/mobile/packages/ui/lib/components/progress_dialog.dartnew file mode 100644index 0000000000..adabff2ee0--- /dev/null+++ b/mobile/packages/ui/lib/components/progress_dialog.dart@@ -0,0 +1,289 @@+import 'package:flutter/material.dart';++enum ProgressDialogType { normal, download }++String _dialogMessage = "Loading...";+double _progress = 0.0, _maxProgress = 100.0;++Widget? _customBody;++TextAlign _textAlign = TextAlign.left;+Alignment _progressWidgetAlignment = Alignment.centerLeft;++TextDirection _direction = TextDirection.ltr;++bool _isShowing = false;+BuildContext? _context, _dismissingContext;+ProgressDialogType? _progressDialogType;+bool _barrierDismissible = true, _showLogs = false;+Color? _barrierColor;++TextStyle _progressTextStyle = const TextStyle(+ color: Colors.black,+ fontSize: 12.0,+ fontWeight: FontWeight.w400,+ ),+ _messageStyle = const TextStyle(+ color: Colors.black,+ fontSize: 18.0,+ fontWeight: FontWeight.w600,+ );++double _dialogElevation = 8.0, _borderRadius = 8.0;+Color _backgroundColor = Colors.white;+Curve _insetAnimCurve = Curves.easeInOut;+EdgeInsets _dialogPadding = const EdgeInsets.all(8.0);++Widget _progressWidget = Image.asset(+ 'assets/double_ring_loading_io.gif',+ package: 'progress_dialog',+);++class ProgressDialog {+ _Body? _dialog;++ ProgressDialog(+ BuildContext context, {+ ProgressDialogType? type,+ bool? isDismissible,+ bool? showLogs,+ TextDirection? textDirection,+ Widget? customBody,+ Color? barrierColor,+ }) {+ _context = context;+ _progressDialogType = type ?? ProgressDialogType.normal;+ _barrierDismissible = isDismissible ?? true;+ _showLogs = showLogs ?? false;+ _customBody = customBody;+ _direction = textDirection ?? TextDirection.ltr;+ _barrierColor = barrierColor ?? barrierColor;+ }++ void style({+ Widget? child,+ double? progress,+ double? maxProgress,+ String? message,+ Widget? progressWidget,+ Color? backgroundColor,+ TextStyle? progressTextStyle,+ TextStyle? messageTextStyle,+ double? elevation,+ TextAlign? textAlign,+ double? borderRadius,+ Curve? insetAnimCurve,+ EdgeInsets? padding,+ Alignment? progressWidgetAlignment,+ }) {+ if (_isShowing) return;+ if (_progressDialogType == ProgressDialogType.download) {+ _progress = progress ?? _progress;+ }++ _dialogMessage = message ?? _dialogMessage;+ _maxProgress = maxProgress ?? _maxProgress;+ _progressWidget = progressWidget ?? _progressWidget;+ _backgroundColor = backgroundColor ?? _backgroundColor;+ _messageStyle = messageTextStyle ?? _messageStyle;+ _progressTextStyle = progressTextStyle ?? _progressTextStyle;+ _dialogElevation = elevation ?? _dialogElevation;+ _borderRadius = borderRadius ?? _borderRadius;+ _insetAnimCurve = insetAnimCurve ?? _insetAnimCurve;+ _textAlign = textAlign ?? _textAlign;+ _progressWidget = child ?? _progressWidget;+ _dialogPadding = padding ?? _dialogPadding;+ _progressWidgetAlignment =+ progressWidgetAlignment ?? _progressWidgetAlignment;+ }++ void update({+ double? progress,+ double? maxProgress,+ String? message,+ Widget? progressWidget,+ TextStyle? progressTextStyle,+ TextStyle? messageTextStyle,+ }) {+ if (_progressDialogType == ProgressDialogType.download) {+ _progress = progress ?? _progress;+ }++ _dialogMessage = message ?? _dialogMessage;+ _maxProgress = maxProgress ?? _maxProgress;+ _progressWidget = progressWidget ?? _progressWidget;+ _messageStyle = messageTextStyle ?? _messageStyle;+ _progressTextStyle = progressTextStyle ?? _progressTextStyle;++ if (_isShowing) _dialog!.update();+ }++ bool isShowing() {+ return _isShowing;+ }++ Future<bool> hide() async {+ try {+ if (_isShowing) {+ _isShowing = false;+ if (_dismissingContext != null) {+ Navigator.of(_dismissingContext!).pop();+ }+ if (_showLogs) debugPrint('ProgressDialog dismissed');+ return Future.value(true);+ } else {+ if (_showLogs) debugPrint('ProgressDialog already dismissed');+ return Future.value(false);+ }+ } catch (err) {+ debugPrint('Seems there is an issue hiding dialog');+ debugPrint(err.toString());+ return Future.value(false);+ }+ }++ Future<bool> show() async {+ try {+ if (!_isShowing) {+ _dialog = _Body();+ // ignore: unawaited_futures+ showDialog<dynamic>(+ context: _context!,+ barrierDismissible: _barrierDismissible,+ barrierColor: _barrierColor,+ builder: (BuildContext context) {+ _dismissingContext = context;+ return PopScope(+ canPop: _barrierDismissible,+ child: Dialog(+ backgroundColor: _backgroundColor,+ insetAnimationCurve: _insetAnimCurve,+ insetAnimationDuration: const Duration(milliseconds: 100),+ elevation: _dialogElevation,+ shape: RoundedRectangleBorder(+ borderRadius:+ BorderRadius.all(Radius.circular(_borderRadius)),+ ),+ child: _dialog,+ ),+ );+ },+ );+ // Delaying the function for 200 milliseconds+ // [Default transitionDuration of DialogRoute]+ await Future.delayed(const Duration(milliseconds: 200));+ if (_showLogs) debugPrint('ProgressDialog shown');+ _isShowing = true;+ return true;+ } else {+ if (_showLogs) debugPrint("ProgressDialog already shown/showing");+ return false;+ }+ } catch (err) {+ _isShowing = false;+ debugPrint('Exception while showing the dialog');+ debugPrint(err.toString());+ return false;+ }+ }+}++// ignore: must_be_immutable+class _Body extends StatefulWidget {+ final _BodyState _dialog = _BodyState();++ update() {+ _dialog.update();+ }++ @override+ State<StatefulWidget> createState() {+ // ignore: no_logic_in_create_state+ return _dialog;+ }+}++class _BodyState extends State<_Body> {+ update() {+ setState(() {});+ }++ @override+ void dispose() {+ _isShowing = false;+ if (_showLogs) debugPrint('ProgressDialog dismissed by back button');+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final loader = Align(+ alignment: _progressWidgetAlignment,+ child: SizedBox(+ width: 60.0,+ height: 60.0,+ child: _progressWidget,+ ),+ );++ final text = Expanded(+ child: _progressDialogType == ProgressDialogType.normal+ ? Text(+ _dialogMessage,+ textAlign: _textAlign,+ style: _messageStyle,+ textDirection: _direction,+ )+ : Padding(+ padding: const EdgeInsets.all(8.0),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: <Widget>[+ const SizedBox(height: 8.0),+ Row(+ children: <Widget>[+ Expanded(+ child: Text(+ _dialogMessage,+ style: _messageStyle,+ textDirection: _direction,+ ),+ ),+ ],+ ),+ const SizedBox(height: 4.0),+ Align(+ alignment: Alignment.bottomRight,+ child: Text(+ "$_progress/$_maxProgress",+ style: _progressTextStyle,+ textDirection: _direction,+ ),+ ),+ ],+ ),+ ),+ );++ return _customBody ??+ Container(+ padding: _dialogPadding,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: <Widget>[+ // row body+ Row(+ mainAxisSize: MainAxisSize.min,+ children: <Widget>[+ const SizedBox(width: 8.0),+ _direction == TextDirection.ltr ? loader : text,+ const SizedBox(width: 8.0),+ _direction == TextDirection.rtl ? loader : text,+ const SizedBox(width: 8.0),+ ],+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/components/separators.dart b/mobile/packages/ui/lib/components/separators.dartnew file mode 100644index 0000000000..bc4b1346ad--- /dev/null+++ b/mobile/packages/ui/lib/components/separators.dart@@ -0,0 +1,13 @@+//This method returns a newly declared list with separators. It will not+//modify the original list+import 'package:flutter/widgets.dart';++List<Widget> addSeparators(List<Widget> listOfWidgets, Widget separator) {+ final int initialLength = listOfWidgets.length;+ final listOfWidgetsWithSeparators = <Widget>[];+ listOfWidgetsWithSeparators.addAll(listOfWidgets);+ for (var i = 1; i < initialLength; i++) {+ listOfWidgetsWithSeparators.insert((2 * i) - 1, separator);+ }+ return listOfWidgetsWithSeparators;+}diff --git a/mobile/packages/ui/lib/components/text_input_widget.dart b/mobile/packages/ui/lib/components/text_input_widget.dartnew file mode 100644index 0000000000..b310f31a08--- /dev/null+++ b/mobile/packages/ui/lib/components/text_input_widget.dart@@ -0,0 +1,406 @@+import 'package:ente_base/typedefs.dart';+import 'package:ente_logging/logging.dart';+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/components/separators.dart';+import 'package:ente_ui/models/execution_states.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_utils/debouncer.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++class TextInputWidget extends StatefulWidget {+ final String? label;+ final String? message;+ final String? hintText;+ final IconData? prefixIcon;+ final String? initialValue;+ final Alignment? alignMessage;+ final bool? autoFocus;+ final int? maxLength;++ ///TextInputWidget will listen to this notifier and executes onSubmit when+ ///notified.+ final ValueNotifier? submitNotifier;+ final bool alwaysShowSuccessState;+ final bool showOnlyLoadingState;+ final FutureVoidCallbackParamStr? onSubmit;+ final VoidCallbackParamStr? onChange;+ final bool popNavAfterSubmission;+ final bool shouldSurfaceExecutionStates;+ final TextCapitalization? textCapitalization;+ final bool isPasswordInput;+ final bool cancellable;+ final bool shouldUnfocusOnCancelOrSubmit;+ const TextInputWidget({+ this.onSubmit,+ this.onChange,+ this.label,+ this.message,+ this.hintText,+ this.prefixIcon,+ this.initialValue,+ this.alignMessage,+ this.autoFocus,+ this.maxLength,+ this.submitNotifier,+ this.alwaysShowSuccessState = false,+ this.showOnlyLoadingState = false,+ this.popNavAfterSubmission = false,+ this.shouldSurfaceExecutionStates = true,+ this.textCapitalization = TextCapitalization.none,+ this.isPasswordInput = false,+ this.cancellable = false,+ this.shouldUnfocusOnCancelOrSubmit = false,+ super.key,+ });++ @override+ State<TextInputWidget> createState() => _TextInputWidgetState();+}++class _TextInputWidgetState extends State<TextInputWidget> {+ final _logger = Logger("TextInputWidget");+ ExecutionState executionState = ExecutionState.idle;+ final _textController = TextEditingController();+ final _debouncer = Debouncer(const Duration(milliseconds: 300));+ late final ValueNotifier<bool> _obscureTextNotifier;++ ///This is to pass if the TextInputWidget is in a dialog and an error is+ ///thrown in executing onSubmit by passing it as arg in Navigator.pop()+ Exception? _exception;+ bool _incorrectPassword = false;+ @override+ void initState() {+ widget.submitNotifier?.addListener(_onSubmit);++ if (widget.initialValue != null) {+ _textController.value = TextEditingValue(+ text: widget.initialValue!,+ selection: TextSelection.collapsed(offset: widget.initialValue!.length),+ );+ }+ if (widget.onChange != null) {+ _textController.addListener(() {+ widget.onChange!.call(_textController.text);+ });+ }+ _obscureTextNotifier = ValueNotifier(widget.isPasswordInput);+ _obscureTextNotifier.addListener(_safeRefresh);+ super.initState();+ }++ @override+ void dispose() {+ widget.submitNotifier?.removeListener(_onSubmit);+ _obscureTextNotifier.dispose();+ _textController.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ if (executionState == ExecutionState.successful) {+ Future.delayed(Duration(seconds: widget.popNavAfterSubmission ? 1 : 2),+ () {+ setState(() {+ executionState = ExecutionState.idle;+ });+ });+ }+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ var textInputChildren = <Widget>[];+ if (widget.label != null) {+ textInputChildren.add(Text(widget.label!));+ }+ textInputChildren.add(+ ClipRRect(+ borderRadius: const BorderRadius.all(Radius.circular(8)),+ child: Material(+ child: TextFormField(+ textCapitalization: widget.textCapitalization!,+ autofocus: widget.autoFocus ?? false,+ controller: _textController,+ inputFormatters: widget.maxLength != null+ ? [LengthLimitingTextInputFormatter(50)]+ : null,+ obscureText: _obscureTextNotifier.value,+ decoration: InputDecoration(+ hintText: widget.hintText,+ hintStyle: textTheme.body.copyWith(color: colorScheme.textMuted),+ filled: true,+ fillColor: colorScheme.fillFaint,+ contentPadding: const EdgeInsets.fromLTRB(+ 12,+ 12,+ 0,+ 12,+ ),+ border: const UnderlineInputBorder(+ borderSide: BorderSide.none,+ ),+ focusedBorder: OutlineInputBorder(+ borderSide: BorderSide(+ color: _incorrectPassword+ ? colorScheme.warning500+ : colorScheme.strokeFaint,+ ),+ borderRadius: BorderRadius.circular(8),+ ),+ suffixIcon: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 12),+ child: AnimatedSwitcher(+ duration: const Duration(milliseconds: 175),+ switchInCurve: Curves.easeInExpo,+ switchOutCurve: Curves.easeOutExpo,+ child: SuffixIconWidget(+ key: ValueKey(executionState),+ executionState: executionState,+ shouldSurfaceExecutionStates:+ widget.shouldSurfaceExecutionStates,+ obscureTextNotifier: _obscureTextNotifier,+ isPasswordInput: widget.isPasswordInput,+ textController: _textController,+ isCancellable: widget.cancellable,+ shouldUnfocusOnCancelOrSubmit:+ widget.shouldUnfocusOnCancelOrSubmit,+ ),+ ),+ ),+ prefixIconConstraints: const BoxConstraints(+ maxHeight: 44,+ maxWidth: 44,+ minHeight: 44,+ minWidth: 44,+ ),+ suffixIconConstraints: const BoxConstraints(+ maxHeight: 24,+ maxWidth: 48,+ minHeight: 24,+ minWidth: 48,+ ),+ prefixIcon: widget.prefixIcon != null+ ? Icon(+ widget.prefixIcon,+ color: colorScheme.strokeMuted,+ )+ : null,+ ),+ onEditingComplete: () {+ _onSubmit();+ },+ ),+ ),+ ),+ );+ if (widget.message != null) {+ textInputChildren.add(+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 8),+ child: Align(+ alignment: widget.alignMessage ?? Alignment.centerLeft,+ child: Text(+ widget.message!,+ style: textTheme.small.copyWith(color: colorScheme.textMuted),+ ),+ ),+ ),+ );+ }+ textInputChildren =+ addSeparators(textInputChildren, const SizedBox(height: 4));+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: textInputChildren,+ );+ }++ void _safeRefresh() {+ if (mounted) {+ setState(() {});+ }+ }++ void _onSubmit() async {+ _debouncer.run(+ () => Future(() {+ setState(() {+ executionState = ExecutionState.inProgress;+ });+ }),+ );+ if (widget.shouldUnfocusOnCancelOrSubmit) {+ FocusScope.of(context).unfocus();+ }+ try {+ await widget.onSubmit!.call(_textController.text);+ } catch (e) {+ executionState = ExecutionState.error;+ _debouncer.cancelDebounce();+ _exception = e as Exception;+ if (e.toString().contains("Incorrect password")) {+ _logger.warning("Incorrect password");+ _surfaceWrongPasswordState();+ }+ if (!widget.popNavAfterSubmission) {+ rethrow;+ }+ }+ widget.alwaysShowSuccessState && _debouncer.isActive()+ ? executionState = ExecutionState.successful+ : null;+ _debouncer.cancelDebounce();+ if (executionState == ExecutionState.successful) {+ setState(() {});+ }++ // when the time taken by widget.onSubmit is approximately equal to the debounce+ // time, the callback is getting executed when/after the if condition+ // below is executing/executed which results in execution state stuck at+ // idle state. This Future is for delaying the execution of the if+ // condition so that the calback in the debouncer finishes execution before.+ await Future.delayed(const Duration(milliseconds: 5));+ if (executionState == ExecutionState.inProgress ||+ executionState == ExecutionState.error) {+ if (executionState == ExecutionState.inProgress) {+ if (mounted) {+ if (widget.showOnlyLoadingState) {+ setState(() {+ executionState = ExecutionState.idle;+ });+ _popNavigatorStack(context);+ } else {+ setState(() {+ executionState = ExecutionState.successful;+ Future.delayed(+ Duration(+ seconds: widget.shouldSurfaceExecutionStates+ ? (widget.popNavAfterSubmission ? 1 : 2)+ : 0,+ ), () {+ widget.popNavAfterSubmission+ ? _popNavigatorStack(context)+ : null;+ if (mounted) {+ setState(() {+ executionState = ExecutionState.idle;+ });+ }+ });+ });+ }+ }+ }+ if (executionState == ExecutionState.error) {+ setState(() {+ executionState = ExecutionState.idle;+ widget.popNavAfterSubmission+ ? Future.delayed(+ const Duration(seconds: 0),+ () => _popNavigatorStack(context, e: _exception),+ )+ : null;+ });+ }+ } else {+ if (widget.popNavAfterSubmission) {+ Future.delayed(+ Duration(seconds: widget.alwaysShowSuccessState ? 1 : 0),+ () => _popNavigatorStack(context),+ );+ }+ }+ }++ void _popNavigatorStack(BuildContext context, {Exception? e}) {+ Navigator.of(context).canPop() ? Navigator.of(context).pop(e) : null;+ }++ void _surfaceWrongPasswordState() {+ setState(() {+ _incorrectPassword = true;+ HapticFeedback.vibrate();+ Future.delayed(const Duration(seconds: 1), () {+ if (mounted) {+ setState(() {+ _incorrectPassword = false;+ });+ }+ });+ });+ }+}++//todo: Add clear and custom icon for suffic icon+class SuffixIconWidget extends StatelessWidget {+ final ExecutionState executionState;+ final bool shouldSurfaceExecutionStates;+ final TextEditingController textController;+ final ValueNotifier? obscureTextNotifier;+ final bool isPasswordInput;+ final bool isCancellable;+ final bool shouldUnfocusOnCancelOrSubmit;++ const SuffixIconWidget({+ required this.executionState,+ required this.shouldSurfaceExecutionStates,+ required this.textController,+ this.obscureTextNotifier,+ this.isPasswordInput = false,+ this.isCancellable = false,+ this.shouldUnfocusOnCancelOrSubmit = false,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final Widget trailingWidget;+ final colorScheme = getEnteColorScheme(context);+ if (executionState == ExecutionState.idle ||+ !shouldSurfaceExecutionStates) {+ if (isCancellable) {+ trailingWidget = GestureDetector(+ onTap: () {+ textController.clear();+ if (shouldUnfocusOnCancelOrSubmit) {+ FocusScope.of(context).unfocus();+ }+ },+ child: Icon(+ Icons.cancel_rounded,+ color: colorScheme.strokeMuted,+ ),+ );+ } else if (isPasswordInput) {+ assert(obscureTextNotifier != null);+ trailingWidget = GestureDetector(+ onTap: () {+ obscureTextNotifier!.value = !obscureTextNotifier!.value;+ },+ child: Icon(+ obscureTextNotifier!.value+ ? Icons.visibility_off_outlined+ : Icons.visibility,+ color: obscureTextNotifier!.value ? colorScheme.strokeMuted : null,+ ),+ );+ } else {+ trailingWidget = const SizedBox.shrink();+ }+ } else if (executionState == ExecutionState.inProgress) {+ trailingWidget = EnteLoadingWidget(+ color: colorScheme.strokeMuted,+ );+ } else if (executionState == ExecutionState.successful) {+ trailingWidget = Icon(+ Icons.check_outlined,+ size: 22,+ color: colorScheme.primary500,+ );+ } else {+ trailingWidget = const SizedBox.shrink();+ }+ return trailingWidget;+ }+}diff --git a/mobile/packages/ui/lib/components/title_bar_title_widget.dart b/mobile/packages/ui/lib/components/title_bar_title_widget.dartnew file mode 100644index 0000000000..3af955fea3--- /dev/null+++ b/mobile/packages/ui/lib/components/title_bar_title_widget.dart@@ -0,0 +1,55 @@+import '../theme/ente_theme.dart';+import 'package:flutter/material.dart';++class TitleBarTitleWidget extends StatelessWidget {+ final String? title;+ final bool isTitleH2;+ final IconData? icon;+ const TitleBarTitleWidget({+ super.key,+ this.title,+ this.isTitleH2 = false,+ this.icon,+ });++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final colorTheme = getEnteColorScheme(context);+ if (title != null) {+ if (icon != null) {+ return Row(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.center,+ children: <Widget>[+ Text(+ title!,+ style: textTheme.h3Bold,+ overflow: TextOverflow.ellipsis,+ maxLines: 1,+ ),+ const SizedBox(width: 8),+ Icon(icon, size: 20, color: colorTheme.strokeMuted),+ ],+ );+ }+ if (isTitleH2) {+ return Text(+ title!,+ style: textTheme.h2Bold,+ overflow: TextOverflow.ellipsis,+ maxLines: 1,+ );+ } else {+ return Text(+ title!,+ style: textTheme.h3Bold,+ overflow: TextOverflow.ellipsis,+ maxLines: 1,+ );+ }+ }++ return const SizedBox.shrink();+ }+}diff --git a/mobile/packages/ui/lib/components/title_bar_widget.dart b/mobile/packages/ui/lib/components/title_bar_widget.dartnew file mode 100644index 0000000000..9517bc1749--- /dev/null+++ b/mobile/packages/ui/lib/components/title_bar_widget.dart@@ -0,0 +1,152 @@+import '../theme/ente_theme.dart';+import '../components/buttons/icon_button_widget.dart';+import 'package:flutter/material.dart';++class TitleBarWidget extends StatelessWidget {+ final IconButtonWidget? leading;+ final String? title;+ final String? caption;+ final Widget? flexibleSpaceTitle;+ final String? flexibleSpaceCaption;+ final List<Widget>? actionIcons;+ final bool isTitleH2WithoutLeading;+ final bool isFlexibleSpaceDisabled;+ final bool isOnTopOfScreen;+ final Color? backgroundColor;+ const TitleBarWidget({+ super.key,+ this.leading,+ this.title,+ this.caption,+ this.flexibleSpaceTitle,+ this.flexibleSpaceCaption,+ this.actionIcons,+ this.isTitleH2WithoutLeading = false,+ this.isFlexibleSpaceDisabled = false,+ this.isOnTopOfScreen = true,+ this.backgroundColor,+ });++ @override+ Widget build(BuildContext context) {+ const toolbarHeight = 48.0;+ final textTheme = getEnteTextTheme(context);+ final colorTheme = getEnteColorScheme(context);+ return SliverAppBar(+ backgroundColor: backgroundColor,+ primary: isOnTopOfScreen ? true : false,+ toolbarHeight: toolbarHeight,+ leadingWidth: 48,+ automaticallyImplyLeading: false,+ pinned: true,+ expandedHeight: isFlexibleSpaceDisabled ? toolbarHeight : 102,+ centerTitle: false,+ titleSpacing: 4,+ title: Padding(+ padding: EdgeInsets.only(left: isTitleH2WithoutLeading ? 16 : 0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisAlignment: MainAxisAlignment.start,+ children: [+ title == null+ ? const SizedBox.shrink()+ : Text(+ title!,+ style: isTitleH2WithoutLeading+ ? textTheme.h2Bold+ : textTheme.largeBold,+ ),+ caption == null || isTitleH2WithoutLeading+ ? const SizedBox.shrink()+ : Text(+ caption!,+ style: textTheme.mini.copyWith(color: colorTheme.textMuted),+ ),+ ],+ ),+ ),+ actions: [+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 4),+ child: Row(+ children: _actionsWithPaddingInBetween(),+ ),+ ),+ ],+ leading: isTitleH2WithoutLeading+ ? null+ : leading ??+ IconButtonWidget(+ icon: Icons.arrow_back_outlined,+ iconButtonType: IconButtonType.primary,+ onTap: () {+ Navigator.pop(context);+ },+ ),+ flexibleSpace: isFlexibleSpaceDisabled+ ? null+ : FlexibleSpaceBar(+ background: SafeArea(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: <Widget>[+ const SizedBox(height: toolbarHeight),+ Padding(+ padding: const EdgeInsets.symmetric(+ vertical: 4,+ horizontal: 16,+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ flexibleSpaceTitle == null+ ? const SizedBox.shrink()+ : flexibleSpaceTitle!,+ flexibleSpaceCaption == null+ ? const SizedBox.shrink()+ : Text(+ flexibleSpaceCaption!,+ style: textTheme.small.copyWith(+ color: colorTheme.textMuted,+ ),+ overflow: TextOverflow.ellipsis,+ maxLines: 1,+ ),+ ],+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }++ _actionsWithPaddingInBetween() {+ if (actionIcons == null) {+ return <Widget>[const SizedBox.shrink()];+ }+ final actions = <Widget>[];+ bool addWhiteSpace = false;+ final length = actionIcons!.length;+ int index = 0;+ if (length == 0) {+ return <Widget>[const SizedBox.shrink()];+ }+ if (length == 1) {+ return actionIcons;+ }+ while (index < length) {+ if (!addWhiteSpace) {+ actions.add(actionIcons![index]);+ index++;+ addWhiteSpace = true;+ } else {+ actions.add(const SizedBox(width: 4));+ addWhiteSpace = false;+ }+ }+ return actions;+ }+}diff --git a/mobile/packages/ui/lib/components/toggle_switch_widget.dart b/mobile/packages/ui/lib/components/toggle_switch_widget.dartnew file mode 100644index 0000000000..438bcf177f--- /dev/null+++ b/mobile/packages/ui/lib/components/toggle_switch_widget.dart@@ -0,0 +1,136 @@+import 'package:ente_base/typedefs.dart';+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/models/execution_states.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_utils/debouncer.dart';+import 'package:flutter/material.dart';++typedef OnChangedCallBack = void Function(bool);++class ToggleSwitchWidget extends StatefulWidget {+ final BoolCallBack value;+ final FutureVoidCallback onChanged;+ const ToggleSwitchWidget({+ required this.value,+ required this.onChanged,+ super.key,+ });++ @override+ State<ToggleSwitchWidget> createState() => _ToggleSwitchWidgetState();+}++class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {+ bool? toggleValue;+ ExecutionState executionState = ExecutionState.idle;+ final _debouncer = Debouncer(const Duration(milliseconds: 300));++ @override+ void initState() {+ toggleValue = widget.value.call();+ super.initState();+ }++ @override+ Widget build(BuildContext context) {+ final enteColorScheme = getEnteColorScheme(context);+ final Widget stateIcon = _stateIcon(enteColorScheme);++ return Row(+ children: [+ Padding(+ padding: const EdgeInsets.only(right: 2),+ child: AnimatedSwitcher(+ duration: const Duration(milliseconds: 175),+ switchInCurve: Curves.easeInExpo,+ switchOutCurve: Curves.easeOutExpo,+ child: stateIcon,+ ),+ ),+ SizedBox(+ height: 31,+ child: FittedBox(+ fit: BoxFit.contain,+ child: Switch.adaptive(+ activeColor: enteColorScheme.primary400,+ activeTrackColor: enteColorScheme.primary300,+ inactiveTrackColor: enteColorScheme.fillMuted,+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,+ value: toggleValue ?? false,+ onChanged: (negationOfToggleValue) async {+ setState(() {+ toggleValue = negationOfToggleValue;+ //start showing inProgress statu icons if toggle takes more than debounce time+ _debouncer.run(+ () => Future(+ () {+ setState(() {+ executionState = ExecutionState.inProgress;+ });+ },+ ),+ );+ });+ final Stopwatch stopwatch = Stopwatch()..start();+ await widget.onChanged.call().onError(+ (error, stackTrace) => _debouncer.cancelDebounce(),+ );+ //for toggle feedback on short unsuccessful onChanged+ await _feedbackOnUnsuccessfulToggle(stopwatch);+ //debouncer gets canceled if onChanged takes less than debounce time+ _debouncer.cancelDebounce();++ final newValue = widget.value.call();+ setState(() {+ if (toggleValue == newValue) {+ if (executionState == ExecutionState.inProgress) {+ executionState = ExecutionState.successful;+ Future.delayed(const Duration(seconds: 2), () {+ setState(() {+ executionState = ExecutionState.idle;+ });+ });+ }+ } else {+ toggleValue = !toggleValue!;+ executionState = ExecutionState.idle;+ }+ });+ },+ ),+ ),+ ),+ ],+ );+ }++ Widget _stateIcon(enteColorScheme) {+ if (executionState == ExecutionState.idle) {+ return const SizedBox(width: 24);+ } else if (executionState == ExecutionState.inProgress) {+ return EnteLoadingWidget(+ color: enteColorScheme.strokeMuted,+ );+ } else if (executionState == ExecutionState.successful) {+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 1),+ child: Icon(+ Icons.check_outlined,+ size: 22,+ color: enteColorScheme.primary500,+ ),+ );+ } else {+ return const SizedBox(width: 24);+ }+ }++ Future<void> _feedbackOnUnsuccessfulToggle(Stopwatch stopwatch) async {+ final timeElapsed = stopwatch.elapsedMilliseconds;+ if (timeElapsed < 200) {+ await Future.delayed(+ Duration(milliseconds: 200 - timeElapsed),+ );+ }+ }+}diff --git a/mobile/packages/ui/lib/lifecycle_event_handler.dart b/mobile/packages/ui/lib/lifecycle_event_handler.dartnew file mode 100644index 0000000000..da5dfb3d97--- /dev/null+++ b/mobile/packages/ui/lib/lifecycle_event_handler.dart@@ -0,0 +1,31 @@+import 'package:flutter/foundation.dart';+import 'package:flutter/widgets.dart';++class LifecycleEventHandler extends WidgetsBindingObserver {+ final AsyncCallback? resumeCallBack;+ final AsyncCallback? suspendingCallBack;++ LifecycleEventHandler({+ this.resumeCallBack,+ this.suspendingCallBack,+ });++ @override+ Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {+ switch (state) {+ case AppLifecycleState.resumed:+ if (resumeCallBack != null) {+ await resumeCallBack!();+ }+ break;+ case AppLifecycleState.inactive:+ case AppLifecycleState.hidden:+ case AppLifecycleState.paused:+ case AppLifecycleState.detached:+ if (suspendingCallBack != null) {+ await suspendingCallBack!();+ }+ break;+ }+ }+}diff --git a/mobile/packages/ui/lib/models/execution_states.dart b/mobile/packages/ui/lib/models/execution_states.dartnew file mode 100644index 0000000000..9522030c14--- /dev/null+++ b/mobile/packages/ui/lib/models/execution_states.dart@@ -0,0 +1,6 @@+enum ExecutionState {+ idle,+ inProgress,+ error,+ successful+}diff --git a/mobile/packages/ui/lib/pages/log_file_viewer.dart b/mobile/packages/ui/lib/pages/log_file_viewer.dartnew file mode 100644index 0000000000..d002556852--- /dev/null+++ b/mobile/packages/ui/lib/pages/log_file_viewer.dart@@ -0,0 +1,65 @@+import 'dart:io';++import 'package:ente_ui/components/loading_widget.dart';+import 'package:flutter/material.dart';+import 'package:flutter/cupertino.dart';++class LogFileViewer extends StatefulWidget {+ final File file;+ const LogFileViewer(this.file, {super.key});++ @override+ State<LogFileViewer> createState() => _LogFileViewerState();+}++class _LogFileViewerState extends State<LogFileViewer> {+ String? _logs;+ @override+ void initState() {+ widget.file.readAsString().then((logs) {+ setState(() {+ _logs = logs;+ });+ });+ super.initState();+ }++ @override+ Widget build(BuildContext context) {+ return Scaffold(+ appBar: AppBar(+ elevation: 0,+ title: const Text("Today's logs"),+ ),+ body: _getBody(),+ );+ }++ Widget _getBody() {+ if (_logs == null) {+ return const EnteLoadingWidget();+ }+ return Container(+ padding: const EdgeInsets.only(left: 12, top: 8, right: 12),+ child: SingleChildScrollView(+ child: SelectableRegion(+ focusNode: FocusNode(),+ selectionControls: Platform.isAndroid+ ? materialTextSelectionControls+ : Platform.isIOS+ ? cupertinoTextSelectionControls+ : desktopTextSelectionControls,+ child: Text(+ _logs!,+ style: const TextStyle(+ fontFeatures: [+ FontFeature.tabularFigures(),+ ],+ height: 1.2,+ ),+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/pages/web_page.dart b/mobile/packages/ui/lib/pages/web_page.dartnew file mode 100644index 0000000000..10652d0e51--- /dev/null+++ b/mobile/packages/ui/lib/pages/web_page.dart@@ -0,0 +1,43 @@+import '../components/loading_widget.dart';+import 'package:flutter/material.dart';+import 'package:flutter_inappwebview/flutter_inappwebview.dart';++class WebPage extends StatefulWidget {+ final String title;+ final String url;++ const WebPage(this.title, this.url, {super.key});++ @override+ State<WebPage> createState() => _WebPageState();+}++class _WebPageState extends State<WebPage> {+ bool _hasLoadedPage = false;++ @override+ Widget build(BuildContext context) {+ return Scaffold(+ appBar: AppBar(+ // force dark theme for appBar till website/family plans add supports for light theme+ backgroundColor: const Color.fromRGBO(10, 20, 20, 1.0),+ foregroundColor: Colors.white,+ iconTheme: const IconThemeData(color: Colors.white),+ title: Text(widget.title),+ actions: [_hasLoadedPage ? Container() : const EnteLoadingWidget()],+ ),+ backgroundColor: Colors.black,+ body: InAppWebView(+ initialUrlRequest: URLRequest(url: WebUri(widget.url)),+ initialSettings: InAppWebViewSettings(+ transparentBackground: true,+ ),+ onLoadStop: (c, url) {+ setState(() {+ _hasLoadedPage = true;+ });+ },+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/theme/color_migration_demo.dart b/mobile/packages/ui/lib/theme/color_migration_demo.dartnew file mode 100644index 0000000000..0f667ea910--- /dev/null+++ b/mobile/packages/ui/lib/theme/color_migration_demo.dart@@ -0,0 +1,206 @@+// Demo showing the color system migration is complete+// This file demonstrates that the new color system works correctly++import 'package:flutter/material.dart';+import '../theme/colors.dart';+import '../theme/ente_theme.dart';+import '../theme/ente_theme_data.dart';++/// Demo widget showing the new color system in action+class ColorMigrationDemo extends StatelessWidget {+ const ColorMigrationDemo({super.key});++ @override+ Widget build(BuildContext context) {+ // NEW: Preferred way to access colors+ final colorScheme = Theme.of(context).extension<EnteColorScheme>() ??+ getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundElevated,+ title: Text(+ 'Color Migration Demo',+ style: TextStyle(color: colorScheme.textBase),+ ),+ ),+ body: SingleChildScrollView(+ padding: const EdgeInsets.all(16.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ _buildSection(+ colorScheme,+ 'Background Colors',+ color: colorScheme.backgroundElevated,+ border: colorScheme.strokeFaint,+ ),+ const SizedBox(height: 16),+ _buildSection(+ colorScheme,+ 'Primary Colors',+ color: colorScheme.primary500,+ textColor: colorScheme.backgroundBase,+ ),+ const SizedBox(height: 16),+ _buildGradientSection(colorScheme),+ const SizedBox(height: 16),+ _buildSection(+ colorScheme,+ 'Warning Colors',+ color: colorScheme.warning500.withOpacity(0.1),+ border: colorScheme.warning500,+ textColor: colorScheme.warning700,+ ),+ const SizedBox(height: 16),+ _buildSection(+ colorScheme,+ 'Fill Colors',+ color: colorScheme.fillFaint,+ textColor: colorScheme.textMuted,+ ),+ const SizedBox(height: 16),+ _buildMigrationInfo(colorScheme),+ ],+ ),+ ),+ );+ }++ Widget _buildSection(+ EnteColorScheme colorScheme,+ String title, {+ required Color color,+ Color? border,+ Color? textColor,+ }) {+ return Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: color,+ border: border != null ? Border.all(color: border) : null,+ borderRadius: BorderRadius.circular(8),+ ),+ child: Text(+ '$title β ',+ style: TextStyle(+ color: textColor ?? colorScheme.textBase,+ fontWeight: FontWeight.w500,+ ),+ ),+ );+ }++ Widget _buildGradientSection(EnteColorScheme colorScheme) {+ return Container(+ height: 60,+ decoration: BoxDecoration(+ gradient: LinearGradient(+ colors: colorScheme.gradientButtonBgColors,+ ),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Center(+ child: Text(+ 'Gradient Colors β ',+ style: TextStyle(+ color: colorScheme.backgroundBase,+ fontWeight: FontWeight.bold,+ fontSize: 16,+ ),+ ),+ ),+ );+ }++ Widget _buildMigrationInfo(EnteColorScheme colorScheme) {+ return Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: colorScheme.primary500.withOpacity(0.1),+ border: Border.all(color: colorScheme.primary500),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ 'Migration Complete! π',+ style: TextStyle(+ color: colorScheme.primary700,+ fontWeight: FontWeight.bold,+ fontSize: 18,+ ),+ ),+ const SizedBox(height: 8),+ Text(+ 'β’ All components migrated to new color system\n'+ 'β’ Theme-aware colors with fallback support\n'+ 'β’ Custom branding support ready\n'+ 'β’ Performance optimized with const colors\n'+ 'β’ Type-safe with compile-time validation',+ style: TextStyle(+ color: colorScheme.textBase,+ height: 1.5,+ ),+ ),+ ],+ ),+ );+ }+}++/// Example of creating custom app themes+class CustomAppThemeExample {+ // Purple brand theme+ static final purpleScheme = ColorSchemeBuilder.fromPrimaryColor(+ const Color(0xFF6C5CE7),+ );++ // Blue brand theme+ static final blueScheme = ColorSchemeBuilder.fromPrimaryColor(+ const Color(0xFF2196F3),+ );++ // Green brand theme+ static final greenScheme = ColorSchemeBuilder.fromPrimaryColor(+ const Color(0xFF4CAF50),+ );++ // Create theme data for each brand+ static ThemeData purpleLightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: purpleScheme.light,+ );++ static ThemeData purpleDarkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: purpleScheme.dark,+ );++ static ThemeData blueLightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: blueScheme.light,+ );++ static ThemeData blueDarkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: blueScheme.dark,+ );+}++/// Example app showing how to use the new color system+class ColorSystemExampleApp extends StatelessWidget {+ const ColorSystemExampleApp({super.key});++ @override+ Widget build(BuildContext context) {+ return MaterialApp(+ title: 'Color System Demo',+ theme: CustomAppThemeExample.blueLightTheme,+ darkTheme: CustomAppThemeExample.blueDarkTheme,+ home: const ColorMigrationDemo(),+ );+ }+}diff --git a/mobile/packages/ui/lib/theme/color_system_test.dart b/mobile/packages/ui/lib/theme/color_system_test.dartnew file mode 100644index 0000000000..00f8018a51--- /dev/null+++ b/mobile/packages/ui/lib/theme/color_system_test.dart@@ -0,0 +1,161 @@+// Test to validate the color system migration+// This file is for verification purposes only++import 'package:flutter/material.dart';+import '../theme/colors.dart';+import '../theme/ente_theme.dart';+import '../theme/ente_theme_data.dart';++/// Test widget to verify the new color system works correctly+class ColorSystemTestWidget extends StatelessWidget {+ const ColorSystemTestWidget({super.key});++ @override+ Widget build(BuildContext context) {+ // Test that we can access the color scheme from theme+ final colorScheme = Theme.of(context).extension<EnteColorScheme>();++ // Test that fallback to old system works+ final fallbackColorScheme = colorScheme ?? getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: fallbackColorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: fallbackColorScheme.backgroundElevated,+ title: Text(+ 'Color System Test',+ style: TextStyle(color: fallbackColorScheme.textBase),+ ),+ ),+ body: Padding(+ padding: const EdgeInsets.all(16.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ // Test basic colors+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: fallbackColorScheme.backgroundElevated,+ border: Border.all(color: fallbackColorScheme.strokeFaint),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Text(+ 'Background Colors Working',+ style: TextStyle(color: fallbackColorScheme.textBase),+ ),+ ),+ const SizedBox(height: 16),++ // Test primary colors+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: fallbackColorScheme.primary500,+ borderRadius: BorderRadius.circular(8),+ ),+ child: Text(+ 'Primary Colors Working',+ style: TextStyle(color: fallbackColorScheme.backgroundBase),+ ),+ ),+ const SizedBox(height: 16),++ // Test gradient colors+ Container(+ height: 50,+ decoration: BoxDecoration(+ gradient: LinearGradient(+ colors: fallbackColorScheme.gradientButtonBgColors,+ ),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Center(+ child: Text(+ 'Gradient Colors Working',+ style: TextStyle(+ color: fallbackColorScheme.backgroundBase,+ fontWeight: FontWeight.bold,+ ),+ ),+ ),+ ),+ const SizedBox(height: 16),++ // Test warning colors+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: fallbackColorScheme.warning500.withOpacity(0.1),+ border: Border.all(color: fallbackColorScheme.warning500),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Text(+ 'Warning Colors Working',+ style: TextStyle(color: fallbackColorScheme.warning700),+ ),+ ),+ const SizedBox(height: 16),++ // Test fill colors+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: fallbackColorScheme.fillFaint,+ borderRadius: BorderRadius.circular(8),+ ),+ child: Text(+ 'Fill Colors Working',+ style: TextStyle(color: fallbackColorScheme.textMuted),+ ),+ ),+ ],+ ),+ ),+ );+ }+}++/// Example showing how apps can create custom themes+class CustomThemeExample {+ // Create a custom purple theme+ static final purpleSchemes = ColorSchemeBuilder.fromPrimaryColor(+ const Color(0xFF6C5CE7), // Purple brand color+ );++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: purpleSchemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: purpleSchemes.dark,+ );+}++/// Example showing migration from old to new system+class MigrationExample extends StatelessWidget {+ const MigrationExample({super.key});++ @override+ Widget build(BuildContext context) {+ // OLD WAY (still works for backward compatibility)+ // final colorScheme = getEnteColorScheme(context);++ // NEW WAY (preferred)+ // final colorScheme = Theme.of(context).extension<EnteColorScheme>()!;++ // SAFE WAY (with fallback)+ final safeColorScheme = Theme.of(context).extension<EnteColorScheme>() ??+ getEnteColorScheme(context);++ return Container(+ color: safeColorScheme.backgroundBase,+ child: Text(+ 'Migration Example',+ style: TextStyle(color: safeColorScheme.textBase),+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/theme/colors.dart b/mobile/packages/ui/lib/theme/colors.dartnew file mode 100644index 0000000000..aa0f6274c5--- /dev/null+++ b/mobile/packages/ui/lib/theme/colors.dart@@ -0,0 +1,832 @@+import 'package:flutter/material.dart';++/// A comprehensive color scheme for consistent theming across apps.+///+/// This color scheme provides all the colors needed for a modern Flutter app,+/// including background, text, fill, stroke, and accent colors for both light+/// and dark themes.+///+/// Apps can easily customize the primary colors using the factory constructors:+///+/// ```dart+/// // Create a light theme with custom primary colors+/// final customLightScheme = EnteColorScheme.light(+/// primary700: Color(0xFF1976D2),+/// primary500: Color(0xFF2196F3),+/// primary400: Color(0xFF42A5F5),+/// primary300: Color(0xFF64B5F6),+/// );+///+/// // Create a dark theme with custom primary colors+/// final customDarkScheme = EnteColorScheme.dark(+/// primary700: Color(0xFF1976D2),+/// primary500: Color(0xFF2196F3),+/// primary400: Color(0xFF42A5F5),+/// primary300: Color(0xFF64B5F6),+/// );+/// ```+class EnteColorScheme extends ThemeExtension<EnteColorScheme> {+ // Background Colors+ final Color backgroundBase;+ final Color backgroundElevated;+ final Color backgroundElevated2;++ // Backdrop Colors+ final Color backdropBase;+ final Color backdropBaseMute;+ final Color backdropFaint;++ // Text Colors+ final Color textBase;+ final Color textMuted;+ final Color textFaint;++ // Fill Colors+ final Color fillBase;+ final Color fillBasePressed;+ final Color fillMuted;+ final Color fillFaint;+ final Color fillFaintPressed;++ // Stroke Colors+ final Color strokeBase;+ final Color strokeMuted;+ final Color strokeFaint;+ final Color strokeFainter;+ final Color blurStrokeBase;+ final Color blurStrokeFaint;+ final Color blurStrokePressed;++ // Fixed Colors+ final Color primary700;+ final Color primary500;+ final Color primary400;+ final Color primary300;++ final Color iconButtonColor;++ final Color warning700;+ final Color warning500;+ final Color warning400;+ final Color warning800;++ final Color caution500;++ // Gradient Button+ final Color gradientButtonBgColor;+ final List<Color> gradientButtonBgColors;++ // Additional colors from ente_theme_data+ final Color fabForegroundColor;+ final Color fabBackgroundColor;+ final Color boxSelectColor;+ final Color boxUnSelectColor;+ final Color alternativeColor;+ final Color dynamicFABBackgroundColor;+ final Color dynamicFABTextColor;+ final Color recoveryKeyBoxColor;+ final Color frostyBlurBackdropFilterColor;+ final Color iconColor;+ final Color bgColorForQuestions;+ final Color greenText;+ final Color cupertinoPickerTopColor;+ final Color stepProgressUnselectedColor;+ final Color gNavBackgroundColor;+ final Color gNavBarActiveColor;+ final Color gNavIconColor;+ final Color gNavActiveIconColor;+ final Color galleryThumbBackgroundColor;+ final Color galleryThumbDrawColor;+ final Color backupEnabledBgColor;+ final Color dotsIndicatorActiveColor;+ final Color dotsIndicatorInactiveColor;+ final Color toastTextColor;+ final Color toastBackgroundColor;+ final Color subTextColor;+ final Color themeSwitchInactiveIconColor;+ final Color searchResultsColor;+ final Color mutedTextColor;+ final Color searchResultsBackgroundColor;+ final Color codeCardBackgroundColor;+ final Color primaryColor;+ final Color surface;++ bool get isLightTheme => backgroundBase == backgroundBaseLight;++ const EnteColorScheme(+ this.backgroundBase,+ this.backgroundElevated,+ this.backgroundElevated2,+ this.backdropBase,+ this.backdropBaseMute,+ this.backdropFaint,+ this.textBase,+ this.textMuted,+ this.textFaint,+ this.fillBase,+ this.fillBasePressed,+ this.fillMuted,+ this.fillFaint,+ this.fillFaintPressed,+ this.strokeBase,+ this.strokeMuted,+ this.strokeFaint,+ this.strokeFainter,+ this.blurStrokeBase,+ this.blurStrokeFaint,+ this.blurStrokePressed,+ this.iconButtonColor,+ this.gradientButtonBgColor,+ this.gradientButtonBgColors,+ this.primary700,+ this.primary500,+ this.primary400,+ this.primary300, {+ this.warning700 = _warning700,+ this.warning800 = _warning800,+ this.warning500 = _warning500,+ this.warning400 = _warning700,+ this.caution500 = _caution500,+ this.fabForegroundColor = _defaultFabForegroundColor,+ this.fabBackgroundColor = _defaultFabBackgroundColor,+ this.boxSelectColor = _defaultBoxSelectColor,+ this.boxUnSelectColor = _defaultBoxUnSelectColor,+ this.alternativeColor = _defaultAlternativeColor,+ this.dynamicFABBackgroundColor = _defaultDynamicFABBackgroundColor,+ this.dynamicFABTextColor = _defaultDynamicFABTextColor,+ this.recoveryKeyBoxColor = _defaultRecoveryKeyBoxColor,+ this.frostyBlurBackdropFilterColor = _defaultFrostyBlurBackdropFilterColor,+ this.iconColor = _defaultIconColor,+ this.bgColorForQuestions = _defaultBgColorForQuestions,+ this.greenText = _defaultGreenText,+ this.cupertinoPickerTopColor = _defaultCupertinoPickerTopColor,+ this.stepProgressUnselectedColor = _defaultStepProgressUnselectedColor,+ this.gNavBackgroundColor = _defaultGNavBackgroundColor,+ this.gNavBarActiveColor = _defaultGNavBarActiveColor,+ this.gNavIconColor = _defaultGNavIconColor,+ this.gNavActiveIconColor = _defaultGNavActiveIconColor,+ this.galleryThumbBackgroundColor = _defaultGalleryThumbBackgroundColor,+ this.galleryThumbDrawColor = _defaultGalleryThumbDrawColor,+ this.backupEnabledBgColor = _defaultBackupEnabledBgColor,+ this.dotsIndicatorActiveColor = _defaultDotsIndicatorActiveColor,+ this.dotsIndicatorInactiveColor = _defaultDotsIndicatorInactiveColor,+ this.toastTextColor = _defaultToastTextColor,+ this.toastBackgroundColor = _defaultToastBackgroundColor,+ this.subTextColor = _defaultSubTextColor,+ this.themeSwitchInactiveIconColor = _defaultThemeSwitchInactiveIconColor,+ this.searchResultsColor = _defaultSearchResultsColor,+ this.mutedTextColor = _defaultMutedTextColor,+ this.searchResultsBackgroundColor = _defaultSearchResultsBackgroundColor,+ this.codeCardBackgroundColor = _defaultCodeCardBackgroundColor,+ this.primaryColor = _defaultPrimaryColor,+ this.surface = _defaultPrimaryColor,+ });++ /// Factory constructor for light theme with customizable primary colors+ factory EnteColorScheme.light({+ Color? primary700,+ Color? primary500,+ Color? primary400,+ Color? primary300,+ Color? iconButtonColor,+ Color? gradientButtonBgColor,+ List<Color>? gradientButtonBgColors,+ Color? warning700,+ Color? warning500,+ Color? warning400,+ Color? warning800,+ Color? caution500,+ }) {+ return EnteColorScheme(+ backgroundBaseLight,+ backgroundElevatedLight,+ backgroundElevated2Light,+ backdropBaseLight,+ backdropMutedLight,+ backdropFaintLight,+ textBaseLight,+ textMutedLight,+ textFaintLight,+ fillBaseLight,+ fillBasePressedLight,+ fillMutedLight,+ fillFaintLight,+ fillFaintPressedLight,+ strokeBaseLight,+ strokeMutedLight,+ strokeFaintLight,+ strokeFainterLight,+ blurStrokeBaseLight,+ blurStrokeFaintLight,+ blurStrokePressedLight,+ iconButtonColor ?? _defaultIconButtonColor,+ gradientButtonBgColor ?? _defaultGradientButtonBgColor,+ gradientButtonBgColors ?? _defaultGradientButtonBgColors,+ primary700 ?? _defaultPrimary700,+ primary500 ?? _defaultPrimary500,+ primary400 ?? _defaultPrimary400,+ primary300 ?? _defaultPrimary300,+ alternativeColor: primary400 ?? _defaultAlternativeColor,+ warning700: warning700 ?? _warning700,+ warning800: warning800 ?? _warning800,+ warning500: warning500 ?? _warning500,+ warning400: warning400 ?? _warning700,+ caution500: caution500 ?? _caution500,+ );+ }++ /// Factory constructor for dark theme with customizable primary colors+ factory EnteColorScheme.dark({+ Color? primary700,+ Color? primary500,+ Color? primary400,+ Color? primary300,+ Color? iconButtonColor,+ Color? gradientButtonBgColor,+ List<Color>? gradientButtonBgColors,+ Color? warning700,+ Color? warning500,+ Color? warning400,+ Color? warning800,+ Color? caution500,+ }) {+ return EnteColorScheme(+ backgroundBaseDark,+ backgroundElevatedDark,+ backgroundElevated2Dark,+ backdropBaseDark,+ backdropMutedDark,+ backdropFaintDark,+ textBaseDark,+ textMutedDark,+ textFaintDark,+ fillBaseDark,+ fillBasePressedDark,+ fillMutedDark,+ fillFaintDark,+ fillFaintPressedDark,+ strokeBaseDark,+ strokeMutedDark,+ strokeFaintDark,+ strokeFainterDark,+ blurStrokeBaseDark,+ blurStrokeFaintDark,+ blurStrokePressedDark,+ iconButtonColor ?? _defaultIconButtonColor,+ gradientButtonBgColor ?? _defaultGradientButtonBgColor,+ gradientButtonBgColors ?? _defaultGradientButtonBgColors,+ primary700 ?? _defaultPrimary700,+ primary500 ?? _defaultPrimary500,+ primary400 ?? _defaultPrimary400,+ primary300 ?? _defaultPrimary300,+ alternativeColor: primary400 ?? _defaultAlternativeColor,+ warning700: warning700 ?? _warning700,+ warning800: warning800 ?? _warning800,+ warning500: warning500 ?? _warning500,+ warning400: warning400 ?? _warning700,+ caution500: caution500 ?? _caution500,+ );+ }++ get inverseEnteTheme => null;++ @override+ EnteColorScheme copyWith({+ Color? backgroundBase,+ Color? backgroundElevated,+ Color? backgroundElevated2,+ Color? backdropBase,+ Color? backdropBaseMute,+ Color? backdropFaint,+ Color? textBase,+ Color? textMuted,+ Color? textFaint,+ Color? fillBase,+ Color? fillBasePressed,+ Color? fillMuted,+ Color? fillFaint,+ Color? fillFaintPressed,+ Color? strokeBase,+ Color? strokeMuted,+ Color? strokeFaint,+ Color? strokeFainter,+ Color? blurStrokeBase,+ Color? blurStrokeFaint,+ Color? blurStrokePressed,+ Color? primary700,+ Color? primary500,+ Color? primary400,+ Color? primary300,+ Color? iconButtonColor,+ Color? warning700,+ Color? warning500,+ Color? warning400,+ Color? warning800,+ Color? caution500,+ Color? gradientButtonBgColor,+ List<Color>? gradientButtonBgColors,+ Color? fabForegroundColor,+ Color? fabBackgroundColor,+ Color? boxSelectColor,+ Color? boxUnSelectColor,+ Color? alternativeColor,+ Color? dynamicFABBackgroundColor,+ Color? dynamicFABTextColor,+ Color? recoveryKeyBoxColor,+ Color? frostyBlurBackdropFilterColor,+ Color? iconColor,+ Color? bgColorForQuestions,+ Color? greenText,+ Color? cupertinoPickerTopColor,+ Color? stepProgressUnselectedColor,+ Color? gNavBackgroundColor,+ Color? gNavBarActiveColor,+ Color? gNavIconColor,+ Color? gNavActiveIconColor,+ Color? galleryThumbBackgroundColor,+ Color? galleryThumbDrawColor,+ Color? backupEnabledBgColor,+ Color? dotsIndicatorActiveColor,+ Color? dotsIndicatorInactiveColor,+ Color? toastTextColor,+ Color? toastBackgroundColor,+ Color? subTextColor,+ Color? themeSwitchInactiveIconColor,+ Color? searchResultsColor,+ Color? mutedTextColor,+ Color? searchResultsBackgroundColor,+ Color? codeCardBackgroundColor,+ Color? primaryColor,+ }) {+ return EnteColorScheme(+ backgroundBase ?? this.backgroundBase,+ backgroundElevated ?? this.backgroundElevated,+ backgroundElevated2 ?? this.backgroundElevated2,+ backdropBase ?? this.backdropBase,+ backdropBaseMute ?? this.backdropBaseMute,+ backdropFaint ?? this.backdropFaint,+ textBase ?? this.textBase,+ textMuted ?? this.textMuted,+ textFaint ?? this.textFaint,+ fillBase ?? this.fillBase,+ fillBasePressed ?? this.fillBasePressed,+ fillMuted ?? this.fillMuted,+ fillFaint ?? this.fillFaint,+ fillFaintPressed ?? this.fillFaintPressed,+ strokeBase ?? this.strokeBase,+ strokeMuted ?? this.strokeMuted,+ strokeFaint ?? this.strokeFaint,+ strokeFainter ?? this.strokeFainter,+ blurStrokeBase ?? this.blurStrokeBase,+ blurStrokeFaint ?? this.blurStrokeFaint,+ blurStrokePressed ?? this.blurStrokePressed,+ iconButtonColor ?? this.iconButtonColor,+ gradientButtonBgColor ?? this.gradientButtonBgColor,+ gradientButtonBgColors ?? this.gradientButtonBgColors,+ primary700 ?? this.primary700,+ primary500 ?? this.primary500,+ primary400 ?? this.primary400,+ primary300 ?? this.primary300,+ warning700: warning700 ?? this.warning700,+ warning800: warning800 ?? this.warning800,+ warning500: warning500 ?? this.warning500,+ warning400: warning400 ?? this.warning400,+ caution500: caution500 ?? this.caution500,+ fabForegroundColor: fabForegroundColor ?? this.fabForegroundColor,+ fabBackgroundColor: fabBackgroundColor ?? this.fabBackgroundColor,+ boxSelectColor: boxSelectColor ?? this.boxSelectColor,+ boxUnSelectColor: boxUnSelectColor ?? this.boxUnSelectColor,+ alternativeColor: alternativeColor ?? this.alternativeColor,+ dynamicFABBackgroundColor:+ dynamicFABBackgroundColor ?? this.dynamicFABBackgroundColor,+ dynamicFABTextColor: dynamicFABTextColor ?? this.dynamicFABTextColor,+ recoveryKeyBoxColor: recoveryKeyBoxColor ?? this.recoveryKeyBoxColor,+ frostyBlurBackdropFilterColor:+ frostyBlurBackdropFilterColor ?? this.frostyBlurBackdropFilterColor,+ iconColor: iconColor ?? this.iconColor,+ bgColorForQuestions: bgColorForQuestions ?? this.bgColorForQuestions,+ greenText: greenText ?? this.greenText,+ cupertinoPickerTopColor:+ cupertinoPickerTopColor ?? this.cupertinoPickerTopColor,+ stepProgressUnselectedColor:+ stepProgressUnselectedColor ?? this.stepProgressUnselectedColor,+ gNavBackgroundColor: gNavBackgroundColor ?? this.gNavBackgroundColor,+ gNavBarActiveColor: gNavBarActiveColor ?? this.gNavBarActiveColor,+ gNavIconColor: gNavIconColor ?? this.gNavIconColor,+ gNavActiveIconColor: gNavActiveIconColor ?? this.gNavActiveIconColor,+ galleryThumbBackgroundColor:+ galleryThumbBackgroundColor ?? this.galleryThumbBackgroundColor,+ galleryThumbDrawColor:+ galleryThumbDrawColor ?? this.galleryThumbDrawColor,+ backupEnabledBgColor: backupEnabledBgColor ?? this.backupEnabledBgColor,+ dotsIndicatorActiveColor:+ dotsIndicatorActiveColor ?? this.dotsIndicatorActiveColor,+ dotsIndicatorInactiveColor:+ dotsIndicatorInactiveColor ?? this.dotsIndicatorInactiveColor,+ toastTextColor: toastTextColor ?? this.toastTextColor,+ toastBackgroundColor: toastBackgroundColor ?? this.toastBackgroundColor,+ subTextColor: subTextColor ?? this.subTextColor,+ themeSwitchInactiveIconColor:+ themeSwitchInactiveIconColor ?? this.themeSwitchInactiveIconColor,+ searchResultsColor: searchResultsColor ?? this.searchResultsColor,+ mutedTextColor: mutedTextColor ?? this.mutedTextColor,+ searchResultsBackgroundColor:+ searchResultsBackgroundColor ?? this.searchResultsBackgroundColor,+ codeCardBackgroundColor:+ codeCardBackgroundColor ?? this.codeCardBackgroundColor,+ primaryColor: primaryColor ?? this.primaryColor,+ );+ }++ @override+ EnteColorScheme lerp(ThemeExtension<EnteColorScheme>? other, double t) {+ if (other is! EnteColorScheme) {+ return this;+ }++ return EnteColorScheme(+ Color.lerp(backgroundBase, other.backgroundBase, t)!,+ Color.lerp(backgroundElevated, other.backgroundElevated, t)!,+ Color.lerp(backgroundElevated2, other.backgroundElevated2, t)!,+ Color.lerp(backdropBase, other.backdropBase, t)!,+ Color.lerp(backdropBaseMute, other.backdropBaseMute, t)!,+ Color.lerp(backdropFaint, other.backdropFaint, t)!,+ Color.lerp(textBase, other.textBase, t)!,+ Color.lerp(textMuted, other.textMuted, t)!,+ Color.lerp(textFaint, other.textFaint, t)!,+ Color.lerp(fillBase, other.fillBase, t)!,+ Color.lerp(fillBasePressed, other.fillBasePressed, t)!,+ Color.lerp(fillMuted, other.fillMuted, t)!,+ Color.lerp(fillFaint, other.fillFaint, t)!,+ Color.lerp(fillFaintPressed, other.fillFaintPressed, t)!,+ Color.lerp(strokeBase, other.strokeBase, t)!,+ Color.lerp(strokeMuted, other.strokeMuted, t)!,+ Color.lerp(strokeFaint, other.strokeFaint, t)!,+ Color.lerp(strokeFainter, other.strokeFainter, t)!,+ Color.lerp(blurStrokeBase, other.blurStrokeBase, t)!,+ Color.lerp(blurStrokeFaint, other.blurStrokeFaint, t)!,+ Color.lerp(blurStrokePressed, other.blurStrokePressed, t)!,+ Color.lerp(iconButtonColor, other.iconButtonColor, t)!,+ Color.lerp(gradientButtonBgColor, other.gradientButtonBgColor, t)!,+ _lerpColorList(gradientButtonBgColors, other.gradientButtonBgColors, t),+ Color.lerp(primary700, other.primary700, t)!,+ Color.lerp(primary500, other.primary500, t)!,+ Color.lerp(primary400, other.primary400, t)!,+ Color.lerp(primary300, other.primary300, t)!,+ warning700: Color.lerp(warning700, other.warning700, t)!,+ warning800: Color.lerp(warning800, other.warning800, t)!,+ warning500: Color.lerp(warning500, other.warning500, t)!,+ warning400: Color.lerp(warning400, other.warning400, t)!,+ caution500: Color.lerp(caution500, other.caution500, t)!,+ );+ }++ /// Helper method to lerp between two color lists+ List<Color> _lerpColorList(List<Color> a, List<Color> b, double t) {+ if (a.length != b.length) {+ return t < 0.5 ? a : b;+ }+ return List.generate(+ a.length,+ (index) => Color.lerp(a[index], b[index], t)!,+ );+ }+}++const EnteColorScheme lightScheme = EnteColorScheme(+ backgroundBaseLight,+ backgroundElevatedLight,+ backgroundElevated2Light,+ backdropBaseLight,+ backdropMutedLight,+ backdropFaintLight,+ textBaseLight,+ textMutedLight,+ textFaintLight,+ fillBaseLight,+ fillBasePressedLight,+ fillMutedLight,+ fillFaintLight,+ fillFaintPressedLight,+ strokeBaseLight,+ strokeMutedLight,+ strokeFaintLight,+ strokeFainterLight,+ blurStrokeBaseLight,+ blurStrokeFaintLight,+ blurStrokePressedLight,+ _defaultIconButtonColor,+ _defaultGradientButtonBgColor,+ _defaultGradientButtonBgColors,+ _defaultPrimary700,+ _defaultPrimary500,+ _defaultPrimary400,+ _defaultPrimary300,+);++const EnteColorScheme darkScheme = EnteColorScheme(+ backgroundBaseDark,+ backgroundElevatedDark,+ backgroundElevated2Dark,+ backdropBaseDark,+ backdropMutedDark,+ backdropFaintDark,+ textBaseDark,+ textMutedDark,+ textFaintDark,+ fillBaseDark,+ fillBasePressedDark,+ fillMutedDark,+ fillFaintDark,+ fillFaintPressedDark,+ strokeBaseDark,+ strokeMutedDark,+ strokeFaintDark,+ strokeFainterDark,+ blurStrokeBaseDark,+ blurStrokeFaintDark,+ blurStrokePressedDark,+ _defaultIconButtonColor,+ _defaultGradientButtonBgColor,+ _defaultGradientButtonBgColors,+ _defaultPrimary700,+ _defaultPrimary500,+ _defaultPrimary400,+ _defaultPrimary300,+);++// Background Colors+const Color backgroundBaseLight = Color.fromRGBO(255, 255, 255, 1);+const Color backgroundElevatedLight = Color.fromRGBO(255, 255, 255, 1);+const Color backgroundElevated2Light = Color.fromRGBO(251, 251, 251, 1);++const Color backgroundBaseDark = Color.fromRGBO(0, 0, 0, 1);+const Color backgroundElevatedDark = Color.fromRGBO(27, 27, 27, 1);+const Color backgroundElevated2Dark = Color.fromRGBO(37, 37, 37, 1);++// Backdrop Colors+const Color backdropBaseLight = Color.fromRGBO(255, 255, 255, 0.92);+const Color backdropMutedLight = Color.fromRGBO(255, 255, 255, 0.75);+const Color backdropFaintLight = Color.fromRGBO(255, 255, 255, 0.30);++const Color backdropBaseDark = Color.fromRGBO(0, 0, 0, 0.90);+const Color backdropMutedDark = Color.fromRGBO(0, 0, 0, 0.65);+const Color backdropFaintDark = Color.fromRGBO(0, 0, 0, 0.20);++// Text Colors+const Color textBaseLight = Color.fromRGBO(0, 0, 0, 1);+const Color textMutedLight = Color.fromRGBO(0, 0, 0, 0.6);+const Color textFaintLight = Color.fromRGBO(0, 0, 0, 0.5);++const Color textBaseDark = Color.fromRGBO(255, 255, 255, 1);+const Color textMutedDark = Color.fromRGBO(255, 255, 255, 0.7);+const Color textFaintDark = Color.fromRGBO(255, 255, 255, 0.5);++// Fill Colors+const Color fillBaseLight = Color.fromRGBO(0, 0, 0, 1);+const Color fillBasePressedLight = Color.fromRGBO(0, 0, 0, 0.87);+const Color fillMutedLight = Color.fromRGBO(0, 0, 0, 0.12);+const Color fillFaintLight = Color.fromRGBO(0, 0, 0, 0.04);+const Color fillFaintPressedLight = Color.fromRGBO(0, 0, 0, 0.08);++const Color fillBaseDark = Color.fromRGBO(255, 255, 255, 1);+const Color fillBasePressedDark = Color.fromRGBO(255, 255, 255, 0.9);+const Color fillMutedDark = Color.fromRGBO(255, 255, 255, 0.16);+const Color fillFaintDark = Color.fromRGBO(255, 255, 255, 0.12);+const Color fillFaintPressedDark = Color.fromRGBO(255, 255, 255, 0.06);++// Stroke Colors+const Color strokeBaseLight = Color.fromRGBO(0, 0, 0, 1);+const Color strokeMutedLight = Color.fromRGBO(0, 0, 0, 0.24);+const Color strokeFaintLight = Color.fromRGBO(0, 0, 0, 0.04);+const Color strokeFainterLight = Color.fromRGBO(0, 0, 0, 0.06);+const Color blurStrokeBaseLight = Color.fromRGBO(0, 0, 0, 0.65);+const Color blurStrokeFaintLight = Color.fromRGBO(0, 0, 0, 0.08);+const Color blurStrokePressedLight = Color.fromRGBO(0, 0, 0, 0.50);++const Color strokeBaseDark = Color.fromRGBO(255, 255, 255, 1);+const Color strokeMutedDark = Color.fromRGBO(255, 255, 255, 0.24);+const Color strokeFaintDark = Color.fromRGBO(255, 255, 255, 0.16);+const Color strokeFainterDark = Color.fromRGBO(255, 255, 255, 0.08);+const Color blurStrokeBaseDark = Color.fromRGBO(255, 255, 255, 0.90);+const Color blurStrokeFaintDark = Color.fromRGBO(255, 255, 255, 0.06);+const Color blurStrokePressedDark = Color.fromRGBO(255, 255, 255, 0.50);++// Default Primary Colors+const Color _defaultPrimary700 = Color.fromRGBO(0, 122, 255, 1);+const Color _defaultPrimary500 = Color.fromRGBO(52, 152, 255, 1);+const Color _defaultPrimary400 = Color.fromRGBO(102, 178, 255, 1);+const Color _defaultPrimary300 = Color.fromRGBO(153, 204, 255, 1);++// Default Gradient Colors+const Color _defaultGradientButtonBgColor = Color.fromRGBO(0, 122, 255, 1);+const List<Color> _defaultGradientButtonBgColors = [+ Color.fromRGBO(0, 122, 255, 1),+ Color.fromRGBO(52, 152, 255, 1),+];++// Default Icon Button Color+const Color _defaultIconButtonColor = Color.fromRGBO(0, 122, 255, 1);++// Warning Colors+const Color _warning700 = Color.fromRGBO(245, 52, 52, 1);+const Color _warning500 = Color.fromRGBO(255, 101, 101, 1);+const Color _warning800 = Color(0xFFF53434);+const Color warning500 = Color.fromRGBO(255, 101, 101, 1);+// ignore: unused_element+const Color _warning400 = Color.fromRGBO(255, 111, 111, 1);++// Caution Colors+const Color _caution500 = Color.fromRGBO(255, 194, 71, 1);++// Additional default colors from ente_theme_data+const Color _defaultPrimaryColor = Color(0xFF9610D6);++// FAB Colors - based on brightness-dependent logic from ente_theme_data+const Color _defaultFabForegroundColor = Color.fromRGBO(255, 255, 255, 1);+const Color _defaultFabBackgroundColor = Color.fromRGBO(40, 40, 40, 1);++// Box selection colors+const Color _defaultBoxSelectColor = Color.fromRGBO(67, 186, 108, 1);+const Color _defaultBoxUnSelectColor = Color.fromRGBO(240, 240, 240, 1);++// Alternative color+const Color _defaultAlternativeColor = Color.fromARGB(255, 152, 77, 244);++// Dynamic FAB colors+const Color _defaultDynamicFABBackgroundColor = Color.fromRGBO(0, 0, 0, 1);+const Color _defaultDynamicFABTextColor = Color.fromRGBO(255, 255, 255, 1);++// Recovery key box color+const Color _defaultRecoveryKeyBoxColor = Color.fromARGB(51, 150, 0, 220);++// Frosty blur backdrop filter color+const Color _defaultFrostyBlurBackdropFilterColor =+ Color.fromRGBO(238, 238, 238, 0.5);++// Default Icon Color+const Color _defaultIconColor = Color.fromRGBO(0, 0, 0, 0.75);++// Default Background Color For Questions+const Color _defaultBgColorForQuestions = Color.fromRGBO(255, 255, 255, 1);++// Default Green Text Color+const Color _defaultGreenText = Color.fromARGB(255, 40, 190, 113);++// Default Cupertino Picker Top Color+const Color _defaultCupertinoPickerTopColor =+ Color.fromARGB(255, 238, 238, 238);++// Default Step Progress Unselected Color+const Color _defaultStepProgressUnselectedColor =+ Color.fromRGBO(196, 196, 196, 0.6);++// Default Navigation Colors+const Color _defaultGNavBackgroundColor = Color.fromRGBO(196, 196, 196, 0.6);+const Color _defaultGNavBarActiveColor = Color.fromRGBO(255, 255, 255, 0.6);+const Color _defaultGNavIconColor = Color.fromRGBO(0, 0, 0, 0.8);+const Color _defaultGNavActiveIconColor = Color.fromRGBO(0, 0, 0, 0.8);++// Default Gallery Thumb Colors+const Color _defaultGalleryThumbBackgroundColor =+ Color.fromRGBO(240, 240, 240, 1);+const Color _defaultGalleryThumbDrawColor = Color.fromRGBO(0, 0, 0, 0.8);++// Default Backup Enabled Background Color+const Color _defaultBackupEnabledBgColor = Color.fromRGBO(230, 230, 230, 0.95);++// Default Dots Indicator Colors+const Color _defaultDotsIndicatorActiveColor = Color.fromRGBO(0, 0, 0, 0.5);+const Color _defaultDotsIndicatorInactiveColor = Color.fromRGBO(0, 0, 0, 0.12);++// Default Toast Colors+const Color _defaultToastTextColor = Color.fromRGBO(255, 255, 255, 1);+const Color _defaultToastBackgroundColor = Color.fromRGBO(24, 24, 24, 0.95);++// Default Sub Text Color+const Color _defaultSubTextColor = Color.fromRGBO(180, 180, 180, 1);++// Default Theme Switch Inactive Icon Color+const Color _defaultThemeSwitchInactiveIconColor = Color.fromRGBO(0, 0, 0, 0.5);++// Default Search Results Colors+const Color _defaultSearchResultsColor = Color.fromRGBO(245, 245, 245, 1.0);+const Color _defaultMutedTextColor = Color.fromRGBO(80, 80, 80, 1);+const Color _defaultSearchResultsBackgroundColor =+ Color.fromRGBO(0, 0, 0, 0.32);++// Default Code Card Background Color+const Color _defaultCodeCardBackgroundColor = Color.fromRGBO(246, 246, 246, 1);++/// Utility class to help apps create custom color schemes with their brand colors.+///+/// This class provides convenient methods to generate complete color schemes+/// from a base primary color, automatically calculating the different shades+/// and variations needed for the app.+class ColorSchemeBuilder {+ /// Creates light and dark color schemes from a single primary color.+ ///+ /// The primary color is used as the base (primary500), and other shades+ /// are automatically calculated:+ /// - primary700: Darker shade for emphasis+ /// - primary400: Lighter shade for secondary elements+ /// - primary300: Lightest shade for subtle accents+ ///+ /// Example:+ /// ```dart+ /// final schemes = ColorSchemeBuilder.fromPrimaryColor(+ /// Color(0xFF2196F3), // Material Blue+ /// );+ /// final lightScheme = schemes.light;+ /// final darkScheme = schemes.dark;+ /// ```+ static ({EnteColorScheme light, EnteColorScheme dark}) fromPrimaryColor(+ Color primaryColor,+ ) {+ // Calculate different shades of the primary color+ final HSLColor hsl = HSLColor.fromColor(primaryColor);++ final primary700 =+ hsl.withLightness((hsl.lightness - 0.1).clamp(0.0, 1.0)).toColor();+ final primary500 = primaryColor;+ final primary400 =+ hsl.withLightness((hsl.lightness + 0.1).clamp(0.0, 1.0)).toColor();+ final primary300 =+ hsl.withLightness((hsl.lightness + 0.2).clamp(0.0, 1.0)).toColor();++ // Create gradient colors from the primary color+ final gradientColors = [primary700, primary500];++ final lightScheme = EnteColorScheme.light(+ primary700: primary700,+ primary500: primary500,+ primary400: primary400,+ primary300: primary300,+ iconButtonColor: primary500,+ gradientButtonBgColor: primary500,+ gradientButtonBgColors: gradientColors,+ );++ final darkScheme = EnteColorScheme.dark(+ primary700: primary700,+ primary500: primary500,+ primary400: primary400,+ primary300: primary300,+ iconButtonColor: primary500,+ gradientButtonBgColor: primary500,+ gradientButtonBgColors: gradientColors,+ );++ return (light: lightScheme, dark: darkScheme);+ }++ /// Creates light and dark color schemes with fully custom primary colors.+ ///+ /// Use this method when you need complete control over all primary color shades.+ ///+ /// Example:+ /// ```dart+ /// final schemes = ColorSchemeBuilder.fromCustomColors(+ /// primary700: Color(0xFF1565C0),+ /// primary500: Color(0xFF2196F3),+ /// primary400: Color(0xFF42A5F5),+ /// primary300: Color(0xFF90CAF9),+ /// );+ /// ```+ static ({EnteColorScheme light, EnteColorScheme dark}) fromCustomColors({+ required Color primary700,+ required Color primary500,+ required Color primary400,+ required Color primary300,+ Color? iconButtonColor,+ Color? gradientButtonBgColor,+ List<Color>? gradientButtonBgColors,+ }) {+ final effectiveIconButtonColor = iconButtonColor ?? primary500;+ final effectiveGradientBgColor = gradientButtonBgColor ?? primary500;+ final effectiveGradientColors =+ gradientButtonBgColors ?? [primary700, primary500];++ final lightScheme = EnteColorScheme.light(+ primary700: primary700,+ primary500: primary500,+ primary400: primary400,+ primary300: primary300,+ iconButtonColor: effectiveIconButtonColor,+ gradientButtonBgColor: effectiveGradientBgColor,+ gradientButtonBgColors: effectiveGradientColors,+ );++ final darkScheme = EnteColorScheme.dark(+ primary700: primary700,+ primary500: primary500,+ primary400: primary400,+ primary300: primary300,+ iconButtonColor: effectiveIconButtonColor,+ gradientButtonBgColor: effectiveGradientBgColor,+ gradientButtonBgColors: effectiveGradientColors,+ );++ return (light: lightScheme, dark: darkScheme);+ }+}diff --git a/mobile/packages/ui/lib/theme/effects.dart b/mobile/packages/ui/lib/theme/effects.dartnew file mode 100644index 0000000000..f97ec06723--- /dev/null+++ b/mobile/packages/ui/lib/theme/effects.dart@@ -0,0 +1,59 @@+import 'package:flutter/material.dart';++const blurBase = 96.0;+const blurMuted = 48.0;+const blurFaint = 24.0;++List<BoxShadow> shadowFloatLight = const [+ BoxShadow(blurRadius: 10, color: Color.fromRGBO(0, 0, 0, 0.25)),+];++List<BoxShadow> shadowFloatFaintLight = const [+ BoxShadow(blurRadius: 10, color: Color.fromRGBO(0, 0, 0, 0.12)),+];++List<BoxShadow> shadowFloatFaintestLight = const [+ BoxShadow(blurRadius: 1, color: Color.fromRGBO(0, 0, 0, 0.25)),+];++List<BoxShadow> shadowMenuLight = const [+ BoxShadow(blurRadius: 6, color: Color.fromRGBO(0, 0, 0, 0.16)),+ BoxShadow(+ blurRadius: 6,+ color: Color.fromRGBO(0, 0, 0, 0.12),+ offset: Offset(0, 3),+ ),+];++List<BoxShadow> shadowButtonLight = const [+ BoxShadow(+ blurRadius: 4,+ color: Color.fromRGBO(0, 0, 0, 0.25),+ offset: Offset(0, 4),+ ),+];++List<BoxShadow> shadowFloatDark = const [+ BoxShadow(+ blurRadius: 12,+ color: Color.fromRGBO(0, 0, 0, 0.75),+ offset: Offset(0, 2),+ ),+];++List<BoxShadow> shadowMenuDark = const [+ BoxShadow(blurRadius: 6, color: Color.fromRGBO(0, 0, 0, 0.50)),+ BoxShadow(+ blurRadius: 6,+ color: Color.fromRGBO(0, 0, 0, 0.25),+ offset: Offset(0, 3),+ ),+];++List<BoxShadow> shadowButtonDark = const [+ BoxShadow(+ blurRadius: 4,+ color: Color.fromRGBO(0, 0, 0, 0.75),+ offset: Offset(0, 4),+ ),+];diff --git a/mobile/packages/ui/lib/theme/ente_theme.dart b/mobile/packages/ui/lib/theme/ente_theme.dartnew file mode 100644index 0000000000..25e16e705f--- /dev/null+++ b/mobile/packages/ui/lib/theme/ente_theme.dart@@ -0,0 +1,85 @@+import 'package:flutter/material.dart';+import 'colors.dart';+import 'effects.dart';+import 'text_style.dart';++class EnteTheme {+ final EnteTextTheme textTheme;+ final EnteColorScheme colorScheme;+ final List<BoxShadow> shadowFloat;+ final List<BoxShadow> shadowMenu;+ final List<BoxShadow> shadowButton;++ const EnteTheme(+ this.textTheme,+ this.colorScheme, {+ required this.shadowFloat,+ required this.shadowMenu,+ required this.shadowButton,+ });++ bool isDark(BuildContext context) {+ return Theme.of(context).brightness == Brightness.dark;+ }+}++EnteTheme lightTheme = EnteTheme(+ lightTextTheme,+ lightScheme,+ shadowFloat: shadowFloatLight,+ shadowMenu: shadowMenuLight,+ shadowButton: shadowButtonLight,+);++EnteTheme darkTheme = EnteTheme(+ darkTextTheme,+ darkScheme,+ shadowFloat: shadowFloatDark,+ shadowMenu: shadowMenuDark,+ shadowButton: shadowButtonDark,+);++EnteColorScheme getEnteColorScheme(+ BuildContext context, {+ bool inverse = false,+}) {+ final colorScheme = Theme.of(context).extension<EnteColorScheme>();+ if (colorScheme != null) {+ return colorScheme;+ }++ // Fallback to old system if new system is not available+ return inverse+ ? getEnteColorScheme(context).inverseEnteTheme.colorScheme+ : getEnteColorScheme(context);+}++EnteTextTheme getEnteTextTheme(+ BuildContext context, {+ bool inverse = false,+}) {+ final isDark = Theme.of(context).brightness == Brightness.dark;+ if (inverse) {+ return isDark ? lightTextTheme : darkTextTheme;+ } else {+ return isDark ? darkTextTheme : lightTextTheme;+ }+}++/// Get theme-aware shadow for floating elements (dialogs, modals, etc.)+List<BoxShadow> getEnteShadowFloat(BuildContext context) {+ final isDark = Theme.of(context).brightness == Brightness.dark;+ return isDark ? shadowFloatDark : shadowFloatLight;+}++/// Get theme-aware shadow for menu elements+List<BoxShadow> getEnteShadowMenu(BuildContext context) {+ final isDark = Theme.of(context).brightness == Brightness.dark;+ return isDark ? shadowMenuDark : shadowMenuLight;+}++/// Get theme-aware shadow for button elements+List<BoxShadow> getEnteShadowButton(BuildContext context) {+ final isDark = Theme.of(context).brightness == Brightness.dark;+ return isDark ? shadowButtonDark : shadowButtonLight;+}diff --git a/mobile/packages/ui/lib/theme/ente_theme_data.dart b/mobile/packages/ui/lib/theme/ente_theme_data.dartnew file mode 100644index 0000000000..8e2448feb1--- /dev/null+++ b/mobile/packages/ui/lib/theme/ente_theme_data.dart@@ -0,0 +1,537 @@+import '../theme/colors.dart';+import 'package:flutter/material.dart';+import '../theme/ente_theme.dart';++final lightThemeData = ThemeData(+ fontFamily: 'Inter',+ brightness: Brightness.light,+ dividerTheme: const DividerThemeData(+ color: Colors.black12,+ ),+ hintColor: const Color.fromRGBO(158, 158, 158, 1),+ primaryColor: const Color.fromRGBO(255, 110, 64, 1),+ primaryColorLight: const Color.fromRGBO(0, 0, 0, 0.541),+ iconTheme: const IconThemeData(color: Colors.black),+ primaryIconTheme:+ const IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),+ buttonTheme: const ButtonThemeData(),+ outlinedButtonTheme: buildOutlinedButtonThemeData(+ bgDisabled: const Color.fromRGBO(158, 158, 158, 1),+ bgEnabled: const Color.fromRGBO(0, 0, 0, 1),+ fgDisabled: const Color.fromRGBO(255, 255, 255, 1),+ fgEnabled: const Color.fromRGBO(255, 255, 255, 1),+ ),+ elevatedButtonTheme: buildElevatedButtonThemeData(+ onPrimary: const Color.fromRGBO(255, 255, 255, 1),+ primary: const Color.fromRGBO(0, 0, 0, 1),+ ),+ scaffoldBackgroundColor: const Color.fromRGBO(255, 255, 255, 1),+ appBarTheme: const AppBarTheme().copyWith(+ backgroundColor: Colors.white,+ foregroundColor: Colors.black,+ iconTheme: const IconThemeData(color: Colors.black),+ elevation: 0,+ ),+ //https://api.flutter.dev/flutter/material/TextTheme-class.html+ textTheme: _buildTextTheme(const Color.fromRGBO(0, 0, 0, 1)),+ primaryTextTheme: const TextTheme().copyWith(+ bodyMedium: const TextStyle(color: Colors.yellow),+ bodyLarge: const TextStyle(color: Colors.orange),+ ),+ cardColor: const Color.fromRGBO(250, 250, 250, 1.0),+ dialogTheme: const DialogThemeData().copyWith(+ backgroundColor: const Color.fromRGBO(250, 250, 250, 1.0), //+ titleTextStyle: const TextStyle(+ color: Colors.black,+ fontSize: 24,+ fontWeight: FontWeight.w600,+ ),+ contentTextStyle: const TextStyle(+ fontFamily: 'Inter-Medium',+ color: Colors.black,+ fontSize: 16,+ fontWeight: FontWeight.w500,+ ),+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),+ ),+ checkboxTheme: CheckboxThemeData(+ side: const BorderSide(+ color: Colors.black,+ width: 2,+ ),+ fillColor: WidgetStateProperty.resolveWith((states) {+ return states.contains(WidgetState.selected)+ ? const Color.fromRGBO(0, 0, 0, 1)+ : const Color.fromRGBO(255, 255, 255, 1);+ }),+ checkColor: WidgetStateProperty.resolveWith((states) {+ return states.contains(WidgetState.selected)+ ? const Color.fromRGBO(255, 255, 255, 1)+ : const Color.fromRGBO(0, 0, 0, 1);+ }),+ ),++ radioTheme: RadioThemeData(+ fillColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ ),+ switchTheme: SwitchThemeData(+ thumbColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ trackColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ ),+ colorScheme: const ColorScheme.light(+ primary: Colors.black,+ secondary: Color.fromARGB(255, 163, 163, 163),+ ).copyWith(surface: const Color.fromRGBO(255, 255, 255, 1)),+);++final darkThemeData = ThemeData(+ fontFamily: 'Inter',+ brightness: Brightness.dark,+ dividerTheme: const DividerThemeData(+ color: Colors.white12,+ ),+ primaryColorLight: const Color.fromRGBO(255, 255, 255, 0.702),+ iconTheme: const IconThemeData(color: Colors.white),+ primaryIconTheme:+ const IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),+ hintColor: const Color.fromRGBO(158, 158, 158, 1),+ buttonTheme: const ButtonThemeData().copyWith(+ buttonColor: const Color.fromRGBO(45, 194, 98, 1.0),+ height: 56,+ ),+ textTheme: _buildTextTheme(const Color.fromRGBO(255, 255, 255, 1)),+ outlinedButtonTheme: buildOutlinedButtonThemeData(+ bgDisabled: const Color.fromRGBO(158, 158, 158, 1),+ bgEnabled: const Color.fromRGBO(255, 255, 255, 1),+ fgDisabled: const Color.fromRGBO(255, 255, 255, 1),+ fgEnabled: const Color.fromRGBO(0, 0, 0, 1),+ ),+ elevatedButtonTheme: buildElevatedButtonThemeData(+ onPrimary: const Color.fromRGBO(0, 0, 0, 1),+ primary: const Color.fromRGBO(255, 255, 255, 1),+ ),+ scaffoldBackgroundColor: const Color.fromRGBO(0, 0, 0, 1),+ appBarTheme: const AppBarTheme().copyWith(+ color: Colors.black,+ elevation: 0,+ ),+ cardColor: const Color.fromRGBO(10, 15, 15, 1.0),+ dialogTheme: const DialogThemeData().copyWith(+ backgroundColor: const Color.fromRGBO(15, 15, 15, 1.0),+ titleTextStyle: const TextStyle(+ color: Colors.white,+ fontSize: 24,+ fontWeight: FontWeight.w600,+ ),+ contentTextStyle: const TextStyle(+ fontFamily: 'Inter-Medium',+ color: Colors.white,+ fontSize: 16,+ fontWeight: FontWeight.w500,+ ),+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),+ ),+ checkboxTheme: CheckboxThemeData(+ side: const BorderSide(+ color: Colors.grey,+ width: 2,+ ),+ fillColor: WidgetStateProperty.resolveWith((states) {+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(158, 158, 158, 1);+ } else {+ return const Color.fromRGBO(0, 0, 0, 1);+ }+ }),+ checkColor: WidgetStateProperty.resolveWith((states) {+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(0, 0, 0, 1);+ } else {+ return const Color.fromRGBO(158, 158, 158, 1);+ }+ }),+ ),+ radioTheme: RadioThemeData(+ fillColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ ),+ switchTheme: SwitchThemeData(+ thumbColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ trackColor:+ WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return null;+ }+ if (states.contains(WidgetState.selected)) {+ return const Color.fromRGBO(102, 187, 106, 1);+ }+ return null;+ }),+ ),+ colorScheme: const ColorScheme.dark(primary: Colors.white)+ .copyWith(surface: const Color.fromRGBO(0, 0, 0, 1)),+);++TextTheme _buildTextTheme(Color textColor) {+ return const TextTheme().copyWith(+ headlineMedium: TextStyle(+ color: textColor,+ fontSize: 32,+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter',+ ),+ headlineSmall: TextStyle(+ color: textColor,+ fontSize: 24,+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter',+ ),+ titleLarge: TextStyle(+ color: textColor,+ fontSize: 18,+ fontFamily: 'Inter',+ fontWeight: FontWeight.w600,+ ),+ titleMedium: TextStyle(+ color: textColor,+ fontFamily: 'Inter',+ fontSize: 16,+ fontWeight: FontWeight.w500,+ ),+ titleSmall: TextStyle(+ color: textColor,+ fontFamily: 'Inter',+ fontSize: 14,+ fontWeight: FontWeight.w500,+ ),+ bodyLarge: TextStyle(+ fontFamily: 'Inter',+ color: textColor,+ fontSize: 16,+ fontWeight: FontWeight.w500,+ ),+ bodyMedium: TextStyle(+ fontFamily: 'Inter',+ color: textColor,+ fontSize: 14,+ fontWeight: FontWeight.w500,+ ),+ bodySmall: TextStyle(+ color: textColor.withOpacity(0.4),+ fontSize: 10,+ fontWeight: FontWeight.w500,+ ),+ labelSmall: TextStyle(+ fontFamily: 'Inter',+ color: textColor,+ fontSize: 14,+ fontWeight: FontWeight.w500,+ decoration: TextDecoration.underline,+ ),+ );+}++extension CustomColorScheme on ColorScheme {+ Color get defaultBackgroundColor =>+ brightness == Brightness.light ? backgroundBaseLight : backgroundBaseDark;++ Color get inverseBackgroundColor =>+ brightness != Brightness.light ? backgroundBaseLight : backgroundBaseDark;++ Color get fabForegroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(255, 255, 255, 1)+ : const Color.fromRGBO(40, 40, 40, 1);++ Color get fabBackgroundColor => brightness != Brightness.light+ ? const Color.fromRGBO(255, 255, 255, 1)+ : const Color.fromRGBO(40, 40, 40, 1);++ Color get defaultTextColor =>+ brightness == Brightness.light ? textBaseLight : textBaseDark;++ Color get inverseTextColor =>+ brightness != Brightness.light ? textBaseLight : textBaseDark;++ Color get boxSelectColor => brightness == Brightness.light+ ? const Color.fromRGBO(67, 186, 108, 1)+ : const Color.fromRGBO(16, 32, 32, 1);++ Color get boxUnSelectColor => brightness == Brightness.light+ ? const Color.fromRGBO(240, 240, 240, 1)+ : const Color.fromRGBO(8, 18, 18, 0.4);++ Color get alternativeColor => const Color.fromARGB(255, 152, 77, 244);++ Color get dynamicFABBackgroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1)+ : const Color.fromRGBO(48, 48, 48, 1);++ Color get dynamicFABTextColor =>+ const Color.fromRGBO(255, 255, 255, 1); //same for both themes++ // todo: use brightness == Brightness.light for changing color for dark/light+ // theme+ ButtonStyle? get optionalActionButtonStyle => buildElevatedButtonThemeData(+ onPrimary: const Color(0xFF777777),+ primary: const Color(0xFFF0F0F0),+ elevation: 0,+ ).style;++ Color get recoveryKeyBoxColor => brightness == Brightness.light+ ? const Color.fromARGB(51, 150, 0, 220)+ : const Color.fromARGB(255, 174, 56, 247);++ Color get frostyBlurBackdropFilterColor => brightness == Brightness.light+ ? const Color.fromRGBO(238, 238, 238, 0.5)+ : const Color.fromRGBO(48, 48, 48, 0.5);++ Color get iconColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.75)+ : const Color.fromRGBO(255, 255, 255, 1);++ Color get bgColorForQuestions => brightness == Brightness.light+ ? const Color.fromRGBO(255, 255, 255, 1)+ : const Color.fromRGBO(10, 15, 15, 1.0);++ Color get greenText => const Color.fromARGB(255, 40, 190, 113);++ Color get cupertinoPickerTopColor => brightness == Brightness.light+ ? const Color.fromARGB(255, 238, 238, 238)+ : const Color.fromRGBO(255, 255, 255, 1).withOpacity(0.1);++ Color get stepProgressUnselectedColor => brightness == Brightness.light+ ? const Color.fromRGBO(196, 196, 196, 0.6)+ : const Color.fromRGBO(255, 255, 255, 0.7);++ Color get gNavBackgroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(196, 196, 196, 0.6)+ : const Color.fromRGBO(40, 40, 40, 0.6);++ Color get gNavBarActiveColor => brightness == Brightness.light+ ? const Color.fromRGBO(255, 255, 255, 0.6)+ : const Color.fromRGBO(255, 255, 255, 0.9);++ Color get gNavIconColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 0.8)+ : const Color.fromRGBO(255, 255, 255, 0.8);++ Color get gNavActiveIconColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 0.8)+ : const Color.fromRGBO(0, 0, 0, 0.8);++ Color get galleryThumbBackgroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(240, 240, 240, 1)+ : const Color.fromRGBO(20, 20, 20, 1);++ Color get galleryThumbDrawColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.8)+ : const Color.fromRGBO(255, 255, 255, 1).withOpacity(0.5);++ Color get backupEnabledBgColor => brightness == Brightness.light+ ? const Color.fromRGBO(230, 230, 230, 0.95)+ : const Color.fromRGBO(10, 40, 40, 0.3);++ Color get dotsIndicatorActiveColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.5)+ : const Color.fromRGBO(255, 255, 255, 1).withOpacity(0.5);++ Color get dotsIndicatorInactiveColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.12)+ : const Color.fromRGBO(255, 255, 255, 1).withOpacity(0.12);++ Color get toastTextColor => brightness == Brightness.light+ ? const Color.fromRGBO(255, 255, 255, 1)+ : const Color.fromRGBO(0, 0, 0, 1);++ Color get toastBackgroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(24, 24, 24, 0.95)+ : const Color.fromRGBO(255, 255, 255, 0.95);++ Color get subTextColor => brightness == Brightness.light+ ? const Color.fromRGBO(180, 180, 180, 1)+ : const Color.fromRGBO(100, 100, 100, 1);++ Color get themeSwitchInactiveIconColor => brightness == Brightness.light+ ? const Color.fromRGBO(0, 0, 0, 1).withOpacity(0.5)+ : const Color.fromRGBO(255, 255, 255, 1).withOpacity(0.5);++ Color get searchResultsColor => brightness == Brightness.light+ ? const Color.fromRGBO(245, 245, 245, 1.0)+ : const Color.fromRGBO(30, 30, 30, 1.0);++ Color get mutedTextColor => brightness == Brightness.light+ ? const Color.fromRGBO(80, 80, 80, 1)+ : const Color.fromRGBO(150, 150, 150, 1);++ Color get searchResultsBackgroundColor => brightness == Brightness.light+ ? Colors.black.withOpacity(0.32)+ : Colors.black.withOpacity(0.64);++ Color get codeCardBackgroundColor => brightness == Brightness.light+ ? const Color.fromRGBO(246, 246, 246, 1)+ : const Color.fromRGBO(40, 40, 40, 0.6);++ Color get primaryColor => brightness == Brightness.light+ ? const Color(0xFF9610D6)+ : const Color(0xFF9610D6);++ EnteTheme get enteTheme =>+ brightness == Brightness.light ? lightTheme : darkTheme;++ EnteTheme get inverseEnteTheme =>+ brightness == Brightness.light ? darkTheme : lightTheme;+}++OutlinedButtonThemeData buildOutlinedButtonThemeData({+ required Color bgDisabled,+ required Color bgEnabled,+ required Color fgDisabled,+ required Color fgEnabled,+}) {+ return OutlinedButtonThemeData(+ style: OutlinedButton.styleFrom(+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(8),+ ),+ fixedSize: const Size.fromHeight(56),+ alignment: Alignment.center,+ padding: const EdgeInsets.fromLTRB(50, 16, 50, 16),+ textStyle: const TextStyle(+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter-SemiBold',+ fontSize: 18,+ ),+ ).copyWith(+ backgroundColor: WidgetStateProperty.resolveWith<Color>(+ (Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return bgDisabled;+ }+ return bgEnabled;+ },+ ),+ foregroundColor: WidgetStateProperty.resolveWith<Color>(+ (Set<WidgetState> states) {+ if (states.contains(WidgetState.disabled)) {+ return fgDisabled;+ }+ return fgEnabled;+ },+ ),+ alignment: Alignment.center,+ ),+ );+}++ElevatedButtonThemeData buildElevatedButtonThemeData({+ required Color onPrimary, // text button color+ required Color primary,+ double elevation = 2, // background color of button+}) {+ return ElevatedButtonThemeData(+ style: ElevatedButton.styleFrom(+ foregroundColor: onPrimary,+ backgroundColor: primary,+ elevation: elevation,+ alignment: Alignment.center,+ textStyle: const TextStyle(+ fontWeight: FontWeight.w600,+ fontFamily: 'Inter-SemiBold',+ fontSize: 18,+ ),+ padding: const EdgeInsets.symmetric(vertical: 8),+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.all(Radius.circular(4)),+ ),+ ),+ );+}++// Helper function to create ThemeData that works with the new color system+ThemeData createAppThemeData({+ required Brightness brightness,+ EnteColorScheme? colorScheme,+}) {+ final effectiveColorScheme = colorScheme ??+ (brightness == Brightness.light ? lightScheme : darkScheme);++ final baseThemeData =+ brightness == Brightness.light ? lightThemeData : darkThemeData;++ // Create platform-specific typography to ensure consistent font sizes+ final typography = Typography.material2021(+ platform: TargetPlatform.android, // Force Android typography for consistency+ );++ return baseThemeData.copyWith(+ extensions: [effectiveColorScheme],+ primaryColor: effectiveColorScheme.primary500,+ scaffoldBackgroundColor: effectiveColorScheme.backgroundBase,+ typography: typography,+ dialogTheme: baseThemeData.dialogTheme.copyWith(+ backgroundColor: effectiveColorScheme.backgroundElevated,+ ),+ appBarTheme: baseThemeData.appBarTheme.copyWith(+ backgroundColor: effectiveColorScheme.backgroundBase,+ foregroundColor: effectiveColorScheme.textBase,+ iconTheme: IconThemeData(color: effectiveColorScheme.textBase),+ ),+ elevatedButtonTheme: ElevatedButtonThemeData(+ style: ElevatedButton.styleFrom(+ backgroundColor: effectiveColorScheme.primary500,+ foregroundColor: effectiveColorScheme.backgroundBase,+ ),+ ),+ outlinedButtonTheme: OutlinedButtonThemeData(+ style: OutlinedButton.styleFrom(+ backgroundColor: effectiveColorScheme.fillFaint,+ foregroundColor: effectiveColorScheme.textBase,+ side: BorderSide(color: effectiveColorScheme.strokeMuted),+ ),+ ),+ );+}diff --git a/mobile/packages/ui/lib/theme/example_app_colors.dart b/mobile/packages/ui/lib/theme/example_app_colors.dartnew file mode 100644index 0000000000..22ee8b99f8--- /dev/null+++ b/mobile/packages/ui/lib/theme/example_app_colors.dart@@ -0,0 +1,152 @@+// Example: How to use the reusable EnteColorScheme in your app+// filepath: example_app_colors.dart++import 'package:flutter/material.dart';+import 'colors.dart'; // Import the reusable color scheme+import 'ente_theme_data.dart'; // Import the theme data helper+import 'ente_theme.dart'; // Import for getEnteColorScheme++/// Example 1: Using the default color scheme+class DefaultThemeExample {+ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: lightScheme,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: darkScheme,+ );+}++/// Example 2: Creating a custom theme with brand colors+class CustomBrandThemeExample {+ // Define your app's brand colors+ static const Color brandPrimaryColor = Color(0xFF6C5CE7); // Purple++ static final schemes = ColorSchemeBuilder.fromPrimaryColor(brandPrimaryColor);++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: schemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: schemes.dark,+ );+}++/// Example 3: Creating a theme with fully custom primary colors+class FullyCustomThemeExample {+ static final schemes = ColorSchemeBuilder.fromCustomColors(+ primary700: const Color(0xFF1565C0), // Dark blue+ primary500: const Color(0xFF2196F3), // Material blue+ primary400: const Color(0xFF42A5F5), // Light blue+ primary300: const Color(0xFF90CAF9), // Very light blue+ iconButtonColor: const Color(0xFF1976D2), // Custom icon color+ gradientButtonBgColors: const [+ Color(0xFF1565C0),+ Color(0xFF2196F3),+ Color(0xFF42A5F5),+ ],+ );++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: schemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: schemes.dark,+ );+}++/// Example 4: Using factory constructors for fine-grained control+class FactoryConstructorExample {+ static final lightScheme = EnteColorScheme.light(+ primary700: const Color(0xFFE91E63), // Pink 700+ primary500: const Color(0xFFF06292), // Pink 300+ primary400: const Color(0xFFF8BBD9), // Pink 200+ primary300: const Color(0xFFFCE4EC), // Pink 50+ warning500: const Color(0xFFFF5722), // Custom warning color+ );++ static final darkScheme = EnteColorScheme.dark(+ primary700: const Color(0xFFE91E63),+ primary500: const Color(0xFFF06292),+ primary400: const Color(0xFFF8BBD9),+ primary300: const Color(0xFFFCE4EC),+ warning500: const Color(0xFFFF5722),+ );++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: lightScheme,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: darkScheme,+ );+}++/// Helper function to get the current color scheme from context+EnteColorScheme getColorScheme(BuildContext context) {+ return getEnteColorScheme(context);+}++/// Example widget showing how to use the color scheme in your UI+class ExampleWidget extends StatelessWidget {+ const ExampleWidget({super.key});++ @override+ Widget build(BuildContext context) {+ final colorScheme = getColorScheme(context);++ return Container(+ color: colorScheme.backgroundBase,+ child: Column(+ children: [+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: colorScheme.backgroundElevated,+ border: Border.all(color: colorScheme.strokeFaint),+ ),+ child: Text(+ 'Example Text',+ style: TextStyle(color: colorScheme.textBase),+ ),+ ),+ ElevatedButton(+ style: ElevatedButton.styleFrom(+ backgroundColor: colorScheme.primary500,+ foregroundColor: colorScheme.backgroundBase,+ ),+ onPressed: () {},+ child: const Text('Primary Button'),+ ),+ Container(+ height: 50,+ decoration: BoxDecoration(+ gradient: LinearGradient(+ colors: colorScheme.gradientButtonBgColors,+ ),+ ),+ child: Center(+ child: Text(+ 'Gradient Button',+ style: TextStyle(+ color: colorScheme.backgroundBase,+ fontWeight: FontWeight.bold,+ ),+ ),+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/packages/ui/lib/theme/multi_app_demo.dart b/mobile/packages/ui/lib/theme/multi_app_demo.dartnew file mode 100644index 0000000000..939cbe81bb--- /dev/null+++ b/mobile/packages/ui/lib/theme/multi_app_demo.dart@@ -0,0 +1,427 @@+// Demo: Complete working example showing multi-app theme compatibility+// This file demonstrates how the reusable theme system works for different apps++import 'package:flutter/material.dart';+import 'colors.dart';+import 'ente_theme_data.dart';+import 'ente_theme.dart';++/// App 1: E-commerce app with blue theme+class ECommerceApp {+ static const Color brandBlue = Color(0xFF1976D2);++ static final schemes = ColorSchemeBuilder.fromPrimaryColor(brandBlue);++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: schemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: schemes.dark,+ );+}++/// App 2: Social media app with purple theme+class SocialMediaApp {+ static const Color brandPurple = Color(0xFF9C27B0);++ static final schemes = ColorSchemeBuilder.fromPrimaryColor(brandPurple);++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: schemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: schemes.dark,+ );+}++/// App 3: Finance app with green theme+class FinanceApp {+ static final schemes = ColorSchemeBuilder.fromCustomColors(+ primary700: const Color(0xFF388E3C),+ primary500: const Color(0xFF4CAF50),+ primary400: const Color(0xFF66BB6A),+ primary300: const Color(0xFF81C784),+ gradientButtonBgColors: const [+ Color(0xFF388E3C),+ Color(0xFF4CAF50),+ Color(0xFF66BB6A),+ ],+ );++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: schemes.light,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: schemes.dark,+ );+}++/// App 4: Gaming app with orange theme+class GamingApp {+ static final customLightScheme = EnteColorScheme.light(+ primary700: const Color(0xFFE65100),+ primary500: const Color(0xFFFF9800),+ primary400: const Color(0xFFFFB74D),+ primary300: const Color(0xFFFFCC02),+ iconButtonColor: const Color(0xFFFF6F00),+ gradientButtonBgColors: const [+ Color(0xFFE65100),+ Color(0xFFFF9800),+ Color(0xFFFFB74D),+ ],+ warning500: const Color(0xFFF44336), // Custom warning for gaming+ );++ static final customDarkScheme = EnteColorScheme.dark(+ primary700: const Color(0xFFE65100),+ primary500: const Color(0xFFFF9800),+ primary400: const Color(0xFFFFB74D),+ primary300: const Color(0xFFFFCC02),+ iconButtonColor: const Color(0xFFFF6F00),+ gradientButtonBgColors: const [+ Color(0xFFE65100),+ Color(0xFFFF9800),+ Color(0xFFFFB74D),+ ],+ warning500: const Color(0xFFF44336),+ );++ static final lightTheme = createAppThemeData(+ brightness: Brightness.light,+ colorScheme: customLightScheme,+ );++ static final darkTheme = createAppThemeData(+ brightness: Brightness.dark,+ colorScheme: customDarkScheme,+ );+}++/// Demo widget that shows how UI components adapt to different app themes+class MultiAppThemeDemo extends StatefulWidget {+ const MultiAppThemeDemo({super.key});++ @override+ State<MultiAppThemeDemo> createState() => _MultiAppThemeDemoState();+}++class _MultiAppThemeDemoState extends State<MultiAppThemeDemo> {+ int currentAppIndex = 0;+ bool isDarkMode = false;++ final List<({String name, ThemeData light, ThemeData dark})> apps = [+ (+ name: "E-commerce",+ light: ECommerceApp.lightTheme,+ dark: ECommerceApp.darkTheme+ ),+ (+ name: "Social Media",+ light: SocialMediaApp.lightTheme,+ dark: SocialMediaApp.darkTheme+ ),+ (name: "Finance", light: FinanceApp.lightTheme, dark: FinanceApp.darkTheme),+ (name: "Gaming", light: GamingApp.lightTheme, dark: GamingApp.darkTheme),+ ];++ @override+ Widget build(BuildContext context) {+ final currentApp = apps[currentAppIndex];+ final currentTheme = isDarkMode ? currentApp.dark : currentApp.light;++ return MaterialApp(+ title: '${currentApp.name} App Demo',+ theme: currentTheme,+ home: DemoHomePage(+ appName: currentApp.name,+ onAppChanged: (index) => setState(() => currentAppIndex = index),+ onThemeChanged: (dark) => setState(() => isDarkMode = dark),+ currentAppIndex: currentAppIndex,+ isDarkMode: isDarkMode,+ appCount: apps.length,+ ),+ );+ }+}++class DemoHomePage extends StatelessWidget {+ final String appName;+ final Function(int) onAppChanged;+ final Function(bool) onThemeChanged;+ final int currentAppIndex;+ final bool isDarkMode;+ final int appCount;++ const DemoHomePage({+ super.key,+ required this.appName,+ required this.onAppChanged,+ required this.onThemeChanged,+ required this.currentAppIndex,+ required this.isDarkMode,+ required this.appCount,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ title: Text('$appName Theme Demo'),+ backgroundColor: colorScheme.backgroundElevated,+ foregroundColor: colorScheme.textBase,+ actions: [+ Switch(+ value: isDarkMode,+ onChanged: onThemeChanged,+ activeColor: colorScheme.primary500,+ ),+ ],+ ),+ body: SingleChildScrollView(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ // App Selector+ Text(+ 'Switch App Theme:',+ style: TextStyle(+ fontSize: 18,+ fontWeight: FontWeight.bold,+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 12),+ Wrap(+ spacing: 8,+ children: List.generate(appCount, (index) {+ final isSelected = index == currentAppIndex;+ return FilterChip(+ label: Text(+ ['E-commerce', 'Social', 'Finance', 'Gaming'][index]),+ selected: isSelected,+ onSelected: (_) => onAppChanged(index),+ backgroundColor: colorScheme.fillFaint,+ selectedColor: colorScheme.primary400,+ labelStyle: TextStyle(+ color: isSelected+ ? colorScheme.backgroundBase+ : colorScheme.textBase,+ ),+ );+ }),+ ),+ const SizedBox(height: 32),++ // UI Components Demo+ Text(+ 'UI Components:',+ style: TextStyle(+ fontSize: 18,+ fontWeight: FontWeight.bold,+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 16),++ // Background colors demo+ Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ color: colorScheme.backgroundElevated,+ border: Border.all(color: colorScheme.strokeFaint),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ 'Card with elevated background',+ style: TextStyle(+ fontSize: 16,+ fontWeight: FontWeight.w600,+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 8),+ Text(+ 'This is secondary text that adapts to the theme.',+ style: TextStyle(color: colorScheme.textMuted),+ ),+ Text(+ 'This is faint text for hints and labels.',+ style: TextStyle(color: colorScheme.textFaint),+ ),+ ],+ ),+ ),+ const SizedBox(height: 16),++ // Buttons demo+ Row(+ children: [+ Expanded(+ child: ElevatedButton(+ style: ElevatedButton.styleFrom(+ backgroundColor: colorScheme.primary500,+ foregroundColor: colorScheme.backgroundBase,+ ),+ onPressed: () {},+ child: const Text('Primary Button'),+ ),+ ),+ const SizedBox(width: 12),+ Expanded(+ child: OutlinedButton(+ style: OutlinedButton.styleFrom(+ backgroundColor: colorScheme.fillFaint,+ foregroundColor: colorScheme.textBase,+ side: BorderSide(color: colorScheme.strokeMuted),+ ),+ onPressed: () {},+ child: const Text('Secondary'),+ ),+ ),+ ],+ ),+ const SizedBox(height: 16),++ // Gradient button demo+ Container(+ width: double.infinity,+ height: 48,+ decoration: BoxDecoration(+ gradient: LinearGradient(+ colors: colorScheme.gradientButtonBgColors,+ begin: Alignment.centerLeft,+ end: Alignment.centerRight,+ ),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Center(+ child: Text(+ 'Gradient Button',+ style: TextStyle(+ color: colorScheme.backgroundBase,+ fontWeight: FontWeight.bold,+ fontSize: 16,+ ),+ ),+ ),+ ),+ const SizedBox(height: 16),++ // Warning demo+ Container(+ padding: const EdgeInsets.all(12),+ decoration: BoxDecoration(+ color: colorScheme.warning500.withOpacity(0.1),+ border: Border.all(color: colorScheme.warning500),+ borderRadius: BorderRadius.circular(8),+ ),+ child: Row(+ children: [+ Icon(+ Icons.warning,+ color: colorScheme.warning500,+ size: 20,+ ),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ 'Warning message with custom warning color',+ style: TextStyle(color: colorScheme.warning700),+ ),+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),++ // Color palette display+ Text(+ 'Color Palette:',+ style: TextStyle(+ fontSize: 18,+ fontWeight: FontWeight.bold,+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 16),+ _buildColorPalette(colorScheme),+ ],+ ),+ ),+ floatingActionButton: FloatingActionButton(+ backgroundColor: colorScheme.iconButtonColor,+ foregroundColor: colorScheme.backgroundBase,+ onPressed: () {+ ScaffoldMessenger.of(context).showSnackBar(+ SnackBar(+ content: Text('$appName theme is working!'),+ backgroundColor: colorScheme.primary500,+ ),+ );+ },+ child: const Icon(Icons.palette),+ ),+ );+ }++ Widget _buildColorPalette(EnteColorScheme colorScheme) {+ final colors = [+ ('Primary 700', colorScheme.primary700),+ ('Primary 500', colorScheme.primary500),+ ('Primary 400', colorScheme.primary400),+ ('Primary 300', colorScheme.primary300),+ ('Warning', colorScheme.warning500),+ ('Icon Button', colorScheme.iconButtonColor),+ ];++ return Wrap(+ spacing: 8,+ runSpacing: 8,+ children: colors.map((color) {+ return Column(+ children: [+ Container(+ width: 60,+ height: 60,+ decoration: BoxDecoration(+ color: color.$2,+ borderRadius: BorderRadius.circular(8),+ border: Border.all(color: colorScheme.strokeFaint),+ ),+ ),+ const SizedBox(height: 4),+ Text(+ color.$1,+ style: TextStyle(+ fontSize: 10,+ color: colorScheme.textMuted,+ ),+ textAlign: TextAlign.center,+ ),+ ],+ );+ }).toList(),+ );+ }+}++// Example of how to use this in main.dart:+void main() {+ runApp(const MultiAppThemeDemo());+}diff --git a/mobile/packages/ui/lib/theme/platform_text_config.dart b/mobile/packages/ui/lib/theme/platform_text_config.dartnew file mode 100644index 0000000000..ffe476e40d--- /dev/null+++ b/mobile/packages/ui/lib/theme/platform_text_config.dart@@ -0,0 +1,75 @@+import 'dart:io';+import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';++/// Platform-specific text scaling configuration to ensure consistent+/// font sizes and appearance across Android and iOS platforms.+class PlatformTextConfig {+ /// Android tends to render fonts slightly larger than iOS, so we apply+ /// a small reduction factor to maintain visual consistency.+ static const double androidFontScaleFactor = 0.95;++ /// iOS uses the default scaling (1.0)+ static const double iosFontScaleFactor = 1.0;++ /// Get the appropriate font scale factor for the current platform+ static double getPlatformFontScaleFactor() {+ if (kIsWeb) return 1.0;++ switch (Platform.operatingSystem) {+ case 'android':+ return androidFontScaleFactor;+ case 'ios':+ return iosFontScaleFactor;+ default:+ return 1.0;+ }+ }++ /// Adjust font size based on platform to ensure consistency+ static double adjustFontSize(double baseFontSize) {+ return baseFontSize * getPlatformFontScaleFactor();+ }++ /// Create a TextStyle with platform-adjusted font size+ static TextStyle createTextStyle({+ required double fontSize,+ FontWeight? fontWeight,+ String? fontFamily,+ Color? color,+ double? height,+ TextDecoration? decoration,+ }) {+ return TextStyle(+ fontSize: adjustFontSize(fontSize),+ fontWeight: fontWeight,+ fontFamily: fontFamily,+ color: color,+ height: height,+ decoration: decoration,+ );+ }++ /// Get platform-specific MediaQuery configuration for text scaling+ static MediaQueryData adjustMediaQueryTextScaling(MediaQueryData data) {+ // Clamp text scaling between 0.8 and 1.3 to prevent extreme scaling+ // that can break UI layouts+ final textScaleFactor =+ (data.textScaler.scale(1.0) * getPlatformFontScaleFactor())+ .clamp(0.8, 1.3);++ return data.copyWith(+ textScaler: TextScaler.linear(textScaleFactor),+ );+ }+}++/// Extension on BuildContext to easily access platform-adjusted text scaling+extension PlatformTextScaling on BuildContext {+ /// Get MediaQuery with platform-adjusted text scaling+ MediaQueryData get platformAdjustedMediaQuery {+ return PlatformTextConfig.adjustMediaQueryTextScaling(+ MediaQuery.of(this),+ );+ }+}diff --git a/mobile/packages/ui/lib/theme/text_style.dart b/mobile/packages/ui/lib/theme/text_style.dartnew file mode 100644index 0000000000..d6b69ca83f--- /dev/null+++ b/mobile/packages/ui/lib/theme/text_style.dart@@ -0,0 +1,204 @@+import 'package:flutter/material.dart';+import '../theme/colors.dart';+import '../theme/platform_text_config.dart';++const FontWeight _regularWeight = FontWeight.w500;+const FontWeight _boldWeight = FontWeight.w600;+const String _fontFamily = 'Inter';++final TextStyle brandStyleSmall = TextStyle(+ fontWeight: FontWeight.bold,+ fontFamily: 'Montserrat',+ fontSize: PlatformTextConfig.adjustFontSize(21),+);++final TextStyle brandStyleMedium = TextStyle(+ fontWeight: FontWeight.bold,+ fontFamily: 'Montserrat',+ fontSize: PlatformTextConfig.adjustFontSize(24),+);++final TextStyle h1 = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(48),+ height: 48 / 28,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle h2 = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(32),+ height: 39 / 32.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle h3 = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(24),+ height: 29 / 24.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle large = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(18),+ height: 22 / 18.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle body = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(16),+ height: 20 / 16.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle small = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(14),+ height: 17 / 14.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle mini = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(12),+ height: 15 / 12.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);+final TextStyle tiny = TextStyle(+ fontSize: PlatformTextConfig.adjustFontSize(10),+ height: 12 / 10.0,+ fontWeight: _regularWeight,+ fontFamily: _fontFamily,+);++class EnteTextTheme {+ final TextStyle h1;+ final TextStyle h1Bold;+ final TextStyle h2;+ final TextStyle h2Bold;+ final TextStyle h3;+ final TextStyle h3Bold;+ final TextStyle large;+ final TextStyle largeBold;+ final TextStyle body;+ final TextStyle bodyBold;+ final TextStyle small;+ final TextStyle smallBold;+ final TextStyle mini;+ final TextStyle miniBold;+ final TextStyle tiny;+ final TextStyle tinyBold;+ final TextStyle brandSmall;+ final TextStyle brandMedium;++ // textMuted variants+ final TextStyle h1Muted;+ final TextStyle h2Muted;+ final TextStyle h3Muted;+ final TextStyle largeMuted;+ final TextStyle bodyMuted;+ final TextStyle smallMuted;+ final TextStyle miniMuted;+ final TextStyle miniBoldMuted;+ final TextStyle tinyMuted;++ // textFaint variants+ final TextStyle h1Faint;+ final TextStyle h2Faint;+ final TextStyle h3Faint;+ final TextStyle largeFaint;+ final TextStyle bodyFaint;+ final TextStyle smallFaint;+ final TextStyle miniFaint;+ final TextStyle tinyFaint;++ const EnteTextTheme({+ required this.h1,+ required this.h1Bold,+ required this.h2,+ required this.h2Bold,+ required this.h3,+ required this.h3Bold,+ required this.large,+ required this.largeBold,+ required this.body,+ required this.bodyBold,+ required this.small,+ required this.smallBold,+ required this.mini,+ required this.miniBold,+ required this.tiny,+ required this.tinyBold,+ required this.brandSmall,+ required this.brandMedium,+ required this.h1Muted,+ required this.h2Muted,+ required this.h3Muted,+ required this.largeMuted,+ required this.bodyMuted,+ required this.smallMuted,+ required this.miniMuted,+ required this.miniBoldMuted,+ required this.tinyMuted,+ required this.h1Faint,+ required this.h2Faint,+ required this.h3Faint,+ required this.largeFaint,+ required this.bodyFaint,+ required this.smallFaint,+ required this.miniFaint,+ required this.tinyFaint,+ });+}++EnteTextTheme lightTextTheme = _buildEnteTextStyle(+ textBaseLight,+ textMutedLight,+ textFaintLight,+);++EnteTextTheme darkTextTheme = _buildEnteTextStyle(+ textBaseDark,+ textMutedDark,+ textFaintDark,+);++EnteTextTheme _buildEnteTextStyle(+ Color color,+ Color textMuted,+ Color textFaint,+) {+ return EnteTextTheme(+ h1: h1.copyWith(color: color),+ h1Bold: h1.copyWith(color: color, fontWeight: _boldWeight),+ h2: h2.copyWith(color: color),+ h2Bold: h2.copyWith(color: color, fontWeight: _boldWeight),+ h3: h3.copyWith(color: color),+ h3Bold: h3.copyWith(color: color, fontWeight: _boldWeight),+ large: large.copyWith(color: color),+ largeBold: large.copyWith(color: color, fontWeight: _boldWeight),+ body: body.copyWith(color: color),+ bodyBold: body.copyWith(color: color, fontWeight: _boldWeight),+ small: small.copyWith(color: color),+ smallBold: small.copyWith(color: color, fontWeight: _boldWeight),+ mini: mini.copyWith(color: color),+ miniBold: mini.copyWith(color: color, fontWeight: _boldWeight),+ tiny: tiny.copyWith(color: color),+ tinyBold: tiny.copyWith(color: color, fontWeight: _boldWeight),+ brandSmall: brandStyleSmall.copyWith(color: color),+ brandMedium: brandStyleMedium.copyWith(color: color),+ h1Muted: h1.copyWith(color: textMuted),+ h2Muted: h2.copyWith(color: textMuted),+ h3Muted: h3.copyWith(color: textMuted),+ largeMuted: large.copyWith(color: textMuted),+ bodyMuted: body.copyWith(color: textMuted),+ smallMuted: small.copyWith(color: textMuted),+ miniMuted: mini.copyWith(color: textMuted),+ miniBoldMuted: mini.copyWith(color: textMuted, fontWeight: _boldWeight),+ tinyMuted: tiny.copyWith(color: textMuted),+ h1Faint: h1.copyWith(color: textFaint),+ h2Faint: h2.copyWith(color: textFaint),+ h3Faint: h3.copyWith(color: textFaint),+ largeFaint: large.copyWith(color: textFaint),+ bodyFaint: body.copyWith(color: textFaint),+ smallFaint: small.copyWith(color: textFaint),+ miniFaint: mini.copyWith(color: textFaint),+ tinyFaint: tiny.copyWith(color: textFaint),+ );+}diff --git a/mobile/packages/ui/lib/utils/dialog_util.dart b/mobile/packages/ui/lib/utils/dialog_util.dartnew file mode 100644index 0000000000..6a1d18b5b7--- /dev/null+++ b/mobile/packages/ui/lib/utils/dialog_util.dart@@ -0,0 +1,373 @@+import 'dart:io';++import 'package:dio/dio.dart';+import 'package:ente_base/typedefs.dart';+import 'package:ente_strings/ente_strings.dart';+import 'package:ente_ui/components/action_sheet_widget.dart';+import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/components/buttons/models/button_result.dart';+import 'package:ente_ui/components/buttons/models/button_type.dart';+import 'package:ente_ui/components/dialog_widget.dart';+import 'package:ente_ui/components/loading_widget.dart';+import 'package:ente_ui/components/progress_dialog.dart';+import 'package:ente_ui/theme/colors.dart';+import 'package:ente_utils/email_util.dart';+import 'package:ente_utils/platform_util.dart';+import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';++typedef DialogBuilder = DialogWidget Function(BuildContext context);++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showErrorDialog(+ BuildContext context,+ String title,+ String? body,+ String primaryButtonLabel,+ FutureVoidCallback primaryButtonAction, {+ bool isDismissable = true,+}) async {+ return showDialogWidget(+ context: context,+ title: title,+ body: body,+ isDismissible: isDismissable,+ buttons: [+ ButtonWidget(+ buttonType: ButtonType.primary,+ labelText: primaryButtonLabel,+ isInAlert: true,+ buttonAction: ButtonAction.first,+ onTap: () async {+ await primaryButtonAction();+ },+ ),+ const ButtonWidget(+ buttonType: ButtonType.secondary,+ labelText: "OK",+ isInAlert: true,+ buttonAction: ButtonAction.second,+ ),+ ],+ );+}++String parseErrorForUI(+ BuildContext context,+ String genericError, {+ Object? error,+ bool surfaceError = kDebugMode,+}) {+ try {+ if (error == null) {+ return genericError;+ }+ if (error is DioException) {+ final DioException dioError = error;+ if (dioError.type == DioExceptionType.unknown) {+ if (dioError.error.toString().contains('Failed host lookup')) {+ return context.strings.networkHostLookUpErr;+ } else if (dioError.error.toString().contains('SocketException')) {+ return context.strings.networkConnectionRefusedErr;+ }+ }+ }+ // return generic error if the user is not internal and the error is not in debug mode+ if (!kDebugMode) {+ return genericError;+ }+ String errorInfo = "";+ if (error is DioException) {+ final DioException dioError = error;+ if (dioError.type == DioExceptionType.badResponse) {+ if (dioError.response?.data["code"] != null) {+ errorInfo = "Reason: ${dioError.response!.data["code"]}";+ } else {+ errorInfo = "Reason: ${dioError.response!.data.toString()}";+ }+ } else if (dioError.type == DioExceptionType.badCertificate) {+ errorInfo = "Reason: ${dioError.error.toString()}";+ } else {+ errorInfo = "Reason: ${dioError.type.toString()}";+ }+ } else {+ if (kDebugMode) {+ errorInfo = error.toString();+ } else {+ errorInfo = error.toString().split('Source stack')[0];+ }+ }+ if (errorInfo.isNotEmpty) {+ return "$genericError\n\n$errorInfo";+ }+ return genericError;+ } catch (e) {+ return genericError;+ }+}++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showGenericErrorDialog({+ required BuildContext context,+ bool isDismissible = true,+ required Object? error,+}) async {+ String errorBody = parseErrorForUI(+ context,+ context.strings.itLooksLikeSomethingWentWrongPleaseRetryAfterSome,+ error: error,+ );+ bool isWindowCertError = false;+ if (Platform.isWindows &&+ error != null &&+ error.toString().contains("CERTIFICATE_VERIFY_FAILED")) {+ isWindowCertError = true;+ errorBody =+ "Certificate verification failed. Please update your system certificates, & restart the app. If the issue persists, please contact support.";+ }++ return showDialogWidget(+ context: context,+ title: context.strings.error,+ icon: Icons.error_outline_outlined,+ body: errorBody,+ isDismissible: isDismissible,+ buttons: [+ ButtonWidget(+ buttonType: ButtonType.primary,+ labelText: context.strings.ok,+ buttonAction: ButtonAction.first,+ isInAlert: true,+ ),+ if (isWindowCertError)+ ButtonWidget(+ buttonType: ButtonType.neutral,+ labelText: 'Update Certificates',+ buttonAction: ButtonAction.third,+ isInAlert: true,+ onTap: () async {+ PlatformUtil.openWebView(+ context,+ context.strings.faq,+ "https://help.ente.io/auth/troubleshooting/windows-login",+ );+ },+ ),+ ButtonWidget(+ buttonType: ButtonType.secondary,+ labelText: context.strings.contactSupport,+ buttonAction: ButtonAction.second,+ onTap: () async {+ await sendLogs(+ context,+ context.strings.contactSupport,+ postShare: () {},+ );+ },+ ),+ ],+ );+}++DialogWidget choiceDialog({+ required String title,+ String? body,+ required String firstButtonLabel,+ String secondButtonLabel = "Cancel",+ ButtonType firstButtonType = ButtonType.neutral,+ ButtonType secondButtonType = ButtonType.secondary,+ ButtonAction firstButtonAction = ButtonAction.first,+ ButtonAction secondButtonAction = ButtonAction.cancel,+ FutureVoidCallback? firstButtonOnTap,+ FutureVoidCallback? secondButtonOnTap,+ bool isCritical = false,+ IconData? icon,+}) {+ final buttons = [+ ButtonWidget(+ buttonType: isCritical ? ButtonType.critical : firstButtonType,+ labelText: firstButtonLabel,+ isInAlert: true,+ onTap: firstButtonOnTap,+ buttonAction: firstButtonAction,+ ),+ ButtonWidget(+ buttonType: secondButtonType,+ labelText: secondButtonLabel,+ isInAlert: true,+ onTap: secondButtonOnTap,+ buttonAction: secondButtonAction,+ ),+ ];++ return DialogWidget(title: title, body: body, buttons: buttons, icon: icon);+}++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showChoiceDialog(+ BuildContext context, {+ required String title,+ String? body,+ required String firstButtonLabel,+ String? secondButtonLabel = "Cancel",+ ButtonType firstButtonType = ButtonType.neutral,+ ButtonType secondButtonType = ButtonType.secondary,+ ButtonAction firstButtonAction = ButtonAction.first,+ ButtonAction secondButtonAction = ButtonAction.cancel,+ FutureVoidCallback? firstButtonOnTap,+ FutureVoidCallback? secondButtonOnTap,+ bool isCritical = false,+ IconData? icon,+ bool isDismissible = true,+}) async {+ final buttons = [+ ButtonWidget(+ buttonType: isCritical ? ButtonType.critical : firstButtonType,+ labelText: firstButtonLabel,+ isInAlert: true,+ onTap: firstButtonOnTap,+ buttonAction: firstButtonAction,+ ),+ if (secondButtonLabel != null)+ ButtonWidget(+ buttonType: secondButtonType,+ labelText: secondButtonLabel,+ isInAlert: true,+ onTap: secondButtonOnTap,+ buttonAction: secondButtonAction,+ ),+ ];+ return showDialogWidget(+ context: context,+ title: title,+ body: body,+ buttons: buttons,+ icon: icon,+ isDismissible: isDismissible,+ );+}++///Will return null if dismissed by tapping outside+Future<ButtonResult?> showChoiceActionSheet(+ BuildContext context, {+ required String title,+ String? body,+ required String firstButtonLabel,+ String secondButtonLabel = "Cancel",+ ButtonType firstButtonType = ButtonType.neutral,+ ButtonType secondButtonType = ButtonType.secondary,+ ButtonAction firstButtonAction = ButtonAction.first,+ ButtonAction secondButtonAction = ButtonAction.cancel,+ FutureVoidCallback? firstButtonOnTap,+ FutureVoidCallback? secondButtonOnTap,+ bool isCritical = false,+ IconData? icon,+ bool isDismissible = true,+}) async {+ final buttons = [+ ButtonWidget(+ buttonType: isCritical ? ButtonType.critical : firstButtonType,+ labelText: firstButtonLabel,+ isInAlert: true,+ onTap: firstButtonOnTap,+ buttonAction: firstButtonAction,+ shouldStickToDarkTheme: true,+ ),+ ButtonWidget(+ buttonType: secondButtonType,+ labelText: secondButtonLabel,+ isInAlert: true,+ onTap: secondButtonOnTap,+ buttonAction: secondButtonAction,+ shouldStickToDarkTheme: true,+ ),+ ];+ return showActionSheet(+ context: context,+ title: title,+ body: body,+ buttons: buttons,+ isDismissible: isDismissible,+ );+}++ProgressDialog createProgressDialog(+ BuildContext context,+ String message, {+ isDismissible = false,+}) {+ final dialog = ProgressDialog(+ context,+ type: ProgressDialogType.normal,+ isDismissible: isDismissible,+ barrierColor: Colors.black12,+ );+ dialog.style(+ message: message,+ messageTextStyle: Theme.of(context).textTheme.labelMedium,+ backgroundColor: Theme.of(context).dialogTheme.backgroundColor,+ progressWidget: const EnteLoadingWidget(),+ borderRadius: 10,+ elevation: 10.0,+ insetAnimCurve: Curves.easeInOut,+ );+ return dialog;+}++//Can return ButtonResult? from ButtonWidget or Exception? from TextInputDialog+Future<dynamic> showTextInputDialog(+ BuildContext context, {+ required String title,+ String? body,+ required String submitButtonLabel,+ IconData? icon,+ String? label,+ String? message,+ String? hintText,+ required FutureVoidCallbackParamStr onSubmit,+ IconData? prefixIcon,+ String? initialValue,+ Alignment? alignMessage,+ int? maxLength,+ bool showOnlyLoadingState = false,+ TextCapitalization textCapitalization = TextCapitalization.none,+ bool alwaysShowSuccessState = false,+ bool isPasswordInput = false,+ bool useRootNavigator = false,+}) {+ return showDialog(+ barrierColor: backdropFaintDark,+ useRootNavigator: useRootNavigator,+ context: context,+ builder: (context) {+ final bottomInset = MediaQuery.of(context).viewInsets.bottom;+ final isKeyboardUp = bottomInset > 100;+ return Material(+ color: Colors.transparent,+ child: Center(+ child: Padding(+ padding: EdgeInsets.only(bottom: isKeyboardUp ? bottomInset : 0),+ child: TextInputDialog(+ title: title,+ message: message,+ label: label,+ body: body,+ icon: icon,+ submitButtonLabel: submitButtonLabel,+ onSubmit: onSubmit,+ hintText: hintText,+ prefixIcon: prefixIcon,+ initialValue: initialValue,+ alignMessage: alignMessage,+ maxLength: maxLength,+ showOnlyLoadingState: showOnlyLoadingState,+ textCapitalization: textCapitalization,+ alwaysShowSuccessState: alwaysShowSuccessState,+ isPasswordInput: isPasswordInput,+ ),+ ),+ ),+ );+ },+ );+}diff --git a/mobile/packages/ui/lib/utils/file_icon_utils.dart b/mobile/packages/ui/lib/utils/file_icon_utils.dartnew file mode 100644index 0000000000..bc1f238200--- /dev/null+++ b/mobile/packages/ui/lib/utils/file_icon_utils.dart@@ -0,0 +1,72 @@+import 'package:flutter/material.dart';++class FileIconConfig {+ final IconData icon;+ final Color color;+ final Set<String> extensions;++ const FileIconConfig({+ required this.icon,+ required this.color,+ required this.extensions,+ });+}++class FileIconUtils {+ // Centralized configuration - change icons and colors here only+ static const Map<String, FileIconConfig> _fileTypeConfigs = {+ 'pdf': FileIconConfig(+ extensions: {'.pdf'},+ icon: Icons.picture_as_pdf,+ color: Colors.red,+ ),+ 'image': FileIconConfig(+ extensions: {'.jpg', '.png', '.heic'},+ icon: Icons.image,+ color: Colors.blue,+ ),+ 'presentation': FileIconConfig(+ extensions: {'.pptx'},+ icon: Icons.slideshow,+ color: Colors.orange,+ ),+ 'spreadsheet': FileIconConfig(+ extensions: {'.xlsx'},+ icon: Icons.table_chart,+ color: Colors.green,+ ),+ };++ static const FileIconConfig _defaultConfig = FileIconConfig(+ extensions: {},+ icon: Icons.insert_drive_file,+ color: Colors.grey,+ );++ static FileIconConfig _getFileConfig(String fileName) {+ final lowerFileName = fileName.toLowerCase();+ final lastDotIndex = lowerFileName.lastIndexOf('.');++ if (lastDotIndex == -1) {+ return _defaultConfig; // No extension found+ }++ final extension = lowerFileName.substring(lastDotIndex);++ for (final config in _fileTypeConfigs.values) {+ if (config.extensions.contains(extension)) {+ return config;+ }+ }++ return _defaultConfig;+ }++ static IconData getFileIcon(String fileName) {+ return _getFileConfig(fileName).icon;+ }++ static Color getFileIconColor(String fileName) {+ return _getFileConfig(fileName).color;+ }+}diff --git a/mobile/packages/ui/lib/utils/toast_util.dart b/mobile/packages/ui/lib/utils/toast_util.dartnew file mode 100644index 0000000000..ce3693ef87--- /dev/null+++ b/mobile/packages/ui/lib/utils/toast_util.dart@@ -0,0 +1,52 @@+import '../theme/ente_theme.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:fluttertoast/fluttertoast.dart';++void showToast(+ BuildContext context,+ String message, {+ toastLength = Toast.LENGTH_LONG,+ iOSDismissOnTap = true,+}) async {+ try {+ await Fluttertoast.cancel();+ await Fluttertoast.showToast(+ msg: message,+ toastLength: toastLength,+ gravity: ToastGravity.BOTTOM,+ timeInSecForIosWeb: 1,+ backgroundColor: getEnteColorScheme(context).toastBackgroundColor,+ textColor: getEnteColorScheme(context).toastTextColor,+ fontSize: 16.0,+ );+ } on MissingPluginException catch (_) {+ Widget toast = Container(+ padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(25.0),+ color: getEnteColorScheme(context).toastBackgroundColor,+ ),+ child: Text(+ message,+ style: TextStyle(+ color: getEnteColorScheme(context).toastTextColor,+ fontSize: 16.0,+ ),+ ),+ );++ final fToast = FToast();+ fToast.init(context);++ fToast.showToast(+ child: toast,+ gravity: ToastGravity.BOTTOM,+ toastDuration: const Duration(seconds: 2),+ );+ }+}++void showShortToast(context, String message) {+ showToast(context, message, toastLength: Toast.LENGTH_SHORT);+}diff --git a/mobile/packages/ui/lib/utils/window_listener_service.dart b/mobile/packages/ui/lib/utils/window_listener_service.dartnew file mode 100644index 0000000000..0a1f391c50--- /dev/null+++ b/mobile/packages/ui/lib/utils/window_listener_service.dart@@ -0,0 +1,41 @@+import 'dart:async';+import 'dart:ui';++import 'package:flutter/widgets.dart';+import 'package:shared_preferences/shared_preferences.dart';+import 'package:window_manager/window_manager.dart';++class WindowListenerService {+ static const double initialWindowHeight = 1200.0;+ static const double initialWindowWidth = 800.0;+ static const double maxWindowHeight = 8192.0;+ static const double maxWindowWidth = 8192.0;+ late SharedPreferences _preferences;++ WindowListenerService._privateConstructor();++ static final WindowListenerService instance =+ WindowListenerService._privateConstructor();++ Future<void> init() async {+ _preferences = await SharedPreferences.getInstance();+ }++ Size getWindowSize() {+ final double windowWidth =+ _preferences.getDouble('windowWidth') ?? initialWindowWidth;+ final double windowHeight =+ _preferences.getDouble('windowHeight') ?? initialWindowHeight;+ final w = windowWidth.clamp(200.0, maxWindowWidth);+ final h = windowHeight.clamp(400.0, maxWindowHeight);+ return Size(w, h);+ }++ Future<void> onWindowResize() async {+ final width = (await windowManager.getSize()).width;+ final height = (await windowManager.getSize()).height;+ // Save the window size to shared preferences+ await _preferences.setDouble('windowWidth', width);+ await _preferences.setDouble('windowHeight', height);+ }+}diff --git a/mobile/packages/ui/pubspec.lock b/mobile/packages/ui/pubspec.locknew file mode 100644index 0000000000..a25bb42857--- /dev/null+++ b/mobile/packages/ui/pubspec.lock@@ -0,0 +1,1002 @@+# Generated by pub+# See https://dart.dev/tools/pub/glossary#lockfile+packages:+ archive:+ dependency: transitive+ description:+ name: archive+ sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"+ url: "https://pub.dev"+ source: hosted+ version: "4.0.7"+ args:+ dependency: transitive+ description:+ name: args+ sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04+ url: "https://pub.dev"+ source: hosted+ version: "2.7.0"+ async:+ dependency: transitive+ description:+ name: async+ sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"+ url: "https://pub.dev"+ source: hosted+ version: "2.13.0"+ bip39:+ dependency: transitive+ description:+ name: bip39+ sha256: de1ee27ebe7d96b84bb3a04a4132a0a3007dcdd5ad27dd14aa87a29d97c45edc+ url: "https://pub.dev"+ source: hosted+ version: "1.0.6"+ boolean_selector:+ dependency: transitive+ description:+ name: boolean_selector+ sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.2"+ characters:+ dependency: transitive+ description:+ name: characters+ sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ clock:+ dependency: transitive+ description:+ name: clock+ sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ collection:+ dependency: transitive+ description:+ name: collection+ sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"+ url: "https://pub.dev"+ source: hosted+ version: "1.19.1"+ convert:+ dependency: transitive+ description:+ name: convert+ sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68+ url: "https://pub.dev"+ source: hosted+ version: "3.1.2"+ cross_file:+ dependency: transitive+ description:+ name: cross_file+ sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"+ url: "https://pub.dev"+ source: hosted+ version: "0.3.4+2"+ crypto:+ dependency: transitive+ description:+ name: crypto+ sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"+ url: "https://pub.dev"+ source: hosted+ version: "3.0.6"+ csslib:+ dependency: transitive+ description:+ name: csslib+ sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e"+ url: "https://pub.dev"+ source: hosted+ version: "1.0.2"+ device_info_plus:+ dependency: transitive+ description:+ name: device_info_plus+ sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"+ url: "https://pub.dev"+ source: hosted+ version: "9.1.2"+ device_info_plus_platform_interface:+ dependency: transitive+ description:+ name: device_info_plus_platform_interface+ sha256: e1ea89119e34903dca74b883d0dd78eb762814f97fb6c76f35e9ff74d261a18f+ url: "https://pub.dev"+ source: hosted+ version: "7.0.3"+ dio:+ dependency: "direct main"+ description:+ name: dio+ sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9"+ url: "https://pub.dev"+ source: hosted+ version: "5.8.0+1"+ dio_web_adapter:+ dependency: transitive+ description:+ name: dio_web_adapter+ sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.1"+ email_validator:+ dependency: transitive+ description:+ name: email_validator+ sha256: b19aa5d92fdd76fbc65112060c94d45ba855105a28bb6e462de7ff03b12fa1fb+ url: "https://pub.dev"+ source: hosted+ version: "3.0.0"+ ente_base:+ dependency: "direct main"+ description:+ path: "../base"+ relative: true+ source: path+ version: "1.0.0"+ ente_configuration:+ dependency: transitive+ description:+ path: "../configuration"+ relative: true+ source: path+ version: "1.0.0"+ ente_crypto_dart:+ dependency: transitive+ description:+ path: "."+ ref: HEAD+ resolved-ref: f91e1545f8263df127762240c4da54a0c42835b2+ url: "https://github.com/ente-io/ente_crypto_dart.git"+ source: git+ version: "1.0.0"+ ente_events:+ dependency: transitive+ description:+ path: "../events"+ relative: true+ source: path+ version: "1.0.0"+ ente_logging:+ dependency: "direct main"+ description:+ path: "../logging"+ relative: true+ source: path+ version: "1.0.0"+ ente_strings:+ dependency: "direct main"+ description:+ path: "../strings"+ relative: true+ source: path+ version: "1.0.0"+ ente_utils:+ dependency: "direct main"+ description:+ path: "../utils"+ relative: true+ source: path+ version: "1.0.0"+ event_bus:+ dependency: transitive+ description:+ name: event_bus+ sha256: "1a55e97923769c286d295240048fc180e7b0768902c3c2e869fe059aafa15304"+ url: "https://pub.dev"+ source: hosted+ version: "2.0.1"+ fake_async:+ dependency: transitive+ description:+ name: fake_async+ sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"+ url: "https://pub.dev"+ source: hosted+ version: "1.3.3"+ ffi:+ dependency: transitive+ description:+ name: ffi+ sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.4"+ file:+ dependency: transitive+ description:+ name: file+ sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4+ url: "https://pub.dev"+ source: hosted+ version: "7.0.1"+ file_saver:+ dependency: transitive+ description:+ name: file_saver+ sha256: "017a127de686af2d2fbbd64afea97052d95f2a0f87d19d25b87e097407bf9c1e"+ url: "https://pub.dev"+ source: hosted+ version: "0.2.14"+ fixnum:+ dependency: transitive+ description:+ name: fixnum+ sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be+ url: "https://pub.dev"+ source: hosted+ version: "1.1.1"+ flutter:+ dependency: "direct main"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_email_sender:+ dependency: transitive+ description:+ name: flutter_email_sender+ sha256: d39eb5e91358fc19ec4050da69accec21f9d5b2b6bcf188aa246327b6ca2352c+ url: "https://pub.dev"+ source: hosted+ version: "7.0.0"+ flutter_inappwebview:+ dependency: "direct main"+ description:+ name: flutter_inappwebview+ sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5"+ url: "https://pub.dev"+ source: hosted+ version: "6.1.5"+ flutter_inappwebview_android:+ dependency: transitive+ description:+ name: flutter_inappwebview_android+ sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.3"+ flutter_inappwebview_internal_annotations:+ dependency: transitive+ description:+ name: flutter_inappwebview_internal_annotations+ sha256: "787171d43f8af67864740b6f04166c13190aa74a1468a1f1f1e9ee5b90c359cd"+ url: "https://pub.dev"+ source: hosted+ version: "1.2.0"+ flutter_inappwebview_ios:+ dependency: transitive+ description:+ name: flutter_inappwebview_ios+ sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_macos:+ dependency: transitive+ description:+ name: flutter_inappwebview_macos+ sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_platform_interface:+ dependency: transitive+ description:+ name: flutter_inappwebview_platform_interface+ sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500+ url: "https://pub.dev"+ source: hosted+ version: "1.3.0+1"+ flutter_inappwebview_web:+ dependency: transitive+ description:+ name: flutter_inappwebview_web+ sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_windows:+ dependency: transitive+ description:+ name: flutter_inappwebview_windows+ sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055"+ url: "https://pub.dev"+ source: hosted+ version: "0.6.0"+ flutter_lints:+ dependency: "direct dev"+ description:+ name: flutter_lints+ sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"+ url: "https://pub.dev"+ source: hosted+ version: "5.0.0"+ flutter_localizations:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_secure_storage:+ dependency: transitive+ description:+ name: flutter_secure_storage+ sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea"+ url: "https://pub.dev"+ source: hosted+ version: "9.2.4"+ flutter_secure_storage_linux:+ dependency: transitive+ description:+ name: flutter_secure_storage_linux+ sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688+ url: "https://pub.dev"+ source: hosted+ version: "1.2.3"+ flutter_secure_storage_macos:+ dependency: transitive+ description:+ name: flutter_secure_storage_macos+ sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247"+ url: "https://pub.dev"+ source: hosted+ version: "3.1.3"+ flutter_secure_storage_platform_interface:+ dependency: transitive+ description:+ name: flutter_secure_storage_platform_interface+ sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_secure_storage_web:+ dependency: transitive+ description:+ name: flutter_secure_storage_web+ sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9+ url: "https://pub.dev"+ source: hosted+ version: "1.2.1"+ flutter_secure_storage_windows:+ dependency: transitive+ description:+ name: flutter_secure_storage_windows+ sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709+ url: "https://pub.dev"+ source: hosted+ version: "3.1.2"+ flutter_test:+ dependency: "direct dev"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_web_plugins:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ fluttertoast:+ dependency: "direct main"+ description:+ name: fluttertoast+ sha256: "25e51620424d92d3db3832464774a6143b5053f15e382d8ffbfd40b6e795dcf1"+ url: "https://pub.dev"+ source: hosted+ version: "8.2.12"+ freezed_annotation:+ dependency: transitive+ description:+ name: freezed_annotation+ sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2+ url: "https://pub.dev"+ source: hosted+ version: "2.4.4"+ hex:+ dependency: transitive+ description:+ name: hex+ sha256: "4e7cd54e4b59ba026432a6be2dd9d96e4c5205725194997193bf871703b82c4a"+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ html:+ dependency: transitive+ description:+ name: html+ sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602"+ url: "https://pub.dev"+ source: hosted+ version: "0.15.6"+ http:+ dependency: transitive+ description:+ name: http+ sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ http_parser:+ dependency: transitive+ description:+ name: http_parser+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"+ url: "https://pub.dev"+ source: hosted+ version: "4.1.2"+ intl:+ dependency: transitive+ description:+ name: intl+ sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"+ url: "https://pub.dev"+ source: hosted+ version: "0.20.2"+ js:+ dependency: transitive+ description:+ name: js+ sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3+ url: "https://pub.dev"+ source: hosted+ version: "0.6.7"+ json_annotation:+ dependency: transitive+ description:+ name: json_annotation+ sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"+ url: "https://pub.dev"+ source: hosted+ version: "4.9.0"+ leak_tracker:+ dependency: transitive+ description:+ name: leak_tracker+ sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"+ url: "https://pub.dev"+ source: hosted+ version: "10.0.9"+ leak_tracker_flutter_testing:+ dependency: transitive+ description:+ name: leak_tracker_flutter_testing+ sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573+ url: "https://pub.dev"+ source: hosted+ version: "3.0.9"+ leak_tracker_testing:+ dependency: transitive+ description:+ name: leak_tracker_testing+ sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"+ url: "https://pub.dev"+ source: hosted+ version: "3.0.1"+ lints:+ dependency: transitive+ description:+ name: lints+ sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7+ url: "https://pub.dev"+ source: hosted+ version: "5.1.1"+ logging:+ dependency: transitive+ description:+ name: logging+ sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61+ url: "https://pub.dev"+ source: hosted+ version: "1.3.0"+ matcher:+ dependency: transitive+ description:+ name: matcher+ sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2+ url: "https://pub.dev"+ source: hosted+ version: "0.12.17"+ material_color_utilities:+ dependency: transitive+ description:+ name: material_color_utilities+ sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec+ url: "https://pub.dev"+ source: hosted+ version: "0.11.1"+ meta:+ dependency: transitive+ description:+ name: meta+ sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c+ url: "https://pub.dev"+ source: hosted+ version: "1.16.0"+ mime:+ dependency: transitive+ description:+ name: mime+ sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"+ url: "https://pub.dev"+ source: hosted+ version: "2.0.0"+ modal_bottom_sheet:+ dependency: "direct main"+ description:+ name: modal_bottom_sheet+ sha256: eac66ef8cb0461bf069a38c5eb0fa728cee525a531a8304bd3f7b2185407c67e+ url: "https://pub.dev"+ source: hosted+ version: "3.0.0"+ package_info_plus:+ dependency: transitive+ description:+ name: package_info_plus+ sha256: "7976bfe4c583170d6cdc7077e3237560b364149fcd268b5f53d95a991963b191"+ url: "https://pub.dev"+ source: hosted+ version: "8.3.0"+ package_info_plus_platform_interface:+ dependency: transitive+ description:+ name: package_info_plus_platform_interface+ sha256: "6c935fb612dff8e3cc9632c2b301720c77450a126114126ffaafe28d2e87956c"+ url: "https://pub.dev"+ source: hosted+ version: "3.2.0"+ path:+ dependency: transitive+ description:+ name: path+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"+ url: "https://pub.dev"+ source: hosted+ version: "1.9.1"+ path_provider:+ dependency: transitive+ description:+ name: path_provider+ sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.5"+ path_provider_android:+ dependency: transitive+ description:+ name: path_provider_android+ sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9+ url: "https://pub.dev"+ source: hosted+ version: "2.2.17"+ path_provider_foundation:+ dependency: transitive+ description:+ name: path_provider_foundation+ sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.1"+ path_provider_linux:+ dependency: transitive+ description:+ name: path_provider_linux+ sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279+ url: "https://pub.dev"+ source: hosted+ version: "2.2.1"+ path_provider_platform_interface:+ dependency: transitive+ description:+ name: path_provider_platform_interface+ sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.2"+ path_provider_windows:+ dependency: transitive+ description:+ name: path_provider_windows+ sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7+ url: "https://pub.dev"+ source: hosted+ version: "2.3.0"+ platform:+ dependency: transitive+ description:+ name: platform+ sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"+ url: "https://pub.dev"+ source: hosted+ version: "3.1.6"+ plugin_platform_interface:+ dependency: transitive+ description:+ name: plugin_platform_interface+ sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.8"+ pointycastle:+ dependency: transitive+ description:+ name: pointycastle+ sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"+ url: "https://pub.dev"+ source: hosted+ version: "3.9.1"+ posix:+ dependency: transitive+ description:+ name: posix+ sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"+ url: "https://pub.dev"+ source: hosted+ version: "6.0.3"+ screen_retriever:+ dependency: transitive+ description:+ name: screen_retriever+ sha256: "570dbc8e4f70bac451e0efc9c9bb19fa2d6799a11e6ef04f946d7886d2e23d0c"+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ screen_retriever_linux:+ dependency: transitive+ description:+ name: screen_retriever_linux+ sha256: f7f8120c92ef0784e58491ab664d01efda79a922b025ff286e29aa123ea3dd18+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ screen_retriever_macos:+ dependency: transitive+ description:+ name: screen_retriever_macos+ sha256: "71f956e65c97315dd661d71f828708bd97b6d358e776f1a30d5aa7d22d78a149"+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ screen_retriever_platform_interface:+ dependency: transitive+ description:+ name: screen_retriever_platform_interface+ sha256: ee197f4581ff0d5608587819af40490748e1e39e648d7680ecf95c05197240c0+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ screen_retriever_windows:+ dependency: transitive+ description:+ name: screen_retriever_windows+ sha256: "449ee257f03ca98a57288ee526a301a430a344a161f9202b4fcc38576716fe13"+ url: "https://pub.dev"+ source: hosted+ version: "0.2.0"+ sentry:+ dependency: transitive+ description:+ name: sentry+ sha256: "599701ca0693a74da361bc780b0752e1abc98226cf5095f6b069648116c896bb"+ url: "https://pub.dev"+ source: hosted+ version: "8.14.2"+ sentry_flutter:+ dependency: transitive+ description:+ name: sentry_flutter+ sha256: "5ba2cf40646a77d113b37a07bd69f61bb3ec8a73cbabe5537b05a7c89d2656f8"+ url: "https://pub.dev"+ source: hosted+ version: "8.14.2"+ share_plus:+ dependency: transitive+ description:+ name: share_plus+ sha256: fce43200aa03ea87b91ce4c3ac79f0cecd52e2a7a56c7a4185023c271fbfa6da+ url: "https://pub.dev"+ source: hosted+ version: "10.1.4"+ share_plus_platform_interface:+ dependency: transitive+ description:+ name: share_plus_platform_interface+ sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b+ url: "https://pub.dev"+ source: hosted+ version: "5.0.2"+ shared_preferences:+ dependency: "direct main"+ description:+ name: shared_preferences+ sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"+ url: "https://pub.dev"+ source: hosted+ version: "2.5.3"+ shared_preferences_android:+ dependency: transitive+ description:+ name: shared_preferences_android+ sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.10"+ shared_preferences_foundation:+ dependency: transitive+ description:+ name: shared_preferences_foundation+ sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"+ url: "https://pub.dev"+ source: hosted+ version: "2.5.4"+ shared_preferences_linux:+ dependency: transitive+ description:+ name: shared_preferences_linux+ sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.1"+ shared_preferences_platform_interface:+ dependency: transitive+ description:+ name: shared_preferences_platform_interface+ sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.1"+ shared_preferences_web:+ dependency: transitive+ description:+ name: shared_preferences_web+ sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019+ url: "https://pub.dev"+ source: hosted+ version: "2.4.3"+ shared_preferences_windows:+ dependency: transitive+ description:+ name: shared_preferences_windows+ sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.1"+ sky_engine:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ sodium:+ dependency: transitive+ description:+ name: sodium+ sha256: d9830a388e37c82891888e64cfd4c6764fa3ac716bed80ac6eab89ee42c3cd76+ url: "https://pub.dev"+ source: hosted+ version: "2.3.1+1"+ sodium_libs:+ dependency: transitive+ description:+ name: sodium_libs+ sha256: aa764acd6ccc6113e119c2d99471aeeb4637a9a501639549b297d3a143ff49b3+ url: "https://pub.dev"+ source: hosted+ version: "2.2.1+6"+ source_span:+ dependency: transitive+ description:+ name: source_span+ sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"+ url: "https://pub.dev"+ source: hosted+ version: "1.10.1"+ sprintf:+ dependency: transitive+ description:+ name: sprintf+ sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.0"+ stack_trace:+ dependency: transitive+ description:+ name: stack_trace+ sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"+ url: "https://pub.dev"+ source: hosted+ version: "1.12.1"+ stream_channel:+ dependency: transitive+ description:+ name: stream_channel+ sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.4"+ string_scanner:+ dependency: transitive+ description:+ name: string_scanner+ sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"+ url: "https://pub.dev"+ source: hosted+ version: "1.4.1"+ synchronized:+ dependency: transitive+ description:+ name: synchronized+ sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0+ url: "https://pub.dev"+ source: hosted+ version: "3.4.0"+ term_glyph:+ dependency: transitive+ description:+ name: term_glyph+ sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"+ url: "https://pub.dev"+ source: hosted+ version: "1.2.2"+ test_api:+ dependency: transitive+ description:+ name: test_api+ sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd+ url: "https://pub.dev"+ source: hosted+ version: "0.7.4"+ tuple:+ dependency: transitive+ description:+ name: tuple+ sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151+ url: "https://pub.dev"+ source: hosted+ version: "2.0.2"+ typed_data:+ dependency: transitive+ description:+ name: typed_data+ sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ url_launcher:+ dependency: transitive+ description:+ name: url_launcher+ sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8+ url: "https://pub.dev"+ source: hosted+ version: "6.3.2"+ url_launcher_android:+ dependency: transitive+ description:+ name: url_launcher_android+ sha256: "8582d7f6fe14d2652b4c45c9b6c14c0b678c2af2d083a11b604caeba51930d79"+ url: "https://pub.dev"+ source: hosted+ version: "6.3.16"+ url_launcher_ios:+ dependency: transitive+ description:+ name: url_launcher_ios+ sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"+ url: "https://pub.dev"+ source: hosted+ version: "6.3.3"+ url_launcher_linux:+ dependency: transitive+ description:+ name: url_launcher_linux+ sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"+ url: "https://pub.dev"+ source: hosted+ version: "3.2.1"+ url_launcher_macos:+ dependency: transitive+ description:+ name: url_launcher_macos+ sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"+ url: "https://pub.dev"+ source: hosted+ version: "3.2.2"+ url_launcher_platform_interface:+ dependency: transitive+ description:+ name: url_launcher_platform_interface+ sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"+ url: "https://pub.dev"+ source: hosted+ version: "2.3.2"+ url_launcher_web:+ dependency: transitive+ description:+ name: url_launcher_web+ sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.1"+ url_launcher_windows:+ dependency: transitive+ description:+ name: url_launcher_windows+ sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"+ url: "https://pub.dev"+ source: hosted+ version: "3.1.4"+ uuid:+ dependency: transitive+ description:+ name: uuid+ sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff+ url: "https://pub.dev"+ source: hosted+ version: "4.5.1"+ vector_math:+ dependency: transitive+ description:+ name: vector_math+ sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.4"+ vm_service:+ dependency: transitive+ description:+ name: vm_service+ sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02+ url: "https://pub.dev"+ source: hosted+ version: "15.0.0"+ web:+ dependency: transitive+ description:+ name: web+ sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.1"+ win32:+ dependency: transitive+ description:+ name: win32+ sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"+ url: "https://pub.dev"+ source: hosted+ version: "5.14.0"+ win32_registry:+ dependency: transitive+ description:+ name: win32_registry+ sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.5"+ window_manager:+ dependency: "direct main"+ description:+ name: window_manager+ sha256: "7eb6d6c4164ec08e1bf978d6e733f3cebe792e2a23fb07cbca25c2872bfdbdcd"+ url: "https://pub.dev"+ source: hosted+ version: "0.5.1"+ xdg_directories:+ dependency: transitive+ description:+ name: xdg_directories+ sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"+sdks:+ dart: ">=3.8.0 <4.0.0"+ flutter: ">=3.29.0"diff --git a/mobile/packages/ui/pubspec.yaml b/mobile/packages/ui/pubspec.yamlnew file mode 100644index 0000000000..e501e11fad--- /dev/null+++ b/mobile/packages/ui/pubspec.yaml@@ -0,0 +1,35 @@+name: ente_ui+description: A Flutter package containing shared UI components, themes, and utilities for Ente apps+version: 1.0.0+publish_to: none++environment:+ sdk: ">=3.0.0 <4.0.0"+ flutter: ">=1.17.0"++dependencies:+ flutter:+ sdk: flutter+ dio: ^5.8.0+1+ ente_base:+ path: ../../packages/base+ ente_configuration:+ path: ../../packages/configuration+ ente_logging:+ path: ../../packages/logging+ ente_strings:+ path: ../../packages/strings+ ente_utils:+ path: ../../packages/utils+ flutter_inappwebview: ^6.1.5+ fluttertoast: ^8.1.1+ modal_bottom_sheet: ^3.0.0+ shared_preferences: ^2.5.3+ window_manager: ^0.5.0++dev_dependencies:+ flutter_test:+ sdk: flutter+ flutter_lints: ^5.0.0++flutter: