|
@@ -1,23 +1,26 @@
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
+import 'package:photos/models/file.dart';
|
|
import 'package:photos/theme/ente_theme.dart';
|
|
import 'package:photos/theme/ente_theme.dart';
|
|
|
|
+import 'package:photos/utils/magic_util.dart';
|
|
|
|
|
|
-class InfoItemWidget extends StatefulWidget {
|
|
|
|
|
|
+class InfoItemTextWidget extends StatefulWidget {
|
|
final String hintText;
|
|
final String hintText;
|
|
- const InfoItemWidget({this.hintText = '', super.key});
|
|
|
|
|
|
+ final File file;
|
|
|
|
+ const InfoItemTextWidget({required this.file, this.hintText = '', super.key});
|
|
|
|
|
|
@override
|
|
@override
|
|
- State<InfoItemWidget> createState() => _InfoItemWidgetState();
|
|
|
|
|
|
+ State<InfoItemTextWidget> createState() => _InfoItemTextWidgetState();
|
|
}
|
|
}
|
|
|
|
|
|
-class _InfoItemWidgetState extends State<InfoItemWidget> {
|
|
|
|
|
|
+class _InfoItemTextWidgetState extends State<InfoItemTextWidget> {
|
|
int maxLength = 280;
|
|
int maxLength = 280;
|
|
int currentLength = 0;
|
|
int currentLength = 0;
|
|
final _textController = TextEditingController();
|
|
final _textController = TextEditingController();
|
|
final _focusNode = FocusNode();
|
|
final _focusNode = FocusNode();
|
|
|
|
+ String caption = "";
|
|
|
|
|
|
@override
|
|
@override
|
|
void dispose() {
|
|
void dispose() {
|
|
- // save caption here
|
|
|
|
_textController.dispose();
|
|
_textController.dispose();
|
|
super.dispose();
|
|
super.dispose();
|
|
}
|
|
}
|
|
@@ -28,7 +31,7 @@ class _InfoItemWidgetState extends State<InfoItemWidget> {
|
|
final textTheme = getEnteTextTheme(context);
|
|
final textTheme = getEnteTextTheme(context);
|
|
return TextField(
|
|
return TextField(
|
|
onEditingComplete: () {
|
|
onEditingComplete: () {
|
|
- //save caption here
|
|
|
|
|
|
+ editCaption();
|
|
_focusNode.unfocus();
|
|
_focusNode.unfocus();
|
|
},
|
|
},
|
|
controller: _textController,
|
|
controller: _textController,
|
|
@@ -57,8 +60,15 @@ class _InfoItemWidgetState extends State<InfoItemWidget> {
|
|
onChanged: (value) {
|
|
onChanged: (value) {
|
|
setState(() {
|
|
setState(() {
|
|
currentLength = value.length;
|
|
currentLength = value.length;
|
|
|
|
+ caption = value;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ void editCaption() {
|
|
|
|
+ if (caption.isNotEmpty) {
|
|
|
|
+ editFileCaption(context, widget.file, caption);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|