diff --git a/integration_test/steps/chat.dart b/integration_test/steps/chat.dart index aa16f168..d735aec2 100644 --- a/integration_test/steps/chat.dart +++ b/integration_test/steps/chat.dart @@ -1,17 +1,8 @@ -import 'package:cwtch/main.dart'; -import 'package:cwtch/widgets/messagebubble.dart'; -import 'package:cwtch/widgets/profilerow.dart'; import 'package:cwtch/widgets/quotedmessage.dart'; -import 'package:cwtch/widgets/tor_icon.dart'; -import 'package:cwtch/views/profilemgrview.dart'; import 'package:flutter_gherkin/flutter_gherkin.dart'; -import 'package:flutter_gherkin/src/flutter/parameters/existence_parameter.dart'; -import 'package:flutter_gherkin/src/flutter/parameters/swipe_direction_parameter.dart'; import 'package:gherkin/gherkin.dart'; -import 'package:flutter/material.dart'; -import 'overrides.dart'; StepDefinitionGeneric ExpectReply() { return given3( diff --git a/integration_test/steps/form_elements.dart b/integration_test/steps/form_elements.dart index afda0d2e..3afdbcda 100644 --- a/integration_test/steps/form_elements.dart +++ b/integration_test/steps/form_elements.dart @@ -1,10 +1,7 @@ -import 'dart:convert'; import 'package:flutter/material.dart'; -import 'package:flutter_driver/flutter_driver.dart'; import 'package:flutter_gherkin/flutter_gherkin.dart'; import 'package:gherkin/gherkin.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; enum SwitchState { checked, unchecked } @@ -17,6 +14,7 @@ class SwitchStateParameter extends CustomParameter { case "unchecked": return SwitchState.unchecked; } + return null; }); } diff --git a/lib/controllers/open_link_modal.dart b/lib/controllers/open_link_modal.dart index c770bcb6..10d81697 100644 --- a/lib/controllers/open_link_modal.dart +++ b/lib/controllers/open_link_modal.dart @@ -1,6 +1,5 @@ import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/third_party/linkify/linkify.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 4448095f..0dd710f8 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -3,15 +3,10 @@ import 'package:cwtch/cwtch/cwtch.dart'; import 'package:cwtch/main.dart'; import 'package:cwtch/models/appstate.dart'; import 'package:cwtch/models/contact.dart'; -import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/profilelist.dart'; -import 'package:cwtch/models/profileservers.dart'; import 'package:cwtch/models/remoteserver.dart'; import 'package:cwtch/models/servers.dart'; import 'package:cwtch/notification_manager.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; -import 'package:provider/provider.dart'; import 'package:cwtch/torstatus.dart'; @@ -254,7 +249,7 @@ class CwtchNotifier { var notification = data["notification"]; // Only bother to do anything if we know about the group and the provided index is greater than our current total... - if (currentTotal != null && idx >= currentTotal) { + if (idx >= currentTotal) { // TODO: There are 2 timestamps associated with a new group message - time sent and time received. // Sent refers to the time a profile alleges they sent a message // Received refers to the time we actually saw the message from the server @@ -346,7 +341,7 @@ class CwtchNotifier { associatedGroups.forEach((identifier) { profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(int.parse(identifier.toString()))!.antispamTickets = count; }); - EnvironmentConfig.debugLog("update server token count for ${associatedGroups}, $count"); + EnvironmentConfig.debugLog("update server token count for $associatedGroups, $count"); } catch (e) { // No tokens in data... } diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index de464a92..32d7ed69 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'dart:ffi'; import 'dart:io'; import 'dart:isolate'; -import 'dart:io' show Platform; import 'package:cwtch/cwtch/cwtchNotifier.dart'; import 'package:path/path.dart' as path; @@ -13,7 +12,6 @@ import 'package:cwtch/cwtch/cwtch.dart'; import '../config.dart'; import "package:path/path.dart" show dirname, join; -import 'dart:io' show Platform; ///////////////////// /// Cwtch API /// diff --git a/lib/cwtch/gomobile.dart b/lib/cwtch/gomobile.dart index 164721fa..e75b95fe 100644 --- a/lib/cwtch/gomobile.dart +++ b/lib/cwtch/gomobile.dart @@ -77,7 +77,7 @@ class CwtchGomobile implements Cwtch { Future Start() async { print("gomobile.dart: Start()..."); androidHomeDirectoryStr = (await androidHomeDirectory).path; - _cwtchDir = path.join(await androidHomeDirectoryStr, ".cwtch"); + _cwtchDir = path.join(androidHomeDirectoryStr, ".cwtch"); if (EnvironmentConfig.BUILD_VER == dev_version) { _cwtchDir = path.join(_cwtchDir, "dev"); } diff --git a/lib/main.dart b/lib/main.dart index 72c8e724..d73071ab 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,7 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:isolate'; import 'package:cwtch/config.dart'; import 'package:cwtch/notification_manager.dart'; -import 'package:cwtch/themes/cwtch.dart'; import 'package:cwtch/views/doublecolview.dart'; import 'package:cwtch/views/messageview.dart'; import 'package:flutter/foundation.dart'; @@ -33,8 +31,6 @@ import 'themes/opaque.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:intl/intl.dart' as intl; - var globalSettings = Settings(Locale("en", '')); var globalErrorHandler = ErrorHandler(); var globalTorStatus = TorStatus(); @@ -130,7 +126,7 @@ class FlwtchState extends State with WindowListener { // gracefully fails and NOPs, as it's not a required functionality startConnectivityListener() async { try { - connectivityStream = await Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { + connectivityStream = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { // Got a new connectivity status! if (result == ConnectivityResult.none) { connectivityState = ConnectivityState.confirmed_offline; @@ -255,7 +251,6 @@ class FlwtchState extends State with WindowListener { exit(0); } } - ; } // Invoked via notificationClickChannel by MyBroadcastReceiver in MainActivity.kt diff --git a/lib/main_test.dart b/lib/main_test.dart index 537f96e4..565dd66f 100644 --- a/lib/main_test.dart +++ b/lib/main_test.dart @@ -1,4 +1,3 @@ -import 'package:cwtch/themes/cwtch.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; @@ -8,11 +7,9 @@ import 'package:glob/list_local_fs.dart'; import 'config.dart'; import 'licenses.dart'; import 'main.dart'; -import 'themes/opaque.dart'; import 'dart:convert'; import 'dart:io'; -import 'dart:typed_data'; import "package:flutter_driver/driver_extension.dart"; import 'package:flutter_test/flutter_test.dart'; import 'package:glob/glob.dart'; diff --git a/lib/models/appstate.dart b/lib/models/appstate.dart index 9d8f54b9..45bc8709 100644 --- a/lib/models/appstate.dart +++ b/lib/models/appstate.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io'; import 'package:cwtch/config.dart'; import 'package:flutter/widgets.dart'; @@ -33,13 +32,13 @@ class AppState extends ChangeNotifier { void SetAppError(String error) { appError = error; - EnvironmentConfig.debugLog("App Error: ${appError}"); + EnvironmentConfig.debugLog("App Error: $appError"); notifyListeners(); } void SetModalState(ModalState newState) { modalState = newState; - EnvironmentConfig.debugLog("Modal State: ${newState}"); + EnvironmentConfig.debugLog("Modal State: $newState"); notifyListeners(); } diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 2dfae7f2..4a80205f 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:cwtch/main.dart'; import 'package:cwtch/models/message_draft.dart'; import 'package:cwtch/models/profile.dart'; @@ -13,7 +11,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; -import 'message.dart'; import 'messagecache.dart'; enum ConversationNotificationPolicy { diff --git a/lib/models/contactlist.dart b/lib/models/contactlist.dart index e8709508..2604f6f5 100644 --- a/lib/models/contactlist.dart +++ b/lib/models/contactlist.dart @@ -54,7 +54,7 @@ class ContactListState extends ChangeNotifier { if (otherGroups != null && otherGroups.isNotEmpty) { EnvironmentConfig.debugLog("sharing antispam tickets to new group. FIXME: in Cwtch 1.14"); var antispamTickets = otherGroups[0].antispamTickets; - _contacts.last!.antispamTickets = antispamTickets; + _contacts.last.antispamTickets = antispamTickets; } servers?.addGroup(newContact); } diff --git a/lib/models/message_draft.dart b/lib/models/message_draft.dart index 23ffb6ff..1a1188db 100644 --- a/lib/models/message_draft.dart +++ b/lib/models/message_draft.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; /// A "MessageDraft" structure that stores information about in-progress message drafts. /// MessageDraft stores text, quoted replies, and attached images. diff --git a/lib/models/messagecache.dart b/lib/models/messagecache.dart index 94bb834e..9b03febd 100644 --- a/lib/models/messagecache.dart +++ b/lib/models/messagecache.dart @@ -129,7 +129,7 @@ class MessageCache extends ChangeNotifier { void addNew(String profileOnion, int conversation, int messageID, DateTime timestamp, String senderHandle, String senderImage, bool isAuto, String data, String contenthash) { this.cache[messageID] = MessageInfo(MessageMetadata(profileOnion, conversation, messageID, timestamp, senderHandle, senderImage, "", {}, false, false, isAuto, contenthash), data); this.cacheByIndex.insert(0, LocalIndexMessage(messageID)); - if (contenthash != null && contenthash != "") { + if (contenthash != "") { this.cacheByHash[contenthash] = messageID; } } diff --git a/lib/models/messages/quotedmessage.dart b/lib/models/messages/quotedmessage.dart index 95b1db5d..af211a6b 100644 --- a/lib/models/messages/quotedmessage.dart +++ b/lib/models/messages/quotedmessage.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:cwtch/config.dart'; import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/messages/malformedmessage.dart'; import 'package:cwtch/widgets/malformedbubble.dart'; @@ -11,7 +10,6 @@ import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; import '../../settings.dart'; -import '../../third_party/linkify/flutter_linkify.dart'; class QuotedMessageStructure { final String quotedHash; diff --git a/lib/models/messages/textmessage.dart b/lib/models/messages/textmessage.dart index bb9d0a7c..74ecb0e9 100644 --- a/lib/models/messages/textmessage.dart +++ b/lib/models/messages/textmessage.dart @@ -1,17 +1,11 @@ -import 'dart:math'; - import 'package:cwtch/models/message.dart'; -import 'package:cwtch/models/messages/malformedmessage.dart'; -import 'package:cwtch/widgets/malformedbubble.dart'; import 'package:cwtch/widgets/messagebubble.dart'; -import 'package:cwtch/widgets/messageloadingbubble.dart'; import 'package:cwtch/widgets/messagerow.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; import '../../settings.dart'; -import '../../third_party/linkify/flutter_linkify.dart'; import '../../widgets/messageBubbleWidgetHelpers.dart'; class TextMessage extends Message { @@ -27,7 +21,6 @@ class TextMessage extends Message { builder: (bcontext, child) { var formatMessages = Provider.of(bcontext).isExperimentEnabled(FormattingExperiment); return compileMessageContentWidget(context, constraints ?? BoxConstraints.loose(MediaQuery.sizeOf(context)), false, content, FocusNode(), formatMessages, false); - ; }); } diff --git a/lib/models/profile.dart b/lib/models/profile.dart index 746bcad4..49b84492 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -14,8 +14,6 @@ import '../views/contactsview.dart'; import 'contact.dart'; import 'contactlist.dart'; import 'filedownloadprogress.dart'; -import 'message.dart'; -import 'messagecache.dart'; import 'profileservers.dart'; class ProfileInfoState extends ChangeNotifier { @@ -241,7 +239,7 @@ class ProfileInfoState extends ChangeNotifier { this._unreadMessages = 0; this.replaceServers(serverJson); - if (contactsJson != null && contactsJson != "" && contactsJson != "null") { + if (contactsJson != "" && contactsJson != "null") { List contacts = jsonDecode(contactsJson); contacts.forEach((contact) { var profileContact = this._contacts.getContact(contact["identifier"]); diff --git a/lib/models/profilelist.dart b/lib/models/profilelist.dart index 83d5363f..cd7046f4 100644 --- a/lib/models/profilelist.dart +++ b/lib/models/profilelist.dart @@ -1,6 +1,3 @@ -import 'dart:ui'; - -import 'package:cwtch/config.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/widgets.dart'; diff --git a/lib/models/redaction.dart b/lib/models/redaction.dart index 506911e6..26730d5a 100644 --- a/lib/models/redaction.dart +++ b/lib/models/redaction.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:flutter/cupertino.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/models/remoteserver.dart b/lib/models/remoteserver.dart index cbe6b3b8..5c5f9ac2 100644 --- a/lib/models/remoteserver.dart +++ b/lib/models/remoteserver.dart @@ -1,4 +1,3 @@ -import 'package:cwtch/config.dart'; import 'package:flutter/cupertino.dart'; import 'contact.dart'; diff --git a/lib/notification_manager.dart b/lib/notification_manager.dart index 81f21fd2..510e4d4f 100644 --- a/lib/notification_manager.dart +++ b/lib/notification_manager.dart @@ -3,13 +3,8 @@ import 'dart:convert'; import 'dart:io'; import 'package:cwtch/main.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:win_toast/win_toast.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:flutter_local_notifications_linux/flutter_local_notifications_linux.dart'; -import 'package:flutter_local_notifications_linux/src/model/hint.dart'; -import 'package:flutter_local_notifications_linux/src/model/icon.dart'; import 'package:path/path.dart' as path; diff --git a/lib/settings.dart b/lib/settings.dart index db286c60..c93f9b08 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -1,8 +1,6 @@ import 'dart:collection'; -import 'dart:ui'; import 'dart:core'; -import 'package:cwtch/themes/cwtch.dart'; import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; diff --git a/lib/themes/opaque.dart b/lib/themes/opaque.dart index 95c314f8..6c4741c4 100644 --- a/lib/themes/opaque.dart +++ b/lib/themes/opaque.dart @@ -1,8 +1,6 @@ import 'dart:io'; -import 'dart:ui'; import 'dart:core'; -import 'package:cwtch/config.dart'; import 'package:cwtch/themes/cwtch.dart'; import 'package:cwtch/themes/yamltheme.dart'; import 'package:flutter/material.dart'; @@ -26,8 +24,9 @@ class ThemeLoader extends ChangeNotifier { Map> themes = Map(); LoadThemes(String cwtchDir) async { - loadBuiltinThemes().then((dir) { - themes.addAll(dir); + themes.clear(); // clear themes... + loadBuiltinThemes().then((builtinThemes) { + themes.addAll(builtinThemes); notifyListeners(); loadCustomThemes(path.join(cwtchDir, custom_themes_subdir)).then((customThemes) { themes.addAll(customThemes); @@ -177,13 +176,11 @@ ThemeData mkThemeData(Settings opaque) { return ThemeData( hoverColor: opaque.current().backgroundHilightElementColor.withOpacity(0.5), visualDensity: VisualDensity.adaptivePlatformDensity, - primarySwatch: getMaterialColor(opaque.current().topbarColor), primaryIconTheme: IconThemeData( color: opaque.current().mainTextColor, ), primaryColor: opaque.current().mainTextColor, canvasColor: opaque.current().backgroundMainColor, - backgroundColor: opaque.current().backgroundMainColor, highlightColor: opaque.current().hilightElementColor, iconTheme: IconThemeData( color: opaque.current().toolbarIconColor, @@ -287,5 +284,6 @@ ThemeData mkThemeData(Settings opaque) { snackBarTheme: SnackBarThemeData( backgroundColor: opaque.current().snackbarBackgroundColor, contentTextStyle: TextStyle(color: opaque.current().snackbarTextColor), - )); + ) + ); } diff --git a/lib/themes/yamltheme.dart b/lib/themes/yamltheme.dart index a7e8f9c1..4f8b90d3 100644 --- a/lib/themes/yamltheme.dart +++ b/lib/themes/yamltheme.dart @@ -1,13 +1,10 @@ import 'dart:convert'; import 'dart:io'; -import 'dart:ui'; -import 'package:cwtch/config.dart'; import 'package:cwtch/themes/cwtch.dart'; import 'package:cwtch/themes/opaque.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:glob/list_local_fs.dart'; import 'package:provider/provider.dart'; import 'package:yaml/yaml.dart'; import 'package:path/path.dart' as path; diff --git a/lib/third_party/linkify/flutter_linkify.dart b/lib/third_party/linkify/flutter_linkify.dart index e6595dbc..210b634b 100644 --- a/lib/third_party/linkify/flutter_linkify.dart +++ b/lib/third_party/linkify/flutter_linkify.dart @@ -24,11 +24,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import 'dart:ui'; - import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'linkify.dart'; diff --git a/lib/torstatus.dart b/lib/torstatus.dart index af94b78d..0341219e 100644 --- a/lib/torstatus.dart +++ b/lib/torstatus.dart @@ -9,24 +9,24 @@ class TorStatus extends ChangeNotifier { TorStatus({this.connected = false, this.progress = 0, this.status = "", this.version = ""}); /// Called by the event bus. - handleUpdate(int new_progress, String new_status) { + handleUpdate(int newProgress, String newStatus) { if (progress == 100) { connected = true; } else { connected = false; } - progress = new_progress; - status = new_status; - if (new_progress != 100) { - status = "$new_progress% - $new_status"; + progress = newProgress; + status = newStatus; + if (newProgress != 100) { + status = "$newProgress% - $newStatus"; } notifyListeners(); } - updateVersion(String new_version) { - version = new_version; + updateVersion(String newVersion) { + version = newVersion; notifyListeners(); } } diff --git a/lib/views/addcontactview.dart b/lib/views/addcontactview.dart index 56b28a1a..15a0c79a 100644 --- a/lib/views/addcontactview.dart +++ b/lib/views/addcontactview.dart @@ -1,12 +1,9 @@ -import 'dart:convert'; - import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/profile.dart'; import 'package:cwtch/models/remoteserver.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:cwtch/errorHandler.dart'; -import 'package:cwtch/models/profileservers.dart'; import 'package:cwtch/settings.dart'; import 'package:cwtch/widgets/buttontextfield.dart'; import 'package:cwtch/widgets/cwtchlabel.dart'; @@ -237,7 +234,9 @@ class _AddContactViewState extends State { controller: ctrlrGroupName, hintText: AppLocalizations.of(bcontext)!.groupNameLabel, onChanged: (newValue) {}, - validator: (value) {}, + validator: (value) { + return null; + }, ), SizedBox( height: 20, diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index c6db4414..1103e149 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -20,7 +20,6 @@ import '../constants.dart'; import '../cwtch_icons_icons.dart'; import '../errorHandler.dart'; import '../main.dart'; -import '../themes/opaque.dart'; import '../settings.dart'; class AddEditProfileView extends StatefulWidget { @@ -154,7 +153,7 @@ class _AddEditProfileViewState extends State { Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-1", profileAttribute1); Provider.of(context, listen: false).attributes[0] = profileAttribute1; }, - hintText: Provider.of(context).attributes[0] ?? AppLocalizations.of(context)!.profileInfoHint!)), + hintText: Provider.of(context).attributes[0] ?? AppLocalizations.of(context)!.profileInfoHint)), Padding( padding: EdgeInsets.all(5.0), child: CwtchTextField( @@ -165,7 +164,7 @@ class _AddEditProfileViewState extends State { Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-2", profileAttribute2); Provider.of(context, listen: false).attributes[1] = profileAttribute2; }, - hintText: Provider.of(context).attributes[1] ?? AppLocalizations.of(context)!.profileInfoHint2!)), + hintText: Provider.of(context).attributes[1] ?? AppLocalizations.of(context)!.profileInfoHint2)), Padding( padding: EdgeInsets.all(5.0), child: CwtchTextField( @@ -176,7 +175,7 @@ class _AddEditProfileViewState extends State { Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-3", profileAttribute3); Provider.of(context, listen: false).attributes[2] = profileAttribute3; }, - hintText: Provider.of(context).attributes[2] ?? AppLocalizations.of(context)!.profileInfoHint3!)), + hintText: Provider.of(context).attributes[2] ?? AppLocalizations.of(context)!.profileInfoHint3)), ], )) ], @@ -258,7 +257,7 @@ class _AddEditProfileViewState extends State { onChanged: (bool value) { Provider.of(context, listen: false).autostart = value; - if (!Provider.of(context, listen: false).onion.isEmpty) { + if (Provider.of(context, listen: false).onion.isNotEmpty) { Provider.of(context, listen: false) .cwtch .SetProfileAttribute(Provider.of(context, listen: false).onion, "profile.autostart", value ? "true" : "false"); @@ -280,7 +279,7 @@ class _AddEditProfileViewState extends State { onChanged: (bool value) { Provider.of(context, listen: false).appearOfflineAtStartup = value; var onion = Provider.of(context, listen: false).onion; - if (!onion.isEmpty) { + if (onion.isNotEmpty) { Provider.of(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.appear-offline", value ? "true" : "false"); } }, @@ -449,11 +448,11 @@ class _AddEditProfileViewState extends State { child: ElevatedButton.icon( style: ElevatedButton.styleFrom( minimumSize: Size(400, 75), + backgroundColor: Provider.of(context).theme.backgroundMainColor, maximumSize: Size(800, 75), shape: RoundedRectangleBorder( side: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor, width: 2.0), borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), - primary: Provider.of(context).theme.backgroundMainColor, ), onPressed: () { showAlertDialog(context); diff --git a/lib/views/addeditservers.dart b/lib/views/addeditservers.dart index cba4fffd..fa2ab930 100644 --- a/lib/views/addeditservers.dart +++ b/lib/views/addeditservers.dart @@ -1,11 +1,9 @@ -import 'dart:convert'; import 'package:cwtch/cwtch/cwtch.dart'; import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/servers.dart'; import 'package:cwtch/widgets/cwtchlabel.dart'; import 'package:cwtch/widgets/passwordfield.dart'; import 'package:cwtch/widgets/textfield.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/settings.dart'; import 'package:provider/provider.dart'; @@ -13,7 +11,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../errorHandler.dart'; import '../main.dart'; -import '../config.dart'; /// Pane to add or edit a server class AddEditServerView extends StatefulWidget { @@ -143,7 +140,7 @@ class _AddEditServerViewState extends State { onChanged: (bool value) { serverInfoState.setAutostart(value); - if (!serverInfoState.onion.isEmpty) { + if (serverInfoState.onion.isNotEmpty) { Provider.of(context, listen: false).cwtch.SetServerAttribute(serverInfoState.onion, "autostart", value ? "true" : "false"); } }, diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index 250eb502..eeb2e3ff 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -19,7 +19,6 @@ import 'package:provider/provider.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import '../config.dart'; import '../main.dart'; -import '../models/message.dart'; import '../models/redaction.dart'; import '../settings.dart'; import '../themes/opaque.dart'; @@ -43,12 +42,12 @@ class ContactsView extends StatefulWidget { // selectConversation can be called from anywhere to set the active conversation void selectConversation(BuildContext context, int handle, int? messageIndex) { - int? index = null; + int? index; if (messageIndex != null) { // this message is loaded Provider.of(context, listen: false).selectedSearchMessage = messageIndex; - Provider.of(context, listen: false).initialScrollIndex = messageIndex!; + Provider.of(context, listen: false).initialScrollIndex = messageIndex; EnvironmentConfig.debugLog("Looked up index $messageIndex"); } @@ -243,7 +242,7 @@ class _ContactsViewState extends State { color: Colors.white, ), Expanded( - child: Text(AppLocalizations.of(context)!.availabilityStatusAvailable!, + child: Text(AppLocalizations.of(context)!.availabilityStatusAvailable, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -256,7 +255,7 @@ class _ContactsViewState extends State { color: Colors.yellowAccent, ), Expanded( - child: Text(AppLocalizations.of(context)!.availabilityStatusAway!, + child: Text(AppLocalizations.of(context)!.availabilityStatusAway, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -269,7 +268,7 @@ class _ContactsViewState extends State { color: Colors.redAccent, ), Expanded( - child: Text(AppLocalizations.of(context)!.availabilityStatusBusy!, + child: Text(AppLocalizations.of(context)!.availabilityStatusBusy, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -280,7 +279,7 @@ class _ContactsViewState extends State { child: Row(children: [ Icon(CwtchIcons.disconnect_from_contact), Expanded( - child: Text(AppLocalizations.of(context)!.profileAppearOffline!, + child: Text(AppLocalizations.of(context)!.profileAppearOffline, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -290,7 +289,7 @@ class _ContactsViewState extends State { child: Row(children: [ Icon(CwtchIcons.disconnect_from_contact), Expanded( - child: Text(AppLocalizations.of(context)!.profileAppearOnline!, + child: Text(AppLocalizations.of(context)!.profileAppearOnline, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -303,7 +302,7 @@ class _ContactsViewState extends State { color: settings.theme.mainTextColor, ), Expanded( - child: Text((settings.blockUnknownConnections ? AppLocalizations.of(context)!.profileAllowUnknownContacts! : AppLocalizations.of(context)!.profileBlockUnknownContacts!), + child: Text((settings.blockUnknownConnections ? AppLocalizations.of(context)!.profileAllowUnknownContacts : AppLocalizations.of(context)!.profileBlockUnknownContacts), textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -313,7 +312,7 @@ class _ContactsViewState extends State { child: Row(children: [ Icon(CwtchIcons.favorite_24dp, color: settings.theme.mainTextColor), Expanded( - child: Text((enabled ? AppLocalizations.of(context)!.profileDisableProfile! : AppLocalizations.of(context)!.profileEnableProfile!), + child: Text((enabled ? AppLocalizations.of(context)!.profileDisableProfile : AppLocalizations.of(context)!.profileEnableProfile), textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), @@ -326,8 +325,7 @@ class _ContactsViewState extends State { color: settings.theme.mainTextColor, ), Expanded( - child: - Text(AppLocalizations.of(context)!.editProfile!, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) + child: Text(AppLocalizations.of(context)!.editProfile, textAlign: TextAlign.right, style: Provider.of(context, listen: false).scaleFonts(defaultTextButtonStyle))) ]), ), ], @@ -640,14 +638,14 @@ class _ContactsViewState extends State { }); } - void _showQRCode(String profile_code) { + void _showQRCode(String profileCode) { showModalBottomSheet( context: context, builder: (BuildContext context) { return Wrap(children: [ Center( child: QrImageView( - data: profile_code, + data: profileCode, version: QrVersions.auto, size: 400.0, backgroundColor: Provider.of(context).theme.backgroundPaneColor, diff --git a/lib/views/doublecolview.dart b/lib/views/doublecolview.dart index 3d9ae778..2b3d458a 100644 --- a/lib/views/doublecolview.dart +++ b/lib/views/doublecolview.dart @@ -4,7 +4,6 @@ import 'package:cwtch/models/profile.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../main.dart'; import '../settings.dart'; import 'contactsview.dart'; import 'messageview.dart'; diff --git a/lib/views/globalsettingsaboutview.dart b/lib/views/globalsettingsaboutview.dart index 08eee3f8..1240399e 100644 --- a/lib/views/globalsettingsaboutview.dart +++ b/lib/views/globalsettingsaboutview.dart @@ -10,7 +10,6 @@ import '../config.dart'; import '../cwtch_icons_icons.dart'; import '../main.dart'; import '../settings.dart'; -import '../themes/opaque.dart'; import 'globalsettingsview.dart'; class GlobalSettingsAboutView extends StatefulWidget { diff --git a/lib/views/globalsettingsappearanceview.dart b/lib/views/globalsettingsappearanceview.dart index 416d6bab..40d9470c 100644 --- a/lib/views/globalsettingsappearanceview.dart +++ b/lib/views/globalsettingsappearanceview.dart @@ -14,7 +14,6 @@ import '../settings.dart'; import '../themes/cwtch.dart'; import '../themes/opaque.dart'; import '../themes/yamltheme.dart'; -import '../widgets/folderpicker.dart'; import 'globalsettingsview.dart'; class GlobalSettingsAppearanceView extends StatefulWidget { diff --git a/lib/views/globalsettingsbehaviourview.dart b/lib/views/globalsettingsbehaviourview.dart index fc72e582..0a35c541 100644 --- a/lib/views/globalsettingsbehaviourview.dart +++ b/lib/views/globalsettingsbehaviourview.dart @@ -5,7 +5,6 @@ import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../config.dart'; import '../cwtch_icons_icons.dart'; import '../settings.dart'; import '../themes/opaque.dart'; diff --git a/lib/views/globalsettingsexperimentsview.dart b/lib/views/globalsettingsexperimentsview.dart index 9aa69275..bc064167 100644 --- a/lib/views/globalsettingsexperimentsview.dart +++ b/lib/views/globalsettingsexperimentsview.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../config.dart'; import '../cwtch_icons_icons.dart'; import '../main.dart'; import '../models/servers.dart'; diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index eaf78bb2..d16a906c 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -1,24 +1,15 @@ -import 'dart:collection'; import 'dart:convert'; -import 'dart:io'; import 'package:cwtch/cwtch_icons_icons.dart'; -import 'package:cwtch/models/servers.dart'; import 'package:cwtch/views/globalsettingsaboutview.dart'; import 'package:cwtch/views/globalsettingsappearanceview.dart'; import 'package:cwtch/views/globalsettingsbehaviourview.dart'; import 'package:cwtch/views/globalsettingsexperimentsview.dart'; -import 'package:cwtch/widgets/folderpicker.dart'; -import 'package:cwtch/themes/cwtch.dart'; -import 'package:cwtch/themes/opaque.dart'; -import 'package:flutter/services.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/settings.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../main.dart'; -import '../config.dart'; /// Global Settings View provides access to modify all the Globally Relevant Settings including Locale, Theme and Experiments. class GlobalSettingsView extends StatefulWidget { diff --git a/lib/views/groupsettingsview.dart b/lib/views/groupsettingsview.dart index 1334ee41..eec1c8ff 100644 --- a/lib/views/groupsettingsview.dart +++ b/lib/views/groupsettingsview.dart @@ -109,7 +109,9 @@ class _GroupSettingsViewState extends State { ), CwtchTextField( controller: TextEditingController(text: Provider.of(context, listen: false).server), - validator: (value) {}, + validator: (value) { + return null; + }, hintText: '', ) ]), diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 4de4508d..465dc671 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:math'; -import 'dart:ui'; import 'package:crypto/crypto.dart'; import 'package:cwtch/cwtch/cwtch.dart'; import 'package:cwtch/cwtch_icons_icons.dart'; diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 5920240c..ce9154c3 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; -import 'dart:ui'; import 'package:cwtch/config.dart'; import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/appstate.dart'; diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index 7adecc85..cc5b430e 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -16,7 +16,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:cwtch/widgets/profilerow.dart'; import 'package:provider/provider.dart'; -import '../config.dart'; import '../main.dart'; import '../torstatus.dart'; import 'addeditprofileview.dart'; @@ -178,7 +177,7 @@ class _ProfileMgrViewState extends State { ); } - void _pushAddProfile(bcontext, {onion: ""}) { + void _pushAddProfile(bcontext, {onion = ""}) { Navigator.popUntil(bcontext, (route) => route.isFirst); Navigator.of(context).push( @@ -246,11 +245,11 @@ class _ProfileMgrViewState extends State { child: ElevatedButton( style: ElevatedButton.styleFrom( minimumSize: Size(399, 20), + backgroundColor: Provider.of(context).theme.backgroundMainColor, maximumSize: Size(400, 20), shape: RoundedRectangleBorder( side: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor, width: 2.0), borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), - primary: Provider.of(context).theme.backgroundMainColor, ), child: Text(AppLocalizations.of(context)!.importProfile, semanticsLabel: AppLocalizations.of(context)!.importProfile, @@ -308,7 +307,9 @@ class _ProfileMgrViewState extends State { autofocus: true, controller: ctrlrPassword, action: unlock, - validator: (value) {}, + validator: (value) { + return null; + }, ), SizedBox( height: 20, diff --git a/lib/views/remoteserverview.dart b/lib/views/remoteserverview.dart index f4430c43..7844fe85 100644 --- a/lib/views/remoteserverview.dart +++ b/lib/views/remoteserverview.dart @@ -1,26 +1,15 @@ -import 'dart:convert'; -import 'package:cwtch/cwtch/cwtch.dart'; import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/contact.dart'; import 'package:cwtch/models/profile.dart'; -import 'package:cwtch/models/profileservers.dart'; import 'package:cwtch/models/remoteserver.dart'; -import 'package:cwtch/models/servers.dart'; import 'package:cwtch/widgets/buttontextfield.dart'; -import 'package:cwtch/widgets/contactrow.dart'; import 'package:cwtch/widgets/cwtchlabel.dart'; -import 'package:cwtch/widgets/passwordfield.dart'; -import 'package:cwtch/widgets/textfield.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/settings.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../errorHandler.dart'; import '../main.dart'; -import '../config.dart'; -import '../models/appstate.dart'; import '../themes/opaque.dart'; /// Pane to add or edit a server diff --git a/lib/views/serversview.dart b/lib/views/serversview.dart index d96d6603..e36dc193 100644 --- a/lib/views/serversview.dart +++ b/lib/views/serversview.dart @@ -3,8 +3,6 @@ import 'package:cwtch/views/addeditservers.dart'; import 'package:cwtch/widgets/passwordfield.dart'; import 'package:cwtch/widgets/serverrow.dart'; import 'package:flutter/material.dart'; -import 'package:cwtch/torstatus.dart'; -import 'package:cwtch/widgets/tor_icon.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -112,7 +110,9 @@ class _ServersView extends State { autofocus: true, controller: ctrlrPassword, action: unlock, - validator: (value) {}, + validator: (value) { + return null; + }, ), SizedBox( height: 20, diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index 23327ed5..1078bc8e 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -1,7 +1,6 @@ import 'package:cwtch/config.dart'; import 'package:cwtch/models/appstate.dart'; import 'package:cwtch/themes/opaque.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 1f4b85da..9d90782d 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -14,7 +14,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../main.dart'; import '../models/message.dart'; import '../settings.dart'; -import 'package:intl/intl.dart'; class ContactRow extends StatefulWidget { int? messageIndex; @@ -26,7 +25,7 @@ class ContactRow extends StatefulWidget { class _ContactRowState extends State { bool isHover = false; - Message? cachedMessage = null; + Message? cachedMessage; @override Widget build(BuildContext context) { diff --git a/lib/widgets/filebubble.dart b/lib/widgets/filebubble.dart index ef76dc19..0ec787ad 100644 --- a/lib/widgets/filebubble.dart +++ b/lib/widgets/filebubble.dart @@ -11,7 +11,6 @@ import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/widgets/malformedbubble.dart'; import 'package:cwtch/widgets/messageBubbleWidgetHelpers.dart'; import 'package:file_picker/file_picker.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../main.dart'; @@ -100,7 +99,7 @@ class FileBubbleState extends State { if (downloadComplete && path != null) { if (isImagePreview) { if (myFile == null || myFile?.path != path) { - myFile = new File(path!); + myFile = new File(path); // reset if (myFile?.existsSync() == false) { myFile = null; diff --git a/lib/widgets/folderpicker.dart b/lib/widgets/folderpicker.dart index 8f16c839..b1f357ad 100644 --- a/lib/widgets/folderpicker.dart +++ b/lib/widgets/folderpicker.dart @@ -6,7 +6,6 @@ import 'package:provider/provider.dart'; import '../settings.dart'; import 'buttontextfield.dart'; import 'package:path/path.dart' as path; -import 'cwtchlabel.dart'; class CwtchFolderPicker extends StatefulWidget { final String label; diff --git a/lib/widgets/invitationbubble.dart b/lib/widgets/invitationbubble.dart index 5af90875..7ed928b3 100644 --- a/lib/widgets/invitationbubble.dart +++ b/lib/widgets/invitationbubble.dart @@ -1,6 +1,3 @@ -import 'dart:convert'; -import 'dart:io'; - import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/contact.dart'; import 'package:cwtch/models/message.dart'; @@ -10,7 +7,6 @@ import 'package:cwtch/widgets/malformedbubble.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../main.dart'; -import 'package:intl/intl.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../models/redaction.dart'; diff --git a/lib/widgets/messagebubble.dart b/lib/widgets/messagebubble.dart index b8747371..f2095007 100644 --- a/lib/widgets/messagebubble.dart +++ b/lib/widgets/messagebubble.dart @@ -1,11 +1,6 @@ -import 'dart:io'; - -import 'package:cwtch/controllers/open_link_modal.dart'; import 'package:cwtch/models/contact.dart'; import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/redaction.dart'; -import 'package:cwtch/themes/opaque.dart'; -import 'package:cwtch/third_party/linkify/flutter_linkify.dart'; import 'package:cwtch/models/profile.dart'; import 'package:cwtch/widgets/malformedbubble.dart'; import 'package:flutter/material.dart'; diff --git a/lib/widgets/messagebubbledecorations.dart b/lib/widgets/messagebubbledecorations.dart index 104a41b0..97a34583 100644 --- a/lib/widgets/messagebubbledecorations.dart +++ b/lib/widgets/messagebubbledecorations.dart @@ -1,6 +1,3 @@ -import 'dart:io'; -import 'package:flutter/cupertino.dart'; -import 'package:intl/intl.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../models/redaction.dart'; diff --git a/lib/widgets/messagelist.dart b/lib/widgets/messagelist.dart index 1c2a987d..59596cfa 100644 --- a/lib/widgets/messagelist.dart +++ b/lib/widgets/messagelist.dart @@ -5,7 +5,6 @@ import 'package:cwtch/models/messagecache.dart'; import 'package:cwtch/models/profile.dart'; import 'package:cwtch/widgets/messageloadingbubble.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:provider/provider.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/widgets/messagerow.dart b/lib/widgets/messagerow.dart index 300a05d0..f64a3e1d 100644 --- a/lib/widgets/messagerow.dart +++ b/lib/widgets/messagerow.dart @@ -51,9 +51,7 @@ class MessageRowState extends State with SingleTickerProviderStateMi @override void dispose() { - if (_controller != null) { - _controller.dispose(); - } + _controller.dispose(); super.dispose(); } diff --git a/lib/widgets/profileimage.dart b/lib/widgets/profileimage.dart index bd729a31..07cfd479 100644 --- a/lib/widgets/profileimage.dart +++ b/lib/widgets/profileimage.dart @@ -20,7 +20,7 @@ class ProfileImage extends StatefulWidget { this.tooltip = "", this.disabled = false, this.badgeEdit = false, - this.badgeIcon = null}); + this.badgeIcon}); final double diameter; final String imagePath; final Color border; diff --git a/lib/widgets/profilerow.dart b/lib/widgets/profilerow.dart index 65fb34a1..bbe65359 100644 --- a/lib/widgets/profilerow.dart +++ b/lib/widgets/profilerow.dart @@ -1,9 +1,7 @@ import 'package:cwtch/models/appstate.dart'; import 'package:cwtch/models/contactlist.dart'; import 'package:cwtch/models/profile.dart'; -import 'package:cwtch/models/profilelist.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:cwtch/views/addeditprofileview.dart'; import 'package:cwtch/views/contactsview.dart'; import 'package:cwtch/views/doublecolview.dart'; @@ -11,7 +9,6 @@ import 'package:cwtch/widgets/profileimage.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import '../errorHandler.dart'; import '../main.dart'; import '../settings.dart'; @@ -116,7 +113,7 @@ class _ProfileRowState extends State { ); } - void _pushEditProfile({onion: "", displayName: "", profileImage: "", encrypted: true}) { + void _pushEditProfile({onion = "", displayName = "", profileImage = "", encrypted = true}) { Navigator.of(context).push( PageRouteBuilder( pageBuilder: (bcontext, a1, a2) { diff --git a/lib/widgets/quotedmessage.dart b/lib/widgets/quotedmessage.dart index 045a380d..3551a4c8 100644 --- a/lib/widgets/quotedmessage.dart +++ b/lib/widgets/quotedmessage.dart @@ -84,9 +84,7 @@ class QuotedMessageBubbleState extends State { var messageInfo = Provider.of(context, listen: false).messageCache.getByContentHash(qMessage.getMetadata().contenthash); if (messageInfo != null) { var index = Provider.of(context, listen: false).messageCache.findIndex(messageInfo.metadata.messageID); - if (index != null) { - Provider.of(context, listen: false).messageScrollController.scrollTo(index: index, duration: Duration(milliseconds: 100)); - } + Provider.of(context, listen: false).messageScrollController.scrollTo(index: index, duration: Duration(milliseconds: 100)); } }, child: Container( diff --git a/lib/widgets/remoteserverrow.dart b/lib/widgets/remoteserverrow.dart index 113ad060..859ec9cc 100644 --- a/lib/widgets/remoteserverrow.dart +++ b/lib/widgets/remoteserverrow.dart @@ -1,19 +1,12 @@ import 'package:cwtch/main.dart'; import 'package:cwtch/models/profile.dart'; -import 'package:cwtch/models/profileservers.dart'; import 'package:cwtch/models/remoteserver.dart'; -import 'package:cwtch/models/servers.dart'; import 'package:cwtch/themes/opaque.dart'; -import 'package:cwtch/views/addeditservers.dart'; import 'package:cwtch/views/remoteserverview.dart'; -import 'package:cwtch/widgets/profileimage.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../cwtch_icons_icons.dart'; -import '../errorHandler.dart'; import '../settings.dart'; class RemoteServerRow extends StatefulWidget { diff --git a/lib/widgets/staticmessagebubble.dart b/lib/widgets/staticmessagebubble.dart index 5bb22b92..7442125c 100644 --- a/lib/widgets/staticmessagebubble.dart +++ b/lib/widgets/staticmessagebubble.dart @@ -3,7 +3,6 @@ import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/profile.dart'; import 'package:cwtch/widgets/malformedbubble.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import '../models/redaction.dart'; import '../settings.dart'; diff --git a/lib/widgets/textfield.dart b/lib/widgets/textfield.dart index 38e194f2..92b2f78d 100644 --- a/lib/widgets/textfield.dart +++ b/lib/widgets/textfield.dart @@ -1,5 +1,4 @@ import 'package:cwtch/themes/opaque.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; diff --git a/test/buttontextfield_test.dart b/test/buttontextfield_test.dart index eb603162..af14aa48 100644 --- a/test/buttontextfield_test.dart +++ b/test/buttontextfield_test.dart @@ -5,7 +5,6 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:cwtch/themes/cwtch.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/settings.dart'; diff --git a/test/cwtchlabel_test.dart b/test/cwtchlabel_test.dart index 52eeebfb..5056f3cd 100644 --- a/test/cwtchlabel_test.dart +++ b/test/cwtchlabel_test.dart @@ -5,7 +5,6 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:cwtch/themes/cwtch.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/settings.dart'; diff --git a/test/profileimage_test.dart b/test/profileimage_test.dart index 93dcf068..d006f08d 100644 --- a/test/profileimage_test.dart +++ b/test/profileimage_test.dart @@ -5,7 +5,6 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:cwtch/themes/cwtch.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/settings.dart'; diff --git a/test/textfield_test.dart b/test/textfield_test.dart index 514b4bb3..3a35a512 100644 --- a/test/textfield_test.dart +++ b/test/textfield_test.dart @@ -7,7 +7,6 @@ import 'package:flutter/material.dart'; import 'package:cwtch/themes/opaque.dart'; -import 'package:cwtch/themes/cwtch.dart'; import 'package:cwtch/settings.dart'; import 'package:cwtch/widgets/textfield.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -27,7 +26,9 @@ void main() { tester.binding.window.physicalSizeTestValue = Size(800, 300); final TextEditingController ctrlr1 = TextEditingController(); - Widget testWidget = CwtchTextField(controller: ctrlr1, validator: (value) { }, hintText: '',); + Widget testWidget = CwtchTextField(controller: ctrlr1, validator: (value) { + return null; + }, hintText: '',); Widget testHarness = MultiProvider( providers:[getSettingsEnglishDark()],