π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][locker] Migrate upload inputs to component theme
aman-pilot830f6eeb46fd
diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dartindex 7f960884a3..0efae52c1c 100644--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart@@ -2,9 +2,6 @@ import 'dart:io';import "package:ente_components/ente_components.dart";import "package:ente_ui/components/title_bar_title_widget.dart";-import "package:ente_ui/theme/colors.dart";-import 'package:ente_ui/theme/ente_theme.dart';-import "package:ente_ui/theme/text_style.dart";import 'package:flutter/material.dart';import "package:hugeicons/hugeicons.dart";import 'package:locker/l10n/l10n.dart';@@ -79,18 +76,17 @@ class _FileUploadScreenState extends State<FileUploadScreen> {@overrideWidget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);+ final colors = context.componentColors;return Scaffold(appBar: AppBar(- backgroundColor: colorScheme.backgroundBase,+ backgroundColor: colors.backgroundBase,surfaceTintColor: Colors.transparent,automaticallyImplyLeading: false,toolbarHeight: 0,elevation: 0,),- backgroundColor: colorScheme.backgroundBase,+ backgroundColor: colors.backgroundBase,body: SafeArea(child: Padding(padding: const EdgeInsets.symmetric(horizontal: 16),@@ -108,7 +104,9 @@ class _FileUploadScreenState extends State<FileUploadScreen> {TitleBarTitleWidget(title: context.l10n.uploadFiles),Text(context.l10n.filesSelected(_files.length),- style: textTheme.smallMuted,+ style: TextStyles.body.copyWith(+ color: colors.textLight,+ ),),],),@@ -119,13 +117,13 @@ class _FileUploadScreenState extends State<FileUploadScreen> {child: Container(decoration: BoxDecoration(borderRadius: BorderRadius.circular(50),- color: colorScheme.fillFaint,+ color: colors.strokeDark,),padding: const EdgeInsets.all(8),child: Icon(Icons.close,size: 24,- color: colorScheme.textBase,+ color: colors.textBase,),),),@@ -142,7 +140,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {if (_files.isNotEmpty) ...[Container(decoration: BoxDecoration(- color: colorScheme.strokeFainter,+ color: colors.fillDark,borderRadius: BorderRadius.circular(24),),padding: const EdgeInsets.all(12),@@ -152,7 +150,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {constraints: BoxConstraints(maxHeight: _files.length > 5? 360- : _files.length * 84.0,+ : _files.length * 72.0,),child: ListView.separated(shrinkWrap: true,@@ -164,11 +162,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {separatorBuilder: (context, index) =>const SizedBox(height: 8),itemBuilder: (context, index) {- return _buildFileItem(- _files[index],- colorScheme,- textTheme,- );+ return _buildFileItem(_files[index], colors);},),),@@ -212,70 +206,51 @@ class _FileUploadScreenState extends State<FileUploadScreen> {);}- Widget _buildFileItem(- File file,- EnteColorScheme colorScheme,- EnteTextTheme textTheme,- ) {+ Widget _buildFileItem(File file, ColorTokens colors) {final fileName = path.basename(file.path);- final widget = Flexible(- flex: 6,+ return Container(+ padding: const EdgeInsets.all(12),+ decoration: BoxDecoration(+ color: colors.fillLight,+ borderRadius: const BorderRadius.all(Radius.circular(20)),+ ),child: Row(children: [- Container(- padding: const EdgeInsets.all(10.0),- width: 60,- height: 60,+ SizedBox(+ height: 40,+ width: 40,child: _buildFileIcon(fileName),),- const SizedBox(width: 6),- Flexible(+ const SizedBox(width: 12),+ Expanded(child: Text(fileName,overflow: TextOverflow.ellipsis,maxLines: 1,- style: textTheme.body,+ style: TextStyles.body,),),- ],- ),- );-- return Container(- decoration: BoxDecoration(- color: colorScheme.backdropBase,- borderRadius: const BorderRadius.all(Radius.circular(16)),- ),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- widget,- Flexible(- flex: 1,- child: GestureDetector(- onTap: () {- setState(() {- _files.remove(file);- if (_files.isEmpty) {- Navigator.of(context).pop();- }- });- },- child: Padding(- padding: const EdgeInsets.only(right: 12),- child: Container(- decoration: BoxDecoration(- shape: BoxShape.circle,- color: colorScheme.backgroundElevated,- ),- padding: const EdgeInsets.all(8),- child: HugeIcon(- icon: HugeIcons.strokeRoundedCancel01,- color: colorScheme.textBase,- size: 20,- ),- ),+ const SizedBox(width: 12),+ GestureDetector(+ onTap: () {+ setState(() {+ _files.remove(file);+ if (_files.isEmpty) {+ Navigator.of(context).pop();+ }+ });+ },+ child: Container(+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: colors.strokeDark,+ ),+ padding: const EdgeInsets.all(6),+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedCancel01,+ color: colors.textBase,+ size: 16,),),),@@ -285,6 +260,11 @@ class _FileUploadScreenState extends State<FileUploadScreen> {}Widget _buildFileIcon(String fileName) {- return FileIconUtils.getFileIcon(fileName, showBackground: true);+ return FileIconUtils.getFileIcon(+ context,+ fileName,+ showBackground: true,+ backgroundColor: context.componentColors.backgroundBase,+ );}}diff --git a/mobile/packages/ente_components/lib/components/text_input_component.dart b/mobile/packages/ente_components/lib/components/text_input_component.dartindex fa119d400e..5db7444942 100644--- a/mobile/packages/ente_components/lib/components/text_input_component.dart+++ b/mobile/packages/ente_components/lib/components/text_input_component.dart@@ -44,6 +44,8 @@ class TextInputComponent extends StatefulWidget {this.inputFormatters,this.keyboardType,this.enableFillColor = true,+ this.backgroundColor,+ this.textColor,this.autocorrect = true,this.isRequired = false,this.prefix,@@ -88,6 +90,8 @@ class TextInputComponent extends StatefulWidget {final List<TextInputFormatter>? inputFormatters;final TextInputType? keyboardType;final bool enableFillColor;+ final Color? backgroundColor;+ final Color? textColor;final bool autocorrect;final bool isRequired;@@ -267,6 +271,7 @@ class _TextInputComponentState extends State<TextInputComponent> {child: TextField(controller: _controller,focusNode: _focusNode,+ cursorColor: widget.textColor,enabled: !widget.isDisabled,autofocus: widget.autofocus,obscureText: _obscureText,@@ -366,12 +371,15 @@ class _TextInputComponentState extends State<TextInputComponent> {}Color _backgroundColor(ColorTokens colors) {- if (!widget.enableFillColor) {- return Colors.transparent;- }if (widget.isDisabled) {return colors.fillDark;}+ if (widget.backgroundColor != null) {+ return widget.backgroundColor!;+ }+ if (!widget.enableFillColor) {+ return Colors.transparent;+ }return colors.fillLight;}@@ -389,7 +397,8 @@ class _TextInputComponentState extends State<TextInputComponent> {}Color _textColor(ColorTokens colors) {- return widget.isDisabled ? colors.textLightest : colors.textBase;+ if (widget.isDisabled) return colors.textLightest;+ return widget.textColor ?? colors.textBase;}Color _hintColor(ColorTokens colors) {