π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add ente components catalog package (#10436)
aman-pilot70fc57224f07
diff --git a/mobile/packages/ente_components/analysis_options.yaml b/mobile/packages/ente_components/analysis_options.yamlnew file mode 100644index 0000000000..777fe57b55--- /dev/null+++ b/mobile/packages/ente_components/analysis_options.yaml@@ -0,0 +1,2 @@+include: ../../analysis_options.yaml+diff --git a/mobile/packages/ente_components/example/.gitignore b/mobile/packages/ente_components/example/.gitignorenew file mode 100644index 0000000000..79c113f9b5--- /dev/null+++ b/mobile/packages/ente_components/example/.gitignore@@ -0,0 +1,45 @@+# Miscellaneous+*.class+*.log+*.pyc+*.swp+.DS_Store+.atom/+.build/+.buildlog/+.history+.svn/+.swiftpm/+migrate_working_dir/++# IntelliJ related+*.iml+*.ipr+*.iws+.idea/++# The .vscode folder contains launch configuration and tasks you configure in+# VS Code which you may wish to be included in version control, so this line+# is commented out by default.+#.vscode/++# Flutter/Dart/Pub related+**/doc/api/+**/ios/Flutter/.last_build_id+.dart_tool/+.flutter-plugins+.flutter-plugins-dependencies+.pub-cache/+.pub/+/build/++# Symbolication related+app.*.symbols++# Obfuscation related+app.*.map.json++# Android Studio will place build artifacts here+/android/app/debug+/android/app/profile+/android/app/releasediff --git a/mobile/packages/ente_components/example/.metadata b/mobile/packages/ente_components/example/.metadatanew file mode 100644index 0000000000..7450c36ac3--- /dev/null+++ b/mobile/packages/ente_components/example/.metadata@@ -0,0 +1,33 @@+# This file tracks properties of this Flutter project.+# Used by Flutter tool to assess capabilities and perform upgrades etc.+#+# This file should be version controlled and should not be manually edited.++version:+ revision: "edada7c56edf4a183c1735310e123c7f923584f1"+ channel: "[user-branch]"++project_type: app++# Tracks metadata for the flutter migrate command+migration:+ platforms:+ - platform: root+ create_revision: edada7c56edf4a183c1735310e123c7f923584f1+ base_revision: edada7c56edf4a183c1735310e123c7f923584f1+ - platform: android+ create_revision: edada7c56edf4a183c1735310e123c7f923584f1+ base_revision: edada7c56edf4a183c1735310e123c7f923584f1+ - platform: ios+ create_revision: edada7c56edf4a183c1735310e123c7f923584f1+ base_revision: edada7c56edf4a183c1735310e123c7f923584f1++ # User provided section++ # List of Local paths (relative to this file) that should be+ # ignored by the migrate tool.+ #+ # Files that are not part of the templates will be ignored by default.+ unmanaged_files:+ - 'lib/main.dart'+ - 'ios/Runner.xcodeproj/project.pbxproj'diff --git a/mobile/packages/ente_components/example/README.md b/mobile/packages/ente_components/example/README.mdnew file mode 100644index 0000000000..c282f1a962--- /dev/null+++ b/mobile/packages/ente_components/example/README.md@@ -0,0 +1,3 @@+# Components catalog++Standalone Flutter catalog for visually checking the component package.diff --git a/mobile/packages/ente_components/example/analysis_options.yaml b/mobile/packages/ente_components/example/analysis_options.yamlnew file mode 100644index 0000000000..0b3ba8ea89--- /dev/null+++ b/mobile/packages/ente_components/example/analysis_options.yaml@@ -0,0 +1,2 @@+include: ../../../analysis_options.yaml+diff --git a/mobile/packages/ente_components/example/android/.gitignore b/mobile/packages/ente_components/example/android/.gitignorenew file mode 100644index 0000000000..be3943c96d--- /dev/null+++ b/mobile/packages/ente_components/example/android/.gitignore@@ -0,0 +1,14 @@+gradle-wrapper.jar+/.gradle+/captures/+/gradlew+/gradlew.bat+/local.properties+GeneratedPluginRegistrant.java+.cxx/++# Remember to never publicly share your keystore.+# See https://flutter.dev/to/reference-keystore+key.properties+**/*.keystore+**/*.jksdiff --git a/mobile/packages/ente_components/example/android/app/build.gradle.kts b/mobile/packages/ente_components/example/android/app/build.gradle.ktsnew file mode 100644index 0000000000..9a67fd1c4e--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/build.gradle.kts@@ -0,0 +1,38 @@+plugins {+ id("com.android.application")+ id("kotlin-android")+ id("dev.flutter.flutter-gradle-plugin")+}++android {+ namespace = "io.ente.ente_components_catalog"+ compileSdk = flutter.compileSdkVersion+ ndkVersion = flutter.ndkVersion++ compileOptions {+ sourceCompatibility = JavaVersion.VERSION_11+ targetCompatibility = JavaVersion.VERSION_11+ }++ kotlinOptions {+ jvmTarget = JavaVersion.VERSION_11.toString()+ }++ defaultConfig {+ applicationId = "io.ente.ente_components_catalog"+ minSdk = flutter.minSdkVersion+ targetSdk = flutter.targetSdkVersion+ versionCode = flutter.versionCode+ versionName = flutter.versionName+ }++ buildTypes {+ release {+ signingConfig = signingConfigs.getByName("debug")+ }+ }+}++flutter {+ source = "../.."+}diff --git a/mobile/packages/ente_components/example/android/app/src/debug/AndroidManifest.xml b/mobile/packages/ente_components/example/android/app/src/debug/AndroidManifest.xmlnew file mode 100644index 0000000000..399f6981d5--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/debug/AndroidManifest.xml@@ -0,0 +1,7 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android">+ <!-- The INTERNET permission is required for development. Specifically,+ the Flutter tool needs it to communicate with the running application+ to allow setting breakpoints, to provide hot reload, etc.+ -->+ <uses-permission android:name="android.permission.INTERNET"/>+</manifest>diff --git a/mobile/packages/ente_components/example/android/app/src/main/AndroidManifest.xml b/mobile/packages/ente_components/example/android/app/src/main/AndroidManifest.xmlnew file mode 100644index 0000000000..583a826e76--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/AndroidManifest.xml@@ -0,0 +1,45 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android">+ <application+ android:label="ente_components_catalog"+ android:name="${applicationName}"+ android:icon="@mipmap/ic_launcher">+ <activity+ android:name=".MainActivity"+ android:exported="true"+ android:launchMode="singleTop"+ android:taskAffinity=""+ android:theme="@style/LaunchTheme"+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"+ android:hardwareAccelerated="true"+ android:windowSoftInputMode="adjustResize">+ <!-- Specifies an Android theme to apply to this Activity as soon as+ the Android process has started. This theme is visible to the user+ while the Flutter UI initializes. After that, this theme continues+ to determine the Window background behind the Flutter UI. -->+ <meta-data+ android:name="io.flutter.embedding.android.NormalTheme"+ android:resource="@style/NormalTheme"+ />+ <intent-filter>+ <action android:name="android.intent.action.MAIN"/>+ <category android:name="android.intent.category.LAUNCHER"/>+ </intent-filter>+ </activity>+ <!-- Don't delete the meta-data below.+ This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->+ <meta-data+ android:name="flutterEmbedding"+ android:value="2" />+ </application>+ <!-- Required to query activities that can process text, see:+ https://developer.android.com/training/package-visibility and+ https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.++ In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->+ <queries>+ <intent>+ <action android:name="android.intent.action.PROCESS_TEXT"/>+ <data android:mimeType="text/plain"/>+ </intent>+ </queries>+</manifest>diff --git a/mobile/packages/ente_components/example/android/app/src/main/kotlin/io/ente/ente_components_catalog/MainActivity.kt b/mobile/packages/ente_components/example/android/app/src/main/kotlin/io/ente/ente_components_catalog/MainActivity.ktnew file mode 100644index 0000000000..c1d7378163--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/kotlin/io/ente/ente_components_catalog/MainActivity.kt@@ -0,0 +1,5 @@+package io.ente.ente_components_catalog++import io.flutter.embedding.android.FlutterActivity++class MainActivity : FlutterActivity()diff --git a/mobile/packages/ente_components/example/android/app/src/main/res/drawable-v21/launch_background.xml b/mobile/packages/ente_components/example/android/app/src/main/res/drawable-v21/launch_background.xmlnew file mode 100644index 0000000000..f74085f3f6--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/res/drawable-v21/launch_background.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Modify this file to customize your launch splash screen -->+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">+ <item android:drawable="?android:colorBackground" />++ <!-- You can insert your own image assets here -->+ <!-- <item>+ <bitmap+ android:gravity="center"+ android:src="@mipmap/launch_image" />+ </item> -->+</layer-list>diff --git a/mobile/packages/ente_components/example/android/app/src/main/res/drawable/launch_background.xml b/mobile/packages/ente_components/example/android/app/src/main/res/drawable/launch_background.xmlnew file mode 100644index 0000000000..304732f884--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/res/drawable/launch_background.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Modify this file to customize your launch splash screen -->+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">+ <item android:drawable="@android:color/white" />++ <!-- You can insert your own image assets here -->+ <!-- <item>+ <bitmap+ android:gravity="center"+ android:src="@mipmap/launch_image" />+ </item> -->+</layer-list>diff --git a/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngnew file mode 100644index 0000000000..db77bb4b7bBinary files /dev/null and b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differdiff --git a/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngnew file mode 100644index 0000000000..17987b79bbBinary files /dev/null and b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differdiff --git a/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngnew file mode 100644index 0000000000..09d4391482Binary files /dev/null and b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differdiff --git a/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngnew file mode 100644index 0000000000..d5f1c8d34eBinary files /dev/null and b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differdiff --git a/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngnew file mode 100644index 0000000000..4d6372eebdBinary files /dev/null and b/mobile/packages/ente_components/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differdiff --git a/mobile/packages/ente_components/example/android/app/src/main/res/values-night/styles.xml b/mobile/packages/ente_components/example/android/app/src/main/res/values-night/styles.xmlnew file mode 100644index 0000000000..06952be745--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/res/values-night/styles.xml@@ -0,0 +1,18 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->+ <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">+ <!-- Show a splash screen on the activity. Automatically removed when+ the Flutter engine draws its first frame -->+ <item name="android:windowBackground">@drawable/launch_background</item>+ </style>+ <!-- Theme applied to the Android Window as soon as the process has started.+ This theme determines the color of the Android Window while your+ Flutter UI initializes, as well as behind your Flutter UI while its+ running.++ This Theme is only used starting with V2 of Flutter's Android embedding. -->+ <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">+ <item name="android:windowBackground">?android:colorBackground</item>+ </style>+</resources>diff --git a/mobile/packages/ente_components/example/android/app/src/main/res/values/styles.xml b/mobile/packages/ente_components/example/android/app/src/main/res/values/styles.xmlnew file mode 100644index 0000000000..cb1ef88056--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/main/res/values/styles.xml@@ -0,0 +1,18 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->+ <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">+ <!-- Show a splash screen on the activity. Automatically removed when+ the Flutter engine draws its first frame -->+ <item name="android:windowBackground">@drawable/launch_background</item>+ </style>+ <!-- Theme applied to the Android Window as soon as the process has started.+ This theme determines the color of the Android Window while your+ Flutter UI initializes, as well as behind your Flutter UI while its+ running.++ This Theme is only used starting with V2 of Flutter's Android embedding. -->+ <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">+ <item name="android:windowBackground">?android:colorBackground</item>+ </style>+</resources>diff --git a/mobile/packages/ente_components/example/android/app/src/profile/AndroidManifest.xml b/mobile/packages/ente_components/example/android/app/src/profile/AndroidManifest.xmlnew file mode 100644index 0000000000..399f6981d5--- /dev/null+++ b/mobile/packages/ente_components/example/android/app/src/profile/AndroidManifest.xml@@ -0,0 +1,7 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android">+ <!-- The INTERNET permission is required for development. Specifically,+ the Flutter tool needs it to communicate with the running application+ to allow setting breakpoints, to provide hot reload, etc.+ -->+ <uses-permission android:name="android.permission.INTERNET"/>+</manifest>diff --git a/mobile/packages/ente_components/example/android/build.gradle.kts b/mobile/packages/ente_components/example/android/build.gradle.ktsnew file mode 100644index 0000000000..89176ef44e--- /dev/null+++ b/mobile/packages/ente_components/example/android/build.gradle.kts@@ -0,0 +1,21 @@+allprojects {+ repositories {+ google()+ mavenCentral()+ }+}++val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()+rootProject.layout.buildDirectory.value(newBuildDir)++subprojects {+ val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)+ project.layout.buildDirectory.value(newSubprojectBuildDir)+}+subprojects {+ project.evaluationDependsOn(":app")+}++tasks.register<Delete>("clean") {+ delete(rootProject.layout.buildDirectory)+}diff --git a/mobile/packages/ente_components/example/android/gradle.properties b/mobile/packages/ente_components/example/android/gradle.propertiesnew file mode 100644index 0000000000..f018a61817--- /dev/null+++ b/mobile/packages/ente_components/example/android/gradle.properties@@ -0,0 +1,3 @@+org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError+android.useAndroidX=true+android.enableJetifier=truediff --git a/mobile/packages/ente_components/example/android/gradle/wrapper/gradle-wrapper.properties b/mobile/packages/ente_components/example/android/gradle/wrapper/gradle-wrapper.propertiesnew file mode 100644index 0000000000..ac3b47926e--- /dev/null+++ b/mobile/packages/ente_components/example/android/gradle/wrapper/gradle-wrapper.properties@@ -0,0 +1,5 @@+distributionBase=GRADLE_USER_HOME+distributionPath=wrapper/dists+zipStoreBase=GRADLE_USER_HOME+zipStorePath=wrapper/dists+distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zipdiff --git a/mobile/packages/ente_components/example/android/settings.gradle.kts b/mobile/packages/ente_components/example/android/settings.gradle.ktsnew file mode 100644index 0000000000..ab39a10a29--- /dev/null+++ b/mobile/packages/ente_components/example/android/settings.gradle.kts@@ -0,0 +1,25 @@+pluginManagement {+ val flutterSdkPath = run {+ val properties = java.util.Properties()+ file("local.properties").inputStream().use { properties.load(it) }+ val flutterSdkPath = properties.getProperty("flutter.sdk")+ require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }+ flutterSdkPath+ }++ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")++ repositories {+ google()+ mavenCentral()+ gradlePluginPortal()+ }+}++plugins {+ id("dev.flutter.flutter-plugin-loader") version "1.0.0"+ id("com.android.application") version "8.7.3" apply false+ id("org.jetbrains.kotlin.android") version "2.1.0" apply false+}++include(":app")diff --git a/mobile/packages/ente_components/example/ios/.gitignore b/mobile/packages/ente_components/example/ios/.gitignorenew file mode 100644index 0000000000..7a7f9873ad--- /dev/null+++ b/mobile/packages/ente_components/example/ios/.gitignore@@ -0,0 +1,34 @@+**/dgph+*.mode1v3+*.mode2v3+*.moved-aside+*.pbxuser+*.perspectivev3+**/*sync/+.sconsign.dblite+.tags*+**/.vagrant/+**/DerivedData/+Icon?+**/Pods/+**/.symlinks/+profile+xcuserdata+**/.generated/+Flutter/App.framework+Flutter/Flutter.framework+Flutter/Flutter.podspec+Flutter/Generated.xcconfig+Flutter/ephemeral/+Flutter/app.flx+Flutter/app.zip+Flutter/flutter_assets/+Flutter/flutter_export_environment.sh+ServiceDefinitions.json+Runner/GeneratedPluginRegistrant.*++# Exceptions to above rules.+!default.mode1v3+!default.mode2v3+!default.pbxuser+!default.perspectivev3diff --git a/mobile/packages/ente_components/example/ios/Flutter/AppFrameworkInfo.plist b/mobile/packages/ente_components/example/ios/Flutter/AppFrameworkInfo.plistnew file mode 100644index 0000000000..7c56964006--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Flutter/AppFrameworkInfo.plist@@ -0,0 +1,26 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>CFBundleDevelopmentRegion</key>+ <string>en</string>+ <key>CFBundleExecutable</key>+ <string>App</string>+ <key>CFBundleIdentifier</key>+ <string>io.flutter.flutter.app</string>+ <key>CFBundleInfoDictionaryVersion</key>+ <string>6.0</string>+ <key>CFBundleName</key>+ <string>App</string>+ <key>CFBundlePackageType</key>+ <string>FMWK</string>+ <key>CFBundleShortVersionString</key>+ <string>1.0</string>+ <key>CFBundleSignature</key>+ <string>????</string>+ <key>CFBundleVersion</key>+ <string>1.0</string>+ <key>MinimumOSVersion</key>+ <string>12.0</string>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfig b/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfignew file mode 100644index 0000000000..592ceee85b--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfig@@ -0,0 +1 @@+#include "Generated.xcconfig"diff --git a/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfig b/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfignew file mode 100644index 0000000000..592ceee85b--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfig@@ -0,0 +1 @@+#include "Generated.xcconfig"diff --git a/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.pbxproj b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.pbxprojnew file mode 100644index 0000000000..4bf164ac7e--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.pbxproj@@ -0,0 +1,616 @@+// !$*UTF8*$!+{+ archiveVersion = 1;+ classes = {+ };+ objectVersion = 54;+ objects = {++/* Begin PBXBuildFile section */+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };+/* End PBXBuildFile section */++/* Begin PBXContainerItemProxy section */+ 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {+ isa = PBXContainerItemProxy;+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;+ proxyType = 1;+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;+ remoteInfo = Runner;+ };+/* End PBXContainerItemProxy section */++/* Begin PBXCopyFilesBuildPhase section */+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {+ isa = PBXCopyFilesBuildPhase;+ buildActionMask = 2147483647;+ dstPath = "";+ dstSubfolderSpec = 10;+ files = (+ );+ name = "Embed Frameworks";+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXCopyFilesBuildPhase section */++/* Begin PBXFileReference section */+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };+ 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };+/* End PBXFileReference section */++/* Begin PBXFrameworksBuildPhase section */+ 97C146EB1CF9000F007C117D /* Frameworks */ = {+ isa = PBXFrameworksBuildPhase;+ buildActionMask = 2147483647;+ files = (+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXFrameworksBuildPhase section */++/* Begin PBXGroup section */+ 331C8082294A63A400263BE5 /* RunnerTests */ = {+ isa = PBXGroup;+ children = (+ 331C807B294A618700263BE5 /* RunnerTests.swift */,+ );+ path = RunnerTests;+ sourceTree = "<group>";+ };+ 9740EEB11CF90186004384FC /* Flutter */ = {+ isa = PBXGroup;+ children = (+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,+ );+ name = Flutter;+ sourceTree = "<group>";+ };+ 97C146E51CF9000F007C117D = {+ isa = PBXGroup;+ children = (+ 9740EEB11CF90186004384FC /* Flutter */,+ 97C146F01CF9000F007C117D /* Runner */,+ 97C146EF1CF9000F007C117D /* Products */,+ 331C8082294A63A400263BE5 /* RunnerTests */,+ );+ sourceTree = "<group>";+ };+ 97C146EF1CF9000F007C117D /* Products */ = {+ isa = PBXGroup;+ children = (+ 97C146EE1CF9000F007C117D /* Runner.app */,+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */,+ );+ name = Products;+ sourceTree = "<group>";+ };+ 97C146F01CF9000F007C117D /* Runner */ = {+ isa = PBXGroup;+ children = (+ 97C146FA1CF9000F007C117D /* Main.storyboard */,+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,+ 97C147021CF9000F007C117D /* Info.plist */,+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,+ );+ path = Runner;+ sourceTree = "<group>";+ };+/* End PBXGroup section */++/* Begin PBXNativeTarget section */+ 331C8080294A63A400263BE5 /* RunnerTests */ = {+ isa = PBXNativeTarget;+ buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;+ buildPhases = (+ 331C807D294A63A400263BE5 /* Sources */,+ 331C807F294A63A400263BE5 /* Resources */,+ );+ buildRules = (+ );+ dependencies = (+ 331C8086294A63A400263BE5 /* PBXTargetDependency */,+ );+ name = RunnerTests;+ productName = RunnerTests;+ productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;+ productType = "com.apple.product-type.bundle.unit-test";+ };+ 97C146ED1CF9000F007C117D /* Runner */ = {+ isa = PBXNativeTarget;+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;+ buildPhases = (+ 9740EEB61CF901F6004384FC /* Run Script */,+ 97C146EA1CF9000F007C117D /* Sources */,+ 97C146EB1CF9000F007C117D /* Frameworks */,+ 97C146EC1CF9000F007C117D /* Resources */,+ 9705A1C41CF9048500538489 /* Embed Frameworks */,+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,+ );+ buildRules = (+ );+ dependencies = (+ );+ name = Runner;+ productName = Runner;+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;+ productType = "com.apple.product-type.application";+ };+/* End PBXNativeTarget section */++/* Begin PBXProject section */+ 97C146E61CF9000F007C117D /* Project object */ = {+ isa = PBXProject;+ attributes = {+ BuildIndependentTargetsInParallel = YES;+ LastUpgradeCheck = 1510;+ ORGANIZATIONNAME = "";+ TargetAttributes = {+ 331C8080294A63A400263BE5 = {+ CreatedOnToolsVersion = 14.0;+ TestTargetID = 97C146ED1CF9000F007C117D;+ };+ 97C146ED1CF9000F007C117D = {+ CreatedOnToolsVersion = 7.3.1;+ LastSwiftMigration = 1100;+ };+ };+ };+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;+ compatibilityVersion = "Xcode 9.3";+ developmentRegion = en;+ hasScannedForEncodings = 0;+ knownRegions = (+ en,+ Base,+ );+ mainGroup = 97C146E51CF9000F007C117D;+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;+ projectDirPath = "";+ projectRoot = "";+ targets = (+ 97C146ED1CF9000F007C117D /* Runner */,+ 331C8080294A63A400263BE5 /* RunnerTests */,+ );+ };+/* End PBXProject section */++/* Begin PBXResourcesBuildPhase section */+ 331C807F294A63A400263BE5 /* Resources */ = {+ isa = PBXResourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+ 97C146EC1CF9000F007C117D /* Resources */ = {+ isa = PBXResourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXResourcesBuildPhase section */++/* Begin PBXShellScriptBuildPhase section */+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {+ isa = PBXShellScriptBuildPhase;+ alwaysOutOfDate = 1;+ buildActionMask = 2147483647;+ files = (+ );+ inputPaths = (+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",+ );+ name = "Thin Binary";+ outputPaths = (+ );+ runOnlyForDeploymentPostprocessing = 0;+ shellPath = /bin/sh;+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";+ };+ 9740EEB61CF901F6004384FC /* Run Script */ = {+ isa = PBXShellScriptBuildPhase;+ alwaysOutOfDate = 1;+ buildActionMask = 2147483647;+ files = (+ );+ inputPaths = (+ );+ name = "Run Script";+ outputPaths = (+ );+ runOnlyForDeploymentPostprocessing = 0;+ shellPath = /bin/sh;+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";+ };+/* End PBXShellScriptBuildPhase section */++/* Begin PBXSourcesBuildPhase section */+ 331C807D294A63A400263BE5 /* Sources */ = {+ isa = PBXSourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+ 97C146EA1CF9000F007C117D /* Sources */ = {+ isa = PBXSourcesBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXSourcesBuildPhase section */++/* Begin PBXTargetDependency section */+ 331C8086294A63A400263BE5 /* PBXTargetDependency */ = {+ isa = PBXTargetDependency;+ target = 97C146ED1CF9000F007C117D /* Runner */;+ targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;+ };+/* End PBXTargetDependency section */++/* Begin PBXVariantGroup section */+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {+ isa = PBXVariantGroup;+ children = (+ 97C146FB1CF9000F007C117D /* Base */,+ );+ name = Main.storyboard;+ sourceTree = "<group>";+ };+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {+ isa = PBXVariantGroup;+ children = (+ 97C147001CF9000F007C117D /* Base */,+ );+ name = LaunchScreen.storyboard;+ sourceTree = "<group>";+ };+/* End PBXVariantGroup section */++/* Begin XCBuildConfiguration section */+ 249021D3217E4FDB00AE95B9 /* Profile */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ ALWAYS_SEARCH_USER_PATHS = NO;+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;+ CLANG_ANALYZER_NONNULL = YES;+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";+ CLANG_CXX_LIBRARY = "libc++";+ CLANG_ENABLE_MODULES = YES;+ CLANG_ENABLE_OBJC_ARC = YES;+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;+ CLANG_WARN_BOOL_CONVERSION = YES;+ CLANG_WARN_COMMA = YES;+ CLANG_WARN_CONSTANT_CONVERSION = YES;+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;+ CLANG_WARN_EMPTY_BODY = YES;+ CLANG_WARN_ENUM_CONVERSION = YES;+ CLANG_WARN_INFINITE_RECURSION = YES;+ CLANG_WARN_INT_CONVERSION = YES;+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;+ CLANG_WARN_STRICT_PROTOTYPES = YES;+ CLANG_WARN_SUSPICIOUS_MOVE = YES;+ CLANG_WARN_UNREACHABLE_CODE = YES;+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";+ COPY_PHASE_STRIP = NO;+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";+ ENABLE_NS_ASSERTIONS = NO;+ ENABLE_STRICT_OBJC_MSGSEND = YES;+ ENABLE_USER_SCRIPT_SANDBOXING = NO;+ GCC_C_LANGUAGE_STANDARD = gnu99;+ GCC_NO_COMMON_BLOCKS = YES;+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;+ GCC_WARN_UNDECLARED_SELECTOR = YES;+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;+ GCC_WARN_UNUSED_FUNCTION = YES;+ GCC_WARN_UNUSED_VARIABLE = YES;+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;+ MTL_ENABLE_DEBUG_INFO = NO;+ SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = iphoneos;+ TARGETED_DEVICE_FAMILY = "1,2";+ VALIDATE_PRODUCT = YES;+ };+ name = Profile;+ };+ 249021D4217E4FDB00AE95B9 /* Profile */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;+ buildSettings = {+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;+ CLANG_ENABLE_MODULES = YES;+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";+ ENABLE_BITCODE = NO;+ INFOPLIST_FILE = Runner/Info.plist;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";+ SWIFT_VERSION = 5.0;+ VERSIONING_SYSTEM = "apple-generic";+ };+ name = Profile;+ };+ 331C8088294A63A400263BE5 /* Debug */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ BUNDLE_LOADER = "$(TEST_HOST)";+ CODE_SIGN_STYLE = Automatic;+ CURRENT_PROJECT_VERSION = 1;+ GENERATE_INFOPLIST_FILE = YES;+ MARKETING_VERSION = 1.0;+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog.RunnerTests;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";+ SWIFT_VERSION = 5.0;+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";+ };+ name = Debug;+ };+ 331C8089294A63A400263BE5 /* Release */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ BUNDLE_LOADER = "$(TEST_HOST)";+ CODE_SIGN_STYLE = Automatic;+ CURRENT_PROJECT_VERSION = 1;+ GENERATE_INFOPLIST_FILE = YES;+ MARKETING_VERSION = 1.0;+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog.RunnerTests;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_VERSION = 5.0;+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";+ };+ name = Release;+ };+ 331C808A294A63A400263BE5 /* Profile */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ BUNDLE_LOADER = "$(TEST_HOST)";+ CODE_SIGN_STYLE = Automatic;+ CURRENT_PROJECT_VERSION = 1;+ GENERATE_INFOPLIST_FILE = YES;+ MARKETING_VERSION = 1.0;+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog.RunnerTests;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_VERSION = 5.0;+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";+ };+ name = Profile;+ };+ 97C147031CF9000F007C117D /* Debug */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ ALWAYS_SEARCH_USER_PATHS = NO;+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;+ CLANG_ANALYZER_NONNULL = YES;+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";+ CLANG_CXX_LIBRARY = "libc++";+ CLANG_ENABLE_MODULES = YES;+ CLANG_ENABLE_OBJC_ARC = YES;+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;+ CLANG_WARN_BOOL_CONVERSION = YES;+ CLANG_WARN_COMMA = YES;+ CLANG_WARN_CONSTANT_CONVERSION = YES;+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;+ CLANG_WARN_EMPTY_BODY = YES;+ CLANG_WARN_ENUM_CONVERSION = YES;+ CLANG_WARN_INFINITE_RECURSION = YES;+ CLANG_WARN_INT_CONVERSION = YES;+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;+ CLANG_WARN_STRICT_PROTOTYPES = YES;+ CLANG_WARN_SUSPICIOUS_MOVE = YES;+ CLANG_WARN_UNREACHABLE_CODE = YES;+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";+ COPY_PHASE_STRIP = NO;+ DEBUG_INFORMATION_FORMAT = dwarf;+ ENABLE_STRICT_OBJC_MSGSEND = YES;+ ENABLE_TESTABILITY = YES;+ ENABLE_USER_SCRIPT_SANDBOXING = NO;+ GCC_C_LANGUAGE_STANDARD = gnu99;+ GCC_DYNAMIC_NO_PIC = NO;+ GCC_NO_COMMON_BLOCKS = YES;+ GCC_OPTIMIZATION_LEVEL = 0;+ GCC_PREPROCESSOR_DEFINITIONS = (+ "DEBUG=1",+ "$(inherited)",+ );+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;+ GCC_WARN_UNDECLARED_SELECTOR = YES;+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;+ GCC_WARN_UNUSED_FUNCTION = YES;+ GCC_WARN_UNUSED_VARIABLE = YES;+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;+ MTL_ENABLE_DEBUG_INFO = YES;+ ONLY_ACTIVE_ARCH = YES;+ SDKROOT = iphoneos;+ TARGETED_DEVICE_FAMILY = "1,2";+ };+ name = Debug;+ };+ 97C147041CF9000F007C117D /* Release */ = {+ isa = XCBuildConfiguration;+ buildSettings = {+ ALWAYS_SEARCH_USER_PATHS = NO;+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;+ CLANG_ANALYZER_NONNULL = YES;+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";+ CLANG_CXX_LIBRARY = "libc++";+ CLANG_ENABLE_MODULES = YES;+ CLANG_ENABLE_OBJC_ARC = YES;+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;+ CLANG_WARN_BOOL_CONVERSION = YES;+ CLANG_WARN_COMMA = YES;+ CLANG_WARN_CONSTANT_CONVERSION = YES;+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;+ CLANG_WARN_EMPTY_BODY = YES;+ CLANG_WARN_ENUM_CONVERSION = YES;+ CLANG_WARN_INFINITE_RECURSION = YES;+ CLANG_WARN_INT_CONVERSION = YES;+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;+ CLANG_WARN_STRICT_PROTOTYPES = YES;+ CLANG_WARN_SUSPICIOUS_MOVE = YES;+ CLANG_WARN_UNREACHABLE_CODE = YES;+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";+ COPY_PHASE_STRIP = NO;+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";+ ENABLE_NS_ASSERTIONS = NO;+ ENABLE_STRICT_OBJC_MSGSEND = YES;+ ENABLE_USER_SCRIPT_SANDBOXING = NO;+ GCC_C_LANGUAGE_STANDARD = gnu99;+ GCC_NO_COMMON_BLOCKS = YES;+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;+ GCC_WARN_UNDECLARED_SELECTOR = YES;+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;+ GCC_WARN_UNUSED_FUNCTION = YES;+ GCC_WARN_UNUSED_VARIABLE = YES;+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;+ MTL_ENABLE_DEBUG_INFO = NO;+ SDKROOT = iphoneos;+ SUPPORTED_PLATFORMS = iphoneos;+ SWIFT_COMPILATION_MODE = wholemodule;+ SWIFT_OPTIMIZATION_LEVEL = "-O";+ TARGETED_DEVICE_FAMILY = "1,2";+ VALIDATE_PRODUCT = YES;+ };+ name = Release;+ };+ 97C147061CF9000F007C117D /* Debug */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;+ buildSettings = {+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;+ CLANG_ENABLE_MODULES = YES;+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";+ ENABLE_BITCODE = NO;+ INFOPLIST_FILE = Runner/Info.plist;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";+ SWIFT_VERSION = 5.0;+ VERSIONING_SYSTEM = "apple-generic";+ };+ name = Debug;+ };+ 97C147071CF9000F007C117D /* Release */ = {+ isa = XCBuildConfiguration;+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;+ buildSettings = {+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;+ CLANG_ENABLE_MODULES = YES;+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";+ ENABLE_BITCODE = NO;+ INFOPLIST_FILE = Runner/Info.plist;+ LD_RUNPATH_SEARCH_PATHS = (+ "$(inherited)",+ "@executable_path/Frameworks",+ );+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.enteComponentsCatalog;+ PRODUCT_NAME = "$(TARGET_NAME)";+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";+ SWIFT_VERSION = 5.0;+ VERSIONING_SYSTEM = "apple-generic";+ };+ name = Release;+ };+/* End XCBuildConfiguration section */++/* Begin XCConfigurationList section */+ 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {+ isa = XCConfigurationList;+ buildConfigurations = (+ 331C8088294A63A400263BE5 /* Debug */,+ 331C8089294A63A400263BE5 /* Release */,+ 331C808A294A63A400263BE5 /* Profile */,+ );+ defaultConfigurationIsVisible = 0;+ defaultConfigurationName = Release;+ };+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {+ isa = XCConfigurationList;+ buildConfigurations = (+ 97C147031CF9000F007C117D /* Debug */,+ 97C147041CF9000F007C117D /* Release */,+ 249021D3217E4FDB00AE95B9 /* Profile */,+ );+ defaultConfigurationIsVisible = 0;+ defaultConfigurationName = Release;+ };+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {+ isa = XCConfigurationList;+ buildConfigurations = (+ 97C147061CF9000F007C117D /* Debug */,+ 97C147071CF9000F007C117D /* Release */,+ 249021D4217E4FDB00AE95B9 /* Profile */,+ );+ defaultConfigurationIsVisible = 0;+ defaultConfigurationName = Release;+ };+/* End XCConfigurationList section */+ };+ rootObject = 97C146E61CF9000F007C117D /* Project object */;+}diff --git a/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedatanew file mode 100644index 0000000000..919434a625--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata@@ -0,0 +1,7 @@+<?xml version="1.0" encoding="UTF-8"?>+<Workspace+ version = "1.0">+ <FileRef+ location = "self:">+ </FileRef>+</Workspace>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistnew file mode 100644index 0000000000..18d981003d--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>IDEDidComputeMac32BitWarning</key>+ <true/>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsnew file mode 100644index 0000000000..f9b0d7c5ea--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>PreviewsEnabled</key>+ <false/>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemenew file mode 100644index 0000000000..e3773d42e2--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme@@ -0,0 +1,101 @@+<?xml version="1.0" encoding="UTF-8"?>+<Scheme+ LastUpgradeVersion = "1510"+ version = "1.3">+ <BuildAction+ parallelizeBuildables = "YES"+ buildImplicitDependencies = "YES">+ <BuildActionEntries>+ <BuildActionEntry+ buildForTesting = "YES"+ buildForRunning = "YES"+ buildForProfiling = "YES"+ buildForArchiving = "YES"+ buildForAnalyzing = "YES">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildActionEntry>+ </BuildActionEntries>+ </BuildAction>+ <TestAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"+ shouldUseLaunchSchemeArgsEnv = "YES">+ <MacroExpansion>+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </MacroExpansion>+ <Testables>+ <TestableReference+ skipped = "NO"+ parallelizable = "YES">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "331C8080294A63A400263BE5"+ BuildableName = "RunnerTests.xctest"+ BlueprintName = "RunnerTests"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </TestableReference>+ </Testables>+ </TestAction>+ <LaunchAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"+ launchStyle = "0"+ useCustomWorkingDirectory = "NO"+ ignoresPersistentStateOnLaunch = "NO"+ debugDocumentVersioning = "YES"+ debugServiceExtension = "internal"+ enableGPUValidationMode = "1"+ allowLocationSimulation = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ </LaunchAction>+ <ProfileAction+ buildConfiguration = "Profile"+ shouldUseLaunchSchemeArgsEnv = "YES"+ savedToolIdentifier = ""+ useCustomWorkingDirectory = "NO"+ debugDocumentVersioning = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ </ProfileAction>+ <AnalyzeAction+ buildConfiguration = "Debug">+ </AnalyzeAction>+ <ArchiveAction+ buildConfiguration = "Release"+ revealArchiveInOrganizer = "YES">+ </ArchiveAction>+</Scheme>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/contents.xcworkspacedatanew file mode 100644index 0000000000..1d526a16ed--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/contents.xcworkspacedata@@ -0,0 +1,7 @@+<?xml version="1.0" encoding="UTF-8"?>+<Workspace+ version = "1.0">+ <FileRef+ location = "group:Runner.xcodeproj">+ </FileRef>+</Workspace>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistnew file mode 100644index 0000000000..18d981003d--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>IDEDidComputeMac32BitWarning</key>+ <true/>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsnew file mode 100644index 0000000000..f9b0d7c5ea--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings@@ -0,0 +1,8 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>PreviewsEnabled</key>+ <false/>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Runner/AppDelegate.swift b/mobile/packages/ente_components/example/ios/Runner/AppDelegate.swiftnew file mode 100644index 0000000000..626664468b--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/AppDelegate.swift@@ -0,0 +1,13 @@+import Flutter+import UIKit++@main+@objc class AppDelegate: FlutterAppDelegate {+ override func application(+ _ application: UIApplication,+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?+ ) -> Bool {+ GeneratedPluginRegistrant.register(with: self)+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)+ }+}diff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.jsonnew file mode 100644index 0000000000..d36b1fab2d--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json@@ -0,0 +1,122 @@+{+ "images" : [+ {+ "size" : "20x20",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "20x20",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "3x"+ },+ {+ "size" : "29x29",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "1x"+ },+ {+ "size" : "29x29",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "29x29",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "3x"+ },+ {+ "size" : "40x40",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "40x40",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "3x"+ },+ {+ "size" : "60x60",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "60x60",+ "idiom" : "iphone",+ "filename" : "[email protected]",+ "scale" : "3x"+ },+ {+ "size" : "20x20",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "1x"+ },+ {+ "size" : "20x20",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "29x29",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "1x"+ },+ {+ "size" : "29x29",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "40x40",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "1x"+ },+ {+ "size" : "40x40",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "76x76",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "1x"+ },+ {+ "size" : "76x76",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "83.5x83.5",+ "idiom" : "ipad",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "size" : "1024x1024",+ "idiom" : "ios-marketing",+ "filename" : "[email protected]",+ "scale" : "1x"+ }+ ],+ "info" : {+ "version" : 1,+ "author" : "xcode"+ }+}diff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..dc9ada4725Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..7353c41ecfBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..797d452e45Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..6ed2d933e1Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..4cd7b0099cBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..fe730945a0Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..321773cd85Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..797d452e45Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..502f463a9bBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..0ec3034392Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..0ec3034392Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..e9f5fea27cBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..84ac32ae7dBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..8953cba090Binary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]new file mode 100644index 0000000000..0467bf12aaBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.jsonnew file mode 100644index 0000000000..0bedcf2fd4--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json@@ -0,0 +1,23 @@+{+ "images" : [+ {+ "idiom" : "universal",+ "filename" : "LaunchImage.png",+ "scale" : "1x"+ },+ {+ "idiom" : "universal",+ "filename" : "[email protected]",+ "scale" : "2x"+ },+ {+ "idiom" : "universal",+ "filename" : "[email protected]",+ "scale" : "3x"+ }+ ],+ "info" : {+ "version" : 1,+ "author" : "xcode"+ }+}diff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.pngnew file mode 100644index 0000000000..9da19eacadBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected]new file mode 100644index 0000000000..9da19eacadBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected]new file mode 100644index 0000000000..9da19eacadBinary files /dev/null and b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] differdiff --git a/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.mdnew file mode 100644index 0000000000..89c2725b70--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md@@ -0,0 +1,5 @@+# Launch Screen Assets++You can customize the launch screen with your own desired assets by replacing the image files in this directory.++You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.\ No newline at end of filediff --git a/mobile/packages/ente_components/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/mobile/packages/ente_components/example/ios/Runner/Base.lproj/LaunchScreen.storyboardnew file mode 100644index 0000000000..f2e259c7c9--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Base.lproj/LaunchScreen.storyboard@@ -0,0 +1,37 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">+ <dependencies>+ <deployment identifier="iOS"/>+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>+ </dependencies>+ <scenes>+ <!--View Controller-->+ <scene sceneID="EHf-IW-A2E">+ <objects>+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">+ <layoutGuides>+ <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>+ <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>+ </layoutGuides>+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>+ <subviews>+ <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">+ </imageView>+ </subviews>+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>+ <constraints>+ <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>+ <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>+ </constraints>+ </view>+ </viewController>+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>+ </objects>+ <point key="canvasLocation" x="53" y="375"/>+ </scene>+ </scenes>+ <resources>+ <image name="LaunchImage" width="168" height="185"/>+ </resources>+</document>diff --git a/mobile/packages/ente_components/example/ios/Runner/Base.lproj/Main.storyboard b/mobile/packages/ente_components/example/ios/Runner/Base.lproj/Main.storyboardnew file mode 100644index 0000000000..f3c28516fb--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Base.lproj/Main.storyboard@@ -0,0 +1,26 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">+ <dependencies>+ <deployment identifier="iOS"/>+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>+ </dependencies>+ <scenes>+ <!--Flutter View Controller-->+ <scene sceneID="tne-QT-ifu">+ <objects>+ <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">+ <layoutGuides>+ <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>+ <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>+ </layoutGuides>+ <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>+ </view>+ </viewController>+ <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>+ </objects>+ </scene>+ </scenes>+</document>diff --git a/mobile/packages/ente_components/example/ios/Runner/Info.plist b/mobile/packages/ente_components/example/ios/Runner/Info.plistnew file mode 100644index 0000000000..4899826feb--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Info.plist@@ -0,0 +1,49 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>CFBundleDevelopmentRegion</key>+ <string>$(DEVELOPMENT_LANGUAGE)</string>+ <key>CFBundleDisplayName</key>+ <string>Ente Components Catalog</string>+ <key>CFBundleExecutable</key>+ <string>$(EXECUTABLE_NAME)</string>+ <key>CFBundleIdentifier</key>+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>+ <key>CFBundleInfoDictionaryVersion</key>+ <string>6.0</string>+ <key>CFBundleName</key>+ <string>ente_components_catalog</string>+ <key>CFBundlePackageType</key>+ <string>APPL</string>+ <key>CFBundleShortVersionString</key>+ <string>$(FLUTTER_BUILD_NAME)</string>+ <key>CFBundleSignature</key>+ <string>????</string>+ <key>CFBundleVersion</key>+ <string>$(FLUTTER_BUILD_NUMBER)</string>+ <key>LSRequiresIPhoneOS</key>+ <true/>+ <key>UILaunchStoryboardName</key>+ <string>LaunchScreen</string>+ <key>UIMainStoryboardFile</key>+ <string>Main</string>+ <key>UISupportedInterfaceOrientations</key>+ <array>+ <string>UIInterfaceOrientationPortrait</string>+ <string>UIInterfaceOrientationLandscapeLeft</string>+ <string>UIInterfaceOrientationLandscapeRight</string>+ </array>+ <key>UISupportedInterfaceOrientations~ipad</key>+ <array>+ <string>UIInterfaceOrientationPortrait</string>+ <string>UIInterfaceOrientationPortraitUpsideDown</string>+ <string>UIInterfaceOrientationLandscapeLeft</string>+ <string>UIInterfaceOrientationLandscapeRight</string>+ </array>+ <key>CADisableMinimumFrameDurationOnPhone</key>+ <true/>+ <key>UIApplicationSupportsIndirectInputEvents</key>+ <true/>+</dict>+</plist>diff --git a/mobile/packages/ente_components/example/ios/Runner/Runner-Bridging-Header.h b/mobile/packages/ente_components/example/ios/Runner/Runner-Bridging-Header.hnew file mode 100644index 0000000000..308a2a560b--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Runner/Runner-Bridging-Header.h@@ -0,0 +1 @@+#import "GeneratedPluginRegistrant.h"diff --git a/mobile/packages/ente_components/example/ios/RunnerTests/RunnerTests.swift b/mobile/packages/ente_components/example/ios/RunnerTests/RunnerTests.swiftnew file mode 100644index 0000000000..e2b04d8a2b--- /dev/null+++ b/mobile/packages/ente_components/example/ios/RunnerTests/RunnerTests.swift@@ -0,0 +1,11 @@+import Flutter+import UIKit+import XCTest++class RunnerTests: XCTestCase {++ func testRunnerTargetLoads() {+ XCTAssertTrue(true)+ }++}diff --git a/mobile/packages/ente_components/example/lib/main.dart b/mobile/packages/ente_components/example/lib/main.dartnew file mode 100644index 0000000000..590333f734--- /dev/null+++ b/mobile/packages/ente_components/example/lib/main.dart@@ -0,0 +1,2925 @@+import 'package:ente_components/ente_components.dart';+import 'package:flutter/gestures.dart';+import 'package:flutter/material.dart';+import 'package:hugeicons/hugeicons.dart';++typedef HugeIconData = List<List<dynamic>>;++void main() {+ runApp(const ComponentsCatalogApp());+}++class ComponentsCatalogApp extends StatefulWidget {+ const ComponentsCatalogApp({super.key});++ @override+ State<ComponentsCatalogApp> createState() => _ComponentsCatalogAppState();+}++class _ComponentsCatalogAppState extends State<ComponentsCatalogApp> {+ ThemeMode _themeMode = ThemeMode.light;+ EnteApp _appTheme = EnteApp.photos;+ double _textScale = 1;+ Duration? _lastPointerUpAt;+ Offset? _lastPointerUpPosition;++ @override+ void initState() {+ super.initState();+ GestureBinding.instance.pointerRouter.addGlobalRoute(_handlePointerEvent);+ }++ @override+ void dispose() {+ GestureBinding.instance.pointerRouter.removeGlobalRoute(+ _handlePointerEvent,+ );+ super.dispose();+ }++ void _setThemeMode(ThemeMode mode) {+ setState(() => _themeMode = mode);+ }++ void _setTextScale(double scale) {+ setState(() => _textScale = scale);+ }++ void _handlePointerEvent(PointerEvent event) {+ if (event is! PointerUpEvent) {+ return;+ }++ final now = event.timeStamp;+ final lastPointerUpAt = _lastPointerUpAt;+ final lastPointerUpPosition = _lastPointerUpPosition;+ final isDoubleTap = lastPointerUpAt != null &&+ lastPointerUpPosition != null &&+ now - lastPointerUpAt <= const Duration(milliseconds: 320) &&+ (event.position - lastPointerUpPosition).distance <= 48;++ _lastPointerUpAt = isDoubleTap ? null : now;+ _lastPointerUpPosition = isDoubleTap ? null : event.position;++ if (isDoubleTap) {+ _cycleAppTheme();+ }+ }++ void _cycleAppTheme() {+ final nextTheme = switch (_appTheme) {+ EnteApp.photos => EnteApp.locker,+ EnteApp.locker => EnteApp.auth,+ EnteApp.auth => EnteApp.photos,+ };+ setState(() => _appTheme = nextTheme);+ }++ @override+ Widget build(BuildContext context) {+ return MaterialApp(+ debugShowCheckedModeBanner: false,+ title: 'Components',+ theme: ComponentTheme.lightTheme(app: _appTheme),+ darkTheme: ComponentTheme.darkTheme(app: _appTheme),+ themeMode: _themeMode,+ builder: (context, child) {+ final mediaQuery = MediaQuery.of(context);+ return MediaQuery(+ data: mediaQuery.copyWith(+ textScaler: TextScaler.linear(_textScale),+ ),+ child: child ?? const SizedBox.shrink(),+ );+ },+ home: CatalogHome(+ themeMode: _themeMode,+ textScale: _textScale,+ onThemeModeChanged: _setThemeMode,+ onTextScaleChanged: _setTextScale,+ ),+ );+ }+}++class CatalogHome extends StatefulWidget {+ const CatalogHome({+ super.key,+ required this.themeMode,+ required this.textScale,+ required this.onThemeModeChanged,+ required this.onTextScaleChanged,+ });++ final ThemeMode themeMode;+ final double textScale;+ final ValueChanged<ThemeMode> onThemeModeChanged;+ final ValueChanged<double> onTextScaleChanged;++ @override+ State<CatalogHome> createState() => _CatalogHomeState();+}++class _CatalogHomeState extends State<CatalogHome> {+ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final sections = _sections();++ return Scaffold(+ appBar: AppBarComponent(+ title: 'Components',+ leading: Builder(+ builder: (context) {+ return IconButtonComponent(+ tooltip: 'Settings',+ variant: IconButtonComponentVariant.unfilled,+ onPressed: () => Scaffold.of(context).openDrawer(),+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedMenu01),+ );+ },+ ),+ actions: [+ Builder(+ builder: (context) {+ return IconButtonComponent(+ tooltip: 'Text scale',+ variant: IconButtonComponentVariant.unfilled,+ onPressed: () => Scaffold.of(context).openEndDrawer(),+ icon: const _CatalogHugeIcon(+ HugeIcons.strokeRoundedTextFont,+ ),+ );+ },+ ),+ _CatalogThemeCycleButton(+ themeMode: widget.themeMode,+ onChanged: widget.onThemeModeChanged,+ ),+ ],+ ),+ drawer: const CatalogSettingsDrawer(),+ endDrawer: CatalogTextScaleDrawer(+ textScale: widget.textScale,+ onTextScaleChanged: widget.onTextScaleChanged,+ ),+ body: ListView(+ padding: const EdgeInsets.all(Spacing.lg),+ children: [+ for (final section in sections) ...[+ _CatalogSectionTile(+ section: section,+ themeMode: widget.themeMode,+ textScale: widget.textScale,+ onThemeModeChanged: widget.onThemeModeChanged,+ onTextScaleChanged: widget.onTextScaleChanged,+ ),+ if (section != sections.last) const SizedBox(height: Spacing.lg),+ ],+ ],+ ),+ backgroundColor: colors.backgroundBase,+ );+ }++ List<CatalogSection> _sections() {+ return [+ CatalogSection(+ title: 'Colours',+ icon: HugeIcons.strokeRoundedColors,+ components: const ['Color tokens'],+ previewBuilder: (_) => _ColorPreview(),+ ),+ CatalogSection(+ title: 'Text styles',+ icon: HugeIcons.strokeRoundedTextFont,+ components: const ['H1', 'H1-Bold', 'H2', 'Large', 'Body', 'Mini'],+ previewBuilder: (_) => const _TextStylesPreview(),+ ),+ CatalogSection(+ title: 'Menu Item',+ icon: HugeIcons.strokeRoundedUser,+ components: const [+ 'Default',+ 'Selected',+ 'Loading',+ 'Success',+ 'Loading only',+ 'Display only',+ 'Leading icon',+ 'No leading icon',+ 'Subtitle',+ 'No subtitle',+ 'Trailing icon',+ 'Trailing toggle',+ 'No trailing',+ 'Async state',+ 'Destructive',+ 'Long text',+ ],+ previewBuilder: (_) => const _MenuItemPreview(),+ ),+ CatalogSection(+ title: 'Buttons',+ icon: HugeIcons.strokeRoundedCursorPointer02,+ components: const ['Button', 'Icon button'],+ previewBuilder: (_) => const _ButtonMatrix(),+ ),+ CatalogSection(+ title: 'Filter chips',+ icon: HugeIcons.strokeRoundedFilter,+ components: const [+ 'Selected',+ 'Unselected',+ 'Disabled',+ 'Leading icon',+ 'Trailing icon',+ 'Face',+ ],+ previewBuilder: (_) => const _FilterChipPreview(),+ ),+ CatalogSection(+ title: 'Text input',+ icon: HugeIcons.strokeRoundedTypeCursor,+ components: const [+ 'Single-line states',+ 'Multiline states',+ 'Label',+ 'Trailing icon',+ 'Clearable',+ 'Password',+ 'Warning message',+ 'Alert message',+ 'Read only',+ 'Max length',+ ],+ previewBuilder: (_) => const _TextInputPreview(),+ ),+ CatalogSection(+ title: 'Title bar',+ icon: HugeIcons.strokeRoundedMenu01,+ components: const [+ 'Default',+ 'Home',+ 'Preserving',+ 'Partially preserved',+ 'Preserved',+ 'Syncing',+ 'Video processing',+ 'Back',+ 'Onboarding',+ 'Settings',+ 'Title topbar',+ 'Title topbar no icon',+ 'Onboarding title',+ ],+ previewBuilder: (_) => const TitleBarPreview(),+ ),+ CatalogSection(+ title: 'Header',+ icon: HugeIcons.strokeRoundedHeading,+ components: const [+ 'Title',+ 'Subtitle',+ 'Image',+ 'One action',+ 'Two actions',+ ],+ previewBuilder: (_) => const _HeaderPreview(),+ ),+ CatalogSection(+ title: 'Avatar',+ icon: HugeIcons.strokeRoundedUser,+ components: const [+ 'Sizes',+ 'Seed palette',+ 'Add contact',+ ],+ previewBuilder: (_) => const _AvatarPreview(),+ ),+ CatalogSection(+ title: 'Selection controls',+ icon: HugeIcons.strokeRoundedSlidersHorizontal,+ components: const [+ 'Checkbox',+ 'Radio',+ 'Switch',+ 'Slider',+ 'Stepper',+ ],+ previewBuilder: (_) => const _SelectionPreview(),+ ),+ ];+ }+}++class CatalogSection {+ const CatalogSection({+ required this.title,+ required this.icon,+ required this.components,+ required this.previewBuilder,+ });++ final String title;+ final HugeIconData icon;+ final List<String> components;+ final WidgetBuilder previewBuilder;+}++class CatalogSettingsDrawer extends StatelessWidget {+ const CatalogSettingsDrawer({super.key});++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Drawer(+ width: _drawerWidth(context),+ shape: const RoundedRectangleBorder(),+ backgroundColor: colors.backgroundBase,+ child: SafeArea(+ bottom: false,+ child: ListView(+ padding: const EdgeInsets.all(Spacing.lg),+ children: [+ Row(+ children: [+ IconButtonComponent(+ tooltip: 'Close settings',+ variant: IconButtonComponentVariant.unfilled,+ icon: const _CatalogHugeIcon(+ HugeIcons.strokeRoundedArrowLeft02,+ ),+ onPressed: () => Navigator.of(context).pop(),+ ),+ const SizedBox(width: Spacing.md),+ Expanded(+ child: Text(+ 'Settings',+ style: TextStyles.h1Bold.copyWith(+ color: colors.textBase,+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: Spacing.xl),+ const _SettingsMainContent(),+ ],+ ),+ ),+ );+ }+}++class CatalogTextScaleDrawer extends StatefulWidget {+ const CatalogTextScaleDrawer({+ super.key,+ required this.textScale,+ required this.onTextScaleChanged,+ });++ final double textScale;+ final ValueChanged<double> onTextScaleChanged;++ @override+ State<CatalogTextScaleDrawer> createState() => _CatalogTextScaleDrawerState();+}++class _CatalogTextScaleDrawerState extends State<CatalogTextScaleDrawer> {+ late double _textScale = widget.textScale;++ void _setTextScale(double scale) {+ setState(() => _textScale = scale);+ widget.onTextScaleChanged(scale);+ }++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Drawer(+ width: _drawerWidth(context),+ shape: const RoundedRectangleBorder(),+ backgroundColor: colors.backgroundBase,+ child: SafeArea(+ bottom: false,+ child: ListView(+ padding: const EdgeInsets.all(Spacing.lg),+ children: [+ Row(+ children: [+ Expanded(+ child: Text(+ 'Text scale',+ style: TextStyles.h1Bold.copyWith(+ color: colors.textBase,+ ),+ ),+ ),+ IconButtonComponent(+ tooltip: 'Close text scale',+ variant: IconButtonComponentVariant.unfilled,+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedCancel01),+ onPressed: () => Navigator.of(context).pop(),+ ),+ ],+ ),+ const SizedBox(height: Spacing.xl),+ _CatalogSettingsPreview(+ textScale: _textScale,+ onTextScaleChanged: _setTextScale,+ ),+ ],+ ),+ ),+ );+ }+}++double _drawerWidth(BuildContext context) {+ final width = MediaQuery.sizeOf(context).width;+ return width < 430 ? width : 430;+}++class _CatalogHugeIcon extends StatelessWidget {+ const _CatalogHugeIcon(+ this.icon, {+ this.color,+ this.size = 24,+ });++ final HugeIconData icon;+ final Color? color;+ final double size;++ @override+ Widget build(BuildContext context) {+ return HugeIcon(+ icon: icon,+ color: color ?? IconTheme.of(context).color,+ size: size,+ strokeWidth: 1.6,+ );+ }+}++class _CatalogTrailingIcon extends StatelessWidget {+ const _CatalogTrailingIcon(this.icon);++ final HugeIconData icon;++ @override+ Widget build(BuildContext context) {+ return _CatalogHugeIcon(+ icon,+ color: context.componentColors.textLight,+ size: 18,+ );+ }+}++class _CatalogThemeCycleButton extends StatelessWidget {+ const _CatalogThemeCycleButton({+ required this.themeMode,+ required this.onChanged,+ });++ final ThemeMode themeMode;+ final ValueChanged<ThemeMode> onChanged;++ ThemeMode get _nextMode {+ return switch (themeMode) {+ ThemeMode.light => ThemeMode.dark,+ ThemeMode.dark => ThemeMode.light,+ ThemeMode.system => ThemeMode.light,+ };+ }++ String get _currentLabel {+ return switch (themeMode) {+ ThemeMode.light => 'Light',+ ThemeMode.dark => 'Dark',+ ThemeMode.system => 'Light',+ };+ }++ String get _nextLabel {+ return switch (_nextMode) {+ ThemeMode.light => 'Light',+ ThemeMode.dark => 'Dark',+ ThemeMode.system => 'Light',+ };+ }++ HugeIconData get _icon {+ return switch (themeMode) {+ ThemeMode.light => HugeIcons.strokeRoundedSun01,+ ThemeMode.dark => HugeIcons.strokeRoundedMoon02,+ ThemeMode.system => HugeIcons.strokeRoundedSun01,+ };+ }++ @override+ Widget build(BuildContext context) {+ return IconButtonComponent(+ tooltip: 'Theme: $_currentLabel. Tap for $_nextLabel',+ variant: IconButtonComponentVariant.unfilled,+ icon: _CatalogHugeIcon(_icon),+ onPressed: () => onChanged(_nextMode),+ );+ }+}++class _CatalogSectionTile extends StatelessWidget {+ const _CatalogSectionTile({+ required this.section,+ required this.themeMode,+ required this.textScale,+ required this.onThemeModeChanged,+ required this.onTextScaleChanged,+ });++ final CatalogSection section;+ final ThemeMode themeMode;+ final double textScale;+ final ValueChanged<ThemeMode> onThemeModeChanged;+ final ValueChanged<double> onTextScaleChanged;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return MenuComponent(+ key: ValueKey('catalog-section-${section.title}'),+ title: section.title,+ leading: _CatalogHugeIcon(section.icon, size: 18),+ trailing: _CatalogHugeIcon(+ HugeIcons.strokeRoundedArrowRight02,+ color: colors.textLight,+ size: 18,+ ),+ onTap: () {+ Navigator.of(context).push(+ MaterialPageRoute<void>(+ builder: (_) => CatalogDetailPage(+ section: section,+ themeMode: themeMode,+ textScale: textScale,+ onThemeModeChanged: onThemeModeChanged,+ onTextScaleChanged: onTextScaleChanged,+ ),+ ),+ );+ },+ );+ }+}++class CatalogDetailPage extends StatefulWidget {+ const CatalogDetailPage({+ super.key,+ required this.section,+ required this.themeMode,+ required this.textScale,+ required this.onThemeModeChanged,+ required this.onTextScaleChanged,+ });++ final CatalogSection section;+ final ThemeMode themeMode;+ final double textScale;+ final ValueChanged<ThemeMode> onThemeModeChanged;+ final ValueChanged<double> onTextScaleChanged;++ @override+ State<CatalogDetailPage> createState() => _CatalogDetailPageState();+}++class _CatalogDetailPageState extends State<CatalogDetailPage> {+ late ThemeMode _themeMode = widget.themeMode;++ void _setThemeMode(ThemeMode mode) {+ setState(() => _themeMode = mode);+ widget.onThemeModeChanged(mode);+ }++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Scaffold(+ appBar: AppBarComponent(+ title: widget.section.title,+ leading: IconButtonComponent(+ tooltip: 'Back',+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedArrowLeft02),+ onPressed: () => Navigator.of(context).pop(),+ ),+ actions: [+ Builder(+ builder: (context) {+ return IconButtonComponent(+ tooltip: 'Text scale',+ variant: IconButtonComponentVariant.unfilled,+ onPressed: () => Scaffold.of(context).openEndDrawer(),+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedTextFont),+ );+ },+ ),+ _CatalogThemeCycleButton(+ themeMode: _themeMode,+ onChanged: _setThemeMode,+ ),+ ],+ ),+ endDrawer: CatalogTextScaleDrawer(+ textScale: widget.textScale,+ onTextScaleChanged: widget.onTextScaleChanged,+ ),+ body: ListView(+ padding: const EdgeInsets.all(Spacing.lg),+ children: [+ widget.section.previewBuilder(context),+ ],+ ),+ backgroundColor: colors.backgroundBase,+ );+ }+}++class _CatalogSettingsPreview extends StatelessWidget {+ const _CatalogSettingsPreview({+ required this.textScale,+ required this.onTextScaleChanged,+ });++ final double textScale;+ final ValueChanged<double> onTextScaleChanged;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ children: [+ Expanded(+ child: Text(+ 'Text scale',+ style: TextStyles.large.copyWith(+ color: colors.textBase,+ ),+ ),+ ),+ Text(+ '${textScale.toStringAsFixed(2)}x',+ style: TextStyles.bodyBold.copyWith(color: colors.textBase),+ ),+ ],+ ),+ SliderComponent(+ value: textScale,+ min: 0.85,+ max: 2,+ divisions: 23,+ onChanged: onTextScaleChanged,+ ),+ Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ ButtonComponent(+ label: '1.0x',+ variant: ButtonComponentVariant.secondary,+ onTap: () => onTextScaleChanged(1),+ ),+ ButtonComponent(+ label: '1.3x',+ variant: ButtonComponentVariant.secondary,+ onTap: () => onTextScaleChanged(1.3),+ ),+ ButtonComponent(+ label: '1.6x',+ variant: ButtonComponentVariant.secondary,+ onTap: () => onTextScaleChanged(1.6),+ ),+ ButtonComponent(+ label: '2.0x',+ variant: ButtonComponentVariant.secondary,+ onTap: () => onTextScaleChanged(2),+ ),+ ],+ ),+ ],+ );+ }+}++class _CatalogPreviewGroup extends StatelessWidget {+ const _CatalogPreviewGroup({+ required this.title,+ required this.child,+ });++ final String title;+ final Widget child;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.md),+ child,+ ],+ );+ }+}++class _CatalogPreviewList extends StatelessWidget {+ const _CatalogPreviewList({required this.children});++ final List<Widget> children;++ @override+ Widget build(BuildContext context) {+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ for (var index = 0; index < children.length; index++) ...[+ children[index],+ if (index != children.length - 1) const SizedBox(height: Spacing.xl),+ ],+ ],+ );+ }+}++class _SettingsMainContent extends StatelessWidget {+ const _SettingsMainContent();++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: Spacing.sm),+ child: Text(+ '[email protected]',+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.body.copyWith(color: colors.textLight),+ ),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'Account',+ icon: HugeIcons.strokeRoundedUser,+ page: _SettingsAccountPage(),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'Security',+ icon: HugeIcons.strokeRoundedSecurityCheck,+ page: _SettingsSecurityPage(),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'Appearance',+ icon: HugeIcons.strokeRoundedPaintBoard,+ page: _SettingsAppearancePage(),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'General',+ icon: HugeIcons.strokeRoundedSettings01,+ page: _SettingsGeneralPage(),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'Help and support',+ icon: HugeIcons.strokeRoundedHelpCircle,+ page: _SettingsSupportPage(),+ ),+ const SizedBox(height: Spacing.md),+ const _SettingsNavigationItem(+ title: 'About',+ icon: HugeIcons.strokeRoundedInformationCircle,+ page: _SettingsAboutPage(),+ ),+ const SizedBox(height: Spacing.xl),+ MenuComponent(+ title: 'Logout',+ leading: _CatalogHugeIcon(+ HugeIcons.strokeRoundedLogout05,+ color: colors.warning,+ ),+ trailing: _SettingsTrailingIcon(color: colors.textLight),+ ),+ const SizedBox(height: Spacing.xxl),+ Center(+ child: Text(+ 'Version 1.0.0',+ style: TextStyles.mini.copyWith(color: colors.textLight),+ ),+ ),+ ],+ );+ }+}++class _SettingsNavigationItem extends StatelessWidget {+ const _SettingsNavigationItem({+ required this.title,+ required this.icon,+ required this.page,+ });++ final String title;+ final HugeIconData icon;+ final Widget page;++ @override+ Widget build(BuildContext context) {+ return MenuComponent(+ title: title,+ leading: _CatalogHugeIcon(icon),+ trailing: const _SettingsTrailingIcon(),+ onTap: () {+ Navigator.of(context).push(+ MaterialPageRoute<void>(builder: (_) => page),+ );+ },+ );+ }+}++class _SettingsTrailingIcon extends StatelessWidget {+ const _SettingsTrailingIcon({this.color});++ final Color? color;++ @override+ Widget build(BuildContext context) {+ return _CatalogHugeIcon(+ HugeIcons.strokeRoundedArrowRight02,+ color: color ?? context.componentColors.textLight,+ size: 18,+ );+ }+}++class _SettingsExampleShell extends StatelessWidget {+ const _SettingsExampleShell({+ required this.title,+ required this.children,+ });++ final String title;+ final List<Widget> children;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Scaffold(+ appBar: AppBarComponent(+ title: title,+ leading: IconButtonComponent(+ tooltip: 'Back',+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedArrowLeft02),+ onPressed: () => Navigator.of(context).pop(),+ ),+ ),+ body: ListView(+ padding: const EdgeInsets.all(Spacing.lg),+ children: [+ for (var index = 0; index < children.length; index++) ...[+ children[index],+ if (index != children.length - 1)+ const SizedBox(height: Spacing.md),+ ],+ ],+ ),+ backgroundColor: colors.backgroundBase,+ );+ }+}++class _SettingsAccountPage extends StatelessWidget {+ const _SettingsAccountPage();++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return _SettingsExampleShell(+ title: 'Account',+ children: [+ const MenuComponent(+ title: 'Change email',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedMail01),+ trailing: _SettingsTrailingIcon(),+ ),+ const MenuComponent(+ title: 'Recovery key',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedKey01),+ trailing: _SettingsTrailingIcon(),+ ),+ const MenuComponent(+ title: 'Change password',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedSquareLock02),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Delete account',+ subtitle: 'Demo destructive row',+ leading: _CatalogHugeIcon(+ HugeIcons.strokeRoundedDelete02,+ color: colors.warning,+ ),+ trailing: _SettingsTrailingIcon(color: colors.textLight),+ ),+ ],+ );+ }+}++class _SettingsSecurityPage extends StatefulWidget {+ const _SettingsSecurityPage();++ @override+ State<_SettingsSecurityPage> createState() => _SettingsSecurityPageState();+}++class _SettingsSecurityPageState extends State<_SettingsSecurityPage> {+ bool _emailVerification = true;++ @override+ Widget build(BuildContext context) {+ return _SettingsExampleShell(+ title: 'Security',+ children: [+ MenuComponent(+ title: 'Email verification',+ leading: const _CatalogHugeIcon(HugeIcons.strokeRoundedMailLock02),+ trailing: ToggleSwitchComponent(+ selected: _emailVerification,+ onChanged: (value) {+ setState(() => _emailVerification = value);+ },+ ),+ ),+ const MenuComponent(+ title: 'Passkey',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedFingerPrint),+ trailing: _SettingsTrailingIcon(),+ ),+ const MenuComponent(+ title: 'App lock',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedLockKey),+ trailing: _SettingsTrailingIcon(),+ ),+ const MenuComponent(+ title: 'Active sessions',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedLaptop),+ trailing: _SettingsTrailingIcon(),+ ),+ ],+ );+ }+}++class _SettingsAppearancePage extends StatefulWidget {+ const _SettingsAppearancePage();++ @override+ State<_SettingsAppearancePage> createState() =>+ _SettingsAppearancePageState();+}++class _SettingsAppearancePageState extends State<_SettingsAppearancePage> {+ String _theme = 'System theme';++ @override+ Widget build(BuildContext context) {+ return _SettingsExampleShell(+ title: 'Appearance',+ children: [+ _SettingsThemeOption(+ title: 'System theme',+ icon: HugeIcons.strokeRoundedComputer,+ selected: _theme == 'System theme',+ onTap: () => _selectTheme('System theme'),+ ),+ _SettingsThemeOption(+ title: 'Light theme',+ icon: HugeIcons.strokeRoundedSun01,+ selected: _theme == 'Light theme',+ onTap: () => _selectTheme('Light theme'),+ ),+ _SettingsThemeOption(+ title: 'Dark theme',+ icon: HugeIcons.strokeRoundedMoon02,+ selected: _theme == 'Dark theme',+ onTap: () => _selectTheme('Dark theme'),+ ),+ ],+ );+ }++ void _selectTheme(String theme) {+ setState(() => _theme = theme);+ }+}++class _SettingsThemeOption extends StatelessWidget {+ const _SettingsThemeOption({+ required this.title,+ required this.icon,+ required this.selected,+ required this.onTap,+ });++ final String title;+ final HugeIconData icon;+ final bool selected;+ final VoidCallback onTap;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return MenuComponent(+ title: title,+ leading: _CatalogHugeIcon(icon),+ selected: selected,+ trailing: selected+ ? _CatalogHugeIcon(+ HugeIcons.strokeRoundedTick02,+ color: colors.primary,+ size: 18,+ )+ : null,+ onTap: onTap,+ );+ }+}++class _SettingsGeneralPage extends StatefulWidget {+ const _SettingsGeneralPage();++ @override+ State<_SettingsGeneralPage> createState() => _SettingsGeneralPageState();+}++class _SettingsGeneralPageState extends State<_SettingsGeneralPage> {+ bool _largeIcons = true;+ bool _compactMode = false;+ bool _hideCodes = true;++ @override+ Widget build(BuildContext context) {+ return _SettingsExampleShell(+ title: 'General',+ children: [+ const MenuComponent(+ title: 'Language',+ subtitle: 'English',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedLanguageSquare),+ trailing: _SettingsTrailingIcon(),+ ),+ _SettingsToggleItem(+ title: 'Show large icons',+ icon: HugeIcons.strokeRoundedImage02,+ selected: _largeIcons,+ onChanged: (value) => setState(() => _largeIcons = value),+ ),+ _SettingsToggleItem(+ title: 'Compact mode',+ icon: HugeIcons.strokeRoundedLayoutTable01,+ selected: _compactMode,+ onChanged: (value) => setState(() => _compactMode = value),+ ),+ _SettingsToggleItem(+ title: 'Hide codes',+ icon: HugeIcons.strokeRoundedViewOff,+ selected: _hideCodes,+ onChanged: (value) => setState(() => _hideCodes = value),+ ),+ ],+ );+ }+}++class _SettingsToggleItem extends StatelessWidget {+ const _SettingsToggleItem({+ required this.title,+ required this.icon,+ required this.selected,+ required this.onChanged,+ });++ final String title;+ final HugeIconData icon;+ final bool selected;+ final ValueChanged<bool> onChanged;++ @override+ Widget build(BuildContext context) {+ return MenuComponent(+ title: title,+ leading: _CatalogHugeIcon(icon),+ trailing: ToggleSwitchComponent(selected: selected, onChanged: onChanged),+ );+ }+}++class _SettingsSupportPage extends StatelessWidget {+ const _SettingsSupportPage();++ @override+ Widget build(BuildContext context) {+ return const _SettingsExampleShell(+ title: 'Help and support',+ children: [+ MenuComponent(+ title: 'Contact support',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedCustomerSupport),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Help',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedHelpCircle),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Suggest features',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedBulb),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Report a bug',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedBug02),+ trailing: _SettingsTrailingIcon(),+ ),+ ],+ );+ }+}++class _SettingsAboutPage extends StatelessWidget {+ const _SettingsAboutPage();++ @override+ Widget build(BuildContext context) {+ return const _SettingsExampleShell(+ title: 'About',+ children: [+ MenuComponent(+ title: 'Open source',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedGithub),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Privacy',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedShield01),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Terms of service',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedNote),+ trailing: _SettingsTrailingIcon(),+ ),+ MenuComponent(+ title: 'Check for updates',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedRefresh),+ trailing: _SettingsTrailingIcon(),+ ),+ ],+ );+ }+}++class _ColorPreview extends StatelessWidget {+ @override+ Widget build(BuildContext context) {+ return const _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Light palette',+ child: _ColorColumn(colors: ColorTokens.light),+ ),+ _CatalogPreviewGroup(+ title: 'Dark palette',+ child: _ColorColumn(colors: ColorTokens.dark),+ ),+ ],+ );+ }+}++class _ColorColumn extends StatelessWidget {+ const _ColorColumn({required this.colors});++ final ColorTokens colors;++ @override+ Widget build(BuildContext context) {+ return Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ _Swatch(color: colors.primary),+ _Swatch(color: colors.warning),+ _Swatch(color: colors.caution),+ _Swatch(color: colors.info),+ _Swatch(color: colors.textBase),+ _Swatch(color: colors.backgroundBase),+ _Swatch(color: colors.fillLight),+ _Swatch(color: colors.strokeDark),+ ],+ );+ }+}++class _Swatch extends StatelessWidget {+ const _Swatch({required this.color});++ final Color color;++ @override+ Widget build(BuildContext context) {+ return Container(+ width: 34,+ height: 34,+ decoration: BoxDecoration(+ color: color,+ border: Border.all(color: context.componentColors.strokeFaint),+ borderRadius: BorderRadius.circular(Radii.xs),+ ),+ );+ }+}++class _TextStylesPreview extends StatelessWidget {+ const _TextStylesPreview();++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return _CatalogPreviewGroup(+ title: 'Type scale',+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'H1 / 20 / 28 / Bold',+ style: TextStyles.h1,+ color: colors.textBase,+ ),+ const SizedBox(height: Spacing.xl),+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'H2 / 18 / 24 / Semi Bold',+ style: TextStyles.h2,+ color: colors.textBase,+ ),+ const SizedBox(height: Spacing.xl),+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'Large / 16 / 20 / Semi Bold',+ style: TextStyles.large,+ color: colors.textBase,+ ),+ const SizedBox(height: Spacing.xl),+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'Body / 14 / 20 / Medium',+ style: TextStyles.body,+ color: colors.textBase,+ ),+ const SizedBox(height: Spacing.xl),+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'Mini / 12 / 16 / Medium',+ style: TextStyles.mini,+ color: colors.textLight,+ ),+ const SizedBox(height: Spacing.xl),+ _TypeSample(+ text: 'Secure backup is ready',+ detail: 'Tiny / 10 / 12 / Medium',+ style: TextStyles.tiny,+ color: colors.textLight,+ ),+ ],+ ),+ );+ }+}++class _TypeSample extends StatelessWidget {+ const _TypeSample({+ required this.text,+ required this.detail,+ required this.style,+ required this.color,+ });++ final String text;+ final String detail;+ final TextStyle style;+ final Color color;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ text,+ style: style.copyWith(color: color),+ ),+ const SizedBox(height: Spacing.xs),+ Text(+ detail,+ style: TextStyles.mini.copyWith(color: colors.textLight),+ ),+ ],+ );+ }+}++class _ButtonMatrix extends StatelessWidget {+ const _ButtonMatrix();++ @override+ Widget build(BuildContext context) {+ return const _CatalogPreviewList(+ children: [+ ButtonStateCyclePreview(),+ _ButtonStateGroup(title: 'Default'),+ _ButtonStateGroup(+ title: 'Disabled',+ disabled: true,+ ),+ _CatalogPreviewGroup(+ title: 'Icon button',+ child: _IconButtonMatrix(),+ ),+ ],+ );+ }+}++class ButtonStateCyclePreview extends StatefulWidget {+ const ButtonStateCyclePreview({super.key});++ @override+ State<ButtonStateCyclePreview> createState() =>+ _ButtonStateCyclePreviewState();+}++class _ButtonStateCyclePreviewState extends State<ButtonStateCyclePreview> {+ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewGroup(+ title: 'State transition',+ child: ButtonComponent(+ key: const ValueKey('button-cycle'),+ label: 'Continue',+ variant: ButtonComponentVariant.primary,+ size: ButtonComponentSize.large,+ onTap: _runPreviewAction,+ ),+ );+ }++ Future<void> _runPreviewAction() {+ return Future<void>.delayed(const Duration(milliseconds: 900));+ }+}++const _buttonPreviewSpecs = <_ButtonPreviewSpec>[+ _ButtonPreviewSpec(+ type: 'Primary',+ label: 'Continue',+ variant: ButtonComponentVariant.primary,+ ),+ _ButtonPreviewSpec(+ type: 'Secondary',+ label: 'Cancel',+ variant: ButtonComponentVariant.secondary,+ ),+ _ButtonPreviewSpec(+ type: 'Neutral',+ label: 'Use recovery key',+ variant: ButtonComponentVariant.neutral,+ ),+ _ButtonPreviewSpec(+ type: 'Critical',+ label: 'Delete account',+ variant: ButtonComponentVariant.critical,+ ),+ _ButtonPreviewSpec(+ type: 'Tertiary critical',+ label: 'Remove trusted contact',+ variant: ButtonComponentVariant.tertiaryCritical,+ ),+ _ButtonPreviewSpec(+ type: 'Link button',+ label: 'Forgot password?',+ variant: ButtonComponentVariant.link,+ ),+];++class _ButtonPreviewSpec {+ const _ButtonPreviewSpec({+ required this.type,+ required this.label,+ required this.variant,+ });++ final String type;+ final String label;+ final ButtonComponentVariant variant;+}++class _ButtonStateGroup extends StatelessWidget {+ const _ButtonStateGroup({+ required this.title,+ this.disabled = false,+ });++ final String title;+ final bool disabled;++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewGroup(+ title: title,+ child: Column(+ children: [+ for (var index = 0; index < _buttonPreviewSpecs.length; index++) ...[+ _ButtonPreviewRow(+ spec: _buttonPreviewSpecs[index],+ disabled: disabled,+ ),+ if (index != _buttonPreviewSpecs.length - 1)+ const SizedBox(height: Spacing.md),+ ],+ ],+ ),+ );+ }+}++class _ButtonPreviewRow extends StatelessWidget {+ const _ButtonPreviewRow({+ required this.spec,+ required this.disabled,+ });++ final _ButtonPreviewSpec spec;+ final bool disabled;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ spec.type,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.xs),+ ButtonComponent(+ label: spec.label,+ variant: spec.variant,+ size: ButtonComponentSize.large,+ onTap: disabled ? null : () {},+ ),+ ],+ );+ }+}++class _IconButtonMatrix extends StatelessWidget {+ const _IconButtonMatrix();++ @override+ Widget build(BuildContext context) {+ const columns = [+ 'Default',+ 'Hover',+ 'Pressed',+ 'Disabled',+ 'Loading',+ 'Success',+ ];+ const rows = [+ _IconButtonPreviewRow(+ label: 'Primary',+ variant: IconButtonComponentVariant.primary,+ states: columns,+ ),+ _IconButtonPreviewRow(+ label: 'Critical',+ variant: IconButtonComponentVariant.critical,+ states: columns,+ ),+ _IconButtonPreviewRow(+ label: 'Unfilled',+ variant: IconButtonComponentVariant.unfilled,+ states: ['Default', 'Disabled', 'Loading', 'Success'],+ ),+ _IconButtonPreviewRow(+ label: 'Secondary',+ variant: IconButtonComponentVariant.secondary,+ states: ['Default', 'Disabled', 'Loading', 'Success'],+ ),+ _IconButtonPreviewRow(+ label: 'Green',+ variant: IconButtonComponentVariant.green,+ states: columns,+ ),+ _IconButtonPreviewRow(+ label: 'Circular',+ variant: IconButtonComponentVariant.circular,+ states: columns,+ ),+ ];+ final colors = context.componentColors;++ return SingleChildScrollView(+ scrollDirection: Axis.horizontal,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ children: [+ const SizedBox(width: 84),+ for (final column in columns)+ SizedBox(+ width: 76,+ child: Text(+ column,+ textAlign: TextAlign.center,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ ),+ ],+ ),+ const SizedBox(height: Spacing.sm),+ for (final row in rows) ...[+ row,+ if (row != rows.last) const SizedBox(height: Spacing.md),+ ],+ ],+ ),+ );+ }+}++class _IconButtonPreviewRow extends StatelessWidget {+ const _IconButtonPreviewRow({+ required this.label,+ required this.variant,+ required this.states,+ });++ final String label;+ final IconButtonComponentVariant variant;+ final List<String> states;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Row(+ children: [+ SizedBox(+ width: 84,+ child: Text(+ label,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ ),+ for (final state in const [+ 'Default',+ 'Hover',+ 'Pressed',+ 'Disabled',+ 'Loading',+ 'Success',+ ])+ SizedBox(+ width: 76,+ child: Center(+ child: states.contains(state)+ ? _IconButtonStatePreview(+ variant: variant,+ state: state,+ )+ : const SizedBox.square(dimension: 38),+ ),+ ),+ ],+ );+ }+}++class _IconButtonStatePreview extends StatelessWidget {+ const _IconButtonStatePreview({+ required this.variant,+ required this.state,+ });++ final IconButtonComponentVariant variant;+ final String state;++ @override+ Widget build(BuildContext context) {+ return IconButtonComponent(+ tooltip: state,+ variant: variant,+ state: switch (state) {+ 'Hover' => IconButtonComponentState.hover,+ 'Pressed' => IconButtonComponentState.pressed,+ _ => IconButtonComponentState.normal,+ },+ isLoading: state == 'Loading',+ isSuccess: state == 'Success',+ onPressed: state == 'Disabled' ? null : () {},+ icon: const _CatalogHugeIcon(+ HugeIcons.strokeRoundedAdd01,+ size: 18,+ ),+ );+ }+}++class _FilterChipPreview extends StatefulWidget {+ const _FilterChipPreview();++ @override+ State<_FilterChipPreview> createState() => _FilterChipPreviewState();+}++class _FilterChipPreviewState extends State<_FilterChipPreview> {+ final Set<String> _selected = {'Faces', 'Favorites'};++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Editable',+ child: Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ _EditableChip(+ label: 'Faces',+ selected: _selected.contains('Faces'),+ onChanged: _toggle('Faces'),+ avatar: const _FaceAvatar(seed: 0, initials: 'AR'),+ ),+ _EditableChip(+ label: 'Favorites',+ selected: _selected.contains('Favorites'),+ onChanged: _toggle('Favorites'),+ leading: const _CatalogHugeIcon(HugeIcons.strokeRoundedStar),+ ),+ _EditableChip(+ label: 'Videos',+ selected: _selected.contains('Videos'),+ onChanged: _toggle('Videos'),+ trailing:+ const _CatalogHugeIcon(HugeIcons.strokeRoundedVideo01),+ ),+ ],+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'States',+ child: Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ FilterChipComponent(+ label: 'Selected',+ state: FilterChipComponentState.selected,+ ),+ FilterChipComponent(+ label: 'Unselected',+ state: FilterChipComponentState.unselected,+ ),+ FilterChipComponent(+ label: 'Disabled',+ state: FilterChipComponentState.disabled,+ ),+ ],+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Icons',+ child: Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ FilterChipComponent(+ label: 'Albums',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.selected,+ ),+ FilterChipComponent(+ label: 'Shared',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.unselected,+ ),+ FilterChipComponent(+ label: 'Archived',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.disabled,+ ),+ FilterChipComponent(+ label: 'Recent',+ trailing: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.selected,+ ),+ FilterChipComponent(+ label: 'Places',+ trailing: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.unselected,+ ),+ FilterChipComponent(+ label: 'Hidden',+ trailing: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ state: FilterChipComponentState.disabled,+ ),+ ],+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Faces',+ child: Wrap(+ spacing: Spacing.sm,+ runSpacing: Spacing.sm,+ children: [+ FilterChipComponent(+ label: 'Aarav',+ avatar: _FaceAvatar(seed: 0, initials: 'AR'),+ state: FilterChipComponentState.selected,+ ),+ FilterChipComponent(+ label: 'Mira',+ avatar: _FaceAvatar(seed: 1, initials: 'MR'),+ state: FilterChipComponentState.unselected,+ ),+ FilterChipComponent(+ label: 'Nila',+ avatar: _FaceAvatar(seed: 2, initials: 'NS'),+ state: FilterChipComponentState.disabled,+ ),+ FilterChipComponent(+ avatar: _FaceAvatar(seed: 3, initials: 'KV'),+ state: FilterChipComponentState.selected,+ ),+ FilterChipComponent(+ avatar: _FaceAvatar(seed: 1, initials: 'MR'),+ state: FilterChipComponentState.unselected,+ ),+ FilterChipComponent(+ avatar: _FaceAvatar(seed: 2, initials: 'NS'),+ state: FilterChipComponentState.disabled,+ ),+ ],+ ),+ ),+ ],+ );+ }++ ValueChanged<bool> _toggle(String label) {+ return (selected) {+ setState(() {+ if (selected) {+ _selected.add(label);+ } else {+ _selected.remove(label);+ }+ });+ };+ }+}++class _AvatarPreview extends StatelessWidget {+ const _AvatarPreview();++ static const _sizes = [+ (label: 'Default', size: AvatarComponentSize.normal),+ (label: 'Small', size: AvatarComponentSize.small),+ (label: 'Large', size: AvatarComponentSize.large),+ (label: 'Contact (huge)', size: AvatarComponentSize.contactHuge),+ ];+ static const _colors = [+ (label: 'Yellow', color: AvatarComponentColor.yellow, initials: 'E'),+ (label: 'Green', color: AvatarComponentColor.green, initials: 'K'),+ (label: 'Orange', color: AvatarComponentColor.orange, initials: 'T'),+ (label: 'Pink', color: AvatarComponentColor.pink, initials: 'U'),+ (label: 'Purple', color: AvatarComponentColor.purple, initials: 'R'),+ (label: 'Blue', color: AvatarComponentColor.blue, initials: 'S'),+ ];++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Variants and sizes',+ child: SingleChildScrollView(+ scrollDirection: Axis.horizontal,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const _AvatarTableHeader(sizes: _sizes),+ const SizedBox(height: Spacing.lg),+ for (final item in _colors) ...[+ _AvatarTableRow(+ label: item.label,+ children: [+ for (final size in _sizes)+ AvatarComponent(+ initials: item.initials,+ color: item.color,+ size: size.size,+ ),+ ],+ ),+ if (item != _colors.last) const SizedBox(height: Spacing.md),+ ],+ const SizedBox(height: Spacing.md),+ const _AvatarTableRow(+ label: 'Add icon',+ children: [+ SizedBox.shrink(),+ SizedBox.shrink(),+ SizedBox.shrink(),+ AvatarComponent.icon(+ icon: _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ ),+ ],+ ),+ ],+ ),+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Seed palette',+ child: Wrap(+ spacing: Spacing.md,+ runSpacing: Spacing.md,+ children: [+ for (var index = 0; index < avatarLight.length; index++)+ AvatarComponent.seeded(+ initials: String.fromCharCode(65 + index % 26),+ seed: index,+ size: AvatarComponentSize.large,+ ),+ ],+ ),+ ),+ ],+ );+ }+}++class _AvatarTableHeader extends StatelessWidget {+ const _AvatarTableHeader({required this.sizes});++ final List<({String label, AvatarComponentSize size})> sizes;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Row(+ children: [+ const SizedBox(width: 92),+ for (final size in sizes)+ SizedBox(+ width: 96,+ child: Text(+ size.label,+ textAlign: TextAlign.center,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ ),+ ],+ );+ }+}++class _AvatarTableRow extends StatelessWidget {+ const _AvatarTableRow({+ required this.label,+ required this.children,+ });++ final String label;+ final List<Widget> children;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Row(+ children: [+ SizedBox(+ width: 92,+ child: Text(+ label,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ ),+ for (final child in children)+ SizedBox(+ width: 96,+ height: 64,+ child: Center(child: child),+ ),+ ],+ );+ }+}++class _EditableChip extends StatelessWidget {+ const _EditableChip({+ required this.label,+ required this.selected,+ required this.onChanged,+ this.leading,+ this.trailing,+ this.avatar,+ });++ final String label;+ final bool selected;+ final ValueChanged<bool> onChanged;+ final Widget? leading;+ final Widget? trailing;+ final Widget? avatar;++ @override+ Widget build(BuildContext context) {+ return FilterChipComponent(+ label: label,+ leading: leading,+ trailing: trailing,+ avatar: avatar,+ state: selected+ ? FilterChipComponentState.selected+ : FilterChipComponentState.unselected,+ onChanged: onChanged,+ );+ }+}++class _FaceAvatar extends StatelessWidget {+ const _FaceAvatar({+ required this.seed,+ required this.initials,+ });++ final int seed;+ final String initials;++ @override+ Widget build(BuildContext context) {+ return AvatarComponent.seeded(+ initials: initials,+ seed: seed,+ size: AvatarComponentSize.large,+ );+ }+}++class _TextInputPreview extends StatefulWidget {+ const _TextInputPreview();++ @override+ State<_TextInputPreview> createState() => _TextInputPreviewState();+}++class _TextInputPreviewState extends State<_TextInputPreview> {+ late final TextEditingController _focusedController;+ late final TextEditingController _errorController;+ late final TextEditingController _successController;+ late final TextEditingController _disabledController;+ late final TextEditingController _clearableController;+ late final TextEditingController _passwordController;+ late final TextEditingController _readOnlyController;++ @override+ void initState() {+ super.initState();+ _focusedController = TextEditingController(text: '[email protected]');+ _errorController = TextEditingController(text: 'short');+ _successController = TextEditingController(text: '482901');+ _disabledController = TextEditingController(text: '[email protected]');+ _clearableController = TextEditingController(text: 'family trip');+ _passwordController = TextEditingController(text: 'correct horse');+ _readOnlyController = TextEditingController(text: 'Mira Roy');+ }++ @override+ void dispose() {+ _focusedController.dispose();+ _errorController.dispose();+ _successController.dispose();+ _disabledController.dispose();+ _clearableController.dispose();+ _passwordController.dispose();+ _readOnlyController.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewList(+ children: [+ const _CatalogPreviewGroup(+ title: 'Normal',+ child:+ TextInputComponent(label: 'Email address', hintText: 'Hint text'),+ ),+ _CatalogPreviewGroup(+ title: 'Focused',+ child: TextInputComponent(+ controller: _focusedController,+ label: 'Email address',+ isFocused: true,+ prefix: const _CatalogHugeIcon(HugeIcons.strokeRoundedMail01),+ suffix: const _CatalogHugeIcon(HugeIcons.strokeRoundedView),+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Error',+ child: TextInputComponent(+ controller: _errorController,+ label: 'Password',+ errorText: 'Use at least 8 characters.',+ obscureText: true,+ prefix: const _CatalogHugeIcon(HugeIcons.strokeRoundedLockPassword),+ suffix: const _CatalogHugeIcon(HugeIcons.strokeRoundedView),+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Success',+ child: TextInputComponent(+ controller: _successController,+ label: 'Recovery code',+ successText: 'Recovery code verified.',+ suffix: const _CatalogHugeIcon(+ HugeIcons.strokeRoundedCheckmarkCircle01,+ ),+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Disabled',+ child: TextInputComponent(+ controller: _disabledController,+ label: 'Account email',+ enabled: false,+ prefix: const _CatalogHugeIcon(HugeIcons.strokeRoundedMail01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'No label',+ child: TextInputComponent(hintText: 'Hint text'),+ ),+ const _CatalogPreviewGroup(+ title: 'Required',+ child: TextInputComponent(+ label: 'Email address',+ hintText: '[email protected]',+ isRequired: true,+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Helper text',+ child: TextInputComponent(+ label: 'Recovery email',+ hintText: '[email protected]',+ helperText: 'Used for receipts and security alerts.',+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Prefix icon',+ child: TextInputComponent(+ label: 'Search',+ hintText: 'Search albums',+ prefix: _CatalogHugeIcon(HugeIcons.strokeRoundedSearch01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Trailing icon',+ child: TextInputComponent(+ label: 'Password',+ hintText: 'Enter password',+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedView),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Prefix and trailing icons',+ child: TextInputComponent(+ label: 'Search',+ hintText: 'Search people',+ prefix: _CatalogHugeIcon(HugeIcons.strokeRoundedSearch01),+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCancel01),+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Clearable search',+ child: TextInputComponent(+ controller: _clearableController,+ label: 'Search',+ hintText: 'Search files',+ prefix: const _CatalogHugeIcon(HugeIcons.strokeRoundedSearch01),+ isClearable: true,+ textInputAction: TextInputAction.search,+ autocorrect: false,+ enableSuggestions: false,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Password visibility',+ child: TextInputComponent(+ controller: _passwordController,+ label: 'Password',+ hintText: 'Enter password',+ obscureText: true,+ showPasswordToggle: true,+ prefix: const _CatalogHugeIcon(HugeIcons.strokeRoundedLockPassword),+ autofillHints: const [AutofillHints.password],+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Alert message',+ child: TextInputComponent(+ label: 'Recovery key',+ hintText: 'Enter recovery key',+ alertText: 'Save this key somewhere safe before continuing.',+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Read only',+ child: TextInputComponent(+ controller: _readOnlyController,+ label: 'Owner',+ readOnly: true,+ suffix: const _CatalogHugeIcon(HugeIcons.strokeRoundedLock),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Max length',+ child: TextInputComponent(+ label: 'Referral code',+ hintText: 'SUMMER2026',+ maxLength: 12,+ counterText: '',+ textCapitalization: TextCapitalization.characters,+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: label + trailing + warning message',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ errorText: 'This is an error',+ maxLines: 4,+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: label + trailing',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: label only',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: no label + trailing',+ child: TextInputComponent(+ hintText: 'Hint text',+ maxLines: 4,+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: no label',+ child: TextInputComponent(+ hintText: 'Hint text',+ maxLines: 4,+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: focused',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ isFocused: true,+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: error',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ errorText: 'This is an error',+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: success',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ successText: 'Saved',+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Multiline: disabled',+ child: TextInputComponent(+ label: 'Description',+ hintText: 'Hint text',+ maxLines: 4,+ enabled: false,+ suffix: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ ),+ ),+ ],+ );+ }+}++class TitleBarPreview extends StatelessWidget {+ const TitleBarPreview({super.key});++ @override+ Widget build(BuildContext context) {+ return const _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Default',+ child: _TitleBarSample(variant: TitleBarComponentVariant.brand),+ ),+ _CatalogPreviewGroup(+ title: 'Home',+ child: _TitleBarSample(variant: TitleBarComponentVariant.home),+ ),+ _CatalogPreviewGroup(+ title: 'Preserving',+ child: _TitleBarSample(variant: TitleBarComponentVariant.preserving),+ ),+ _CatalogPreviewGroup(+ title: 'Partially preserved',+ child: _TitleBarSample(+ variant: TitleBarComponentVariant.partiallyPreserved,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Preserved',+ child: _TitleBarSample(variant: TitleBarComponentVariant.preserved),+ ),+ _CatalogPreviewGroup(+ title: 'Syncing',+ child: _TitleBarSample(variant: TitleBarComponentVariant.syncing),+ ),+ _CatalogPreviewGroup(+ title: 'Video processing',+ child: _TitleBarSample(+ variant: TitleBarComponentVariant.videoProcessing,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Back',+ child: _TitleBarSample(variant: TitleBarComponentVariant.back),+ ),+ _CatalogPreviewGroup(+ title: 'Onboarding',+ child: _TitleBarSample(variant: TitleBarComponentVariant.onboarding),+ ),+ _CatalogPreviewGroup(+ title: 'Settings',+ child: _TitleBarSample(variant: TitleBarComponentVariant.settings),+ ),+ _CatalogPreviewGroup(+ title: 'Title topbar',+ child: _TitleBarSample(variant: TitleBarComponentVariant.titleTopbar),+ ),+ _CatalogPreviewGroup(+ title: 'Title topbar no icon',+ child: _TitleBarSample(+ variant: TitleBarComponentVariant.titleTopbarNoIcon,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Onboarding title',+ child: _TitleBarSample(+ variant: TitleBarComponentVariant.onboardingTitle,+ ),+ ),+ ],+ );+ }+}++class _TitleBarSample extends StatelessWidget {+ const _TitleBarSample({required this.variant});++ final TitleBarComponentVariant variant;++ @override+ Widget build(BuildContext context) {+ return SizedBox(+ width: double.infinity,+ child: TitleBarComponent(+ variant: variant,+ title: _title,+ leading: _leading,+ trailing: _trailing,+ statusIcon: _statusIcon,+ ),+ );+ }++ String? get _title {+ return switch (variant) {+ TitleBarComponentVariant.brand => 'Photos',+ TitleBarComponentVariant.home => 'Home',+ TitleBarComponentVariant.onboarding => 'Create account',+ TitleBarComponentVariant.titleTopbar => 'Albums',+ TitleBarComponentVariant.titleTopbarNoIcon => 'Albums',+ TitleBarComponentVariant.onboardingTitle => 'Secure backup',+ _ => null,+ };+ }++ Widget? get _leading {+ return switch (variant) {+ TitleBarComponentVariant.onboarding => null,+ _ => const _CatalogHugeIcon(HugeIcons.strokeRoundedArrowLeft02),+ };+ }++ Widget? get _trailing {+ return switch (variant) {+ TitleBarComponentVariant.home ||+ TitleBarComponentVariant.preserving ||+ TitleBarComponentVariant.partiallyPreserved ||+ TitleBarComponentVariant.preserved ||+ TitleBarComponentVariant.syncing ||+ TitleBarComponentVariant.videoProcessing =>+ const _CatalogHugeIcon(HugeIcons.strokeRoundedMoreHorizontal),+ TitleBarComponentVariant.settings ||+ TitleBarComponentVariant.titleTopbar =>+ const _CatalogHugeIcon(HugeIcons.strokeRoundedSearch01),+ _ => null,+ };+ }++ Widget? get _statusIcon {+ return switch (variant) {+ TitleBarComponentVariant.preserving ||+ TitleBarComponentVariant.partiallyPreserved ||+ TitleBarComponentVariant.preserved =>+ const _CatalogHugeIcon(HugeIcons.strokeRoundedCheckmarkCircle01),+ TitleBarComponentVariant.syncing => const _CatalogHugeIcon(+ HugeIcons.strokeRoundedRefresh,+ ),+ TitleBarComponentVariant.videoProcessing => const _CatalogHugeIcon(+ HugeIcons.strokeRoundedVideo01,+ ),+ _ => null,+ };+ }+}++class _HeaderPreview extends StatelessWidget {+ const _HeaderPreview();++ @override+ Widget build(BuildContext context) {+ return const _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Title + subtitle + two actions',+ child: _HeaderSample(+ subtitle: true,+ actionCount: 2,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Title + two actions',+ child: _HeaderSample(actionCount: 2),+ ),+ _CatalogPreviewGroup(+ title: 'Title + one action',+ child: _HeaderSample(actionCount: 1),+ ),+ _CatalogPreviewGroup(+ title: 'Title + subtitle',+ child: _HeaderSample(subtitle: true),+ ),+ _CatalogPreviewGroup(+ title: 'Title only',+ child: _HeaderSample(),+ ),+ _CatalogPreviewGroup(+ title: 'Title + subtitle + one action',+ child: _HeaderSample(+ subtitle: true,+ actionCount: 1,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Image + subtitle + two actions',+ child: _HeaderSample(+ image: true,+ subtitle: true,+ actionCount: 2,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Image + two actions',+ child: _HeaderSample(+ image: true,+ actionCount: 2,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Image + one action',+ child: _HeaderSample(+ image: true,+ actionCount: 1,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Image + subtitle',+ child: _HeaderSample(+ image: true,+ subtitle: true,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Image only',+ child: _HeaderSample(image: true),+ ),+ _CatalogPreviewGroup(+ title: 'Image + subtitle + one action',+ child: _HeaderSample(+ image: true,+ subtitle: true,+ actionCount: 1,+ ),+ ),+ ],+ );+ }+}++class _HeaderSample extends StatelessWidget {+ const _HeaderSample({+ this.image = false,+ this.subtitle = false,+ this.actionCount = 0,+ });++ final bool image;+ final bool subtitle;+ final int actionCount;++ @override+ Widget build(BuildContext context) {+ return HeaderComponent(+ title: 'Title',+ subtitle: subtitle ? 'Subtitle' : null,+ leading: image ? const _HeaderImage() : null,+ actions: [+ for (var index = 0; index < actionCount; index++)+ IconButtonComponent(+ tooltip: index == 0 ? 'Add' : 'Create',+ variant: IconButtonComponentVariant.primary,+ icon: const _CatalogHugeIcon(HugeIcons.strokeRoundedAdd01),+ onPressed: () {},+ ),+ ],+ );+ }+}++class _HeaderImage extends StatelessWidget {+ const _HeaderImage();++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return ColoredBox(+ color: colors.fillDark,+ child: Center(+ child: _CatalogHugeIcon(+ HugeIcons.strokeRoundedUser,+ color: colors.textLight,+ size: 20,+ ),+ ),+ );+ }+}++class _SelectionPreview extends StatefulWidget {+ const _SelectionPreview();++ @override+ State<_SelectionPreview> createState() => _SelectionPreviewState();+}++class _SelectionPreviewState extends State<_SelectionPreview> {+ bool _checkbox = true;+ bool _radio = true;+ bool _switch = true;+ double _slider = 0.42;+ int _stepper = 3;++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Interactive controls',+ child: Wrap(+ spacing: Spacing.xl,+ runSpacing: Spacing.md,+ children: [+ LabeledControlComponent(+ control: CheckboxComponent(+ selected: _checkbox,+ onChanged: (value) => setState(() => _checkbox = value),+ ),+ label: 'Checkbox',+ ),+ LabeledControlComponent(+ control: RadioComponent(+ selected: _radio,+ onChanged: (value) => setState(() => _radio = value),+ ),+ label: 'Radio',+ ),+ LabeledControlComponent(+ control: ToggleSwitchComponent(+ selected: _switch,+ onChanged: (value) => setState(() => _switch = value),+ ),+ label: 'Switch',+ ),+ ],+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Disabled controls',+ child: Wrap(+ spacing: Spacing.xl,+ runSpacing: Spacing.md,+ children: [+ LabeledControlComponent(+ control: CheckboxComponent(selected: true, onChanged: null),+ label: 'Selected checkbox',+ ),+ LabeledControlComponent(+ control: CheckboxComponent(selected: false, onChanged: null),+ label: 'Empty checkbox',+ ),+ LabeledControlComponent(+ control: RadioComponent(selected: true, onChanged: null),+ label: 'Selected radio',+ ),+ LabeledControlComponent(+ control:+ ToggleSwitchComponent(selected: false, onChanged: null),+ label: 'Off switch',+ ),+ ],+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Slider',+ child: SliderComponent(+ value: _slider,+ onChanged: (value) => setState(() => _slider = value),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Disabled slider',+ child: SliderComponent(value: 0.7, onChanged: null),+ ),+ _CatalogPreviewGroup(+ title: 'Stepper',+ child: StepperComponent(+ value: _stepper,+ onChanged: (value) => setState(() => _stepper = value),+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Stepper limits',+ child: Wrap(+ spacing: Spacing.lg,+ runSpacing: Spacing.md,+ children: [+ StepperComponent(value: 0, min: 0, max: 5, onChanged: null),+ StepperComponent(value: 5, min: 0, max: 5, onChanged: null),+ ],+ ),+ ),+ ],+ );+ }+}++enum _MenuItemTrailingKind {+ icon,+ toggle,+ none,+}++class _MenuItemPreview extends StatefulWidget {+ const _MenuItemPreview();++ @override+ State<_MenuItemPreview> createState() => _MenuItemPreviewState();+}++class _MenuItemPreviewState extends State<_MenuItemPreview> {+ bool _toggleSelected = true;++ @override+ Widget build(BuildContext context) {+ return _CatalogPreviewList(+ children: [+ _CatalogPreviewGroup(+ title: 'Default',+ child: _MenuItemMatrix(+ toggleSelected: _toggleSelected,+ onToggleChanged: _setToggleSelected,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Selected',+ child: _MenuItemMatrix(+ selected: true,+ toggleSelected: _toggleSelected,+ onToggleChanged: _setToggleSelected,+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Loading',+ child: _MenuItemLoadingPreview(),+ ),+ const _CatalogPreviewGroup(+ title: 'Success',+ child: _MenuItemSuccessPreview(),+ ),+ const _CatalogPreviewGroup(+ title: 'Loading only',+ child: _MenuItemLoadingOnlyPreview(),+ ),+ _CatalogPreviewGroup(+ title: 'Display only',+ child: Builder(+ builder: (context) {+ final colors = context.componentColors;+ return MenuComponent(+ title: 'Storage plan',+ subtitle: 'Gestures disabled for read-only rows',+ leading:+ const _CatalogHugeIcon(HugeIcons.strokeRoundedDatabase),+ trailing: Text(+ '2 TB',+ style: TextStyles.body.copyWith(color: colors.textLight),+ ),+ gesturesEnabled: false,+ );+ },+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Async state',+ child: MenuComponent(+ title: 'Check for updates',+ subtitle: 'Shows loading and success states',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedRefresh),+ trailing: _CatalogTrailingIcon(HugeIcons.strokeRoundedArrowRight01),+ surfaceExecutionStates: true,+ alwaysShowSuccessState: true,+ onTap: _completeAfterDelay,+ ),+ ),+ _CatalogPreviewGroup(+ title: 'Destructive',+ child: Builder(+ builder: (context) {+ final colors = context.componentColors;+ return MenuComponent(+ title: 'Delete account',+ subtitle: 'Warning color title and icon',+ leading:+ const _CatalogHugeIcon(HugeIcons.strokeRoundedDelete02),+ trailing: const _CatalogTrailingIcon(+ HugeIcons.strokeRoundedArrowRight01,+ ),+ titleColor: colors.warning,+ iconColor: colors.warning,+ onTap: () {},+ );+ },+ ),+ ),+ const _CatalogPreviewGroup(+ title: 'Long text',+ child: MenuComponent(+ title:+ 'Camera uploads from this device and shared albums waiting for review',+ subtitle:+ 'This subtitle remains one line and truncates like Photos and Locker menu rows',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedImageUpload),+ trailing: _CatalogTrailingIcon(HugeIcons.strokeRoundedArrowRight01),+ onTap: _completeAfterDelay,+ ),+ ),+ ],+ );+ }++ void _setToggleSelected(bool value) {+ setState(() => _toggleSelected = value);+ }+}++Future<void> _completeAfterDelay() {+ return Future<void>.delayed(const Duration(milliseconds: 650));+}++class _MenuItemLoadingPreview extends StatelessWidget {+ const _MenuItemLoadingPreview();++ @override+ Widget build(BuildContext context) {+ return const MenuComponent(+ title: 'Updating backup',+ subtitle: 'Tap to see the trailing loading state',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedCloudUpload),+ trailing: _CatalogTrailingIcon(HugeIcons.strokeRoundedArrowRight01),+ surfaceExecutionStates: true,+ onTap: _completeAfterDelay,+ );+ }+}++class _MenuItemLoadingOnlyPreview extends StatelessWidget {+ const _MenuItemLoadingOnlyPreview();++ @override+ Widget build(BuildContext context) {+ return const MenuComponent(+ title: 'Opening sessions',+ subtitle: 'Loading-only execution state',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedUserGroup),+ trailing: _CatalogTrailingIcon(HugeIcons.strokeRoundedArrowRight01),+ showOnlyLoadingState: true,+ onTap: _completeAfterDelay,+ );+ }+}++class _MenuItemSuccessPreview extends StatelessWidget {+ const _MenuItemSuccessPreview();++ @override+ Widget build(BuildContext context) {+ return const MenuComponent(+ title: 'Copied recovery key',+ subtitle: 'Tap to see completion replace trailing slot',+ leading: _CatalogHugeIcon(HugeIcons.strokeRoundedCopy01),+ trailing: _CatalogTrailingIcon(HugeIcons.strokeRoundedArrowRight01),+ alwaysShowSuccessState: true,+ onTap: _completeAfterDelay,+ );+ }+}++class _MenuItemMatrix extends StatelessWidget {+ const _MenuItemMatrix({+ required this.toggleSelected,+ required this.onToggleChanged,+ this.selected = false,+ });++ final bool toggleSelected;+ final ValueChanged<bool> onToggleChanged;+ final bool selected;++ @override+ Widget build(BuildContext context) {+ final trailingKinds = selected+ ? const [_MenuItemTrailingKind.icon, _MenuItemTrailingKind.none]+ : _MenuItemTrailingKind.values;+ return Wrap(+ spacing: Spacing.lg,+ runSpacing: Spacing.md,+ children: [+ for (final hasSubtitle in const [true, false])+ for (final hasLeading in const [true, false])+ for (final trailingKind in trailingKinds)+ _MenuItemExample(+ selected: selected,+ hasLeading: hasLeading,+ hasSubtitle: hasSubtitle,+ trailingKind: trailingKind,+ toggleSelected: toggleSelected,+ onToggleChanged: onToggleChanged,+ ),+ ],+ );+ }+}++class _MenuItemExample extends StatelessWidget {+ const _MenuItemExample({+ required this.selected,+ required this.hasLeading,+ required this.hasSubtitle,+ required this.trailingKind,+ required this.toggleSelected,+ required this.onToggleChanged,+ });++ final bool selected;+ final bool hasLeading;+ final bool hasSubtitle;+ final _MenuItemTrailingKind trailingKind;+ final bool toggleSelected;+ final ValueChanged<bool> onToggleChanged;++ @override+ Widget build(BuildContext context) {+ return MenuComponent(+ title: hasLeading ? 'Camera uploads' : 'Storage plan',+ subtitle: hasSubtitle ? '834 items' : null,+ leading: hasLeading+ ? const _CatalogHugeIcon(HugeIcons.strokeRoundedUser, size: 18)+ : null,+ trailing: _trailing(context),+ selected: selected,+ onTap: () {},+ );+ }++ Widget? _trailing(BuildContext context) {+ final colors = context.componentColors;+ if (selected) {+ return _CatalogHugeIcon(+ HugeIcons.strokeRoundedCheckmarkCircle02,+ color: colors.primary,+ size: 18,+ );+ }+ return switch (trailingKind) {+ _MenuItemTrailingKind.icon => const _CatalogTrailingIcon(+ HugeIcons.strokeRoundedMoreVertical,+ ),+ _MenuItemTrailingKind.toggle => ToggleSwitchComponent(+ selected: toggleSelected,+ onChanged: onToggleChanged,+ ),+ _MenuItemTrailingKind.none => null,+ };+ }+}diff --git a/mobile/packages/ente_components/example/pubspec.lock b/mobile/packages/ente_components/example/pubspec.locknew file mode 100644index 0000000000..7d1be90eb8--- /dev/null+++ b/mobile/packages/ente_components/example/pubspec.lock@@ -0,0 +1,316 @@+# Generated by pub+# See https://dart.dev/tools/pub/glossary#lockfile+packages:+ 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"+ 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"+ ente_components:+ dependency: "direct main"+ description:+ path: ".."+ relative: true+ source: path+ version: "0.1.0"+ fake_async:+ dependency: transitive+ description:+ name: fake_async+ sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"+ url: "https://pub.dev"+ source: hosted+ version: "1.3.3"+ flutter:+ dependency: "direct main"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_lints:+ dependency: "direct dev"+ description:+ name: flutter_lints+ sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"+ url: "https://pub.dev"+ source: hosted+ version: "5.0.0"+ flutter_svg:+ dependency: transitive+ description:+ name: flutter_svg+ sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95"+ url: "https://pub.dev"+ source: hosted+ version: "2.2.3"+ flutter_test:+ dependency: "direct dev"+ description: flutter+ source: sdk+ version: "0.0.0"+ http:+ dependency: transitive+ description:+ name: http+ sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"+ url: "https://pub.dev"+ source: hosted+ version: "1.6.0"+ http_parser:+ dependency: transitive+ description:+ name: http_parser+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"+ url: "https://pub.dev"+ source: hosted+ version: "4.1.2"+ hugeicons:+ dependency: "direct main"+ description:+ name: hugeicons+ sha256: d19c0e2b57ccf455dd8ef08b84da40ae6dbba898c92960a0a0ada77df7865b8a+ url: "https://pub.dev"+ source: hosted+ version: "1.1.5"+ 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"+ 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"+ path:+ dependency: transitive+ description:+ name: path+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"+ url: "https://pub.dev"+ source: hosted+ version: "1.9.1"+ path_parsing:+ dependency: transitive+ description:+ name: path_parsing+ sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"+ petitparser:+ dependency: transitive+ description:+ name: petitparser+ sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.2"+ sky_engine:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ source_span:+ dependency: transitive+ description:+ name: source_span+ sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"+ url: "https://pub.dev"+ source: hosted+ version: "1.10.1"+ 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"+ 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"+ typed_data:+ dependency: transitive+ description:+ name: typed_data+ sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ vector_graphics:+ dependency: transitive+ description:+ name: vector_graphics+ sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6+ url: "https://pub.dev"+ source: hosted+ version: "1.1.19"+ vector_graphics_codec:+ dependency: transitive+ description:+ name: vector_graphics_codec+ sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.13"+ vector_graphics_compiler:+ dependency: transitive+ description:+ name: vector_graphics_compiler+ sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc+ url: "https://pub.dev"+ source: hosted+ version: "1.1.19"+ 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"+ xml:+ dependency: transitive+ description:+ name: xml+ sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"+ url: "https://pub.dev"+ source: hosted+ version: "6.6.1"+sdks:+ dart: ">=3.8.0 <4.0.0"+ flutter: ">=3.32.0"diff --git a/mobile/packages/ente_components/example/pubspec.yaml b/mobile/packages/ente_components/example/pubspec.yamlnew file mode 100644index 0000000000..2bdb33c255--- /dev/null+++ b/mobile/packages/ente_components/example/pubspec.yaml@@ -0,0 +1,21 @@+name: ente_components_catalog+description: Visual catalog for the mobile component package.+publish_to: none++environment:+ sdk: ">=3.0.0 <4.0.0"++dependencies:+ ente_components:+ path: ..+ flutter:+ sdk: flutter+ hugeicons: 1.1.5++dev_dependencies:+ flutter_lints: 5.0.0+ flutter_test:+ sdk: flutter++flutter:+ uses-material-design: truediff --git a/mobile/packages/ente_components/example/test/smoke_test.dart b/mobile/packages/ente_components/example/test/smoke_test.dartnew file mode 100644index 0000000000..3f57fe2859--- /dev/null+++ b/mobile/packages/ente_components/example/test/smoke_test.dart@@ -0,0 +1,48 @@+import 'package:ente_components/ente_components.dart' show ComponentTheme;+import 'package:ente_components_catalog/main.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';++void main() {+ testWidgets('catalog app mounts', (tester) async {+ await tester.pumpWidget(const ComponentsCatalogApp());++ expect(find.text('Components'), findsOneWidget);+ });++ testWidgets('button transition preview surfaces loading and success', (+ tester,+ ) async {+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: const Scaffold(+ body: ButtonStateCyclePreview(),+ ),+ ),+ );++ final button = find.byKey(const ValueKey('button-cycle'));+ expect(button, findsOneWidget);+ expect(find.text('Continue'), findsOneWidget);++ await tester.tap(button);+ await tester.pump(const Duration(milliseconds: 299));++ expect(find.byKey(const ValueKey('loading')), findsNothing);++ await tester.pump(const Duration(milliseconds: 1));++ expect(find.byKey(const ValueKey('loading')), findsOneWidget);++ await tester.pump(const Duration(milliseconds: 900));+ await tester.pump();++ expect(find.byKey(const ValueKey('success')), findsOneWidget);++ await tester.pump(const Duration(seconds: 2));+ await tester.pump();++ expect(find.text('Continue'), findsOneWidget);+ });+}diff --git a/mobile/packages/ente_components/lib/components/app_bar_component.dart b/mobile/packages/ente_components/lib/components/app_bar_component.dartnew file mode 100644index 0000000000..9702840639--- /dev/null+++ b/mobile/packages/ente_components/lib/components/app_bar_component.dart@@ -0,0 +1,328 @@+import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++enum TitleBarComponentVariant {+ brand,+ home,+ preserving,+ partiallyPreserved,+ preserved,+ syncing,+ videoProcessing,+ back,+ onboarding,+ settings,+ titleTopbar,+ titleTopbarNoIcon,+ onboardingTitle,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2472-5809&m=dev+/// Section: Title Bar+/// Specs: 327px design width, 42px title/status row, centered or leading title layouts.+class TitleBarComponent extends StatelessWidget implements PreferredSizeWidget {+ const TitleBarComponent({+ super.key,+ this.variant = TitleBarComponentVariant.brand,+ this.title,+ this.statusText,+ this.leading,+ this.trailing,+ this.statusIcon,+ this.height = 42,+ this.leadingWidth = 44,+ this.trailingWidth = 44,+ });++ final TitleBarComponentVariant variant;+ final String? title;+ final String? statusText;+ final Widget? leading;+ final Widget? trailing;+ final Widget? statusIcon;+ final double height;+ final double leadingWidth;+ final double trailingWidth;++ @override+ Size get preferredSize => Size.fromHeight(height);++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final child = variant == TitleBarComponentVariant.titleTopbarNoIcon+ ? _buildLeadingTitleBar(colors)+ : _buildCenteredTitleBar(colors);++ return IconTheme(+ data: IconThemeData(color: colors.textBase, size: 24),+ child: SizedBox(height: height, child: child),+ );+ }++ Widget _buildCenteredTitleBar(ColorTokens colors) {+ return Stack(+ alignment: Alignment.center,+ children: [+ Padding(+ padding: EdgeInsets.symmetric(+ horizontal: _centerContentHorizontalPadding,+ ),+ child: ColoredBox(+ color: colors.specialScrim.withAlpha(0),+ child: Center(+ child: _centerContent(colors),+ ),+ ),+ ),+ Positioned(+ left: 0,+ top: 0,+ bottom: 0,+ child: _TitleBarSlot(+ width: leadingWidth,+ visible: _leadingVisible,+ child: leading,+ ),+ ),+ Positioned(+ right: 0,+ top: 0,+ bottom: 0,+ child: _TitleBarSlot(+ width: trailingWidth,+ visible: _trailingVisible,+ alignment: Alignment.centerRight,+ child: trailing,+ ),+ ),+ ],+ );+ }++ Widget _buildLeadingTitleBar(ColorTokens colors) {+ return Row(+ children: [+ _TitleBarSlot(+ width: leadingWidth,+ visible: _leadingVisible,+ child: leading,+ ),+ const SizedBox(width: Spacing.md),+ Expanded(+ child: Text(+ _effectiveTitle,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.h1Bold.copyWith(color: colors.textBase),+ ),+ ),+ _TitleBarSlot(+ width: trailingWidth,+ visible: _trailingVisible,+ alignment: Alignment.centerRight,+ child: trailing,+ ),+ ],+ );+ }++ Widget _centerContent(ColorTokens colors) {+ if (_usesStatus) {+ return Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (statusIcon != null) ...[+ IconTheme(+ data: IconThemeData(color: colors.primary, size: 20),+ child: SizedBox.square(dimension: 20, child: statusIcon),+ ),+ const SizedBox(width: Spacing.sm),+ ],+ Flexible(+ child: Text(+ _effectiveStatusText,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.body.copyWith(color: colors.textBase),+ ),+ ),+ ],+ );+ }++ if (!_titleVisible) {+ return const SizedBox.shrink();+ }++ return Text(+ _effectiveTitle,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: _usesHeadingStyle+ ? TextStyles.h1Bold.copyWith(color: colors.textBase)+ : TextStyles.h1.copyWith(color: colors.textBase),+ );+ }++ bool get _usesStatus {+ return switch (variant) {+ TitleBarComponentVariant.preserving ||+ TitleBarComponentVariant.partiallyPreserved ||+ TitleBarComponentVariant.preserved ||+ TitleBarComponentVariant.syncing ||+ TitleBarComponentVariant.videoProcessing =>+ true,+ _ => false,+ };+ }++ bool get _usesHeadingStyle {+ return switch (variant) {+ TitleBarComponentVariant.titleTopbar ||+ TitleBarComponentVariant.titleTopbarNoIcon ||+ TitleBarComponentVariant.onboardingTitle =>+ true,+ _ => false,+ };+ }++ bool get _titleVisible {+ return switch (variant) {+ TitleBarComponentVariant.back ||+ TitleBarComponentVariant.settings =>+ false,+ _ => true,+ };+ }++ bool get _leadingVisible {+ return switch (variant) {+ TitleBarComponentVariant.onboarding => false,+ _ => true,+ };+ }++ bool get _trailingVisible {+ return switch (variant) {+ TitleBarComponentVariant.home ||+ TitleBarComponentVariant.preserving ||+ TitleBarComponentVariant.partiallyPreserved ||+ TitleBarComponentVariant.preserved ||+ TitleBarComponentVariant.syncing ||+ TitleBarComponentVariant.videoProcessing ||+ TitleBarComponentVariant.settings ||+ TitleBarComponentVariant.titleTopbar ||+ TitleBarComponentVariant.titleTopbarNoIcon =>+ true,+ _ => false,+ };+ }++ String get _effectiveTitle {+ if (title != null) {+ return title!;+ }+ return _usesHeadingStyle ? 'Heading' : 'ente';+ }++ String get _effectiveStatusText {+ if (statusText != null) {+ return statusText!;+ }+ return switch (variant) {+ TitleBarComponentVariant.preserving => 'Preserving 3 memories',+ TitleBarComponentVariant.partiallyPreserved => '1/3 memories preserved',+ TitleBarComponentVariant.preserved => 'All memories preserved',+ TitleBarComponentVariant.syncing => 'Syncing...',+ TitleBarComponentVariant.videoProcessing => 'Video processing',+ _ => '',+ };+ }++ double get _centerContentHorizontalPadding {+ return _trailingVisible+ ? leadingWidth > trailingWidth+ ? leadingWidth+ : trailingWidth+ : leadingWidth;+ }+}++class _TitleBarSlot extends StatelessWidget {+ const _TitleBarSlot({+ required this.width,+ required this.visible,+ required this.child,+ this.alignment = Alignment.center,+ });++ final double width;+ final bool visible;+ final Widget? child;+ final Alignment alignment;++ @override+ Widget build(BuildContext context) {+ return SizedBox(+ width: width,+ child: Align(+ alignment: alignment,+ child: Visibility(+ visible: visible && child != null,+ maintainAnimation: true,+ maintainSize: true,+ maintainState: true,+ child: child ?? const SizedBox.square(dimension: 24),+ ),+ ),+ );+ }+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2513-47854&m=dev+/// Section: Appbar/header / Title Bar+/// Specs: Compact mobile title bar with leading slot, centered title, and trailing actions.+class AppBarComponent extends StatelessWidget implements PreferredSizeWidget {+ const AppBarComponent({+ super.key,+ required this.title,+ this.leading,+ this.actions = const [],+ this.height = 56,+ });++ final String title;+ final Widget? leading;+ final List<Widget> actions;+ final double height;++ @override+ Size get preferredSize => Size.fromHeight(height);++ @override+ Widget build(BuildContext context) {+ return SafeArea(+ bottom: false,+ child: TitleBarComponent(+ variant: TitleBarComponentVariant.titleTopbar,+ title: title,+ height: height,+ leading: leading,+ trailingWidth: actions.isEmpty ? 44 : actions.length * 44,+ trailing: actions.isEmpty+ ? null+ : Row(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ for (final action in actions) action,+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/avatar_component.dart b/mobile/packages/ente_components/lib/components/avatar_component.dartnew file mode 100644index 0000000000..1d4b4e1a62--- /dev/null+++ b/mobile/packages/ente_components/lib/components/avatar_component.dart@@ -0,0 +1,274 @@+import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++enum AvatarComponentSize {+ small,+ normal,+ large,+ contactHuge,+}++enum AvatarComponentColor {+ yellow,+ green,+ orange,+ pink,+ purple,+ blue,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2482-6547&m=dev+/// Section: Labels and avatars / Avatar+/// Specs: 16px, 24px, 32px, and 56px circular avatars with image, color, and add-icon variants.+class AvatarComponent extends StatelessWidget {+ const AvatarComponent({+ super.key,+ this.initials = '',+ this.size = AvatarComponentSize.normal,+ this.color = AvatarComponentColor.yellow,+ this.seed,+ this.semanticLabel,+ }) : image = null,+ icon = null;++ const AvatarComponent.image({+ super.key,+ required this.image,+ this.size = AvatarComponentSize.normal,+ this.semanticLabel,+ }) : initials = '',+ color = AvatarComponentColor.yellow,+ seed = null,+ icon = null;++ const AvatarComponent.icon({+ super.key,+ this.icon = const Icon(Icons.add_rounded),+ this.size = AvatarComponentSize.contactHuge,+ this.semanticLabel,+ }) : initials = '',+ image = null,+ color = AvatarComponentColor.yellow,+ seed = null;++ const AvatarComponent.seeded({+ super.key,+ required this.initials,+ required this.seed,+ this.size = AvatarComponentSize.normal,+ this.semanticLabel,+ }) : image = null,+ color = AvatarComponentColor.yellow,+ icon = null;++ final String initials;+ final AvatarComponentSize size;+ final AvatarComponentColor color;+ final int? seed;+ final ImageProvider? image;+ final Widget? icon;+ final String? semanticLabel;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final dimension = size.dimension;+ final borderWidth = size.borderWidth;+ final child = _child(context);++ return Semantics(+ image: image != null,+ label: semanticLabel ?? _semanticLabel,+ child: SizedBox.square(+ key: const ValueKey('avatar-surface'),+ dimension: dimension,+ child: image != null+ ? DecoratedBox(+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ border: Border.all(+ color: colors.backgroundBase,+ width: borderWidth,+ ),+ image: DecorationImage(+ image: image!,+ fit: BoxFit.cover,+ ),+ ),+ )+ : icon != null+ ? CustomPaint(+ foregroundPainter: _DashedCircleBorderPainter(+ color: colors.strokeFaint,+ strokeWidth: borderWidth,+ ),+ child: DecoratedBox(+ decoration: BoxDecoration(+ color: colors.specialWhite,+ shape: BoxShape.circle,+ ),+ child: Center(child: child),+ ),+ )+ : DecoratedBox(+ decoration: BoxDecoration(+ color: _backgroundColor(context),+ shape: BoxShape.circle,+ border: Border.all(+ color: colors.backgroundBase,+ width: borderWidth,+ ),+ ),+ child: Center(child: child),+ ),+ ),+ );+ }++ Widget _child(BuildContext context) {+ if (icon != null) {+ return Padding(+ padding: const EdgeInsets.all(Spacing.md),+ child: IconTheme.merge(+ data: IconThemeData(+ color: context.componentColors.textLight,+ size: size.iconSize,+ ),+ child: icon!,+ ),+ );+ }++ final text = initials.trim().isEmpty ? '?' : initials.trim().toUpperCase();+ return FittedBox(+ fit: BoxFit.scaleDown,+ child: Text(+ text,+ maxLines: 1,+ textAlign: TextAlign.center,+ style: size.textStyle+ .copyWith(color: context.componentColors.specialWhite),+ ),+ );+ }++ Color _backgroundColor(BuildContext context) {+ final colors = context.componentColors;+ if (seed != null) {+ final palette = Theme.of(context).brightness == Brightness.dark+ ? avatarDark+ : avatarLight;+ return palette[seed!.abs() % palette.length];+ }++ return switch (color) {+ AvatarComponentColor.yellow => colors.caution,+ AvatarComponentColor.green => colors.primary,+ AvatarComponentColor.orange => colors.accentOrange,+ AvatarComponentColor.pink => colors.accentPink,+ AvatarComponentColor.purple => colors.accentPurple,+ AvatarComponentColor.blue => colors.info,+ };+ }++ String? get _semanticLabel {+ if (image != null) return 'AvatarComponent image';+ if (icon != null) return 'Add avatar';+ if (initials.trim().isEmpty) return 'AvatarComponent';+ return 'AvatarComponent $initials';+ }+}++extension on AvatarComponentSize {+ double get dimension {+ return switch (this) {+ AvatarComponentSize.small => 16,+ AvatarComponentSize.normal => 24,+ AvatarComponentSize.large => 32,+ AvatarComponentSize.contactHuge => 56,+ };+ }++ double get borderWidth {+ return switch (this) {+ AvatarComponentSize.small || AvatarComponentSize.normal => 1,+ AvatarComponentSize.large || AvatarComponentSize.contactHuge => 2,+ };+ }++ double get iconSize {+ return switch (this) {+ AvatarComponentSize.contactHuge => 24,+ AvatarComponentSize.large => 18,+ AvatarComponentSize.normal => 16,+ AvatarComponentSize.small => 12,+ };+ }++ TextStyle get textStyle {+ return switch (this) {+ AvatarComponentSize.small => const TextStyle(+ fontFamily: TextStyles.fontFamily,+ fontSize: 8,+ height: 15 / 8,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ ),+ AvatarComponentSize.contactHuge => TextStyles.h2,+ AvatarComponentSize.normal ||+ AvatarComponentSize.large =>+ const TextStyle(+ fontFamily: TextStyles.fontFamily,+ fontSize: 12,+ height: 15 / 12,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ ),+ };+ }+}++class _DashedCircleBorderPainter extends CustomPainter {+ const _DashedCircleBorderPainter({+ required this.color,+ required this.strokeWidth,+ });++ final Color color;+ final double strokeWidth;++ @override+ void paint(Canvas canvas, Size size) {+ final paint = Paint()+ ..color = color+ ..style = PaintingStyle.stroke+ ..strokeWidth = strokeWidth;+ final radius = (size.shortestSide - strokeWidth) / 2;+ final center = Offset(size.width / 2, size.height / 2);+ const dashLength = 4.0;+ const gapLength = 4.0;+ final circumference = 2 * 3.141592653589793 * radius;+ final dashCount = (circumference / (dashLength + gapLength)).floor();+ final sweep = (dashLength / circumference) * 2 * 3.141592653589793;+ final gap = (gapLength / circumference) * 2 * 3.141592653589793;++ for (var index = 0; index < dashCount; index++) {+ final start = index * (sweep + gap);+ canvas.drawArc(+ Rect.fromCircle(center: center, radius: radius),+ start,+ sweep,+ false,+ paint,+ );+ }+ }++ @override+ bool shouldRepaint(_DashedCircleBorderPainter oldDelegate) {+ return oldDelegate.color != color || oldDelegate.strokeWidth != strokeWidth;+ }+}diff --git a/mobile/packages/ente_components/lib/components/buttons/button_component.dart b/mobile/packages/ente_components/lib/components/buttons/button_component.dartnew file mode 100644index 0000000000..a6210ba475--- /dev/null+++ b/mobile/packages/ente_components/lib/components/buttons/button_component.dart@@ -0,0 +1,603 @@+import 'dart:async';++import 'package:ente_components/theme/motion.dart';+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';+import 'package:flutter/scheduler.dart';+import 'package:hugeicons/hugeicons.dart';++enum ButtonComponentVariant {+ primary,+ secondary,+ neutral,+ critical,+ tertiaryCritical,+ link,+}++enum ButtonComponentSize {+ small,+ large,+}++enum _ButtonVisualState {+ normal,+ hover,+ pressed,+}++enum _ButtonExecutionState {+ idle,+ inProgress,+ successful,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2207-41578&m=dev+/// Section: Buttons / Button Small+/// Specs: 52px height, 20px radius, 24px horizontal padding, 8px icon gap.+/// States: default, hover, pressed, disabled, loading, success.+class ButtonComponent extends StatefulWidget {+ const ButtonComponent({+ super.key,+ required this.label,+ this.onTap,+ this.variant = ButtonComponentVariant.primary,+ this.size = ButtonComponentSize.small,+ this.leading,+ this.trailing,+ this.isDisabled = false,+ this.shouldSurfaceExecutionStates = true,+ this.shouldShowSuccessConfirmation = false,+ this.progressStatus,+ this.iconColor,+ this.width,+ });++ final String label;+ final FutureOr<void> Function()? onTap;+ final ButtonComponentVariant variant;+ final ButtonComponentSize size;+ final Widget? leading;+ final Widget? trailing;+ final bool isDisabled;+ final bool shouldSurfaceExecutionStates;+ final bool shouldShowSuccessConfirmation;+ final ValueListenable<String>? progressStatus;+ final Color? iconColor;+ final double? width;++ @override+ State<ButtonComponent> createState() => _ButtonComponentState();+}++class _ButtonComponentState extends State<ButtonComponent>+ with SingleTickerProviderStateMixin {+ static const double _executionIconSize = 24;+ static const double _contentMinHeight = 24;+ static const double _verticalPadding = 14;+ static const Duration _loadingDelay = Duration(milliseconds: 300);+ static const Duration _successDisplayDuration = Duration(seconds: 2);+ static const Duration _minimumPressDuration = Duration(milliseconds: 120);++ late final AnimationController _loadingController;+ bool _isHovered = false;+ bool _isPressed = false;+ int _pressToken = 0;+ DateTime? _tapDownTime;+ double? _idleWidth;+ Timer? _loadingTimer;+ Timer? _successResetTimer;+ Timer? _pressReleaseTimer;+ _ButtonExecutionState _executionState = _ButtonExecutionState.idle;+ bool _loadingVisible = false;++ @override+ void initState() {+ super.initState();+ _loadingController = AnimationController(+ vsync: this,+ duration: const Duration(milliseconds: 800),+ );+ _syncLoadingController();+ }++ @override+ void didUpdateWidget(covariant ButtonComponent oldWidget) {+ super.didUpdateWidget(oldWidget);+ final idleContentChanged = widget.variant != oldWidget.variant ||+ widget.label != oldWidget.label ||+ widget.leading != oldWidget.leading ||+ widget.trailing != oldWidget.trailing;+ if (widget.size != oldWidget.size ||+ (widget.size == ButtonComponentSize.small && idleContentChanged)) {+ _idleWidth = null;+ }+ if (widget.isDisabled && !oldWidget.isDisabled) {+ _isPressed = false;+ }+ _syncLoadingController();+ }++ @override+ void dispose() {+ _loadingTimer?.cancel();+ _successResetTimer?.cancel();+ _pressReleaseTimer?.cancel();+ _loadingController.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final isInlineLink = widget.variant == ButtonComponentVariant.link &&+ widget.size == ButtonComponentSize.small;+ final resolvedColors = _colors(context);+ final enabled = _canHandleGestures;+ final verticalPadding = isInlineLink ? Spacing.xs : _buttonVerticalPadding;+ _captureIdleWidth();++ return MouseRegion(+ cursor: enabled ? SystemMouseCursors.click : SystemMouseCursors.forbidden,+ onEnter: (_) => _setHovered(true),+ onExit: (_) => _setHovered(false),+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: enabled ? _handleTap : null,+ onTapDown: enabled ? (_) => _setPressed(true) : null,+ onTapUp: enabled ? (_) => _releasePressed() : null,+ onTapCancel: enabled ? _releasePressed : null,+ child: AnimatedScale(+ scale: _isPressed ? 0.98 : 1,+ duration: const Duration(milliseconds: 120),+ curve: Curves.easeOutCubic,+ child: AnimatedContainer(+ duration: Motion.standard,+ curve: Curves.easeInOutCubic,+ width: widget.width ??+ (widget.size == ButtonComponentSize.large+ ? double.infinity+ : _executionWidth),+ decoration: BoxDecoration(+ color: resolvedColors.background,+ borderRadius:+ BorderRadius.circular(isInlineLink ? 0 : Radii.button),+ border: resolvedColors.border == null+ ? null+ : Border.all(color: resolvedColors.border!),+ ),+ child: Padding(+ padding: EdgeInsets.symmetric(+ horizontal: isInlineLink ? 0 : Spacing.xl,+ vertical: verticalPadding,+ ),+ child: ConstrainedBox(+ constraints: BoxConstraints(+ minHeight: isInlineLink ? 0 : _contentMinHeight,+ ),+ child: AnimatedSwitcher(+ duration: Motion.quick,+ switchInCurve: Curves.easeOutCubic,+ switchOutCurve: Curves.easeInCubic,+ transitionBuilder: (child, animation) {+ return FadeTransition(+ opacity: animation,+ child: ScaleTransition(+ scale: Tween<double>(begin: 0.92, end: 1).animate(+ CurvedAnimation(+ parent: animation,+ curve: Curves.easeOutCubic,+ ),+ ),+ child: child,+ ),+ );+ },+ child: _content(context, resolvedColors.foreground),+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }++ _ButtonVisualState get _effectiveVisualState {+ if (_isPressed) return _ButtonVisualState.pressed;+ if (_isHovered) return _ButtonVisualState.hover;+ return _ButtonVisualState.normal;+ }++ void _setHovered(bool value) {+ if (!_canHandleGestures || _isHovered == value) {+ return;+ }+ setState(() => _isHovered = value);+ }++ void _setPressed(bool value) {+ if (!_canHandleGestures || _isPressed == value) {+ return;+ }+ if (value) {+ _pressToken++;+ _tapDownTime = DateTime.now();+ setState(() => _isPressed = true);+ return;+ }+ _releasePressed();+ }++ void _releasePressed() {+ final token = _pressToken;+ final tapDownTime = _tapDownTime;+ if (tapDownTime == null) {+ if (mounted) setState(() => _isPressed = false);+ return;+ }++ final elapsed = DateTime.now().difference(tapDownTime);+ final remaining = _minimumPressDuration - elapsed;++ void release() {+ if (!mounted || token != _pressToken) return;+ setState(() => _isPressed = false);+ }++ if (remaining <= Duration.zero) {+ release();+ } else {+ _pressReleaseTimer?.cancel();+ _pressReleaseTimer = Timer(remaining, release);+ }+ _tapDownTime = null;+ }++ Widget _content(BuildContext context, Color foreground) {+ if (_showLoading) {+ final spinner = SizedBox(+ width: _executionIconSize,+ height: _executionIconSize,+ child: Center(+ child: RotationTransition(+ turns: _loadingController,+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedLoading03,+ color: _iconForeground(foreground),+ size: _executionIconSize,+ ),+ ),+ ),+ );+ if (widget.progressStatus == null) {+ return KeyedSubtree(+ key: const ValueKey('loading'),+ child: spinner,+ );+ }+ return Row(+ key: const ValueKey('loading'),+ mainAxisAlignment: MainAxisAlignment.center,+ mainAxisSize: MainAxisSize.min,+ children: [+ ValueListenableBuilder<String>(+ valueListenable: widget.progressStatus!,+ builder: (context, value, _) {+ if (value.isEmpty) return const SizedBox.shrink();+ return Padding(+ padding: const EdgeInsets.only(right: Spacing.sm),+ child: Text(+ value,+ style: TextStyles.mini.copyWith(color: foreground),+ ),+ );+ },+ ),+ spinner,+ ],+ );+ }+ if (_showSuccess) {+ return HugeIcon(+ key: const ValueKey('success'),+ icon: HugeIcons.strokeRoundedTick02,+ size: _executionIconSize,+ color: _iconForeground(foreground),+ );+ }++ final underlined = widget.variant == ButtonComponentVariant.link ||+ widget.variant == ButtonComponentVariant.tertiaryCritical;+ final label = Text(+ widget.label,+ overflow: TextOverflow.ellipsis,+ maxLines: 2,+ style: TextStyles.bodyBold.copyWith(+ color: foreground,+ decoration: underlined ? TextDecoration.underline : null,+ decorationColor: underlined ? foreground : null,+ ),+ );+ final children = <Widget>[+ if (widget.leading != null) ...[+ IconTheme.merge(+ data: IconThemeData(size: 20, color: _iconForeground(foreground)),+ child: widget.leading!,+ ),+ const SizedBox(width: Spacing.sm),+ ],+ if (widget.size == ButtonComponentSize.large)+ Flexible(child: label)+ else+ label,+ if (widget.trailing != null) ...[+ const SizedBox(width: Spacing.md),+ IconTheme.merge(+ data: IconThemeData(size: 20, color: _iconForeground(foreground)),+ child: widget.trailing!,+ ),+ ],+ ];++ return Row(+ key: const ValueKey('content'),+ mainAxisSize: widget.size == ButtonComponentSize.large+ ? MainAxisSize.max+ : MainAxisSize.min,+ mainAxisAlignment: widget.trailing == null+ ? MainAxisAlignment.center+ : MainAxisAlignment.spaceBetween,+ children: children,+ );+ }++ Color _iconForeground(Color foreground) => widget.iconColor ?? foreground;++ double get _buttonVerticalPadding {+ return _verticalPadding;+ }++ _ResolvedButtonColors _colors(BuildContext context) {+ if (widget.isDisabled || widget.onTap == null) {+ return _ResolvedButtonColors(+ background: _disabledBackground(context),+ foreground: context.componentColors.textLighter,+ border: null,+ );+ }++ final visualState =+ _showLoading ? _ButtonVisualState.pressed : _effectiveVisualState;+ return _ResolvedButtonColors(+ background: switch (visualState) {+ _ButtonVisualState.pressed when !_showSuccess =>+ _pressedBackground(context),+ _ButtonVisualState.hover when !_showSuccess =>+ _hoverBackground(context),+ _ => _background(context),+ },+ foreground: _foreground(context, visualState),+ border: _borderColor(),+ );+ }++ void _syncLoadingController() {+ if (_showLoading) {+ if (!_loadingController.isAnimating) {+ _loadingController.repeat();+ }+ return;+ }++ if (_loadingController.isAnimating || _loadingController.value != 0) {+ _loadingController.stop();+ _loadingController.reset();+ }+ }++ bool get _canHandleGestures =>+ !widget.isDisabled &&+ widget.onTap != null &&+ _executionState == _ButtonExecutionState.idle;++ bool get _showLoading =>+ widget.shouldSurfaceExecutionStates &&+ _executionState == _ButtonExecutionState.inProgress &&+ _loadingVisible;++ bool get _showSuccess =>+ widget.shouldSurfaceExecutionStates &&+ _executionState == _ButtonExecutionState.successful;++ double? get _executionWidth {+ if (widget.size != ButtonComponentSize.small ||+ (!_showLoading && !_showSuccess)) {+ return null;+ }+ return _idleWidth;+ }++ Future<void> _handleTap() async {+ final callback = widget.onTap;+ if (callback == null) return;++ _successResetTimer?.cancel();+ var loadingSurfaced = false;+ _loadingTimer?.cancel();+ setState(() {+ _executionState = _ButtonExecutionState.inProgress;+ _loadingVisible = false;+ });+ _loadingTimer = Timer(_loadingDelay, () {+ if (!mounted) return;+ loadingSurfaced = true;+ setState(() {+ _loadingVisible = true;+ _isPressed = false;+ });+ _syncLoadingController();+ });++ try {+ await Future.sync(callback);+ if (!mounted) return;++ final loadingPending = _loadingTimer?.isActive ?? false;+ _loadingTimer?.cancel();+ _loadingTimer = null;++ final shouldShowSuccess = widget.shouldSurfaceExecutionStates &&+ (loadingSurfaced ||+ (loadingPending && widget.shouldShowSuccessConfirmation));++ if (shouldShowSuccess) {+ _showSuccessForDuration();+ } else {+ setState(() {+ _executionState = _ButtonExecutionState.idle;+ _loadingVisible = false;+ _isPressed = false;+ });+ _syncLoadingController();+ }+ } catch (_) {+ _loadingTimer?.cancel();+ _loadingTimer = null;+ if (!mounted) return;+ setState(() {+ _executionState = _ButtonExecutionState.idle;+ _loadingVisible = false;+ _isPressed = false;+ });+ _syncLoadingController();+ }+ }++ void _showSuccessForDuration() {+ setState(() {+ _executionState = _ButtonExecutionState.successful;+ _loadingVisible = false;+ _isPressed = false;+ });+ _syncLoadingController();+ _successResetTimer?.cancel();+ _successResetTimer = Timer(_successDisplayDuration, () {+ if (!mounted) return;+ setState(() {+ _executionState = _ButtonExecutionState.idle;+ _loadingVisible = false;+ });+ _syncLoadingController();+ });+ }++ void _captureIdleWidth() {+ if (widget.size != ButtonComponentSize.small ||+ _showLoading ||+ _showSuccess) {+ return;+ }+ SchedulerBinding.instance.addPostFrameCallback((_) {+ if (!mounted || widget.size != ButtonComponentSize.small) return;+ final box = context.findRenderObject() as RenderBox?;+ if (box == null || !box.hasSize) return;+ final width = box.size.width;+ if (_idleWidth != null && (_idleWidth! - width).abs() < 0.5) return;+ setState(() => _idleWidth = width);+ });+ }++ Color _background(BuildContext context) {+ final colors = context.componentColors;+ return switch (widget.variant) {+ ButtonComponentVariant.primary => colors.primary,+ ButtonComponentVariant.secondary+ when widget.size == ButtonComponentSize.large =>+ colors.primaryLight,+ ButtonComponentVariant.secondary => colors.fillDark,+ ButtonComponentVariant.neutral => colors.fillBase,+ ButtonComponentVariant.critical => colors.warning,+ ButtonComponentVariant.tertiaryCritical => Colors.transparent,+ ButtonComponentVariant.link => Colors.transparent,+ };+ }++ Color _hoverBackground(BuildContext context) {+ final colors = context.componentColors;+ return switch (widget.variant) {+ ButtonComponentVariant.primary => colors.primaryDark,+ ButtonComponentVariant.secondary => colors.fillDarker,+ ButtonComponentVariant.neutral => colors.fillBase,+ ButtonComponentVariant.critical => colors.warningDark,+ ButtonComponentVariant.tertiaryCritical => Colors.transparent,+ ButtonComponentVariant.link => Colors.transparent,+ };+ }++ Color _pressedBackground(BuildContext context) {+ final colors = context.componentColors;+ return switch (widget.variant) {+ ButtonComponentVariant.primary => colors.primaryDarker,+ ButtonComponentVariant.secondary => colors.fillDarkest,+ ButtonComponentVariant.neutral => colors.fillBase,+ ButtonComponentVariant.critical => colors.warningDarker,+ ButtonComponentVariant.tertiaryCritical => Colors.transparent,+ ButtonComponentVariant.link => Colors.transparent,+ };+ }++ Color _disabledBackground(BuildContext context) {+ final colors = context.componentColors;+ return switch (widget.variant) {+ ButtonComponentVariant.tertiaryCritical => Colors.transparent,+ ButtonComponentVariant.link => Colors.transparent,+ _ => colors.fillDark,+ };+ }++ Color _foreground(BuildContext context, _ButtonVisualState visualState) {+ final colors = context.componentColors;+ return switch (widget.variant) {+ ButtonComponentVariant.primary => colors.specialWhite,+ ButtonComponentVariant.secondary+ when widget.size == ButtonComponentSize.large =>+ switch (visualState) {+ _ButtonVisualState.normal => colors.primary,+ _ => colors.textBase,+ },+ ButtonComponentVariant.secondary => colors.textBase,+ ButtonComponentVariant.neutral => colors.textReverse,+ ButtonComponentVariant.critical => colors.specialWhite,+ ButtonComponentVariant.tertiaryCritical => switch (visualState) {+ _ButtonVisualState.pressed => colors.warningDarker,+ _ButtonVisualState.hover => colors.warningDark,+ _ButtonVisualState.normal => colors.warning,+ },+ ButtonComponentVariant.link => switch (visualState) {+ _ButtonVisualState.pressed => colors.primaryDarker,+ _ButtonVisualState.hover => colors.primaryDark,+ _ButtonVisualState.normal => colors.primary,+ },+ };+ }++ Color? _borderColor() {+ return null;+ }+}++class _ResolvedButtonColors {+ const _ResolvedButtonColors({+ required this.background,+ required this.foreground,+ required this.border,+ });++ final Color background;+ final Color foreground;+ final Color? border;+}diff --git a/mobile/packages/ente_components/lib/components/buttons/icon_button_component.dart b/mobile/packages/ente_components/lib/components/buttons/icon_button_component.dartnew file mode 100644index 0000000000..11634e10e0--- /dev/null+++ b/mobile/packages/ente_components/lib/components/buttons/icon_button_component.dart@@ -0,0 +1,254 @@+import 'package:ente_components/theme/motion.dart';+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++enum IconButtonComponentVariant {+ primary,+ critical,+ unfilled,+ secondary,+ green,+ circular,+}++enum IconButtonComponentState {+ normal,+ hover,+ pressed,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2207-42075&m=dev+/// Section: Buttons / Icon Button+/// Specs: 38px square, compact icon affordance with default, hover, pressed, disabled, loading, success states.+class IconButtonComponent extends StatefulWidget {+ const IconButtonComponent({+ super.key,+ required this.icon,+ required this.onPressed,+ this.variant = IconButtonComponentVariant.secondary,+ this.state,+ this.isLoading = false,+ this.isSuccess = false,+ this.tooltip,+ });++ final Widget icon;+ final VoidCallback? onPressed;+ final IconButtonComponentVariant variant;+ final IconButtonComponentState? state;+ final bool isLoading;+ final bool isSuccess;+ final String? tooltip;++ @override+ State<IconButtonComponent> createState() => _IconButtonComponentState();+}++class _IconButtonComponentState extends State<IconButtonComponent> {+ bool _isHovered = false;+ bool _isPressed = false;++ @override+ Widget build(BuildContext context) {+ final enabled =+ widget.onPressed != null && !widget.isLoading && !widget.isSuccess;+ final visualState = _visualState(enabled);+ final foreground = _foreground(context, visualState);+ final background = _background(context, visualState);+ final radius = widget.variant == IconButtonComponentVariant.circular+ ? BorderRadius.circular(35)+ : BorderRadius.circular(Radii.md);++ Widget button = SizedBox(+ width: _buttonSize,+ height: _buttonSize,+ child: MouseRegion(+ cursor: enabled ? SystemMouseCursors.click : SystemMouseCursors.basic,+ onEnter: enabled ? (_) => _setHovered(true) : null,+ onExit: enabled ? (_) => _setHovered(false) : null,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: enabled ? widget.onPressed : null,+ onTapDown: enabled ? (_) => _setPressed(true) : null,+ onTapUp: enabled ? (_) => _setPressed(false) : null,+ onTapCancel: enabled ? () => _setPressed(false) : null,+ child: AnimatedContainer(+ key: const ValueKey('icon-button-surface'),+ duration: Motion.quick,+ curve: Curves.easeInOutCubic,+ width: _buttonSize,+ height: _buttonSize,+ padding: EdgeInsets.all(_outerPadding(visualState)),+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: background,+ borderRadius: radius,+ ),+ child: Padding(+ padding: const EdgeInsets.all(Spacing.sm),+ child: AnimatedSwitcher(+ duration: Motion.quick,+ child: _content(context, foreground),+ ),+ ),+ ),+ ),+ ),+ );++ if (widget.tooltip != null) {+ button = Tooltip(message: widget.tooltip!, child: button);+ }++ return Semantics(+ button: true,+ enabled: enabled,+ label: widget.tooltip,+ child: button,+ );+ }++ _ResolvedIconButtonState _visualState(bool enabled) {+ if (widget.isLoading) {+ return _ResolvedIconButtonState.loading;+ }+ if (widget.isSuccess) {+ return _ResolvedIconButtonState.success;+ }+ if (!enabled) {+ return _ResolvedIconButtonState.disabled;+ }++ final forcedState = widget.state;+ if (forcedState != null) {+ return switch (forcedState) {+ IconButtonComponentState.normal => _ResolvedIconButtonState.normal,+ IconButtonComponentState.hover => _ResolvedIconButtonState.hover,+ IconButtonComponentState.pressed => _ResolvedIconButtonState.pressed,+ };+ }++ if (_isPressed) {+ return _ResolvedIconButtonState.pressed;+ }+ if (_isHovered) {+ return _ResolvedIconButtonState.hover;+ }+ return _ResolvedIconButtonState.normal;+ }++ void _setHovered(bool value) {+ if (widget.onPressed == null || _isHovered == value) return;+ setState(() => _isHovered = value);+ }++ void _setPressed(bool value) {+ if (widget.onPressed == null || _isPressed == value) return;+ setState(() => _isPressed = value);+ }++ Widget _content(BuildContext context, Color foreground) {+ if (widget.isLoading) {+ return SizedBox(+ key: const ValueKey('loading'),+ width: _iconSize,+ height: _iconSize,+ child: CircularProgressIndicator(+ strokeWidth: 2,+ valueColor: AlwaysStoppedAnimation(foreground),+ ),+ );+ }+ if (widget.isSuccess) {+ return Icon(+ key: const ValueKey('success'),+ Icons.check_circle_rounded,+ size: _iconSize,+ color: foreground,+ );+ }+ return IconTheme.merge(+ key: const ValueKey('icon'),+ data: IconThemeData(size: _iconSize, color: foreground),+ child: widget.icon,+ );+ }++ double _outerPadding(_ResolvedIconButtonState state) {+ return switch (widget.variant) {+ IconButtonComponentVariant.unfilled ||+ IconButtonComponentVariant.secondary =>+ 0,+ _ => Spacing.xxs,+ };+ }++ Color _background(BuildContext context, _ResolvedIconButtonState state) {+ final colors = context.componentColors;+ final transparent = colors.specialScrim.withAlpha(0);++ return switch (widget.variant) {+ IconButtonComponentVariant.unfilled ||+ IconButtonComponentVariant.secondary =>+ transparent,+ IconButtonComponentVariant.primary => switch (state) {+ _ResolvedIconButtonState.normal => colors.fillLight,+ _ResolvedIconButtonState.hover ||+ _ResolvedIconButtonState.disabled ||+ _ResolvedIconButtonState.loading ||+ _ResolvedIconButtonState.success =>+ colors.fillDark,+ _ResolvedIconButtonState.pressed => colors.fillDarker,+ },+ IconButtonComponentVariant.critical => switch (state) {+ _ResolvedIconButtonState.hover => colors.fillDarker,+ _ResolvedIconButtonState.pressed => colors.fillDarkest,+ _ => colors.fillDark,+ },+ IconButtonComponentVariant.green => switch (state) {+ _ResolvedIconButtonState.hover => colors.primaryDark,+ _ResolvedIconButtonState.pressed => colors.primaryDarker,+ _ResolvedIconButtonState.disabled => colors.fillDark,+ _ => colors.primary,+ },+ IconButtonComponentVariant.circular => switch (state) {+ _ResolvedIconButtonState.hover ||+ _ResolvedIconButtonState.disabled =>+ colors.fillDark,+ _ResolvedIconButtonState.pressed => colors.fillDarker,+ _ => colors.fillLight,+ },+ };+ }++ Color _foreground(BuildContext context, _ResolvedIconButtonState state) {+ final colors = context.componentColors;+ if (state == _ResolvedIconButtonState.success &&+ widget.variant != IconButtonComponentVariant.green) {+ return colors.primary;+ }+ if (widget.variant == IconButtonComponentVariant.green &&+ state != _ResolvedIconButtonState.disabled) {+ return colors.specialWhite;+ }+ if (widget.variant == IconButtonComponentVariant.unfilled ||+ widget.variant == IconButtonComponentVariant.secondary) {+ return colors.iconColor;+ }+ return colors.textBase;+ }+}++const double _buttonSize = 38;+const double _iconSize = 18;++enum _ResolvedIconButtonState {+ normal,+ hover,+ pressed,+ disabled,+ loading,+ success,+}diff --git a/mobile/packages/ente_components/lib/components/filter_chip_component.dart b/mobile/packages/ente_components/lib/components/filter_chip_component.dartnew file mode 100644index 0000000000..3bf03da2cb--- /dev/null+++ b/mobile/packages/ente_components/lib/components/filter_chip_component.dart@@ -0,0 +1,238 @@+import 'package:ente_components/theme/motion.dart';+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++enum FilterChipComponentState {+ selected,+ unselected,+ disabled,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=9524-4352&m=dev+/// Section: Filter Chip+/// Specs: 40px height, 24px radius, selected/unselected/disabled states with icon and avatar slots.+class FilterChipComponent extends StatelessWidget {+ const FilterChipComponent({+ super.key,+ this.label,+ this.leading,+ this.trailing,+ this.avatar,+ this.state = FilterChipComponentState.unselected,+ this.onChanged,+ this.tooltip,+ }) : assert(label != null || avatar != null);++ final String? label;+ final Widget? leading;+ final Widget? trailing;+ final Widget? avatar;+ final FilterChipComponentState state;+ final ValueChanged<bool>? onChanged;+ final String? tooltip;++ bool get _selected => state == FilterChipComponentState.selected;++ bool get _enabled =>+ state != FilterChipComponentState.disabled && onChanged != null;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final textColor = switch (state) {+ FilterChipComponentState.selected => colors.primary,+ FilterChipComponentState.unselected => colors.textLight,+ FilterChipComponentState.disabled => colors.textLightest,+ };+ final background = _selected ? colors.primaryLight : colors.fillLight;++ Widget chip = MouseRegion(+ cursor: _enabled ? SystemMouseCursors.click : SystemMouseCursors.basic,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: _enabled ? () => onChanged!(!_selected) : null,+ child: AnimatedContainer(+ key: const ValueKey('filter-chip-surface'),+ duration: Motion.quick,+ curve: Curves.easeInOutCubic,+ height: 40,+ constraints: const BoxConstraints(minWidth: 40),+ padding: _padding,+ decoration: BoxDecoration(+ color: background,+ borderRadius: BorderRadius.circular(24),+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: _children(textColor),+ ),+ ),+ ),+ );++ if (tooltip != null) {+ chip = Tooltip(message: tooltip!, child: chip);+ }++ return Semantics(+ button: true,+ enabled: _enabled,+ selected: _selected,+ label: tooltip ?? label,+ child: chip,+ );+ }++ List<Widget> _children(Color color) {+ final children = <Widget>[];+ final gap = avatar != null ? Spacing.xs : Spacing.sm;++ void addGap() {+ if (children.isNotEmpty) {+ children.add(SizedBox(width: gap));+ }+ }++ if (avatar != null) {+ children.add(+ _FilterChipAvatar(+ enabled: state != FilterChipComponentState.disabled,+ child: avatar!,+ ),+ );+ }++ if (leading != null) {+ addGap();+ children.add(_FilterChipIcon(color: color, child: leading!));+ }++ if (label != null) {+ addGap();+ children.add(+ Text(+ label!,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.mini.copyWith(color: color),+ ),+ );+ }++ final selectedTrailing = _selected && trailing == null;+ if (trailing != null || selectedTrailing) {+ addGap();+ children.add(+ _FilterChipIcon(+ color: color,+ size: selectedTrailing ? 12 : 18,+ child: selectedTrailing ? const Icon(Icons.close_rounded) : trailing!,+ ),+ );+ }++ return children;+ }++ EdgeInsets get _padding {+ if (avatar != null && label == null) {+ return _selected+ ? const EdgeInsets.fromLTRB(+ Spacing.xs,+ Spacing.xs,+ Spacing.sm,+ Spacing.xs,+ )+ : const EdgeInsets.all(Spacing.xs);+ }++ if (avatar != null) {+ return EdgeInsets.fromLTRB(+ Spacing.xs,+ Spacing.xs,+ _selected ? Spacing.sm : 18,+ Spacing.xs,+ );+ }++ if (leading != null && trailing == null) {+ return EdgeInsets.fromLTRB(+ Spacing.md,+ Spacing.md,+ _selected ? Spacing.md : Spacing.lg,+ Spacing.md,+ );+ }++ if (trailing != null) {+ return const EdgeInsets.fromLTRB(+ Spacing.lg,+ Spacing.md,+ Spacing.md,+ Spacing.md,+ );+ }++ if (_selected) {+ return const EdgeInsets.fromLTRB(18, Spacing.md, Spacing.md, Spacing.md);+ }++ return const EdgeInsets.symmetric(+ horizontal: 18,+ vertical: Spacing.md,+ );+ }+}++class _FilterChipIcon extends StatelessWidget {+ const _FilterChipIcon({+ required this.color,+ required this.child,+ this.size = 18,+ });++ final Color color;+ final Widget child;+ final double size;++ @override+ Widget build(BuildContext context) {+ return SizedBox.square(+ dimension: size == 12 ? 20 : 16,+ child: Center(+ child: IconTheme.merge(+ data: IconThemeData(color: color, size: size),+ child: child,+ ),+ ),+ );+ }+}++class _FilterChipAvatar extends StatelessWidget {+ const _FilterChipAvatar({+ required this.enabled,+ required this.child,+ });++ final bool enabled;+ final Widget child;++ @override+ Widget build(BuildContext context) {+ return Opacity(+ opacity: enabled ? 1 : 0.6,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(Radii.button),+ child: SizedBox.square(+ dimension: 32,+ child: child,+ ),+ ),+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/header_component.dart b/mobile/packages/ente_components/lib/components/header_component.dartnew file mode 100644index 0000000000..9a5f22f042--- /dev/null+++ b/mobile/packages/ente_components/lib/components/header_component.dart@@ -0,0 +1,91 @@+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2475-5968&m=dev+/// Section: Appbar/header / HeaderComponent+/// Specs: 327px design width, optional 36px image slot, optional subtitle, and up to two trailing icon actions.+class HeaderComponent extends StatelessWidget {+ const HeaderComponent({+ super.key,+ required this.title,+ this.subtitle,+ this.leading,+ this.action,+ this.actions = const [],+ });++ final String title;+ final String? subtitle;+ final Widget? leading;+ final Widget? action;+ final List<Widget> actions;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final effectiveActions = [+ ...actions,+ if (action != null) action!,+ ];++ return ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 40),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ if (leading != null) ...[+ ClipRRect(+ borderRadius: BorderRadius.circular(Radii.md),+ child: SizedBox.square(+ dimension: 36,+ child: leading,+ ),+ ),+ const SizedBox(width: Spacing.md),+ ],+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.h1Bold.copyWith(color: colors.textBase),+ ),+ if (subtitle != null) ...[+ const SizedBox(height: Spacing.xxs),+ Text(+ subtitle!,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.mini.copyWith(color: colors.textLight),+ ),+ ],+ ],+ ),+ ),+ if (effectiveActions.isNotEmpty) ...[+ const SizedBox(width: Spacing.md),+ Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ for (var index = 0;+ index < effectiveActions.length;+ index++) ...[+ effectiveActions[index],+ if (index != effectiveActions.length - 1)+ const SizedBox(width: 6),+ ],+ ],+ ),+ ],+ ],+ ),+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/menu_component.dart b/mobile/packages/ente_components/lib/components/menu_component.dartnew file mode 100644index 0000000000..0abebcf2bc--- /dev/null+++ b/mobile/packages/ente_components/lib/components/menu_component.dart@@ -0,0 +1,317 @@+import 'dart:async';++import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/motion.dart';+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++const double _menuItemVerticalPadding = 9;+const double _leadingSlotSize = 36;+const double _trailingSlotSize = 36;++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=4055-18734&m=dev+/// Section: List items / Menu Item+/// Specs: 336px by typography-derived menu item, optional leading icon, subtitle, trailing item, hover and selected states.+class MenuComponent extends StatefulWidget {+ const MenuComponent({+ super.key,+ required this.title,+ this.subtitle,+ this.leading,+ this.trailing,+ this.selected = false,+ this.onTap,+ this.gesturesEnabled = true,+ this.showOnlyLoadingState = false,+ this.surfaceExecutionStates = true,+ this.alwaysShowSuccessState = false,+ this.titleMaxLines = 2,+ this.subtitleMaxLines = 1,+ this.titleColor,+ this.iconColor,+ });++ final String title;+ final String? subtitle;+ final Widget? leading;+ final Widget? trailing;+ final bool selected;+ final FutureOr<void> Function()? onTap;+ final bool gesturesEnabled;+ final bool showOnlyLoadingState;+ final bool surfaceExecutionStates;+ final bool alwaysShowSuccessState;+ final int titleMaxLines;+ final int subtitleMaxLines;+ final Color? titleColor;+ final Color? iconColor;++ @override+ State<MenuComponent> createState() => _MenuComponentState();+}++class _MenuComponentState extends State<MenuComponent> {+ bool _isHovered = false;+ bool _isPressed = false;+ bool _isBusy = false;+ bool _showsLoading = false;+ bool _showsSuccess = false;+ Timer? _loadingTimer;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final enabled = _canHandleGestures;+ final trailing = _trailing(colors);+ return UnconstrainedBox(+ alignment: Alignment.topLeft,+ constrainedAxis: Axis.horizontal,+ child: Material(+ color: Colors.transparent,+ child: MouseRegion(+ cursor: enabled ? SystemMouseCursors.click : SystemMouseCursors.basic,+ onEnter: enabled ? (_) => _setHovered(true) : null,+ onExit: enabled ? (_) => _setHovered(false) : null,+ child: InkWell(+ onTap: enabled ? _handleTap : null,+ onHighlightChanged: enabled ? _setPressed : null,+ borderRadius: BorderRadius.circular(Radii.button),+ child: AnimatedContainer(+ key: const ValueKey('menu-item-surface'),+ duration: Motion.quick,+ decoration: BoxDecoration(+ color: _backgroundColor(colors, enabled),+ border: Border.all(+ color: widget.selected+ ? colors.primaryStroke+ : Colors.transparent,+ ),+ borderRadius: BorderRadius.circular(Radii.button),+ ),+ child: ConstrainedBox(+ constraints: BoxConstraints(minHeight: _minimumHeight(context)),+ child: Padding(+ padding: EdgeInsets.only(+ left: widget.leading == null ? Spacing.lg : Spacing.md,+ right: Spacing.md,+ top: _menuItemVerticalPadding,+ bottom: _menuItemVerticalPadding,+ ),+ child: Row(+ children: [+ if (widget.leading != null) ...[+ SizedBox.square(+ dimension: _leadingSlotSize,+ child: Center(+ child: IconTheme.merge(+ data: IconThemeData(+ color: widget.iconColor ?? colors.textLight,+ size: 18,+ ),+ child: widget.leading!,+ ),+ ),+ ),+ const SizedBox(width: Spacing.md),+ ],+ Expanded(+ child: Column(+ mainAxisAlignment: MainAxisAlignment.center,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ widget.title,+ maxLines: widget.titleMaxLines,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.body.copyWith(+ color: widget.titleColor ?? colors.textBase,+ ),+ ),+ if (widget.subtitle != null) ...[+ const SizedBox(height: Spacing.xs),+ Text(+ widget.subtitle!,+ maxLines: widget.subtitleMaxLines,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.mini.copyWith(+ color: colors.textLight,+ ),+ ),+ ],+ ],+ ),+ ),+ if (trailing != null) ...[+ const SizedBox(width: Spacing.md),+ ConstrainedBox(+ constraints: const BoxConstraints(+ minWidth: _trailingSlotSize,+ minHeight: _trailingSlotSize,+ ),+ child: Center(child: trailing),+ ),+ ],+ ],+ ),+ ),+ ),+ ),+ ),+ ),+ ),+ );+ }++ @override+ void dispose() {+ _loadingTimer?.cancel();+ super.dispose();+ }++ bool get _canHandleGestures {+ return widget.gesturesEnabled && widget.onTap != null && !_isBusy;+ }++ bool get _shouldSurfaceExecutionState {+ return widget.surfaceExecutionStates ||+ widget.showOnlyLoadingState ||+ widget.alwaysShowSuccessState;+ }++ Color _backgroundColor(ColorTokens colors, bool enabled) {+ if (_isPressed) {+ return colors.fillDarker;+ }+ if (_isHovered && enabled) {+ return colors.fillDark;+ }+ return colors.fillLight;+ }++ Widget? _trailing(ColorTokens colors) {+ if (_showsLoading && _shouldSurfaceExecutionState) {+ return SizedBox.square(+ key: const ValueKey('menu-item-loading'),+ dimension: 18,+ child: CircularProgressIndicator(+ strokeWidth: 2,+ valueColor: AlwaysStoppedAnimation(colors.textLight),+ ),+ );+ }+ if (_showsSuccess &&+ _shouldSurfaceExecutionState &&+ !widget.showOnlyLoadingState) {+ return Icon(+ key: const ValueKey('menu-item-success'),+ Icons.check_rounded,+ color: colors.primary,+ size: 18,+ );+ }+ return widget.trailing;+ }++ double _minimumHeight(BuildContext context) {+ final textHeight = _scaledLineHeight(context, TextStyles.body) ++ Spacing.xs ++ _scaledLineHeight(context, TextStyles.mini);+ final contentHeight =+ textHeight > _leadingSlotSize ? textHeight : _leadingSlotSize;+ return contentHeight + (_menuItemVerticalPadding * 2);+ }++ double _scaledLineHeight(BuildContext context, TextStyle style) {+ final fontSize =+ style.fontSize ?? DefaultTextStyle.of(context).style.fontSize ?? 14;+ final height = style.height ?? 1;+ return MediaQuery.textScalerOf(context).scale(fontSize) * height;+ }++ void _setHovered(bool value) {+ if (_isHovered == value) {+ return;+ }+ setState(() => _isHovered = value);+ }++ void _setPressed(bool value) {+ if (_isPressed == value) {+ return;+ }+ setState(() => _isPressed = value);+ }++ Future<void> _handleTap() async {+ if (!_canHandleGestures) {+ return;+ }++ _isBusy = true;+ var loadingWasShown = false;+ _loadingTimer = Timer(const Duration(milliseconds: 300), () {+ if (!mounted || !_isBusy) {+ return;+ }+ loadingWasShown = true;+ setState(() => _showsLoading = true);+ });++ try {+ await widget.onTap?.call();+ _loadingTimer?.cancel();+ if (!mounted) {+ return;+ }++ if (widget.alwaysShowSuccessState) {+ await _showSuccessThenReset();+ return;+ }++ if (widget.showOnlyLoadingState) {+ _resetExecutionState();+ return;+ }++ if (widget.surfaceExecutionStates && loadingWasShown) {+ await _showSuccessThenReset();+ return;+ }++ _resetExecutionState();+ } catch (_) {+ _loadingTimer?.cancel();+ if (mounted) {+ _resetExecutionState();+ }+ }+ }++ Future<void> _showSuccessThenReset() async {+ if (!mounted) {+ return;+ }+ setState(() {+ _showsLoading = false;+ _showsSuccess = true;+ });+ await Future<void>.delayed(const Duration(seconds: 2));+ if (mounted) {+ _resetExecutionState();+ }+ }++ void _resetExecutionState() {+ _loadingTimer?.cancel();+ setState(() {+ _isBusy = false;+ _isPressed = false;+ _showsLoading = false;+ _showsSuccess = false;+ });+ }+}diff --git a/mobile/packages/ente_components/lib/components/selection_control_components.dart b/mobile/packages/ente_components/lib/components/selection_control_components.dartnew file mode 100644index 0000000000..c6ef7a0a5c--- /dev/null+++ b/mobile/packages/ente_components/lib/components/selection_control_components.dart@@ -0,0 +1,175 @@+import 'package:ente_components/theme/motion.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2513-47857&m=dev+/// Section: Radio buttons, toggles and checkboxes / CheckboxComponent+/// Specs: 16px checkbox, selected and disabled variants.+class CheckboxComponent extends StatelessWidget {+ const CheckboxComponent({+ super.key,+ required this.selected,+ required this.onChanged,+ });++ final bool selected;+ final ValueChanged<bool>? onChanged;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final enabled = onChanged != null;+ final fill = selected+ ? (enabled ? colors.primary : colors.fillDarkest)+ : Colors.transparent;+ final stroke = enabled ? colors.strokeDark : colors.strokeFaint;++ return InkWell(+ onTap: enabled ? () => onChanged!(!selected) : null,+ borderRadius: BorderRadius.circular(4),+ child: AnimatedContainer(+ duration: Motion.quick,+ width: 16,+ height: 16,+ decoration: BoxDecoration(+ color: fill,+ borderRadius: BorderRadius.circular(4),+ border: Border.all(color: selected ? fill : stroke),+ ),+ child: selected+ ? Icon(Icons.check_rounded, size: 12, color: colors.specialWhite)+ : null,+ ),+ );+ }+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2513-47857&m=dev+/// Section: Radio buttons, toggles and checkboxes / Radio Button+/// Specs: 16px radio, selected and disabled variants.+class RadioComponent extends StatelessWidget {+ const RadioComponent({+ super.key,+ required this.selected,+ required this.onChanged,+ });++ final bool selected;+ final ValueChanged<bool>? onChanged;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final enabled = onChanged != null;+ final active = enabled ? colors.primary : colors.fillDarkest;++ return InkWell(+ onTap: enabled ? () => onChanged!(!selected) : null,+ customBorder: const CircleBorder(),+ child: AnimatedContainer(+ duration: Motion.quick,+ width: 16,+ height: 16,+ padding: const EdgeInsets.all(3),+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ border: Border.all(+ color: selected ? active : colors.strokeDark,+ width: selected ? 2 : 1,+ ),+ ),+ child: selected+ ? DecoratedBox(+ decoration:+ BoxDecoration(shape: BoxShape.circle, color: active),+ )+ : null,+ ),+ );+ }+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2482-6644&m=dev+/// Section: Radio buttons, toggles and checkboxes / Toggle Switch+/// Specs: 31px by 18px switch with selected and unselected states.+class ToggleSwitchComponent extends StatelessWidget {+ const ToggleSwitchComponent({+ super.key,+ required this.selected,+ required this.onChanged,+ });++ final bool selected;+ final ValueChanged<bool>? onChanged;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final enabled = onChanged != null;+ final track = selected+ ? (enabled ? colors.primary : colors.fillDarkest)+ : colors.strokeDark;++ return InkWell(+ onTap: enabled ? () => onChanged!(!selected) : null,+ borderRadius: BorderRadius.circular(9),+ child: AnimatedContainer(+ duration: Motion.quick,+ width: 31,+ height: 18,+ padding: const EdgeInsets.all(2),+ decoration: BoxDecoration(+ color: track,+ borderRadius: BorderRadius.circular(9),+ ),+ child: AnimatedAlign(+ duration: Motion.quick,+ alignment: selected ? Alignment.centerRight : Alignment.centerLeft,+ child: Container(+ width: 14,+ height: 14,+ decoration: BoxDecoration(+ color: colors.specialWhite,+ shape: BoxShape.circle,+ ),+ ),+ ),+ ),+ );+ }+}++class LabeledControlComponent extends StatelessWidget {+ const LabeledControlComponent({+ super.key,+ required this.control,+ required this.label,+ this.subtitle,+ });++ final Widget control;+ final String label;+ final String? subtitle;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Row(+ children: [+ control,+ const SizedBox(width: Spacing.md),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(label, style: TextStyle(color: colors.textBase)),+ if (subtitle != null)+ Text(subtitle!, style: TextStyle(color: colors.textLight)),+ ],+ ),+ ),+ ],+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/slider_component.dart b/mobile/packages/ente_components/lib/components/slider_component.dartnew file mode 100644index 0000000000..9003cd06fd--- /dev/null+++ b/mobile/packages/ente_components/lib/components/slider_component.dart@@ -0,0 +1,43 @@+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';+import 'package:flutter/material.dart' as material show Slider;++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Slider+/// Specs: Mobile slider primitive using primary and stroke tokens.+class SliderComponent extends StatelessWidget {+ const SliderComponent({+ super.key,+ required this.value,+ required this.onChanged,+ this.min = 0,+ this.max = 1,+ this.divisions,+ });++ final double value;+ final ValueChanged<double>? onChanged;+ final double min;+ final double max;+ final int? divisions;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return SliderTheme(+ data: SliderTheme.of(context).copyWith(+ activeTrackColor: colors.primary,+ inactiveTrackColor: colors.strokeFaint,+ thumbColor: colors.primary,+ overlayColor: colors.primaryLight,+ ),+ child: material.Slider(+ value: value.clamp(min, max),+ min: min,+ max: max,+ divisions: divisions,+ onChanged: onChanged,+ ),+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/stepper_component.dart b/mobile/packages/ente_components/lib/components/stepper_component.dartnew file mode 100644index 0000000000..5ffaca2e85--- /dev/null+++ b/mobile/packages/ente_components/lib/components/stepper_component.dart@@ -0,0 +1,82 @@+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';+import 'package:flutter/material.dart' as material show IconButton;++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Stepper+/// Specs: Compact numeric stepper with decrement and increment icon controls.+class StepperComponent extends StatelessWidget {+ const StepperComponent({+ super.key,+ required this.value,+ required this.onChanged,+ this.min = 0,+ this.max = 999,+ });++ final int value;+ final ValueChanged<int>? onChanged;+ final int min;+ final int max;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return DecoratedBox(+ decoration: BoxDecoration(+ color: colors.fillLight,+ borderRadius: BorderRadius.circular(Radii.md),+ border: Border.all(color: colors.strokeFaint),+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ _StepButton(+ icon: Icons.remove_rounded,+ enabled: onChanged != null && value > min,+ onPressed: () => onChanged?.call(value - 1),+ ),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: Spacing.md),+ child: Text(+ '$value',+ style: TextStyles.bodyBold.copyWith(color: colors.textBase),+ ),+ ),+ _StepButton(+ icon: Icons.add_rounded,+ enabled: onChanged != null && value < max,+ onPressed: () => onChanged?.call(value + 1),+ ),+ ],+ ),+ );+ }+}++class _StepButton extends StatelessWidget {+ const _StepButton({+ required this.icon,+ required this.enabled,+ required this.onPressed,+ });++ final IconData icon;+ final bool enabled;+ final VoidCallback onPressed;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return material.IconButton(+ visualDensity: VisualDensity.compact,+ onPressed: enabled ? onPressed : null,+ icon: Icon(icon, size: 18),+ color: colors.textBase,+ disabledColor: colors.textLighter,+ );+ }+}diff --git a/mobile/packages/ente_components/lib/components/text_input_component.dart b/mobile/packages/ente_components/lib/components/text_input_component.dartnew file mode 100644index 0000000000..96914b29fb--- /dev/null+++ b/mobile/packages/ente_components/lib/components/text_input_component.dart@@ -0,0 +1,432 @@+import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/radii.dart';+import 'package:ente_components/theme/spacing.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++enum TextInputComponentMessageType {+ helper,+ error,+ alert,+ success,+}++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2275-11526&m=dev+/// Section: Textfield / Text Input+/// Specs: 388px design width, 52px field height, 81px with label, 100px with helper.+/// States: default, disabled, focused, error, success.+///+/// Multiline variant:+/// https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2275-11746&m=dev+class TextInputComponent extends StatefulWidget {+ const TextInputComponent({+ super.key,+ this.controller,+ this.focusNode,+ this.label,+ this.hintText,+ this.helperText,+ this.alertText,+ this.errorText,+ this.successText,+ this.isFocused = false,+ this.prefix,+ this.suffix,+ this.messageIcon,+ this.isRequired = false,+ this.enabled = true,+ this.readOnly = false,+ this.autofocus = false,+ this.obscureText = false,+ this.showPasswordToggle = false,+ this.isClearable = false,+ this.maxLines = 1,+ this.minLines,+ this.maxLength,+ this.keyboardType,+ this.textInputAction,+ this.textCapitalization = TextCapitalization.none,+ this.inputFormatters,+ this.autofillHints,+ this.autocorrect = true,+ this.enableSuggestions = true,+ this.enableInteractiveSelection,+ this.showCursor,+ this.obscuringCharacter = 'β’',+ this.textAlign = TextAlign.start,+ this.textAlignVertical,+ this.scrollController,+ this.expands = false,+ this.counterText,+ this.onChanged,+ this.onSubmitted,+ this.onEditingComplete,+ });++ final TextEditingController? controller;+ final FocusNode? focusNode;+ final String? label;+ final String? hintText;+ final String? helperText;+ final String? alertText;+ final String? errorText;+ final String? successText;+ final bool isFocused;+ final Widget? prefix;+ final Widget? suffix;+ final IconData? messageIcon;+ final bool isRequired;+ final bool enabled;+ final bool readOnly;+ final bool autofocus;+ final bool obscureText;+ final bool showPasswordToggle;+ final bool isClearable;+ final int maxLines;+ final int? minLines;+ final int? maxLength;+ final TextInputType? keyboardType;+ final TextInputAction? textInputAction;+ final TextCapitalization textCapitalization;+ final List<TextInputFormatter>? inputFormatters;+ final Iterable<String>? autofillHints;+ final bool autocorrect;+ final bool enableSuggestions;+ final bool? enableInteractiveSelection;+ final bool? showCursor;+ final String obscuringCharacter;+ final TextAlign textAlign;+ final TextAlignVertical? textAlignVertical;+ final ScrollController? scrollController;+ final bool expands;+ final String? counterText;+ final ValueChanged<String>? onChanged;+ final ValueChanged<String>? onSubmitted;+ final VoidCallback? onEditingComplete;++ @override+ State<TextInputComponent> createState() => _TextInputComponentState();+}++class _TextInputComponentState extends State<TextInputComponent> {+ TextEditingController? _internalController;+ FocusNode? _internalFocusNode;+ late bool _obscureText;+ bool _hasText = false;++ TextEditingController get _controller =>+ widget.controller ?? _internalController!;++ FocusNode get _focusNode => widget.focusNode ?? _internalFocusNode!;++ @override+ void initState() {+ super.initState();+ _internalController =+ widget.controller == null ? TextEditingController() : null;+ _internalFocusNode = widget.focusNode == null ? FocusNode() : null;+ _obscureText = widget.obscureText;+ _hasText = _controller.text.isNotEmpty;+ _controller.addListener(_handleControllerChanged);+ _focusNode.addListener(_handleFocusChanged);+ }++ @override+ void didUpdateWidget(covariant TextInputComponent oldWidget) {+ super.didUpdateWidget(oldWidget);+ if (oldWidget.controller != widget.controller) {+ oldWidget.controller?.removeListener(_handleControllerChanged);+ _internalController?.removeListener(_handleControllerChanged);+ if (oldWidget.controller == null) {+ _internalController?.dispose();+ }+ _internalController =+ widget.controller == null ? TextEditingController() : null;+ _controller.addListener(_handleControllerChanged);+ _hasText = _controller.text.isNotEmpty;+ }+ if (oldWidget.focusNode != widget.focusNode) {+ oldWidget.focusNode?.removeListener(_handleFocusChanged);+ _internalFocusNode?.removeListener(_handleFocusChanged);+ if (oldWidget.focusNode == null) {+ _internalFocusNode?.dispose();+ }+ _internalFocusNode = widget.focusNode == null ? FocusNode() : null;+ _focusNode.addListener(_handleFocusChanged);+ }+ if (oldWidget.obscureText != widget.obscureText) {+ _obscureText = widget.obscureText;+ }+ }++ @override+ void dispose() {+ _controller.removeListener(_handleControllerChanged);+ _focusNode.removeListener(_handleFocusChanged);+ _internalController?.dispose();+ _internalFocusNode?.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ final message = _message;+ final messageType = _messageType;+ final messageColor = switch (messageType) {+ TextInputComponentMessageType.error ||+ TextInputComponentMessageType.alert =>+ colors.warning,+ TextInputComponentMessageType.success => colors.primary,+ TextInputComponentMessageType.helper => colors.textLight,+ };+ final suffix = _effectiveSuffix();+ final effectiveObscureText = _obscureText;++ return Opacity(+ opacity: widget.enabled ? 1 : 0.38,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ if (widget.label != null) ...[+ Text.rich(+ TextSpan(+ text: widget.label,+ children: [+ if (widget.isRequired)+ TextSpan(+ text: ' *',+ style: TextStyles.body.copyWith(+ color: colors.warning,+ ),+ ),+ ],+ ),+ style: TextStyles.body.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.sm),+ ],+ TextField(+ controller: _controller,+ focusNode: _focusNode,+ enabled: widget.enabled,+ readOnly: widget.readOnly,+ autofocus: widget.autofocus,+ obscureText: effectiveObscureText,+ obscuringCharacter: widget.obscuringCharacter,+ maxLines: widget.expands+ ? null+ : effectiveObscureText+ ? 1+ : widget.maxLines,+ minLines:+ widget.expands || effectiveObscureText ? null : widget.minLines,+ expands: widget.expands,+ maxLength: widget.maxLength,+ keyboardType: widget.keyboardType,+ textInputAction: widget.textInputAction,+ textCapitalization: widget.textCapitalization,+ inputFormatters: widget.inputFormatters,+ autofillHints: widget.autofillHints,+ autocorrect: widget.autocorrect && !effectiveObscureText,+ enableSuggestions:+ widget.enableSuggestions && !effectiveObscureText,+ enableInteractiveSelection: widget.enableInteractiveSelection,+ showCursor: widget.showCursor,+ textAlign: widget.textAlign,+ textAlignVertical: widget.textAlignVertical ??+ (_isMultiline+ ? TextAlignVertical.top+ : TextAlignVertical.center),+ scrollController: widget.scrollController,+ onChanged: _handleChanged,+ onSubmitted: widget.onSubmitted,+ onEditingComplete: widget.onEditingComplete,+ style: TextStyles.body.copyWith(color: colors.textBase),+ decoration: InputDecoration(+ hintText: widget.hintText,+ hintStyle: TextStyles.body.copyWith(color: colors.textLighter),+ filled: true,+ fillColor: colors.fillLight,+ prefixIcon:+ widget.prefix == null ? null : _slot(widget.prefix!, colors),+ suffixIcon: suffix == null ? null : _slot(suffix, colors),+ prefixIconConstraints: const BoxConstraints.tightFor(+ width: Spacing.xxl + Spacing.lg,+ height: Spacing.xxl + Spacing.lg,+ ),+ suffixIconConstraints: const BoxConstraints.tightFor(+ width: Spacing.xxl + Spacing.lg,+ height: Spacing.xxl + Spacing.lg,+ ),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: Spacing.lg,+ vertical: Spacing.lg,+ ),+ counterText: widget.counterText,+ border: _border(colors),+ enabledBorder: _border(colors),+ focusedBorder: _border(colors, focused: true),+ disabledBorder: _border(colors),+ ),+ ),+ if (message != null) ...[+ const SizedBox(height: Spacing.xs),+ Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ if (_messageIcon(messageType) != null) ...[+ Icon(+ _messageIcon(messageType),+ size: 14,+ color: messageColor,+ ),+ const SizedBox(width: Spacing.xs),+ ],+ Expanded(+ child: Text(+ message,+ style: TextStyles.tiny.copyWith(color: messageColor),+ ),+ ),+ ],+ ),+ ],+ ],+ ),+ );+ }++ bool get _isMultiline {+ return !_obscureText &&+ (widget.maxLines > 1 ||+ (widget.minLines != null && widget.minLines! > 1));+ }++ String? get _message =>+ widget.errorText ??+ widget.alertText ??+ widget.successText ??+ widget.helperText;++ TextInputComponentMessageType get _messageType {+ if (widget.errorText != null) {+ return TextInputComponentMessageType.error;+ }+ if (widget.alertText != null) {+ return TextInputComponentMessageType.alert;+ }+ if (widget.successText != null) {+ return TextInputComponentMessageType.success;+ }+ return TextInputComponentMessageType.helper;+ }++ IconData? _messageIcon(TextInputComponentMessageType messageType) {+ if (widget.messageIcon != null) {+ return widget.messageIcon;+ }+ return switch (messageType) {+ TextInputComponentMessageType.alert => Icons.warning_amber_rounded,+ TextInputComponentMessageType.success =>+ Icons.check_circle_outline_rounded,+ TextInputComponentMessageType.error ||+ TextInputComponentMessageType.helper =>+ null,+ };+ }++ Widget? _effectiveSuffix() {+ if (widget.showPasswordToggle) {+ return GestureDetector(+ key: const ValueKey('text-field-password-toggle'),+ behavior: HitTestBehavior.opaque,+ onTap: widget.enabled+ ? () => setState(() => _obscureText = !_obscureText)+ : null,+ child: Icon(+ _obscureText+ ? Icons.visibility_off_outlined+ : Icons.visibility_outlined,+ size: 20,+ ),+ );+ }+ if (widget.isClearable && _hasText) {+ return GestureDetector(+ key: const ValueKey('text-field-clear'),+ behavior: HitTestBehavior.opaque,+ onTap: widget.enabled && !widget.readOnly+ ? () {+ _controller.clear();+ widget.onChanged?.call('');+ }+ : null,+ child: const Icon(Icons.close_rounded, size: 20),+ );+ }+ return widget.suffix;+ }++ void _handleChanged(String value) {+ widget.onChanged?.call(value);+ }++ void _handleControllerChanged() {+ final hasText = _controller.text.isNotEmpty;+ if (_hasText != hasText && mounted) {+ setState(() => _hasText = hasText);+ }+ }++ void _handleFocusChanged() {+ if (mounted) {+ setState(() {});+ }+ }++ Widget _slot(Widget child, ColorTokens colors) {+ return IconTheme.merge(+ data: IconThemeData(color: colors.textLighter, size: 24),+ child: Center(+ widthFactor: 1,+ child: SizedBox.square(+ dimension: 24,+ child: Center(child: child),+ ),+ ),+ );+ }++ bool get _hasError => widget.errorText != null || widget.alertText != null;++ bool get _hasSuccess => widget.successText != null;++ bool get _hasFocus => widget.isFocused || _focusNode.hasFocus;++ OutlineInputBorder _border(ColorTokens colors, {bool focused = false}) {+ final Color color;+ final double width;+ if (_hasError) {+ color = colors.warning;+ width = 1.5;+ } else if (_hasSuccess) {+ color = colors.primary;+ width = 1.5;+ } else if (focused || _hasFocus) {+ color = colors.primary;+ width = 2;+ } else {+ color = colors.strokeFaint.withAlpha(0);+ width = 0;+ }++ return OutlineInputBorder(+ borderRadius: BorderRadius.circular(Radii.lg),+ borderSide: BorderSide(color: color, width: width),+ );+ }+}diff --git a/mobile/packages/ente_components/lib/ente_components.dart b/mobile/packages/ente_components/lib/ente_components.dartnew file mode 100644index 0000000000..917095ecdb--- /dev/null+++ b/mobile/packages/ente_components/lib/ente_components.dart@@ -0,0 +1,18 @@+export 'components/app_bar_component.dart';+export 'components/avatar_component.dart';+export 'components/buttons/button_component.dart';+export 'components/buttons/icon_button_component.dart';+export 'components/filter_chip_component.dart';+export 'components/header_component.dart';+export 'components/menu_component.dart';+export 'components/selection_control_components.dart';+export 'components/slider_component.dart';+export 'components/stepper_component.dart';+export 'components/text_input_component.dart';+export 'theme/colors.dart';+export 'theme/motion.dart';+export 'theme/radii.dart';+export 'theme/shadows.dart';+export 'theme/spacing.dart';+export 'theme/text_styles.dart';+export 'theme/theme.dart';diff --git a/mobile/packages/ente_components/lib/theme/colors.dart b/mobile/packages/ente_components/lib/theme/colors.dartnew file mode 100644index 0000000000..b42e767567--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/colors.dart@@ -0,0 +1,559 @@+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&view=variables+/// Section: Colours / Semantic tokens+/// Specs: Color Tokens collection with Photos-Light and Photos-Dark modes.+enum EnteApp {+ photos,+ auth,+ locker,+}++class ColorTokens {+ const ColorTokens({+ required this.primaryLight,+ required this.primaryStroke,+ required this.primary,+ required this.primaryDark,+ required this.primaryDarker,+ required this.warningLight,+ required this.warning,+ required this.warningDark,+ required this.warningDarker,+ required this.cautionLight,+ required this.caution,+ required this.infoLight,+ required this.infoStroke,+ required this.info,+ required this.infoDark,+ required this.infoDarker,+ required this.textLight,+ required this.textBase,+ required this.textDark,+ required this.textDarker,+ required this.textLighter,+ required this.textLightest,+ required this.textReverse,+ required this.iconColor,+ required this.backgroundBase,+ required this.fillLight,+ required this.fillBase,+ required this.fillDark,+ required this.fillDarker,+ required this.fillDarkest,+ required this.strokeDark,+ required this.strokeFaint,+ required this.accentOrangeLight,+ required this.accentPinkLight,+ required this.accentPurpleLight,+ required this.accentTealLight,+ required this.accentOrange,+ required this.accentPink,+ required this.accentPurple,+ required this.accentTeal,+ required this.specialContentReverse,+ required this.specialScrim,+ required this.specialWhite,+ required this.specialWhiteOverlay,+ });++ final Color primaryLight;+ final Color primaryStroke;+ final Color primary;+ final Color primaryDark;+ final Color primaryDarker;+ final Color warningLight;+ final Color warning;+ final Color warningDark;+ final Color warningDarker;+ final Color cautionLight;+ final Color caution;+ final Color infoLight;+ final Color infoStroke;+ final Color info;+ final Color infoDark;+ final Color infoDarker;+ final Color textLight;+ final Color textBase;+ final Color textDark;+ final Color textDarker;+ final Color textLighter;+ final Color textLightest;+ final Color textReverse;+ final Color iconColor;+ final Color backgroundBase;+ final Color fillLight;+ final Color fillBase;+ final Color fillDark;+ final Color fillDarker;+ final Color fillDarkest;+ final Color strokeDark;+ final Color strokeFaint;+ final Color accentOrangeLight;+ final Color accentPinkLight;+ final Color accentPurpleLight;+ final Color accentTealLight;+ final Color accentOrange;+ final Color accentPink;+ final Color accentPurple;+ final Color accentTeal;+ final Color specialContentReverse;+ final Color specialScrim;+ final Color specialWhite;+ final Color specialWhiteOverlay;++ static const light = colorTokensLight;+ static const dark = colorTokensDark;++ factory ColorTokens.forApp(+ EnteApp app, {+ Brightness brightness = Brightness.light,+ }) {+ final base =+ brightness == Brightness.dark ? colorTokensDark : colorTokensLight;+ return base.withPrimary(_primaryTokensForApp(app, brightness));+ }++ ColorTokens withPrimary(PrimaryColorTokens primaryTokens) {+ return ColorTokens(+ primaryLight: primaryTokens.primaryLight,+ primaryStroke: primaryTokens.primaryStroke,+ primary: primaryTokens.primary,+ primaryDark: primaryTokens.primaryDark,+ primaryDarker: primaryTokens.primaryDarker,+ warningLight: warningLight,+ warning: warning,+ warningDark: warningDark,+ warningDarker: warningDarker,+ cautionLight: cautionLight,+ caution: caution,+ infoLight: infoLight,+ infoStroke: infoStroke,+ info: info,+ infoDark: infoDark,+ infoDarker: infoDarker,+ textLight: textLight,+ textBase: textBase,+ textDark: textDark,+ textDarker: textDarker,+ textLighter: textLighter,+ textLightest: textLightest,+ textReverse: textReverse,+ iconColor: iconColor,+ backgroundBase: backgroundBase,+ fillLight: fillLight,+ fillBase: fillBase,+ fillDark: fillDark,+ fillDarker: fillDarker,+ fillDarkest: fillDarkest,+ strokeDark: strokeDark,+ strokeFaint: strokeFaint,+ accentOrangeLight: accentOrangeLight,+ accentPinkLight: accentPinkLight,+ accentPurpleLight: accentPurpleLight,+ accentTealLight: accentTealLight,+ accentOrange: accentOrange,+ accentPink: accentPink,+ accentPurple: accentPurple,+ accentTeal: accentTeal,+ specialContentReverse: specialContentReverse,+ specialScrim: specialScrim,+ specialWhite: specialWhite,+ specialWhiteOverlay: specialWhiteOverlay,+ );+ }+}++class PrimaryColorTokens {+ const PrimaryColorTokens({+ required this.primaryLight,+ required this.primaryStroke,+ required this.primary,+ required this.primaryDark,+ required this.primaryDarker,+ });++ final Color primaryLight;+ final Color primaryStroke;+ final Color primary;+ final Color primaryDark;+ final Color primaryDarker;+}++PrimaryColorTokens _primaryTokensForApp(EnteApp app, Brightness brightness) {+ final dark = brightness == Brightness.dark;+ return switch (app) {+ EnteApp.photos => dark ? photosPrimaryTokensDark : photosPrimaryTokensLight,+ EnteApp.auth => dark ? authPrimaryTokensDark : authPrimaryTokensLight,+ EnteApp.locker => dark ? lockerPrimaryTokensDark : lockerPrimaryTokensLight,+ };+}++const ColorTokens colorTokensLight = ColorTokens(+ primaryLight: primaryLightLight,+ primaryStroke: primaryStrokeLight,+ primary: primaryDefaultLight,+ primaryDark: primaryDarkLight,+ primaryDarker: primaryDarkerLight,+ warningLight: warningLightLight,+ warning: warningDefaultLight,+ warningDark: warningDarkLight,+ warningDarker: warningDarkerLight,+ cautionLight: cautionLightLight,+ caution: cautionDefaultLight,+ infoLight: infoLightLight,+ infoStroke: infoStrokeLight,+ info: infoDefaultLight,+ infoDark: infoDarkLight,+ infoDarker: infoDarkerLight,+ textLight: textLightLight,+ textBase: textBaseLight,+ textDark: textDarkLight,+ textDarker: textDarkerLight,+ textLighter: textLighterLight,+ textLightest: textLightestLight,+ textReverse: textReverseLight,+ iconColor: iconColorLight,+ backgroundBase: backgroundBaseLight,+ fillLight: fillLightLight,+ fillBase: fillBaseLight,+ fillDark: fillDarkLight,+ fillDarker: fillDarkerLight,+ fillDarkest: fillDarkestLight,+ strokeDark: strokeDarkLight,+ strokeFaint: strokeFaintLight,+ accentOrangeLight: accentOrangeLightLight,+ accentPinkLight: accentPinkLightLight,+ accentPurpleLight: accentPurpleLightLight,+ accentTealLight: accentTealLightLight,+ accentOrange: accentOrangeDefaultLight,+ accentPink: accentPinkDefaultLight,+ accentPurple: accentPurpleDefaultLight,+ accentTeal: accentTealDefaultLight,+ specialContentReverse: specialContentReverseLight,+ specialScrim: specialScrimLight,+ specialWhite: specialWhiteLight,+ specialWhiteOverlay: specialWhiteOverlayLight,+);++const ColorTokens colorTokensDark = ColorTokens(+ primaryLight: primaryLightDark,+ primaryStroke: primaryStrokeDark,+ primary: primaryDefaultDark,+ primaryDark: primaryDarkDark,+ primaryDarker: primaryDarkerDark,+ warningLight: warningLightDark,+ warning: warningDefaultDark,+ warningDark: warningDarkDark,+ warningDarker: warningDarkerDark,+ cautionLight: cautionLightDark,+ caution: cautionDefaultDark,+ infoLight: infoLightDark,+ infoStroke: infoStrokeDark,+ info: infoDefaultDark,+ infoDark: infoDarkDark,+ infoDarker: infoDarkerDark,+ textLight: textLightDark,+ textBase: textBaseDark,+ textDark: textDarkDark,+ textDarker: textDarkerDark,+ textLighter: textLighterDark,+ textLightest: textLightestDark,+ textReverse: textReverseDark,+ iconColor: iconColorDark,+ backgroundBase: backgroundBaseDark,+ fillLight: fillLightDark,+ fillBase: fillBaseDark,+ fillDark: fillDarkDark,+ fillDarker: fillDarkerDark,+ fillDarkest: fillDarkestDark,+ strokeDark: strokeDarkDark,+ strokeFaint: strokeFaintDark,+ accentOrangeLight: accentOrangeLightDark,+ accentPinkLight: accentPinkLightDark,+ accentPurpleLight: accentPurpleLightDark,+ accentTealLight: accentTealLightDark,+ accentOrange: accentOrangeDefaultDark,+ accentPink: accentPinkDefaultDark,+ accentPurple: accentPurpleDefaultDark,+ accentTeal: accentTealDefaultDark,+ specialContentReverse: specialContentReverseDark,+ specialScrim: specialScrimDark,+ specialWhite: specialWhiteDark,+ specialWhiteOverlay: specialWhiteOverlayDark,+);++const PrimaryColorTokens photosPrimaryTokensLight = PrimaryColorTokens(+ primaryLight: primaryLightLight,+ primaryStroke: primaryStrokeLight,+ primary: primaryDefaultLight,+ primaryDark: primaryDarkLight,+ primaryDarker: primaryDarkerLight,+);++const PrimaryColorTokens photosPrimaryTokensDark = PrimaryColorTokens(+ primaryLight: primaryLightDark,+ primaryStroke: primaryStrokeDark,+ primary: primaryDefaultDark,+ primaryDark: primaryDarkDark,+ primaryDarker: primaryDarkerDark,+);++const PrimaryColorTokens authPrimaryTokensLight = PrimaryColorTokens(+ primaryLight: authPrimaryLightLight,+ primaryStroke: authPrimaryStrokeLight,+ primary: authPrimaryDefaultLight,+ primaryDark: authPrimaryDarkLight,+ primaryDarker: authPrimaryDarkerLight,+);++const PrimaryColorTokens authPrimaryTokensDark = PrimaryColorTokens(+ primaryLight: authPrimaryLightDark,+ primaryStroke: authPrimaryStrokeDark,+ primary: authPrimaryDefaultDark,+ primaryDark: authPrimaryDarkDark,+ primaryDarker: authPrimaryDarkerDark,+);++const PrimaryColorTokens lockerPrimaryTokensLight = PrimaryColorTokens(+ primaryLight: lockerPrimaryLightLight,+ primaryStroke: lockerPrimaryStrokeLight,+ primary: lockerPrimaryDefaultLight,+ primaryDark: lockerPrimaryDarkLight,+ primaryDarker: lockerPrimaryDarkerLight,+);++const PrimaryColorTokens lockerPrimaryTokensDark = PrimaryColorTokens(+ primaryLight: lockerPrimaryLightDark,+ primaryStroke: lockerPrimaryStrokeDark,+ primary: lockerPrimaryDefaultDark,+ primaryDark: lockerPrimaryDarkDark,+ primaryDarker: lockerPrimaryDarkerDark,+);++// Primary Colors+const Color primaryLightLight = Color.fromRGBO(231, 246, 233, 1);+const Color primaryLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color primaryStrokeLight = Color.fromRGBO(186, 236, 194, 1);+const Color primaryStrokeDark = Color.fromRGBO(28, 65, 34, 1);++const Color primaryDefaultLight = Color.fromRGBO(8, 194, 37, 1);+const Color primaryDefaultDark = Color.fromRGBO(8, 194, 37, 1);++const Color primaryDarkLight = Color.fromRGBO(6, 157, 30, 1);+const Color primaryDarkDark = Color.fromRGBO(6, 157, 30, 1);++const Color primaryDarkerLight = Color.fromRGBO(5, 124, 24, 1);+const Color primaryDarkerDark = Color.fromRGBO(5, 124, 24, 1);++// Auth Primary Colors+const Color authPrimaryLightLight = Color.fromRGBO(248, 243, 254, 1);+const Color authPrimaryLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color authPrimaryStrokeLight = Color.fromRGBO(221, 191, 248, 1);+const Color authPrimaryStrokeDark = Color.fromRGBO(61, 34, 88, 1);++const Color authPrimaryDefaultLight = Color(0xFF8F33D6);+const Color authPrimaryDefaultDark = Color(0xFF8F33D6);++const Color authPrimaryDarkLight = Color(0xFF722ED1);+const Color authPrimaryDarkDark = Color(0xFF722ED1);++const Color authPrimaryDarkerLight = Color(0xFF5D25AD);+const Color authPrimaryDarkerDark = Color(0xFF5D25AD);++// Locker Primary Colors+const Color lockerPrimaryLightLight = Color.fromRGBO(231, 239, 250, 1);+const Color lockerPrimaryLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color lockerPrimaryStrokeLight = Color.fromRGBO(200, 216, 238, 1);+const Color lockerPrimaryStrokeDark = Color.fromRGBO(26, 43, 77, 1);++const Color lockerPrimaryDefaultLight = Color.fromRGBO(16, 113, 255, 1);+const Color lockerPrimaryDefaultDark = Color.fromRGBO(16, 113, 255, 1);++const Color lockerPrimaryDarkLight = Color.fromRGBO(14, 95, 217, 1);+const Color lockerPrimaryDarkDark = Color.fromRGBO(14, 95, 217, 1);++const Color lockerPrimaryDarkerLight = Color.fromRGBO(11, 76, 173, 1);+const Color lockerPrimaryDarkerDark = Color.fromRGBO(11, 76, 173, 1);++// Warning Colors+const Color warningLightLight = Color.fromRGBO(250, 235, 235, 1);+const Color warningLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color warningDefaultLight = Color.fromRGBO(246, 58, 58, 1);+const Color warningDefaultDark = Color.fromRGBO(246, 58, 58, 1);++const Color warningDarkLight = Color.fromRGBO(221, 52, 52, 1);+const Color warningDarkDark = Color.fromRGBO(221, 52, 52, 1);++const Color warningDarkerLight = Color.fromRGBO(197, 46, 46, 1);+const Color warningDarkerDark = Color.fromRGBO(197, 46, 46, 1);++// Caution Colors+const Color cautionLightLight = Color.fromRGBO(250, 244, 235, 1);+const Color cautionLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color cautionDefaultLight = Color.fromRGBO(255, 169, 57, 1);+const Color cautionDefaultDark = Color.fromRGBO(255, 169, 57, 1);++// Info Colors+const Color infoLightLight = Color.fromRGBO(231, 239, 250, 1);+const Color infoLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color infoStrokeLight = Color.fromRGBO(200, 216, 238, 1);+const Color infoStrokeDark = Color.fromRGBO(26, 43, 77, 1);++const Color infoDefaultLight = Color.fromRGBO(16, 113, 255, 1);+const Color infoDefaultDark = Color.fromRGBO(16, 113, 255, 1);++const Color infoDarkLight = Color.fromRGBO(14, 95, 217, 1);+const Color infoDarkDark = Color.fromRGBO(14, 95, 217, 1);++const Color infoDarkerLight = Color.fromRGBO(11, 76, 173, 1);+const Color infoDarkerDark = Color.fromRGBO(11, 76, 173, 1);++// Text Colors+const Color textLightLight = Color.fromRGBO(102, 102, 102, 1);+const Color textLightDark = Color.fromRGBO(153, 153, 153, 1);++const Color textBaseLight = Color.fromRGBO(0, 0, 0, 1);+const Color textBaseDark = Color.fromRGBO(255, 255, 255, 1);++const Color textDarkLight = Color.fromRGBO(26, 26, 26, 1);+const Color textDarkDark = Color.fromRGBO(229, 229, 229, 1);++const Color textDarkerLight = Color.fromRGBO(21, 21, 21, 1);+const Color textDarkerDark = Color.fromRGBO(204, 204, 204, 1);++const Color textLighterLight = Color.fromRGBO(150, 150, 150, 1);+const Color textLighterDark = Color.fromRGBO(150, 150, 150, 1);++const Color textLightestLight = Color.fromRGBO(222, 222, 222, 1);+const Color textLightestDark = Color.fromRGBO(10, 10, 10, 1);++const Color textReverseLight = Color.fromRGBO(255, 255, 255, 1);+const Color textReverseDark = Color.fromRGBO(0, 0, 0, 1);++// Icon Colors+const Color iconColorLight = Color.fromRGBO(0, 0, 0, 0.75);+const Color iconColorDark = Color.fromRGBO(255, 255, 255, 1);++// Background Colors+const Color backgroundBaseLight = Color.fromRGBO(250, 250, 250, 1);+const Color backgroundBaseDark = Color.fromRGBO(22, 22, 22, 1);++// Fill Colors+const Color fillLightLight = Color.fromRGBO(255, 255, 255, 1);+const Color fillLightDark = Color.fromRGBO(33, 33, 33, 1);++const Color fillBaseLight = Color.fromRGBO(0, 0, 0, 1);+const Color fillBaseDark = Color.fromRGBO(255, 255, 255, 1);++const Color fillDarkLight = Color.fromRGBO(245, 245, 245, 1);+const Color fillDarkDark = Color.fromRGBO(10, 10, 10, 1);++const Color fillDarkerLight = Color.fromRGBO(233, 233, 233, 1);+const Color fillDarkerDark = Color.fromRGBO(20, 20, 20, 1);++const Color fillDarkestLight = Color.fromRGBO(210, 210, 210, 1);+const Color fillDarkestDark = Color.fromRGBO(41, 41, 41, 1);++// Stroke Colors+const Color strokeDarkLight = Color.fromRGBO(224, 224, 224, 1);+const Color strokeDarkDark = Color.fromRGBO(62, 62, 62, 1);++const Color strokeFaintLight = Color.fromRGBO(235, 235, 235, 1);+const Color strokeFaintDark = Color.fromRGBO(33, 33, 33, 1);++// Accent Colors+const Color accentOrangeLightLight = Color.fromRGBO(255, 247, 244, 1);+const Color accentOrangeLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color accentPinkLightLight = Color.fromRGBO(253, 246, 251, 1);+const Color accentPinkLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color accentPurpleLightLight = Color.fromRGBO(248, 243, 254, 1);+const Color accentPurpleLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color accentTealLightLight = Color.fromRGBO(245, 251, 251, 1);+const Color accentTealLightDark = Color.fromRGBO(41, 41, 41, 1);++const Color accentOrangeDefaultLight = Color.fromRGBO(242, 72, 34, 1);+const Color accentOrangeDefaultDark = Color.fromRGBO(242, 72, 34, 1);++const Color accentPinkDefaultLight = Color.fromRGBO(223, 97, 187, 1);+const Color accentPinkDefaultDark = Color.fromRGBO(223, 97, 187, 1);++const Color accentPurpleDefaultLight = Color.fromRGBO(138, 56, 245, 1);+const Color accentPurpleDefaultDark = Color.fromRGBO(138, 56, 245, 1);++const Color accentTealDefaultLight = Color.fromRGBO(95, 183, 187, 1);+const Color accentTealDefaultDark = Color.fromRGBO(95, 183, 187, 1);++// Special Colors+const Color specialContentReverseLight = Color.fromRGBO(255, 255, 255, 1);+const Color specialContentReverseDark = Color.fromRGBO(0, 0, 0, 1);++const Color specialScrimLight = Color.fromRGBO(0, 0, 0, 0.4);+const Color specialScrimDark = Color.fromRGBO(0, 0, 0, 0.4);++const Color specialWhiteLight = Color.fromRGBO(255, 255, 255, 1);+const Color specialWhiteDark = Color.fromRGBO(255, 255, 255, 1);++const Color specialWhiteOverlayLight = Color.fromRGBO(255, 255, 255, 0.14);+const Color specialWhiteOverlayDark = Color.fromRGBO(255, 255, 255, 0.14);++const List<Color> avatarLight = [+ Color.fromRGBO(118, 84, 154, 1),+ Color.fromRGBO(223, 120, 97, 1),+ Color.fromRGBO(148, 180, 159, 1),+ Color.fromRGBO(135, 162, 251, 1),+ Color.fromRGBO(198, 137, 198, 1),+ Color.fromRGBO(198, 137, 198, 1),+ Color.fromRGBO(50, 82, 136, 1),+ Color.fromRGBO(133, 180, 224, 1),+ Color.fromRGBO(193, 163, 163, 1),+ Color.fromRGBO(193, 163, 163, 1),+ Color.fromRGBO(66, 97, 101, 1),+ Color.fromRGBO(66, 97, 101, 1),+ Color.fromRGBO(66, 97, 101, 1),+ Color.fromRGBO(221, 157, 226, 1),+ Color.fromRGBO(130, 171, 139, 1),+ Color.fromRGBO(155, 187, 232, 1),+ Color.fromRGBO(143, 190, 190, 1),+ Color.fromRGBO(138, 195, 161, 1),+ Color.fromRGBO(168, 176, 242, 1),+ Color.fromRGBO(176, 198, 149, 1),+ Color.fromRGBO(233, 154, 173, 1),+ Color.fromRGBO(209, 132, 132, 1),+ Color.fromRGBO(120, 181, 167, 1),+];++const List<Color> avatarDark = [+ Color.fromRGBO(118, 84, 154, 1),+ Color.fromRGBO(223, 120, 97, 1),+ Color.fromRGBO(148, 180, 159, 1),+ Color.fromRGBO(135, 162, 251, 1),+ Color.fromRGBO(198, 137, 198, 1),+ Color.fromRGBO(147, 125, 194, 1),+ Color.fromRGBO(50, 82, 136, 1),+ Color.fromRGBO(133, 180, 224, 1),+ Color.fromRGBO(193, 163, 163, 1),+ Color.fromRGBO(225, 160, 89, 1),+ Color.fromRGBO(66, 97, 101, 1),+ Color.fromRGBO(107, 119, 178, 1),+ Color.fromRGBO(149, 127, 239, 1),+ Color.fromRGBO(221, 157, 226, 1),+ Color.fromRGBO(130, 171, 139, 1),+ Color.fromRGBO(155, 187, 232, 1),+ Color.fromRGBO(143, 190, 190, 1),+ Color.fromRGBO(138, 195, 161, 1),+ Color.fromRGBO(168, 176, 242, 1),+ Color.fromRGBO(176, 198, 149, 1),+ Color.fromRGBO(233, 154, 173, 1),+ Color.fromRGBO(209, 132, 132, 1),+ Color.fromRGBO(120, 181, 167, 1),+];diff --git a/mobile/packages/ente_components/lib/theme/motion.dart b/mobile/packages/ente_components/lib/theme/motion.dartnew file mode 100644index 0000000000..925e32a027--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/motion.dart@@ -0,0 +1,10 @@+/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Design system / Motion+/// Specs: Short, predictable state transitions for mobile controls.+class Motion {+ const Motion._();++ static const quick = Duration(milliseconds: 120);+ static const standard = Duration(milliseconds: 180);+ static const slow = Duration(milliseconds: 260);+}diff --git a/mobile/packages/ente_components/lib/theme/radii.dart b/mobile/packages/ente_components/lib/theme/radii.dartnew file mode 100644index 0000000000..2cd288fe22--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/radii.dart@@ -0,0 +1,17 @@+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=2207-41577&m=dev+/// Section: Buttons / Button Small+/// Specs: Button radius 20px; supporting surfaces use compact mobile radii.+class Radii {+ const Radii._();++ static const double xs = 4;+ static const double sm = 8;+ static const double md = 12;+ static const double lg = 16;+ static const double button = 20;+ static const double sheet = 24;+ static const Radius buttonRadius = Radius.circular(button);+ static const BorderRadius buttonBorder = BorderRadius.all(buttonRadius);+}diff --git a/mobile/packages/ente_components/lib/theme/shadows.dart b/mobile/packages/ente_components/lib/theme/shadows.dartnew file mode 100644index 0000000000..ce4fe42d01--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/shadows.dart@@ -0,0 +1,24 @@+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Design system / Shadows+/// Specs: Subtle elevation shadows for sheets, overlays, and floating controls.+class Shadows {+ const Shadows._();++ static const soft = [+ BoxShadow(+ color: Color(0x14000000),+ blurRadius: 16,+ offset: Offset(0, 8),+ ),+ ];++ static const floating = [+ BoxShadow(+ color: Color(0x24000000),+ blurRadius: 24,+ offset: Offset(0, 12),+ ),+ ];+}diff --git a/mobile/packages/ente_components/lib/theme/spacing.dart b/mobile/packages/ente_components/lib/theme/spacing.dartnew file mode 100644index 0000000000..f251392277--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/spacing.dart@@ -0,0 +1,15 @@+/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Design system / Spacing+/// Specs: Compact mobile spacing scale used by components and catalog previews.+class Spacing {+ const Spacing._();++ static const double xxs = 2;+ static const double xs = 4;+ static const double sm = 8;+ static const double md = 12;+ static const double lg = 16;+ static const double xl = 24;+ static const double xxl = 32;+ static const double xxxl = 40;+}diff --git a/mobile/packages/ente_components/lib/theme/text_styles.dart b/mobile/packages/ente_components/lib/theme/text_styles.dartnew file mode 100644index 0000000000..376c2b0278--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/text_styles.dart@@ -0,0 +1,83 @@+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=7672-54672&m=dev+/// Section: Text styles+/// Specs: Inter, letter spacing 0; H1 20/28, H2 18/24, body 14/20, mini 12/16, tiny 10/12.+class TextStyles {+ const TextStyles._();++ static const String fontFamily = 'Inter';++ static const h1 = TextStyle(+ fontFamily: fontFamily,+ fontSize: 20,+ height: 28 / 20,+ fontWeight: FontWeight.w700,+ letterSpacing: 0,+ );++ static const h1Bold = TextStyle(+ fontFamily: fontFamily,+ fontSize: 20,+ height: 28 / 20,+ fontWeight: FontWeight.w600,+ letterSpacing: 0,+ );++ static const h2 = TextStyle(+ fontFamily: fontFamily,+ fontSize: 18,+ height: 24 / 18,+ fontWeight: FontWeight.w600,+ letterSpacing: 0,+ );++ static const large = TextStyle(+ fontFamily: fontFamily,+ fontSize: 16,+ height: 20 / 16,+ fontWeight: FontWeight.w600,+ letterSpacing: 0,+ );++ static const bodyBold = TextStyle(+ fontFamily: fontFamily,+ fontSize: 14,+ height: 20 / 14,+ fontWeight: FontWeight.w600,+ letterSpacing: 0,+ );++ static const body = TextStyle(+ fontFamily: fontFamily,+ fontSize: 14,+ height: 20 / 14,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ );++ static const bodyLink = TextStyle(+ fontFamily: fontFamily,+ fontSize: 14,+ height: 20 / 14,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ decoration: TextDecoration.underline,+ );++ static const mini = TextStyle(+ fontFamily: fontFamily,+ fontSize: 12,+ height: 16 / 12,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ );++ static const tiny = TextStyle(+ fontFamily: fontFamily,+ fontSize: 10,+ height: 12 / 10,+ fontWeight: FontWeight.w500,+ letterSpacing: 0,+ );+}diff --git a/mobile/packages/ente_components/lib/theme/theme.dart b/mobile/packages/ente_components/lib/theme/theme.dartnew file mode 100644index 0000000000..2461c6fd82--- /dev/null+++ b/mobile/packages/ente_components/lib/theme/theme.dart@@ -0,0 +1,107 @@+import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/text_styles.dart';+import 'package:flutter/material.dart';++/// Figma: https://www.figma.com/design/BuBNPPytxlVnqfmCUW0mgz/Ente-Visual-Design?node-id=57-6281&m=dev+/// Section: Design system / Theme helpers+/// Specs: Light and dark theme mapping for Ente component tokens.+class ComponentTheme {+ const ComponentTheme._();++ static ColorTokens colorsOf(BuildContext context) {+ final theme = Theme.of(context);+ return theme.extension<ComponentColorTokens>()?.colors ??+ colorsForApp(+ EnteApp.photos,+ brightness: theme.brightness,+ );+ }++ static ColorTokens colorsForApp(+ EnteApp app, {+ Brightness brightness = Brightness.light,+ }) {+ return ColorTokens.forApp(app, brightness: brightness);+ }++ static ThemeData lightTheme({EnteApp app = EnteApp.photos}) {+ return _theme(+ colorsForApp(app),+ Brightness.light,+ );+ }++ static ThemeData darkTheme({EnteApp app = EnteApp.photos}) {+ return _theme(+ colorsForApp(+ app,+ brightness: Brightness.dark,+ ),+ Brightness.dark,+ );+ }++ static ThemeData themeForApp(+ EnteApp app, {+ Brightness brightness = Brightness.light,+ }) {+ return brightness == Brightness.dark+ ? darkTheme(app: app)+ : lightTheme(app: app);+ }++ static ThemeData _theme(ColorTokens colors, Brightness brightness) {+ return ThemeData(+ useMaterial3: true,+ brightness: brightness,+ scaffoldBackgroundColor: colors.backgroundBase,+ colorScheme: ColorScheme.fromSeed(+ seedColor: colors.primary,+ brightness: brightness,+ primary: colors.primary,+ error: colors.warning,+ surface: colors.backgroundBase,+ ),+ textTheme: const TextTheme(+ headlineLarge: TextStyles.h1,+ headlineMedium: TextStyles.h2,+ titleLarge: TextStyles.large,+ bodyLarge: TextStyles.body,+ bodyMedium: TextStyles.body,+ labelLarge: TextStyles.bodyBold,+ labelMedium: TextStyles.mini,+ labelSmall: TextStyles.tiny,+ ),+ extensions: [+ ComponentColorTokens(colors),+ ],+ );+ }+}++@immutable+class ComponentColorTokens extends ThemeExtension<ComponentColorTokens> {+ const ComponentColorTokens(this.colors);++ final ColorTokens colors;++ @override+ ComponentColorTokens copyWith({ColorTokens? colors}) {+ return ComponentColorTokens(colors ?? this.colors);+ }++ @override+ ComponentColorTokens lerp(+ ThemeExtension<ComponentColorTokens>? other,+ double t,+ ) {+ if (other is! ComponentColorTokens) {+ return this;+ }+ return t < 0.5 ? this : other;+ }+}++extension ThemeContext on BuildContext {+ ColorTokens get componentColors => ComponentTheme.colorsOf(this);+}diff --git a/mobile/packages/ente_components/pubspec.lock b/mobile/packages/ente_components/pubspec.locknew file mode 100644index 0000000000..22e3327208--- /dev/null+++ b/mobile/packages/ente_components/pubspec.lock@@ -0,0 +1,309 @@+# Generated by pub+# See https://dart.dev/tools/pub/glossary#lockfile+packages:+ 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"+ 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"+ fake_async:+ dependency: transitive+ description:+ name: fake_async+ sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"+ url: "https://pub.dev"+ source: hosted+ version: "1.3.3"+ flutter:+ dependency: "direct main"+ description: flutter+ source: sdk+ version: "0.0.0"+ flutter_lints:+ dependency: "direct dev"+ description:+ name: flutter_lints+ sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"+ url: "https://pub.dev"+ source: hosted+ version: "5.0.0"+ flutter_svg:+ dependency: transitive+ description:+ name: flutter_svg+ sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95"+ url: "https://pub.dev"+ source: hosted+ version: "2.2.3"+ flutter_test:+ dependency: "direct dev"+ description: flutter+ source: sdk+ version: "0.0.0"+ http:+ dependency: transitive+ description:+ name: http+ sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"+ url: "https://pub.dev"+ source: hosted+ version: "1.6.0"+ http_parser:+ dependency: transitive+ description:+ name: http_parser+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"+ url: "https://pub.dev"+ source: hosted+ version: "4.1.2"+ hugeicons:+ dependency: "direct main"+ description:+ name: hugeicons+ sha256: d19c0e2b57ccf455dd8ef08b84da40ae6dbba898c92960a0a0ada77df7865b8a+ url: "https://pub.dev"+ source: hosted+ version: "1.1.5"+ 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"+ 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"+ path:+ dependency: transitive+ description:+ name: path+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"+ url: "https://pub.dev"+ source: hosted+ version: "1.9.1"+ path_parsing:+ dependency: transitive+ description:+ name: path_parsing+ sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"+ petitparser:+ dependency: transitive+ description:+ name: petitparser+ sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.2"+ sky_engine:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"+ source_span:+ dependency: transitive+ description:+ name: source_span+ sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"+ url: "https://pub.dev"+ source: hosted+ version: "1.10.1"+ 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"+ 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"+ typed_data:+ dependency: transitive+ description:+ name: typed_data+ sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006+ url: "https://pub.dev"+ source: hosted+ version: "1.4.0"+ vector_graphics:+ dependency: transitive+ description:+ name: vector_graphics+ sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6+ url: "https://pub.dev"+ source: hosted+ version: "1.1.19"+ vector_graphics_codec:+ dependency: transitive+ description:+ name: vector_graphics_codec+ sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.13"+ vector_graphics_compiler:+ dependency: transitive+ description:+ name: vector_graphics_compiler+ sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc+ url: "https://pub.dev"+ source: hosted+ version: "1.1.19"+ 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"+ xml:+ dependency: transitive+ description:+ name: xml+ sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"+ url: "https://pub.dev"+ source: hosted+ version: "6.6.1"+sdks:+ dart: ">=3.8.0 <4.0.0"+ flutter: ">=3.32.0"diff --git a/mobile/packages/ente_components/pubspec.yaml b/mobile/packages/ente_components/pubspec.yamlnew file mode 100644index 0000000000..07700730f6--- /dev/null+++ b/mobile/packages/ente_components/pubspec.yaml@@ -0,0 +1,20 @@+name: ente_components+description: Production-ready Flutter design-system components for mobile apps.+version: 0.1.0+publish_to: none++environment:+ sdk: ">=3.0.0 <4.0.0"+ flutter: ">=1.17.0"++dependencies:+ flutter:+ sdk: flutter+ hugeicons: 1.1.5++dev_dependencies:+ flutter_lints: 5.0.0+ flutter_test:+ sdk: flutter++flutter:diff --git a/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dartnew file mode 100644index 0000000000..a7e235a8dd--- /dev/null+++ b/mobile/packages/ente_components/test/components/app_surface_widgets_test.dart@@ -0,0 +1,415 @@+import 'dart:async';++import 'package:ente_components/components/app_bar_component.dart';+import 'package:ente_components/components/header_component.dart';+import 'package:ente_components/components/menu_component.dart';+import 'package:ente_components/theme/colors.dart';+import 'package:ente_components/theme/theme.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';++Future<void> pumpComponent(+ WidgetTester tester,+ Widget child, {+ double width = 420,+ double? height,+}) async {+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: Align(+ alignment: Alignment.topLeft,+ child: SizedBox(width: width, height: height, child: child),+ ),+ ),+ ),+ );+}++void main() {+ testWidgets('MenuComponent renders slots, states, and handles taps',+ (tester) async {+ var tapped = false;++ await pumpComponent(+ tester,+ MenuComponent(+ title: 'Camera uploads',+ subtitle: 'Enabled on Wi-Fi',+ leading: const Icon(Icons.cloud_upload_outlined),+ trailing: Icon(+ Icons.chevron_right,+ color: ColorTokens.light.textLight,+ size: 18,+ ),+ selected: true,+ titleColor: ColorTokens.light.warning,+ iconColor: ColorTokens.light.primary,+ onTap: () async => tapped = true,+ ),+ );++ expect(find.text('Camera uploads'), findsOneWidget);+ expect(find.text('Enabled on Wi-Fi'), findsOneWidget);+ expect(find.byIcon(Icons.cloud_upload_outlined), findsOneWidget);+ expect(find.byIcon(Icons.chevron_right), findsOneWidget);+ expect(tester.getSize(find.byType(MenuComponent)).height, 60);+ final surface = tester.widget<AnimatedContainer>(+ find.byKey(const ValueKey('menu-item-surface')),+ );+ final decoration = surface.decoration! as BoxDecoration;+ expect(decoration.border, isNotNull);+ expect(tester.widget<Text>(find.text('Camera uploads')).maxLines, 2);+ expect(tester.widget<Text>(find.text('Enabled on Wi-Fi')).maxLines, 1);+ expect(+ tester.widget<Text>(find.text('Camera uploads')).style?.color,+ ColorTokens.light.warning,+ );+ expect(+ IconTheme.of(tester.element(find.byIcon(Icons.cloud_upload_outlined)))+ .color,+ ColorTokens.light.primary,+ );+ expect(+ tester.widget<Icon>(find.byIcon(Icons.chevron_right)).color,+ ColorTokens.light.textLight,+ );++ await tester.tap(find.text('Camera uploads'));+ await tester.pump();+ expect(tapped, isTrue);+ });++ testWidgets(+ 'MenuComponent delays loading, blocks repeat taps, and shows success',+ (tester) async {+ final completer = Completer<void>();+ var tapCount = 0;++ await pumpComponent(+ tester,+ MenuComponent(+ title: 'Sync now',+ trailing: const Icon(Icons.chevron_right),+ onTap: () {+ tapCount += 1;+ return completer.future;+ },+ ),+ );++ await tester.tap(find.text('Sync now'));+ await tester.pump(const Duration(milliseconds: 299));+ expect(find.byKey(const ValueKey('menu-item-loading')), findsNothing);++ await tester.tap(find.text('Sync now'));+ await tester.pump(const Duration(milliseconds: 1));+ expect(tapCount, 1);+ expect(find.byKey(const ValueKey('menu-item-loading')), findsOneWidget);+ expect(find.byIcon(Icons.chevron_right), findsNothing);++ completer.complete();+ await tester.pump();+ expect(find.byKey(const ValueKey('menu-item-success')), findsOneWidget);+ expect(find.byKey(const ValueKey('menu-item-loading')), findsNothing);++ await tester.pump(const Duration(seconds: 2));+ expect(find.byIcon(Icons.chevron_right), findsOneWidget);+ });++ testWidgets('MenuComponent can show only loading without success',+ (tester) async {+ final completer = Completer<void>();++ await pumpComponent(+ tester,+ MenuComponent(+ title: 'Refresh',+ showOnlyLoadingState: true,+ onTap: () => completer.future,+ ),+ );++ await tester.tap(find.text('Refresh'));+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.byKey(const ValueKey('menu-item-loading')), findsOneWidget);++ completer.complete();+ await tester.pump();+ expect(find.byKey(const ValueKey('menu-item-success')), findsNothing);+ expect(find.byKey(const ValueKey('menu-item-loading')), findsNothing);+ });++ testWidgets('MenuComponent can force success for fast actions',+ (tester) async {+ await pumpComponent(+ tester,+ MenuComponent(+ title: 'Copy',+ alwaysShowSuccessState: true,+ onTap: () async {},+ ),+ );++ await tester.tap(find.text('Copy'));+ await tester.pump();+ expect(find.byKey(const ValueKey('menu-item-success')), findsOneWidget);++ await tester.pump(const Duration(seconds: 2));+ expect(find.byKey(const ValueKey('menu-item-success')), findsNothing);+ });++ testWidgets('MenuComponent can disable gestures for display-only rows',+ (tester) async {+ var tapCount = 0;++ await pumpComponent(+ tester,+ MenuComponent(+ title: 'Storage plan',+ gesturesEnabled: false,+ onTap: () {+ tapCount += 1;+ },+ ),+ );++ await tester.tap(find.text('Storage plan'));+ await tester.pump();+ expect(tapCount, 0);+ });++ testWidgets('MenuComponent supports pressed and execution visuals', (+ tester,+ ) async {+ final loadingCompleter = Completer<void>();+ var tapCount = 0;+ await pumpComponent(+ tester,+ Column(+ children: [+ MenuComponent(+ title: 'Pressed row',+ onTap: () {+ tapCount += 1;+ },+ ),+ MenuComponent(+ title: 'Loading row',+ trailing: const Icon(Icons.chevron_right),+ showOnlyLoadingState: true,+ onTap: () => loadingCompleter.future,+ ),+ MenuComponent(+ title: 'Success row',+ trailing: const Icon(Icons.chevron_right),+ alwaysShowSuccessState: true,+ onTap: () async {},+ ),+ ],+ ),+ height: 180,+ );++ await tester.press(find.text('Pressed row'));+ await tester.pump();+ await tester.tap(find.text('Loading row'));+ await tester.pump(const Duration(milliseconds: 300));+ await tester.tap(find.text('Success row'));+ await tester.pump();++ final surfaces = tester.widgetList<AnimatedContainer>(+ find.byKey(const ValueKey('menu-item-surface')),+ );+ final pressedDecoration = surfaces.first.decoration! as BoxDecoration;+ expect(pressedDecoration.color, ColorTokens.light.fillDarker);+ expect(find.byKey(const ValueKey('menu-item-loading')), findsOneWidget);+ expect(find.byKey(const ValueKey('menu-item-success')), findsOneWidget);+ expect(find.byIcon(Icons.chevron_right), findsNothing);+ expect(tapCount, 0);+ loadingCompleter.complete();+ await tester.pump();+ await tester.pump(const Duration(seconds: 2));+ });++ testWidgets(+ 'MenuComponent long text uses two title lines and one subtitle line', (+ tester,+ ) async {+ await pumpComponent(+ tester,+ const MenuComponent(+ title:+ 'Camera uploads from this device and shared albums waiting for review',+ subtitle:+ 'This subtitle remains one line and truncates like app menu rows',+ leading: Icon(Icons.image_outlined),+ trailing: Icon(Icons.chevron_right),+ ),+ width: 260,+ );++ expect(+ tester+ .widget<Text>(+ find.text(+ 'Camera uploads from this device and shared albums waiting for review',+ ),+ )+ .maxLines,+ 2,+ );+ expect(+ tester+ .widget<Text>(+ find.text(+ 'This subtitle remains one line and truncates like app menu rows',+ ),+ )+ .maxLines,+ 1,+ );+ expect(tester.getSize(find.byType(MenuComponent)).height, greaterThan(60));+ });++ testWidgets(+ 'MenuComponent grows with text scale from typography-derived height', (+ tester,+ ) async {+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: const MediaQuery(+ data: MediaQueryData(+ textScaler: TextScaler.linear(1.6),+ ),+ child: Scaffold(+ body: Align(+ alignment: Alignment.topLeft,+ child: SizedBox(+ width: 260,+ child: MenuComponent(+ title: 'Camera uploads',+ subtitle: 'Enabled on Wi-Fi',+ leading: Icon(Icons.cloud_upload_outlined),+ trailing: Icon(Icons.chevron_right),+ ),+ ),+ ),+ ),+ ),+ ),+ );++ expect(tester.getSize(find.byType(MenuComponent)).height, greaterThan(60));+ });++ testWidgets('TitleBarComponent renders heading and status variants',+ (tester) async {+ await pumpComponent(+ tester,+ const TitleBarComponent(+ variant: TitleBarComponentVariant.titleTopbar,+ title: 'Heading',+ leading: Icon(Icons.arrow_back),+ trailing: Icon(Icons.search),+ ),+ width: 327,+ height: 42,+ );++ expect(find.text('Heading'), findsOneWidget);+ expect(find.byIcon(Icons.arrow_back), findsOneWidget);+ expect(find.byIcon(Icons.search), findsOneWidget);+ expect(tester.getSize(find.byType(TitleBarComponent)), const Size(327, 42));+ expect(+ tester.getTopRight(find.byIcon(Icons.search)).dx,+ tester.getTopRight(find.byType(TitleBarComponent)).dx,+ );++ await pumpComponent(+ tester,+ const TitleBarComponent(+ variant: TitleBarComponentVariant.preserving,+ leading: Icon(Icons.menu),+ trailing: Icon(Icons.upload),+ statusIcon: Icon(Icons.sync),+ ),+ width: 327,+ height: 42,+ );++ expect(find.text('Preserving 3 memories'), findsOneWidget);+ expect(find.text('ente'), findsNothing);+ expect(find.byIcon(Icons.menu), findsOneWidget);+ expect(find.byIcon(Icons.upload), findsOneWidget);+ expect(+ tester.getTopRight(find.byIcon(Icons.upload)).dx,+ tester.getTopRight(find.byType(TitleBarComponent)).dx,+ );+ });++ testWidgets(+ 'TitleBarComponent keeps title centered with multiple trailing actions', (+ tester,+ ) async {+ await pumpComponent(+ tester,+ const TitleBarComponent(+ variant: TitleBarComponentVariant.titleTopbar,+ title: 'Buttons',+ leadingWidth: 44,+ trailingWidth: 88,+ leading: Icon(Icons.arrow_back),+ trailing: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Icon(Icons.text_fields),+ Icon(Icons.dark_mode),+ ],+ ),+ ),+ width: 327,+ height: 42,+ );++ final titleCenter = tester.getCenter(find.text('Buttons')).dx;+ final barCenter = tester.getCenter(find.byType(TitleBarComponent)).dx;++ expect((titleCenter - barCenter).abs(), lessThan(1));+ expect(find.byIcon(Icons.text_fields), findsOneWidget);+ expect(find.byIcon(Icons.dark_mode), findsOneWidget);+ });++ testWidgets('HeaderComponent renders image, subtitle, and multiple actions', (+ tester,+ ) async {+ await pumpComponent(+ tester,+ const HeaderComponent(+ title: 'Title',+ subtitle: 'Subtitle',+ leading: ColoredBox(+ key: ValueKey('header-image'),+ color: Colors.blue,+ ),+ actions: [+ Icon(Icons.add),+ Icon(Icons.more_horiz),+ ],+ ),+ width: 327,+ );++ expect(find.text('Title'), findsOneWidget);+ expect(find.text('Subtitle'), findsOneWidget);+ expect(find.byKey(const ValueKey('header-image')), findsOneWidget);+ expect(find.byIcon(Icons.add), findsOneWidget);+ expect(find.byIcon(Icons.more_horiz), findsOneWidget);++ final imageSize =+ tester.getSize(find.byKey(const ValueKey('header-image')));+ expect(imageSize, const Size(36, 36));+ });+}diff --git a/mobile/packages/ente_components/test/components/avatar_test.dart b/mobile/packages/ente_components/test/components/avatar_test.dartnew file mode 100644index 0000000000..5267233b22--- /dev/null+++ b/mobile/packages/ente_components/test/components/avatar_test.dart@@ -0,0 +1,74 @@+import 'dart:convert';+import 'dart:typed_data';++import 'package:ente_components/ente_components.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';++void main() {+ testWidgets('AvatarComponent renders the Figma sizes', (tester) async {+ await tester.pumpWidget(+ _wrap(+ const Column(+ children: [+ AvatarComponent(initials: 'E', size: AvatarComponentSize.small),+ AvatarComponent(initials: 'E'),+ AvatarComponent(initials: 'E', size: AvatarComponentSize.large),+ AvatarComponent(+ initials: 'E',+ size: AvatarComponentSize.contactHuge,+ ),+ ],+ ),+ ),+ );++ final surfaces = find.byKey(const ValueKey('avatar-surface'));+ expect(tester.getSize(surfaces.at(0)), const Size(16, 16));+ expect(tester.getSize(surfaces.at(1)), const Size(24, 24));+ expect(tester.getSize(surfaces.at(2)), const Size(32, 32));+ expect(tester.getSize(surfaces.at(3)), const Size(56, 56));+ });++ testWidgets(+ 'AvatarComponent supports image, icon, named colors, and seed colors', (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ Column(+ children: [+ AvatarComponent.image(image: MemoryImage(_transparentPng)),+ const AvatarComponent.icon(),+ const AvatarComponent(+ initials: 'K',+ color: AvatarComponentColor.green,+ ),+ const AvatarComponent.seeded(+ initials: 'A',+ seed: 0,+ ),+ ],+ ),+ ),+ );++ expect(find.byIcon(Icons.add_rounded), findsOneWidget);+ expect(find.text('K'), findsOneWidget);+ expect(find.text('A'), findsOneWidget);+ expect(avatarLight.length, avatarDark.length);+ });+}++Widget _wrap(Widget child) {+ return MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: Center(child: child),+ ),+ );+}++final Uint8List _transparentPng = base64Decode(+ 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/p9sAAAAASUVORK5CYII=',+);diff --git a/mobile/packages/ente_components/test/components/button_test.dart b/mobile/packages/ente_components/test/components/button_test.dartnew file mode 100644index 0000000000..efcb53d179--- /dev/null+++ b/mobile/packages/ente_components/test/components/button_test.dart@@ -0,0 +1,427 @@+import "dart:async";++import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:flutter_test/flutter_test.dart";+import "package:hugeicons/hugeicons.dart";++void main() {+ testWidgets("ButtonComponent renders label, icons, and expected size", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Continue",+ leading: const Icon(Icons.arrow_back_rounded),+ trailing: const Icon(Icons.arrow_forward_rounded),+ onTap: () {},+ ),+ ),+ );++ expect(find.text("Continue"), findsOneWidget);+ expect(find.byIcon(Icons.arrow_back_rounded), findsOneWidget);+ expect(find.byIcon(Icons.arrow_forward_rounded), findsOneWidget);+ expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);+ });++ testWidgets("ButtonComponent calls onTap when tapped", (tester) async {+ var tapCount = 0;++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Save",+ onTap: () => tapCount += 1,+ ),+ ),+ );++ await tester.tap(find.text("Save"));+ await tester.pump();++ expect(tapCount, 1);+ });++ testWidgets(+ "Small ButtonComponent shrink-wraps content without a minimum width", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "OK",+ onTap: () {},+ ),+ ),+ );++ final size = tester.getSize(find.byType(AnimatedContainer));+ expect(size.height, 52);+ expect(size.width, lessThan(100));+ });++ testWidgets(+ "ButtonComponent height grows with text scale instead of clipping", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Continue",+ onTap: () {},+ ),+ ),+ );++ final normalHeight = tester.getSize(find.byType(AnimatedContainer)).height;+ expect(normalHeight, 52);++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Continue",+ onTap: () {},+ ),+ textScaler: const TextScaler.linear(2),+ ),+ );++ final scaledHeight = tester.getSize(find.byType(AnimatedContainer)).height;+ expect(scaledHeight, greaterThan(normalHeight));+ });++ testWidgets(+ "ButtonComponent surfaces loading after debounce and blocks repeat taps",+ (+ tester,+ ) async {+ var tapCount = 0;+ final completer = Completer<void>();++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Uploading",+ onTap: () {+ tapCount += 1;+ return completer.future;+ },+ ),+ ),+ );++ await tester.tap(find.text("Uploading"));+ await tester.pump();++ expect(tapCount, 1);+ expect(find.byKey(const ValueKey('loading')), findsNothing);++ await tester.tap(find.text("Uploading"));+ await tester.pump();++ expect(tapCount, 1);++ await tester.pump(const Duration(milliseconds: 299));+ expect(find.byKey(const ValueKey('loading')), findsNothing);++ await tester.pump(const Duration(milliseconds: 1));++ final loadingFinder = find.byKey(const ValueKey('loading'));+ expect(loadingFinder, findsOneWidget);+ expect(+ find.descendant(+ of: loadingFinder,+ matching: find.byType(RotationTransition),+ ),+ findsOneWidget,+ );+ expect(+ find.descendant(of: loadingFinder, matching: find.byType(HugeIcon)),+ findsOneWidget,+ );+ expect(find.byType(CircularProgressIndicator), findsNothing);+ expect(find.text("Uploading"), findsNothing);+ expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);++ completer.complete();+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 100));++ expect(find.byKey(const ValueKey('success')), findsOneWidget);+ });++ testWidgets(+ "ButtonComponent shows success confirmation for fast actions when enabled",+ (+ tester,+ ) async {+ var tapCount = 0;++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Saved",+ shouldShowSuccessConfirmation: true,+ onTap: () => tapCount += 1,+ ),+ ),+ );++ await tester.tap(find.text("Saved"));+ await tester.pump();++ expect(tapCount, 1);+ expect(find.byType(HugeIcon), findsOneWidget);+ expect(find.text("Saved"), findsNothing);+ expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);++ await tester.pump(const Duration(seconds: 2));+ await tester.pump();++ expect(find.text("Saved"), findsOneWidget);+ });++ testWidgets(+ "ButtonComponent can hide execution visuals while still blocking taps", (+ tester,+ ) async {+ var tapCount = 0;+ final completer = Completer<void>();++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Silent",+ shouldSurfaceExecutionStates: false,+ onTap: () {+ tapCount += 1;+ return completer.future;+ },+ ),+ ),+ );++ await tester.tap(find.text("Silent"));+ await tester.pump(const Duration(milliseconds: 400));++ expect(tapCount, 1);+ expect(find.byKey(const ValueKey('loading')), findsNothing);+ expect(find.text("Silent"), findsOneWidget);++ await tester.tap(find.text("Silent"));+ await tester.pump();++ expect(tapCount, 1);++ completer.complete();+ await tester.pump();+ });++ testWidgets("ButtonComponent remains disabled when onTap is null or disabled",+ (+ tester,+ ) async {+ var tapCount = 0;++ await tester.pumpWidget(+ _wrap(+ Column(+ children: [+ const ButtonComponent(+ label: "No callback",+ onTap: null,+ ),+ ButtonComponent(+ label: "Disabled",+ isDisabled: true,+ onTap: () => tapCount += 1,+ ),+ ],+ ),+ ),+ );++ expect(find.text("No callback"), findsOneWidget);+ expect(find.text("Disabled"), findsOneWidget);+ await tester.tap(find.text("Disabled"));+ await tester.pump();++ expect(tapCount, 0);+ });++ testWidgets("ButtonComponent renders pressed visual state from gesture", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Continue",+ onTap: () {},+ ),+ ),+ );++ expect(_containerColor(tester), const Color(0xFF08C225));++ final gesture = await tester.startGesture(+ tester.getCenter(find.text("Continue")),+ );+ await tester.pump();++ expect(_containerColor(tester), const Color(0xFF057C18));++ await gesture.up();+ await tester.pump(const Duration(milliseconds: 140));++ expect(_containerColor(tester), const Color(0xFF08C225));+ });++ testWidgets("Large secondary and link buttons match the catalog layout", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Cancel",+ variant: ButtonComponentVariant.secondary,+ size: ButtonComponentSize.large,+ onTap: () {},+ ),+ ),+ );++ expect(_containerColor(tester), const Color(0xFFE7F6E9));+ expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);++ await tester.pumpWidget(+ _wrap(+ ButtonComponent(+ label: "Forgot password?",+ variant: ButtonComponentVariant.link,+ size: ButtonComponentSize.large,+ onTap: () {},+ ),+ ),+ );++ expect(tester.getSize(find.byType(AnimatedContainer)).height, 52);+ });++ testWidgets("IconButtonComponent renders Figma size and token-backed states",+ (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ IconButtonComponent(+ icon: const Icon(Icons.add),+ variant: IconButtonComponentVariant.primary,+ state: IconButtonComponentState.pressed,+ onPressed: () {},+ ),+ ),+ );++ final surfaceFinder = find.byKey(const ValueKey('icon-button-surface'));+ final surface = tester.widget<AnimatedContainer>(surfaceFinder);+ final decoration = surface.decoration! as BoxDecoration;++ expect(tester.getSize(surfaceFinder), const Size(38, 38));+ expect(decoration.color, ColorTokens.light.fillDarker);+ });++ testWidgets(+ "IconButtonComponent maps loading and success to designed affordances", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ IconButtonComponent(+ icon: const Icon(Icons.add),+ variant: IconButtonComponentVariant.green,+ isSuccess: true,+ onPressed: () {},+ ),+ ),+ );++ final surface = tester.widget<AnimatedContainer>(+ find.byKey(const ValueKey('icon-button-surface')),+ );+ final decoration = surface.decoration! as BoxDecoration;+ final successIcon = tester.widget<Icon>(+ find.byIcon(Icons.check_circle_rounded),+ );++ expect(decoration.color, ColorTokens.light.primary);+ expect(successIcon.color, ColorTokens.light.specialWhite);++ await tester.pumpWidget(+ _wrap(+ IconButtonComponent(+ icon: const Icon(Icons.add),+ isLoading: true,+ onPressed: () {},+ ),+ ),+ );++ expect(find.byType(CircularProgressIndicator), findsOneWidget);+ expect(find.byIcon(Icons.add), findsNothing);+ });++ testWidgets("IconButtonComponent calls taps only when enabled",+ (tester) async {+ var tapCount = 0;++ await tester.pumpWidget(+ _wrap(+ IconButtonComponent(+ icon: const Icon(Icons.add),+ onPressed: () => tapCount += 1,+ ),+ ),+ );++ await tester.tap(find.byType(GestureDetector));+ await tester.pump();++ expect(tapCount, 1);++ await tester.pumpWidget(+ _wrap(+ IconButtonComponent(+ icon: const Icon(Icons.add),+ isLoading: true,+ onPressed: () => tapCount += 1,+ ),+ ),+ );++ await tester.tap(find.byType(GestureDetector));+ await tester.pump();++ expect(tapCount, 1);+ });+}++Widget _wrap(Widget child, {TextScaler textScaler = TextScaler.noScaling}) {+ return MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: MediaQuery(+ data: MediaQueryData(textScaler: textScaler),+ child: Center(child: child),+ ),+ ),+ );+}++Color _containerColor(WidgetTester tester) {+ final container = tester.widget<AnimatedContainer>(+ find.byType(AnimatedContainer),+ );+ return (container.decoration! as BoxDecoration).color!;+}diff --git a/mobile/packages/ente_components/test/components/selection_controls_test.dart b/mobile/packages/ente_components/test/components/selection_controls_test.dartnew file mode 100644index 0000000000..e7de1f7daa--- /dev/null+++ b/mobile/packages/ente_components/test/components/selection_controls_test.dart@@ -0,0 +1,164 @@+import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:flutter_test/flutter_test.dart";++void main() {+ testWidgets("CheckboxComponent toggles to the next selected value", (+ tester,+ ) async {+ bool? nextValue;++ await tester.pumpWidget(+ _wrap(+ CheckboxComponent(+ selected: false,+ onChanged: (value) => nextValue = value,+ ),+ ),+ );++ await tester.tap(find.byType(InkWell));+ await tester.pump();++ expect(nextValue, isTrue);+ });++ testWidgets("RadioComponent toggles to the next selected value",+ (tester) async {+ bool? nextValue;++ await tester.pumpWidget(+ _wrap(+ RadioComponent(+ selected: false,+ onChanged: (value) => nextValue = value,+ ),+ ),+ );++ await tester.tap(find.byType(InkWell));+ await tester.pump();++ expect(nextValue, isTrue);+ });++ testWidgets("ToggleSwitchComponent toggles to the next selected value",+ (tester) async {+ bool? nextValue;++ await tester.pumpWidget(+ _wrap(+ ToggleSwitchComponent(+ selected: false,+ onChanged: (value) => nextValue = value,+ ),+ ),+ );++ await tester.tap(find.byType(InkWell));+ await tester.pump();++ expect(nextValue, isTrue);+ });++ testWidgets("LabeledControlComponent renders label and subtitle",+ (tester) async {+ await tester.pumpWidget(+ _wrap(+ const LabeledControlComponent(+ control: CheckboxComponent(+ selected: true,+ onChanged: null,+ ),+ label: "Back up automatically",+ subtitle: "Includes new photos",+ ),+ ),+ );++ expect(find.text("Back up automatically"), findsOneWidget);+ expect(find.text("Includes new photos"), findsOneWidget);+ expect(find.byIcon(Icons.check_rounded), findsOneWidget);+ });++ testWidgets("FilterChipComponent renders selected state with token colors", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const FilterChipComponent(+ label: "Faces",+ state: FilterChipComponentState.selected,+ ),+ ),+ );++ final surfaceFinder = find.byKey(const ValueKey("filter-chip-surface"));+ final surface = tester.widget<AnimatedContainer>(surfaceFinder);+ final decoration = surface.decoration! as BoxDecoration;+ final label = tester.widget<Text>(find.text("Faces"));++ expect(tester.getSize(surfaceFinder).height, 40);+ expect(decoration.color, ColorTokens.light.primaryLight);+ expect(label.style?.color, ColorTokens.light.primary);+ expect(find.byIcon(Icons.close_rounded), findsOneWidget);+ });++ testWidgets("FilterChipComponent toggles only when enabled", (tester) async {+ bool? nextValue;++ await tester.pumpWidget(+ _wrap(+ FilterChipComponent(+ label: "Albums",+ state: FilterChipComponentState.unselected,+ onChanged: (value) => nextValue = value,+ ),+ ),+ );++ await tester.tap(find.byKey(const ValueKey("filter-chip-surface")));+ await tester.pump();++ expect(nextValue, isTrue);++ await tester.pumpWidget(+ _wrap(+ FilterChipComponent(+ label: "Albums",+ state: FilterChipComponentState.disabled,+ onChanged: (value) => nextValue = value,+ ),+ ),+ );++ await tester.tap(find.byKey(const ValueKey("filter-chip-surface")));+ await tester.pump();++ expect(nextValue, isTrue);+ });++ testWidgets("FilterChipComponent clips avatar content", (tester) async {+ await tester.pumpWidget(+ _wrap(+ const FilterChipComponent(+ label: "Mira",+ avatar: ColoredBox(color: Colors.purple),+ state: FilterChipComponentState.unselected,+ ),+ ),+ );++ expect(find.byType(ClipRRect), findsOneWidget);+ expect(find.text("Mira"), findsOneWidget);+ });+}++Widget _wrap(Widget child) {+ return MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: Center(child: child),+ ),+ );+}diff --git a/mobile/packages/ente_components/test/components/slider_stepper_test.dart b/mobile/packages/ente_components/test/components/slider_stepper_test.dartnew file mode 100644index 0000000000..553a6a9f83--- /dev/null+++ b/mobile/packages/ente_components/test/components/slider_stepper_test.dart@@ -0,0 +1,124 @@+import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:flutter/material.dart" as material show IconButton, Slider;+import "package:flutter_test/flutter_test.dart";++void main() {+ testWidgets("SliderComponent clamps its rendered value", (tester) async {+ await tester.pumpWidget(+ _wrap(+ SliderComponent(+ value: 12,+ min: 0,+ max: 10,+ onChanged: (_) {},+ ),+ ),+ );++ expect(+ tester.widget<material.Slider>(find.byType(material.Slider)).value,+ 10,+ );+ });++ testWidgets("SliderComponent reports value changes from user interaction", (+ tester,+ ) async {+ var value = 0.25;++ await tester.pumpWidget(+ _wrap(+ StatefulBuilder(+ builder: (context, setState) {+ return SliderComponent(+ value: value,+ min: 0,+ max: 1,+ onChanged: (nextValue) {+ setState(() => value = nextValue);+ },+ );+ },+ ),+ ),+ );++ await tester.drag(find.byType(material.Slider), const Offset(300, 0));+ await tester.pump();++ expect(value, greaterThan(0.25));+ expect(+ tester.widget<material.Slider>(find.byType(material.Slider)).value,+ value,+ );+ });++ testWidgets("StepperComponent increments and decrements around its value", (+ tester,+ ) async {+ final changedValues = <int>[];++ await tester.pumpWidget(+ _wrap(+ StepperComponent(+ value: 5,+ onChanged: changedValues.add,+ ),+ ),+ );++ expect(find.text("5"), findsOneWidget);++ await tester.tap(find.byIcon(Icons.add_rounded));+ await tester.pump();+ await tester.tap(find.byIcon(Icons.remove_rounded));+ await tester.pump();++ expect(changedValues, [6, 4]);+ });++ testWidgets("StepperComponent disables controls at min and max",+ (tester) async {+ await tester.pumpWidget(+ _wrap(+ StepperComponent(+ value: 0,+ min: 0,+ max: 1,+ onChanged: (_) {},+ ),+ ),+ );++ final minButtons = tester+ .widgetList<material.IconButton>(find.byType(material.IconButton));+ expect(minButtons.first.onPressed, isNull);+ expect(minButtons.last.onPressed, isNotNull);++ await tester.pumpWidget(+ _wrap(+ StepperComponent(+ value: 1,+ min: 0,+ max: 1,+ onChanged: (_) {},+ ),+ ),+ );++ final maxButtons = tester+ .widgetList<material.IconButton>(find.byType(material.IconButton));+ expect(maxButtons.first.onPressed, isNotNull);+ expect(maxButtons.last.onPressed, isNull);+ });+}++Widget _wrap(Widget child) {+ return MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: Center(child: child),+ ),+ );+}diff --git a/mobile/packages/ente_components/test/components/text_input_component_test.dart b/mobile/packages/ente_components/test/components/text_input_component_test.dartnew file mode 100644index 0000000000..b21d641860--- /dev/null+++ b/mobile/packages/ente_components/test/components/text_input_component_test.dart@@ -0,0 +1,362 @@+import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:flutter/services.dart";+import "package:flutter_test/flutter_test.dart";++void main() {+ testWidgets(+ "TextInputComponent renders label, required mark, and helper text", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Email",+ hintText: "[email protected]",+ helperText: "Use your account email",+ isRequired: true,+ ),+ ),+ );++ expect(_richText("Email *"), findsOneWidget);+ expect(find.text("Use your account email"), findsOneWidget);+ expect(+ tester.widget<Text>(find.text("Use your account email")).style?.color,+ ColorTokens.light.textLight,+ );+ expect(+ tester+ .widget<TextField>(+ find.byType(TextField),+ )+ .decoration+ ?.hintText,+ "[email protected]",+ );+ });++ testWidgets("TextInputComponent gives error text priority over helper text", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Password",+ helperText: "At least 8 characters",+ errorText: "Password is required",+ ),+ ),+ );++ expect(find.text("Password is required"), findsOneWidget);+ expect(find.text("At least 8 characters"), findsNothing);+ expect(+ tester.widget<Text>(find.text("Password is required")).style?.color,+ ColorTokens.light.warning,+ );+ });++ testWidgets("TextInputComponent renders success text when valid",+ (tester) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Code",+ successText: "Looks good",+ ),+ ),+ );++ expect(find.text("Looks good"), findsOneWidget);+ expect(+ tester.widget<Text>(find.text("Looks good")).style?.color,+ ColorTokens.light.primary,+ );+ });++ testWidgets("TextInputComponent supports explicit focused visual state", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Email",+ isFocused: true,+ ),+ ),+ );++ final input = tester.widget<TextField>(+ find.byType(TextField),+ );+ final border = input.decoration?.enabledBorder as OutlineInputBorder?;+ expect(border?.borderSide.color, ColorTokens.light.primary);+ expect(border?.borderSide.width, 2);+ });++ testWidgets(+ "TextInputComponent maps error and success states to Figma borders", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const Column(+ children: [+ TextInputComponent(label: "Error", errorText: "This is an error"),+ TextInputComponent(label: "Success", successText: "Saved"),+ ],+ ),+ ),+ );++ final inputs = tester.widgetList<TextField>(+ find.byType(TextField),+ );+ final errorBorder =+ inputs.first.decoration?.enabledBorder as OutlineInputBorder?;+ final successBorder =+ inputs.last.decoration?.enabledBorder as OutlineInputBorder?;++ expect(errorBorder?.borderSide.color, ColorTokens.light.warning);+ expect(errorBorder?.borderSide.width, 1.5);+ expect(successBorder?.borderSide.color, ColorTokens.light.primary);+ expect(successBorder?.borderSide.width, 1.5);+ });++ testWidgets(+ "TextInputComponent forwards disabled state to the platform field", (+ tester,+ ) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Email",+ enabled: false,+ ),+ ),+ );++ final input = tester.widget<TextField>(+ find.byType(TextField),+ );+ expect(input.enabled, isFalse);+ expect(input.decoration?.fillColor, ColorTokens.light.fillLight);+ expect(tester.widget<Opacity>(find.byType(Opacity).first).opacity, 0.38);+ });++ testWidgets("TextInputComponent supports the Figma multiline layout",+ (tester) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Notes",+ hintText: "Hint text",+ errorText: "This is an error",+ maxLines: 4,+ suffix: Icon(Icons.copy, key: ValueKey("copy-icon")),+ ),+ ),+ );++ final input = tester.widget<TextField>(+ find.byType(TextField),+ );+ final border = input.decoration?.enabledBorder as OutlineInputBorder?;++ expect(input.maxLines, 4);+ expect(+ input.decoration?.contentPadding,+ const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 16,+ ),+ );+ expect(border?.borderRadius, BorderRadius.circular(16));+ expect(border?.borderSide.color, ColorTokens.light.warning);+ expect(border?.borderSide.width, 1.5);+ expect(find.byKey(const ValueKey("copy-icon")), findsOneWidget);+ expect(+ tester.widget<Text>(find.text("This is an error")).style?.fontSize,+ TextStyles.tiny.fontSize,+ );+ });++ testWidgets("TextInputComponent accepts text entry and reports changes", (+ tester,+ ) async {+ final controller = TextEditingController();+ var changedValue = "";+ addTearDown(controller.dispose);++ await tester.pumpWidget(+ _wrap(+ TextInputComponent(+ controller: controller,+ label: "Name",+ onChanged: (value) => changedValue = value,+ ),+ ),+ );++ await tester.enterText(find.byType(TextInputComponent), "Ada Lovelace");+ await tester.pump();++ expect(controller.text, "Ada Lovelace");+ expect(changedValue, "Ada Lovelace");+ expect(find.text("Ada Lovelace"), findsOneWidget);+ });++ testWidgets("TextInputComponent forwards production text input behavior", (+ tester,+ ) async {+ final controller = TextEditingController();+ final focusNode = FocusNode();+ final scrollController = ScrollController();+ var submitted = "";+ var editingComplete = false;+ addTearDown(controller.dispose);+ addTearDown(focusNode.dispose);+ addTearDown(scrollController.dispose);++ await tester.pumpWidget(+ _wrap(+ TextInputComponent(+ controller: controller,+ focusNode: focusNode,+ label: "Invite email",+ autofocus: true,+ readOnly: true,+ showCursor: false,+ enableInteractiveSelection: false,+ textCapitalization: TextCapitalization.words,+ textInputAction: TextInputAction.done,+ inputFormatters: [+ FilteringTextInputFormatter.allow(RegExp("[a-z@.]")),+ ],+ maxLength: 48,+ counterText: "",+ keyboardType: TextInputType.emailAddress,+ autofillHints: const [AutofillHints.email],+ autocorrect: false,+ enableSuggestions: false,+ textAlign: TextAlign.center,+ textAlignVertical: TextAlignVertical.top,+ scrollController: scrollController,+ onSubmitted: (value) => submitted = value,+ onEditingComplete: () => editingComplete = true,+ ),+ ),+ );++ final input = tester.widget<TextField>(+ find.byType(TextField),+ );+ expect(input.focusNode, focusNode);+ expect(input.autofocus, isTrue);+ expect(input.readOnly, isTrue);+ expect(input.showCursor, isFalse);+ expect(input.enableInteractiveSelection, isFalse);+ expect(input.textCapitalization, TextCapitalization.words);+ expect(input.textInputAction, TextInputAction.done);+ expect(input.maxLength, 48);+ expect(input.decoration?.counterText, "");+ expect(input.keyboardType, TextInputType.emailAddress);+ expect(input.autofillHints, const [AutofillHints.email]);+ expect(input.autocorrect, isFalse);+ expect(input.enableSuggestions, isFalse);+ expect(input.textAlign, TextAlign.center);+ expect(input.textAlignVertical, TextAlignVertical.top);+ expect(input.scrollController, scrollController);++ input.onSubmitted?.call("[email protected]");+ input.onEditingComplete?.call();+ expect(submitted, "[email protected]");+ expect(editingComplete, isTrue);+ });++ testWidgets(+ "TextInputComponent supports clear and password visibility affordances", (+ tester,+ ) async {+ final clearController = TextEditingController(text: "search");+ final passwordController = TextEditingController(text: "secret");+ addTearDown(clearController.dispose);+ addTearDown(passwordController.dispose);++ await tester.pumpWidget(+ _wrap(+ Column(+ children: [+ TextInputComponent(+ controller: clearController,+ label: "Search",+ isClearable: true,+ ),+ TextInputComponent(+ controller: passwordController,+ label: "Password",+ obscureText: true,+ showPasswordToggle: true,+ ),+ ],+ ),+ ),+ );++ expect(find.byKey(const ValueKey("text-field-clear")), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey("text-field-clear")));+ await tester.pump();+ expect(clearController.text, "");+ expect(find.byKey(const ValueKey("text-field-clear")), findsNothing);++ var inputs = tester.widgetList<TextField>(+ find.byType(TextField),+ );+ expect(inputs.last.obscureText, isTrue);++ await tester.tap(find.byKey(const ValueKey("text-field-password-toggle")));+ await tester.pump();+ inputs = tester.widgetList<TextField>(+ find.byType(TextField),+ );+ expect(inputs.last.obscureText, isFalse);+ });++ testWidgets("TextInputComponent renders alert message visuals",+ (tester) async {+ await tester.pumpWidget(+ _wrap(+ const TextInputComponent(+ label: "Recovery key",+ alertText: "Save this somewhere safe.",+ ),+ ),+ );++ expect(find.text("Save this somewhere safe."), findsOneWidget);+ expect(find.byIcon(Icons.warning_amber_rounded), findsOneWidget);+ expect(+ tester.widget<Text>(find.text("Save this somewhere safe.")).style?.color,+ ColorTokens.light.warning,+ );+ });+}++Finder _richText(String value) {+ return find.byWidgetPredicate(+ (widget) => widget is Text && widget.textSpan?.toPlainText() == value,+ );+}++Widget _wrap(Widget child) {+ return MaterialApp(+ theme: ComponentTheme.lightTheme(),+ home: Scaffold(+ body: Padding(+ padding: const EdgeInsets.all(24),+ child: child,+ ),+ ),+ );+}diff --git a/mobile/packages/ente_components/test/theme/theme_tokens_test.dart b/mobile/packages/ente_components/test/theme/theme_tokens_test.dartnew file mode 100644index 0000000000..872fbcc1fc--- /dev/null+++ b/mobile/packages/ente_components/test/theme/theme_tokens_test.dart@@ -0,0 +1,404 @@+import "package:ente_components/ente_components.dart";+import "package:flutter/material.dart";+import "package:flutter_test/flutter_test.dart";++void main() {+ group("foundation tokens", () {+ test("expose expected spacing, radii, motion, and shadow values", () {+ expect(Spacing.xxs, 2);+ expect(Spacing.sm, 8);+ expect(Spacing.xl, 24);+ expect(Spacing.xxxl, 40);++ expect(Radii.xs, 4);+ expect(Radii.md, 12);+ expect(Radii.button, 20);+ expect(Radii.buttonRadius, const Radius.circular(20));+ expect(+ Radii.buttonBorder,+ const BorderRadius.all(Radius.circular(20)),+ );++ expect(Motion.quick, const Duration(milliseconds: 120));+ expect(Motion.standard, const Duration(milliseconds: 180));+ expect(Motion.slow, const Duration(milliseconds: 260));++ expect(Shadows.soft, hasLength(1));+ expect(Shadows.soft.first.color, const Color(0x14000000));+ expect(Shadows.soft.first.blurRadius, 16);+ expect(Shadows.floating.first.offset, const Offset(0, 12));+ });++ test("expose light and dark semantic color values", () {+ expect(ColorTokens.light.primary, const Color(0xFF08C225));+ expect(ColorTokens.light.warning, const Color(0xFFF63A3A));+ expect(ColorTokens.light.backgroundBase, const Color(0xFFFAFAFA));+ expect(ColorTokens.light.textBase, const Color(0xFF000000));+ expect(ColorTokens.light.textReverse, const Color(0xFFFFFFFF));+ expect(ColorTokens.light.iconColor, const Color.fromRGBO(0, 0, 0, 0.75));++ expect(ColorTokens.dark.primary, const Color(0xFF08C225));+ expect(ColorTokens.dark.warningLight, const Color(0xFF292929));+ expect(ColorTokens.dark.backgroundBase, const Color(0xFF161616));+ expect(ColorTokens.dark.textBase, const Color(0xFFFFFFFF));+ expect(ColorTokens.dark.textReverse, const Color(0xFF000000));+ expect(ColorTokens.dark.iconColor, const Color(0xFFFFFFFF));+ });++ test("selects app primary tokens without changing shared colors", () {+ final photosLight = ColorTokens.forApp(EnteApp.photos);+ final authLight = ColorTokens.forApp(EnteApp.auth);+ final lockerLight = ColorTokens.forApp(EnteApp.locker);+ final authDark = ColorTokens.forApp(+ EnteApp.auth,+ brightness: Brightness.dark,+ );++ expect(photosLight.primary, primaryDefaultLight);+ expect(photosLight.primaryLight, primaryLightLight);+ expect(photosLight.primaryStroke, primaryStrokeLight);+ expect(photosLight.primaryDark, primaryDarkLight);+ expect(photosLight.primaryDarker, primaryDarkerLight);++ expect(authLight.primary, authPrimaryDefaultLight);+ expect(authLight.primaryLight, authPrimaryLightLight);+ expect(authLight.primaryStroke, authPrimaryStrokeLight);+ expect(authLight.primaryDark, authPrimaryDarkLight);+ expect(authLight.primaryDarker, authPrimaryDarkerLight);++ expect(lockerLight.primary, lockerPrimaryDefaultLight);+ expect(lockerLight.primaryLight, lockerPrimaryLightLight);+ expect(lockerLight.primaryStroke, lockerPrimaryStrokeLight);+ expect(lockerLight.primaryDark, lockerPrimaryDarkLight);+ expect(lockerLight.primaryDarker, lockerPrimaryDarkerLight);++ expect(authDark.primary, authPrimaryDefaultDark);+ expect(authDark.primaryLight, authPrimaryLightDark);++ expect(authLight.backgroundBase, ColorTokens.light.backgroundBase);+ expect(authLight.warning, ColorTokens.light.warning);+ expect(authLight.info, ColorTokens.light.info);+ expect(lockerLight.textBase, ColorTokens.light.textBase);+ expect(lockerLight.iconColor, ColorTokens.light.iconColor);+ expect(lockerLight.accentPurple, ColorTokens.light.accentPurple);+ });++ test("match Figma Color Tokens light and dark modes", () {+ const expectedLight = <String, Color>{+ "accent/orange": Color.fromRGBO(242, 72, 34, 1),+ "accent/orange-light": Color.fromRGBO(255, 247, 244, 1),+ "accent/pink": Color.fromRGBO(223, 97, 187, 1),+ "accent/pink-light": Color.fromRGBO(253, 246, 251, 1),+ "accent/purple": Color.fromRGBO(138, 56, 245, 1),+ "accent/purple-light": Color.fromRGBO(248, 243, 254, 1),+ "accent/teal": Color.fromRGBO(95, 183, 187, 1),+ "accent/teal-light": Color.fromRGBO(245, 251, 251, 1),+ "background/base": Color.fromRGBO(250, 250, 250, 1),+ "caution/default": Color.fromRGBO(255, 169, 57, 1),+ "caution/light": Color.fromRGBO(250, 244, 235, 1),+ "fill/base": Color.fromRGBO(0, 0, 0, 1),+ "fill/dark": Color.fromRGBO(245, 245, 245, 1),+ "fill/darker": Color.fromRGBO(233, 233, 233, 1),+ "fill/darkest": Color.fromRGBO(210, 210, 210, 1),+ "fill/light": Color.fromRGBO(255, 255, 255, 1),+ "info/dark": Color.fromRGBO(14, 95, 217, 1),+ "info/darker": Color.fromRGBO(11, 76, 173, 1),+ "info/default": Color.fromRGBO(16, 113, 255, 1),+ "info/light": Color.fromRGBO(231, 239, 250, 1),+ "info/stroke": Color.fromRGBO(200, 216, 238, 1),+ "primary/dark": Color.fromRGBO(6, 157, 30, 1),+ "primary/darker": Color.fromRGBO(5, 124, 24, 1),+ "primary/default": Color.fromRGBO(8, 194, 37, 1),+ "primary/light": Color.fromRGBO(231, 246, 233, 1),+ "primary/stroke": Color.fromRGBO(186, 236, 194, 1),+ "special/content-reverse": Color.fromRGBO(255, 255, 255, 1),+ "special/scrim": Color.fromRGBO(0, 0, 0, 0.4),+ "special/white": Color.fromRGBO(255, 255, 255, 1),+ "special/white-overlay": Color.fromRGBO(255, 255, 255, 0.14),+ "stroke/dark": Color.fromRGBO(224, 224, 224, 1),+ "stroke/faint": Color.fromRGBO(235, 235, 235, 1),+ "text/base": Color.fromRGBO(0, 0, 0, 1),+ "text/dark": Color.fromRGBO(26, 26, 26, 1),+ "text/darker": Color.fromRGBO(21, 21, 21, 1),+ "text/light": Color.fromRGBO(102, 102, 102, 1),+ "text/lighter": Color.fromRGBO(150, 150, 150, 1),+ "text/lightest": Color.fromRGBO(222, 222, 222, 1),+ "text/reverse": Color.fromRGBO(255, 255, 255, 1),+ "warning/dark": Color.fromRGBO(221, 52, 52, 1),+ "warning/darker": Color.fromRGBO(197, 46, 46, 1),+ "warning/default": Color.fromRGBO(246, 58, 58, 1),+ "warning/light": Color.fromRGBO(250, 235, 235, 1),+ };+ const expectedDark = <String, Color>{+ "accent/orange": Color.fromRGBO(242, 72, 34, 1),+ "accent/orange-light": Color.fromRGBO(41, 41, 41, 1),+ "accent/pink": Color.fromRGBO(223, 97, 187, 1),+ "accent/pink-light": Color.fromRGBO(41, 41, 41, 1),+ "accent/purple": Color.fromRGBO(138, 56, 245, 1),+ "accent/purple-light": Color.fromRGBO(41, 41, 41, 1),+ "accent/teal": Color.fromRGBO(95, 183, 187, 1),+ "accent/teal-light": Color.fromRGBO(41, 41, 41, 1),+ "background/base": Color.fromRGBO(22, 22, 22, 1),+ "caution/default": Color.fromRGBO(255, 169, 57, 1),+ "caution/light": Color.fromRGBO(41, 41, 41, 1),+ "fill/base": Color.fromRGBO(255, 255, 255, 1),+ "fill/dark": Color.fromRGBO(10, 10, 10, 1),+ "fill/darker": Color.fromRGBO(20, 20, 20, 1),+ "fill/darkest": Color.fromRGBO(41, 41, 41, 1),+ "fill/light": Color.fromRGBO(33, 33, 33, 1),+ "info/dark": Color.fromRGBO(14, 95, 217, 1),+ "info/darker": Color.fromRGBO(11, 76, 173, 1),+ "info/default": Color.fromRGBO(16, 113, 255, 1),+ "info/light": Color.fromRGBO(41, 41, 41, 1),+ "info/stroke": Color.fromRGBO(26, 43, 77, 1),+ "primary/dark": Color.fromRGBO(6, 157, 30, 1),+ "primary/darker": Color.fromRGBO(5, 124, 24, 1),+ "primary/default": Color.fromRGBO(8, 194, 37, 1),+ "primary/light": Color.fromRGBO(41, 41, 41, 1),+ "primary/stroke": Color.fromRGBO(28, 65, 34, 1),+ "special/content-reverse": Color.fromRGBO(0, 0, 0, 1),+ "special/scrim": Color.fromRGBO(0, 0, 0, 0.4),+ "special/white": Color.fromRGBO(255, 255, 255, 1),+ "special/white-overlay": Color.fromRGBO(255, 255, 255, 0.14),+ "stroke/dark": Color.fromRGBO(62, 62, 62, 1),+ "stroke/faint": Color.fromRGBO(33, 33, 33, 1),+ "text/base": Color.fromRGBO(255, 255, 255, 1),+ "text/dark": Color.fromRGBO(229, 229, 229, 1),+ "text/darker": Color.fromRGBO(204, 204, 204, 1),+ "text/light": Color.fromRGBO(153, 153, 153, 1),+ "text/lighter": Color.fromRGBO(150, 150, 150, 1),+ "text/lightest": Color.fromRGBO(10, 10, 10, 1),+ "text/reverse": Color.fromRGBO(0, 0, 0, 1),+ "warning/dark": Color.fromRGBO(221, 52, 52, 1),+ "warning/darker": Color.fromRGBO(197, 46, 46, 1),+ "warning/default": Color.fromRGBO(246, 58, 58, 1),+ "warning/light": Color.fromRGBO(41, 41, 41, 1),+ };++ expect(_figmaColorTokenMap(ColorTokens.light), expectedLight);+ expect(_figmaColorTokenMap(ColorTokens.dark), expectedDark);+ });+ });++ group("text styles", () {+ test("match the published type scale", () {+ expect(TextStyles.fontFamily, "Inter");++ expect(TextStyles.h1.fontSize, 20);+ expect(TextStyles.h1.height, 28 / 20);+ expect(TextStyles.h1.fontWeight, FontWeight.w700);+ expect(TextStyles.h1.letterSpacing, 0);++ expect(TextStyles.h2.fontSize, 18);+ expect(TextStyles.h2.height, 24 / 18);+ expect(TextStyles.h2.fontWeight, FontWeight.w600);++ expect(TextStyles.body.fontSize, 14);+ expect(TextStyles.body.height, 20 / 14);+ expect(TextStyles.body.fontWeight, FontWeight.w500);++ expect(TextStyles.mini.fontSize, 12);+ expect(TextStyles.tiny.fontSize, 10);+ expect(TextStyles.bodyLink.decoration, TextDecoration.underline);+ });+ });++ group("theme", () {+ test("maps color and text tokens into light ThemeData", () {+ final theme = ComponentTheme.lightTheme();++ expect(theme.brightness, Brightness.light);+ expect(+ theme.scaffoldBackgroundColor,+ ColorTokens.light.backgroundBase,+ );+ expect(theme.colorScheme.primary, ColorTokens.light.primary);+ expect(theme.colorScheme.error, ColorTokens.light.warning);+ expect(+ theme.textTheme.headlineLarge?.fontFamily,+ TextStyles.fontFamily,+ );+ expect(+ theme.textTheme.headlineLarge?.fontSize,+ TextStyles.h1.fontSize,+ );+ expect(+ theme.textTheme.headlineLarge?.fontWeight,+ TextStyles.h1.fontWeight,+ );+ expect(+ theme.textTheme.bodyMedium?.fontFamily,+ TextStyles.fontFamily,+ );+ expect(+ theme.textTheme.bodyMedium?.fontSize,+ TextStyles.body.fontSize,+ );+ });++ test("maps color and text tokens into dark ThemeData", () {+ final theme = ComponentTheme.darkTheme();++ expect(theme.brightness, Brightness.dark);+ expect(+ theme.scaffoldBackgroundColor,+ ColorTokens.dark.backgroundBase,+ );+ expect(theme.colorScheme.primary, ColorTokens.dark.primary);+ expect(theme.colorScheme.error, ColorTokens.dark.warning);+ expect(+ theme.textTheme.labelSmall?.fontFamily,+ TextStyles.fontFamily,+ );+ expect(+ theme.textTheme.labelSmall?.fontSize,+ TextStyles.tiny.fontSize,+ );+ expect(+ theme.textTheme.labelSmall?.fontWeight,+ TextStyles.tiny.fontWeight,+ );+ });++ test("maps selected app primary tokens into ThemeData", () {+ final authTheme = ComponentTheme.lightTheme(app: EnteApp.auth);+ final lockerTheme = ComponentTheme.darkTheme(app: EnteApp.locker);++ expect(authTheme.colorScheme.primary, authPrimaryDefaultLight);+ expect(+ authTheme.scaffoldBackgroundColor,+ ColorTokens.light.backgroundBase,+ );+ expect(lockerTheme.colorScheme.primary, lockerPrimaryDefaultDark);+ expect(+ lockerTheme.scaffoldBackgroundColor,+ ColorTokens.dark.backgroundBase,+ );+ });++ testWidgets("selects color tokens from the ambient brightness",+ (tester) async {+ late ColorTokens lightColors;+ late ColorTokens darkColors;++ await tester.pumpWidget(+ Theme(+ data: ComponentTheme.lightTheme(),+ child: Builder(+ builder: (context) {+ lightColors = ComponentTheme.colorsOf(context);+ return const SizedBox.shrink();+ },+ ),+ ),+ );++ await tester.pumpWidget(+ Theme(+ data: ComponentTheme.darkTheme(),+ child: Builder(+ builder: (context) {+ darkColors = context.componentColors;+ return const SizedBox.shrink();+ },+ ),+ ),+ );++ expect(lightColors.backgroundBase, ColorTokens.light.backgroundBase);+ expect(lightColors.textBase, ColorTokens.light.textBase);+ expect(darkColors.backgroundBase, ColorTokens.dark.backgroundBase);+ expect(darkColors.textBase, ColorTokens.dark.textBase);+ });++ testWidgets("reads app-aware tokens from ComponentTheme ThemeData",+ (tester) async {+ late ColorTokens authColors;+ late ColorTokens lockerColors;++ await tester.pumpWidget(+ Theme(+ data: ComponentTheme.lightTheme(app: EnteApp.auth),+ child: Builder(+ builder: (context) {+ authColors = context.componentColors;+ return const SizedBox.shrink();+ },+ ),+ ),+ );++ await tester.pumpWidget(+ Theme(+ data: ComponentTheme.darkTheme(app: EnteApp.locker),+ child: Builder(+ builder: (context) {+ lockerColors = context.componentColors;+ return const SizedBox.shrink();+ },+ ),+ ),+ );++ expect(authColors.primary, authPrimaryDefaultLight);+ expect(authColors.backgroundBase, ColorTokens.light.backgroundBase);+ expect(lockerColors.primary, lockerPrimaryDefaultDark);+ expect(lockerColors.backgroundBase, ColorTokens.dark.backgroundBase);+ });++ test("defaults to photos primary tokens when no app is passed", () {+ expect(+ ComponentTheme.lightTheme().colorScheme.primary,+ primaryDefaultLight,+ );+ });+ });+}++Map<String, Color> _figmaColorTokenMap(ColorTokens colors) {+ return {+ "accent/orange": colors.accentOrange,+ "accent/orange-light": colors.accentOrangeLight,+ "accent/pink": colors.accentPink,+ "accent/pink-light": colors.accentPinkLight,+ "accent/purple": colors.accentPurple,+ "accent/purple-light": colors.accentPurpleLight,+ "accent/teal": colors.accentTeal,+ "accent/teal-light": colors.accentTealLight,+ "background/base": colors.backgroundBase,+ "caution/default": colors.caution,+ "caution/light": colors.cautionLight,+ "fill/base": colors.fillBase,+ "fill/dark": colors.fillDark,+ "fill/darker": colors.fillDarker,+ "fill/darkest": colors.fillDarkest,+ "fill/light": colors.fillLight,+ "info/dark": colors.infoDark,+ "info/darker": colors.infoDarker,+ "info/default": colors.info,+ "info/light": colors.infoLight,+ "info/stroke": colors.infoStroke,+ "primary/dark": colors.primaryDark,+ "primary/darker": colors.primaryDarker,+ "primary/default": colors.primary,+ "primary/light": colors.primaryLight,+ "primary/stroke": colors.primaryStroke,+ "special/content-reverse": colors.specialContentReverse,+ "special/scrim": colors.specialScrim,+ "special/white": colors.specialWhite,+ "special/white-overlay": colors.specialWhiteOverlay,+ "stroke/dark": colors.strokeDark,+ "stroke/faint": colors.strokeFaint,+ "text/base": colors.textBase,+ "text/dark": colors.textDark,+ "text/darker": colors.textDarker,+ "text/light": colors.textLight,+ "text/lighter": colors.textLighter,+ "text/lightest": colors.textLightest,+ "text/reverse": colors.textReverse,+ "warning/dark": colors.warningDark,+ "warning/darker": colors.warningDarker,+ "warning/default": colors.warning,+ "warning/light": colors.warningLight,+ };+}