Browse Source

add textfield for caption in file info by creating InfoItemWidget

ashilkn 2 years ago
parent
commit
3c1d68cd8d
2 changed files with 34 additions and 0 deletions
  1. 29 0
      lib/ui/components/info_item_widget.dart
  2. 5 0
      lib/ui/viewer/file/file_info_widget.dart

+ 29 - 0
lib/ui/components/info_item_widget.dart

@@ -0,0 +1,29 @@
+import 'package:flutter/material.dart';
+import 'package:photos/theme/ente_theme.dart';
+
+class InfoItemWidget extends StatelessWidget {
+  final String hintText;
+  const InfoItemWidget({this.hintText = '', super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    final colorScheme = getEnteColorScheme(context);
+    return TextField(
+      decoration: InputDecoration(
+        contentPadding: const EdgeInsets.all(16),
+        border: InputBorder.none,
+        focusedBorder: InputBorder.none,
+        filled: true,
+        fillColor: colorScheme.fillFaint,
+        hintText: hintText,
+        hintStyle: getEnteTextTheme(context)
+            .small
+            .copyWith(color: colorScheme.textMuted),
+      ),
+      style: getEnteTextTheme(context).small,
+      cursorWidth: 1.5,
+      maxLength: 280,
+      maxLines: null,
+    );
+  }
+}

+ 5 - 0
lib/ui/viewer/file/file_info_widget.dart

@@ -11,6 +11,7 @@ import "package:photos/models/file.dart";
 import "package:photos/models/file_type.dart";
 import 'package:photos/ui/components/divider_widget.dart';
 import 'package:photos/ui/components/icon_button_widget.dart';
+import 'package:photos/ui/components/info_item_widget.dart';
 import 'package:photos/ui/components/title_bar_widget.dart';
 import 'package:photos/ui/viewer/file/collections_list_of_file_widget.dart';
 import 'package:photos/ui/viewer/file/device_folders_list_of_file_widget.dart';
@@ -92,6 +93,10 @@ class _FileInfoWidgetState extends State<FileInfoWidget> {
     final bool showDimension =
         _exifData["resolution"] != null && _exifData["megaPixels"] != null;
     final listTiles = <Widget>[
+      const Padding(
+        padding: EdgeInsets.only(top: 8, bottom: 4),
+        child: InfoItemWidget(),
+      ),
       ListTile(
         leading: const Padding(
           padding: EdgeInsets.only(top: 8, left: 6),