mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 08:19:30 +01:00
chore: Hide FAB story buttons on focus
This commit is contained in:
parent
f8a82c96da
commit
87a60feb63
@ -27,6 +27,7 @@ class AddStoryPage extends StatefulWidget {
|
||||
|
||||
class AddStoryController extends State<AddStoryPage> {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
final FocusNode focusNode = FocusNode();
|
||||
late Color backgroundColor;
|
||||
late Color backgroundColorDark;
|
||||
MatrixImageFile? image;
|
||||
@ -38,6 +39,8 @@ class AddStoryController extends State<AddStoryPage> {
|
||||
|
||||
bool hasText = false;
|
||||
|
||||
bool textFieldHasFocus = false;
|
||||
|
||||
Timer? _updateColorsCooldown;
|
||||
|
||||
void updateColors() {
|
||||
@ -167,6 +170,13 @@ class AddStoryController extends State<AddStoryPage> {
|
||||
final text = Matrix.of(context).client.userID!;
|
||||
backgroundColor = text.color;
|
||||
backgroundColorDark = text.darkColor;
|
||||
focusNode.addListener(() {
|
||||
if (textFieldHasFocus != focusNode.hasFocus) {
|
||||
setState(() {
|
||||
textFieldHasFocus = focusNode.hasFocus;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
final shareContent = Matrix.of(context).shareContent;
|
||||
if (shareContent != null) {
|
||||
|
@ -80,10 +80,11 @@ class AddStoryView extends StatelessWidget {
|
||||
child: Center(
|
||||
child: TextField(
|
||||
controller: controller.controller,
|
||||
focusNode: controller.focusNode,
|
||||
minLines: 1,
|
||||
maxLines: 15,
|
||||
maxLength: 500,
|
||||
autofocus: true,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
@ -114,29 +115,31 @@ class AddStoryView extends StatelessWidget {
|
||||
floatingActionButton: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
onPressed: controller.captureVideo,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.video_camera_front_outlined),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FloatingActionButton(
|
||||
onPressed: controller.capturePhoto,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.camera_alt_outlined),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FloatingActionButton(
|
||||
onPressed: controller.importMedia,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.photo_outlined),
|
||||
),
|
||||
if (!controller.hasMedia && !controller.textFieldHasFocus) ...[
|
||||
FloatingActionButton(
|
||||
onPressed: controller.captureVideo,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.video_camera_front_outlined),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FloatingActionButton(
|
||||
onPressed: controller.capturePhoto,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.camera_alt_outlined),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FloatingActionButton(
|
||||
onPressed: controller.importMedia,
|
||||
backgroundColor: controller.backgroundColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.photo_outlined),
|
||||
),
|
||||
],
|
||||
if (controller.hasMedia || controller.hasText) ...[
|
||||
const SizedBox(height: 16),
|
||||
FloatingActionButton(
|
||||
|
@ -7,6 +7,7 @@ import Foundation
|
||||
|
||||
import audioplayers
|
||||
import desktop_drop
|
||||
import emoji_picker_flutter
|
||||
import file_selector_macos
|
||||
import flutter_local_notifications
|
||||
import flutter_secure_storage_macos
|
||||
@ -23,6 +24,7 @@ import wakelock_macos
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AudioplayersPlugin.register(with: registry.registrar(forPlugin: "AudioplayersPlugin"))
|
||||
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
|
||||
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||
FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin"))
|
||||
|
@ -9,9 +9,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
@ -20,8 +17,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user