Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Simplify file edit sheet layout

aman-pilotec61b99001b7
diff --git a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
index 2c3593dd39..ce13400649 100644
--- a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
@@ -91,7 +91,6 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
final containsUncategorized = _uncategorizedCollection != null;
final chips = <Widget>[];
@@ -135,7 +134,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.title.isNotEmpty) ...[
- Text(widget.title, style: textTheme.body),
+ Text(widget.title, style: TextStyles.bodyBold),
const SizedBox(height: 12),
],
ClipRRect(
diff --git a/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart b/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
index c19101d7d5..9e89772b6f 100644
--- a/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
+++ b/mobile/apps/locker/lib/ui/components/file_edit_sheet.dart
@@ -1,12 +1,10 @@
import 'package:ente_components/ente_components.dart';
-import 'package:ente_ui/components/base_bottom_sheet.dart';
import 'package:flutter/material.dart';
import 'package:locker/l10n/l10n.dart';
import 'package:locker/services/collections/collections_service.dart';
import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/files/sync/models/file.dart';
import 'package:locker/ui/components/collection_selection_widget.dart';
-import 'package:locker/ui/components/form_text_input_widget.dart';
import 'package:locker/utils/collection_list_util.dart';
class FileEditSheetResult {
@@ -52,13 +50,9 @@ class _FileEditSheetState extends State<FileEditSheet> {
@override
void initState() {
super.initState();
-
_availableCollections = _filterCollections(widget.collections);
-
_titleController.text = widget.file.displayName;
-
_captionController.text = widget.file.caption ?? '';
-
_initializeSelections();
}
@@ -66,11 +60,9 @@ class _FileEditSheetState extends State<FileEditSheet> {
try {
final existingCollections = await CollectionService.instance
.getCollectionsForFile(widget.file);
-
if (!mounted) {
return;
}
-
setState(() {
_selectedCollectionIds
..clear()
@@ -121,38 +113,41 @@ class _FileEditSheetState extends State<FileEditSheet> {
final selectedCollections = _availableCollections
.where((c) => _selectedCollectionIds.contains(c.id))
.toList();
-
final result = FileEditSheetResult(
title: _titleController.text.trim(),
caption: _captionController.text.trim(),
selectedCollections: selectedCollections,
);
-
Navigator.of(context).pop(result);
}
@override
Widget build(BuildContext context) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- FormTextInputWidget(
- controller: _titleController,
- labelText: context.l10n.title,
- hintText: context.l10n.enterNewTitle,
- maxLength: 200,
- shouldUseTextInputWidget: false,
- ),
- const SizedBox(height: 24),
- CollectionSelectionWidget(
- collections: _availableCollections,
- selectedCollectionIds: _selectedCollectionIds,
- onToggleCollection: _toggleCollection,
- onCollectionsUpdated: _onCollectionsUpdated,
- title: context.l10n.collections,
- ),
- const SizedBox(height: 28),
+ return BottomSheetComponent(
+ title: context.l10n.editItem,
+ isKeyboardAware: true,
+ content: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TextInputComponent(
+ isRequired: true,
+ controller: _titleController,
+ label: context.l10n.title,
+ hintText: context.l10n.enterNewTitle,
+ maxLength: 200,
+ ),
+ const SizedBox(height: 24),
+ CollectionSelectionWidget(
+ collections: _availableCollections,
+ selectedCollectionIds: _selectedCollectionIds,
+ onToggleCollection: _toggleCollection,
+ onCollectionsUpdated: _onCollectionsUpdated,
+ title: context.l10n.collections,
+ ),
+ ],
+ ),
+ actions: [
ValueListenableBuilder<TextEditingValue>(
valueListenable: _titleController,
builder: (context, _, _) => ButtonComponent(
@@ -171,12 +166,9 @@ Future<FileEditSheetResult?> showFileEditSheet(
required List<Collection> collections,
BuildContext? snackBarContext,
}) async {
- return showBaseBottomSheet<FileEditSheetResult>(
- context,
- title: context.l10n.editItem,
- headerSpacing: 20,
- isKeyboardAware: true,
- child: FileEditSheet(
+ return showBottomSheetComponent<FileEditSheetResult>(
+ context: context,
+ builder: (_) => FileEditSheet(
file: file,
collections: collections,
snackBarContext: snackBarContext ?? context,