From 6210a64315d912468e5aa2d444d9112458353619 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 26 Aug 2021 14:56:58 -0700 Subject: [PATCH] Format --- lib/views/contactsview.dart | 10 +++-- lib/views/messageview.dart | 79 ++++++++++++++++++++----------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index cbb27a61..297fc0d5 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -96,15 +96,17 @@ class _ContactsViewState extends State { ), body: showSearchBar || Provider.of(context).isFiltered ? _buildFilterable() : _buildContactList()); } - + List getActions(context) { var actions = List.empty(growable: true); - if (Provider.of(context).blockUnknownConnections ) { + if (Provider.of(context).blockUnknownConnections) { actions.add(Tooltip(message: AppLocalizations.of(context)!.blockUnknownConnectionsEnabledDescription, child: Icon(CwtchIcons.block_unknown))); } - actions.add( IconButton(icon: TorIcon(), onPressed: _pushTorStatus),); + actions.add( + IconButton(icon: TorIcon(), onPressed: _pushTorStatus), + ); actions.add(IconButton( - // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset + // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset icon: Icon(showSearchBar || Provider.of(context).isFiltered ? Icons.search_off : Icons.search), onPressed: () { Provider.of(context, listen: false).filter = ""; diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 91e576ac..5528d97a 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -78,9 +78,13 @@ class _MessageViewState extends State { return WillPopScope( onWillPop: _onWillPop, child: Scaffold( - floatingActionButton: appState.unreadMessagesBelow ? FloatingActionButton(child: Icon(Icons.arrow_downward), onPressed: (){ - scrollController.scrollTo(index: 0, duration: Duration(milliseconds: 600)); - }) : null, + floatingActionButton: appState.unreadMessagesBelow + ? FloatingActionButton( + child: Icon(Icons.arrow_downward), + onPressed: () { + scrollController.scrollTo(index: 0, duration: Duration(milliseconds: 600)); + }) + : null, appBar: AppBar( // setting leading to null makes it do the default behaviour; container() hides it leading: Provider.of(context).uiColumns(appState.isLandscape(context)).length > 1 ? Container() : null, @@ -106,9 +110,11 @@ class _MessageViewState extends State { //IconButton(icon: Icon(Icons.list), onPressed: _pushContactSettings), //IconButton(icon: Icon(Icons.push_pin), onPressed: _pushContactSettings), IconButton( - icon: Icon(CwtchIcons.send_invite, size: 24), - tooltip: AppLocalizations.of(context)!.sendInvite, - onPressed: (){_modalSendInvitation(context);}), + icon: Icon(CwtchIcons.send_invite, size: 24), + tooltip: AppLocalizations.of(context)!.sendInvite, + onPressed: () { + _modalSendInvitation(context); + }), IconButton( icon: Provider.of(context, listen: false).isGroup == true ? Icon(CwtchIcons.group_settings_24px) : Icon(CwtchIcons.peer_settings_24px), tooltip: AppLocalizations.of(context)!.conversationSettings, @@ -204,36 +210,37 @@ class _MessageViewState extends State { child: Row( children: [ Expanded( - child: Container( - decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor()))), - child: RawKeyboardListener( - focusNode: FocusNode(), - onKey: handleKeyPress, - child: Padding( - padding: EdgeInsets.all(8), child:TextFormField( - key: Key('txtCompose'), - controller: ctrlrCompose, - focusNode: focusNode, - autofocus: !Platform.isAndroid, - textInputAction: TextInputAction.newline, - keyboardType: TextInputType.multiline, - enableIMEPersonalizedLearning: false, - minLines: 1, - maxLines: null, - onFieldSubmitted: _sendMessage, - enabled: !isOffline, - decoration: InputDecoration( - hintText: isOffline ? "" : AppLocalizations.of(context)!.placeholderEnterMessage, - hintStyle: TextStyle(color: Provider.of(context).theme.altTextColor()), - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - enabled: true, - suffixIcon: ElevatedButton( - style: ElevatedButton.styleFrom(primary: Provider.of(context).theme.defaultButtonColor()), - child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.mainTextColor()), - onPressed: isOffline ? null : _sendMessage, - ))), - )))), + child: Container( + decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor()))), + child: RawKeyboardListener( + focusNode: FocusNode(), + onKey: handleKeyPress, + child: Padding( + padding: EdgeInsets.all(8), + child: TextFormField( + key: Key('txtCompose'), + controller: ctrlrCompose, + focusNode: focusNode, + autofocus: !Platform.isAndroid, + textInputAction: TextInputAction.newline, + keyboardType: TextInputType.multiline, + enableIMEPersonalizedLearning: false, + minLines: 1, + maxLines: null, + onFieldSubmitted: _sendMessage, + enabled: !isOffline, + decoration: InputDecoration( + hintText: isOffline ? "" : AppLocalizations.of(context)!.placeholderEnterMessage, + hintStyle: TextStyle(color: Provider.of(context).theme.altTextColor()), + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + enabled: true, + suffixIcon: ElevatedButton( + style: ElevatedButton.styleFrom(primary: Provider.of(context).theme.defaultButtonColor()), + child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.mainTextColor()), + onPressed: isOffline ? null : _sendMessage, + ))), + )))), ], ), );