diff --git a/lib/components/default_app_bar_search_field.dart b/lib/components/default_app_bar_search_field.dart index c86390e5..6ce2ff33 100644 --- a/lib/components/default_app_bar_search_field.dart +++ b/lib/components/default_app_bar_search_field.dart @@ -8,6 +8,7 @@ class DefaultAppBarSearchField extends StatefulWidget { final String prefixText; final String hintText; final EdgeInsets padding; + final bool readOnly; const DefaultAppBarSearchField({ Key key, @@ -18,6 +19,7 @@ class DefaultAppBarSearchField extends StatefulWidget { this.prefixText, this.hintText, this.padding, + this.readOnly = false, }) : super(key: key); @override @@ -71,6 +73,7 @@ class _DefaultAppBarSearchFieldState extends State { controller: _searchController, onChanged: widget.onChanged, focusNode: _focusNode, + readOnly: widget.readOnly, decoration: InputDecoration( prefixText: widget.prefixText, contentPadding: EdgeInsets.only( @@ -82,9 +85,10 @@ class _DefaultAppBarSearchFieldState extends State { borderRadius: BorderRadius.circular(32), ), hintText: widget.hintText, - suffixIcon: _focusNode.hasFocus || - (widget.suffix == null && - (_searchController.text?.isNotEmpty ?? false)) + suffixIcon: !widget.readOnly && + (_focusNode.hasFocus || + (widget.suffix == null && + (_searchController.text?.isNotEmpty ?? false))) ? IconButton( icon: Icon(Icons.backspace_outlined), onPressed: () { diff --git a/lib/views/homeserver_picker.dart b/lib/views/homeserver_picker.dart index 32e0a964..a559186a 100644 --- a/lib/views/homeserver_picker.dart +++ b/lib/views/homeserver_picker.dart @@ -71,6 +71,7 @@ class _HomeserverPickerState extends State { suffix: Icon(Icons.edit_outlined), padding: padding, onChanged: (s) => _domain = s, + readOnly: !AppConfig.allowOtherHomeservers, ), elevation: 0, ),