From 17b4b62133cb92ac8cd5d211859df808c42d308f Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Fri, 8 Oct 2021 09:37:26 +0100 Subject: [PATCH] make linter happier --- .gitignore | 2 +- packages/simplex_app/analysis_options.yaml | 2 +- packages/simplex_app/ios/Podfile.lock | 91 +++++++++++++++++++ .../ios/Runner.xcodeproj/project.pbxproj | 68 ++++++++++++++ .../contents.xcworkspacedata | 3 + ...omAnimation.dart => bottom_animation.dart} | 16 ++-- packages/simplex_app/lib/app_routes.dart | 12 +-- packages/simplex_app/lib/main.dart | 16 ++-- .../lib/views/contacts/add_contact_view.dart | 6 +- .../views/contacts/qr_code_details_view.dart | 4 +- .../lib/views/group/add_group_view.dart | 32 +++---- .../simplex_app/lib/views/home/drawer.dart | 2 +- .../simplex_app/lib/views/home/home_view.dart | 8 +- .../lib/views/home/home_view_widget.dart | 46 +++++----- .../scan_invitation_view.dart | 14 +-- .../lib/views/setup_profile_view.dart | 28 +++--- .../{customBtn.dart => custom_btn.dart} | 0 ...mTextField.dart => custom_text_field.dart} | 10 +- 18 files changed, 260 insertions(+), 100 deletions(-) create mode 100644 packages/simplex_app/ios/Podfile.lock rename packages/simplex_app/lib/animations/{bottomAnimation.dart => bottom_animation.dart} (79%) rename packages/simplex_app/lib/views/{scanInvitation => scan_invitation}/scan_invitation_view.dart (92%) rename packages/simplex_app/lib/widgets/{customBtn.dart => custom_btn.dart} (100%) rename packages/simplex_app/lib/widgets/{customTextField.dart => custom_text_field.dart} (90%) diff --git a/.gitignore b/.gitignore index c75fab8dab..4a7f7174fa 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,7 @@ stack.yaml.lock .packages .pub-cache/ .pub/ -/build/ +build/ # Web lib/generated_plugin_registrant.dart diff --git a/packages/simplex_app/analysis_options.yaml b/packages/simplex_app/analysis_options.yaml index 7904c81040..a58a840c25 100644 --- a/packages/simplex_app/analysis_options.yaml +++ b/packages/simplex_app/analysis_options.yaml @@ -4,7 +4,7 @@ include: package:flutter_lints/flutter.yaml linter: # https://dart-lang.github.io/linter/lints/index.html. rules: - prefer_double_quotes: true + prefer_single_quotes: true always_declare_return_types: true avoid_dynamic_calls: true avoid_empty_else: true diff --git a/packages/simplex_app/ios/Podfile.lock b/packages/simplex_app/ios/Podfile.lock new file mode 100644 index 0000000000..d7bd220f09 --- /dev/null +++ b/packages/simplex_app/ios/Podfile.lock @@ -0,0 +1,91 @@ +PODS: + - DKImagePickerController/Core (4.3.2): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.2) + - DKImagePickerController/PhotoGallery (4.3.2): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.2) + - DKPhotoGallery (0.0.17): + - DKPhotoGallery/Core (= 0.0.17) + - DKPhotoGallery/Model (= 0.0.17) + - DKPhotoGallery/Preview (= 0.0.17) + - DKPhotoGallery/Resource (= 0.0.17) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.17): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.17): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Flutter (1.0.0) + - image_picker (0.0.1): + - Flutter + - MTBBarcodeScanner (5.0.11) + - qr_code_scanner (0.2.0): + - Flutter + - MTBBarcodeScanner + - SDWebImage (5.12.0): + - SDWebImage/Core (= 5.12.0) + - SDWebImage/Core (5.12.0) + - share (0.0.1): + - Flutter + - SwiftyGif (5.4.0) + +DEPENDENCIES: + - file_picker (from `.symlinks/plugins/file_picker/ios`) + - Flutter (from `Flutter`) + - image_picker (from `.symlinks/plugins/image_picker/ios`) + - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - share (from `.symlinks/plugins/share/ios`) + +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - MTBBarcodeScanner + - SDWebImage + - SwiftyGif + +EXTERNAL SOURCES: + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + Flutter: + :path: Flutter + image_picker: + :path: ".symlinks/plugins/image_picker/ios" + qr_code_scanner: + :path: ".symlinks/plugins/qr_code_scanner/ios" + share: + :path: ".symlinks/plugins/share/ios" + +SPEC CHECKSUMS: + DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + image_picker: 50e7c7ff960e5f58faa4d1f4af84a771c671bc4a + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + SDWebImage: 4ea20cca2986adc5aacde07aa686742fd4c67a37 + share: 0b2c3e82132f5888bccca3351c504d0003b3b410 + SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.11.0 diff --git a/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj b/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj index f3fbcb8a28..4708178eb3 100644 --- a/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/simplex_app/ios/Runner.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + AE3860269BF424274DA84C73 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B0B8C697FBAC21A75BCBB5A /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -29,12 +30,16 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 031FDA72D548A2F92732ADA4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2FD15BE67425B26EB06BB4AE /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4B0B8C697FBAC21A75BCBB5A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7E09253D517C54DFA8ECEE7A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -49,12 +54,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + AE3860269BF424274DA84C73 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 415DD71D33C5D1C1BBA9E62B /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4B0B8C697FBAC21A75BCBB5A /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5A0F33679D6B606E9775E794 /* Pods */ = { + isa = PBXGroup; + children = ( + 7E09253D517C54DFA8ECEE7A /* Pods-Runner.debug.xcconfig */, + 2FD15BE67425B26EB06BB4AE /* Pods-Runner.release.xcconfig */, + 031FDA72D548A2F92732ADA4 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +97,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 5A0F33679D6B606E9775E794 /* Pods */, + 415DD71D33C5D1C1BBA9E62B /* Frameworks */, ); sourceTree = ""; }; @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + AA6465993557C0297F2D0450 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + B4CC1E87FA75B139B238C706 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -197,6 +226,45 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + AA6465993557C0297F2D0450 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + B4CC1E87FA75B139B238C706 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/packages/simplex_app/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/simplex_app/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed..21a3cc14c7 100644 --- a/packages/simplex_app/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/packages/simplex_app/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/packages/simplex_app/lib/animations/bottomAnimation.dart b/packages/simplex_app/lib/animations/bottom_animation.dart similarity index 79% rename from packages/simplex_app/lib/animations/bottomAnimation.dart rename to packages/simplex_app/lib/animations/bottom_animation.dart index 244214bb0e..6c1f28e361 100644 --- a/packages/simplex_app/lib/animations/bottomAnimation.dart +++ b/packages/simplex_app/lib/animations/bottom_animation.dart @@ -6,7 +6,7 @@ class Animator extends StatefulWidget { final Widget child; final Duration time; - Animator(this.child, this.time); + const Animator(this.child, this.time); @override _AnimatorState createState() => _AnimatorState(); @@ -22,7 +22,7 @@ class _AnimatorState extends State void initState() { super.initState(); animationController = - AnimationController(duration: Duration(milliseconds: 290), vsync: this); + AnimationController(duration: const Duration(milliseconds: 290), vsync: this); animation = CurvedAnimation(parent: animationController!, curve: Curves.easeInOut); timer = Timer(widget.time, animationController!.forward); @@ -54,22 +54,22 @@ class _AnimatorState extends State } Timer? timer; -Duration duration = Duration(); +Duration duration = const Duration(); -wait() { +Duration wait() { if (timer == null || !timer!.isActive) { - timer = Timer(Duration(microseconds: 120), () { - duration = Duration(); + timer = Timer(const Duration(microseconds: 120), () { + duration = const Duration(); }); } - duration += Duration(milliseconds: 100); + duration += const Duration(milliseconds: 100); return duration; } class WidgetAnimator extends StatelessWidget { final Widget? child; - WidgetAnimator({this.child}); + const WidgetAnimator({this.child}); @override Widget build(BuildContext context) { diff --git a/packages/simplex_app/lib/app_routes.dart b/packages/simplex_app/lib/app_routes.dart index ef8c78c3b5..5e52fa3f79 100644 --- a/packages/simplex_app/lib/app_routes.dart +++ b/packages/simplex_app/lib/app_routes.dart @@ -1,9 +1,7 @@ -import 'package:simplex_chat/views/scanInvitation/scan_invitation_view.dart'; - class AppRoutes { - static final intro = '/intro'; - static final setupProfile = '/setupProfile'; - static final addContact = '/addContact'; - static final scanInvitation = '/ScanInvitation'; - static final addGroup = '/addGroup'; + static const intro = '/intro'; + static const setupProfile = '/setupProfile'; + static const addContact = '/addContact'; + static const scanInvitation = '/ScanInvitation'; + static const addGroup = '/addGroup'; } diff --git a/packages/simplex_app/lib/main.dart b/packages/simplex_app/lib/main.dart index a6449903ec..ea1144a8a5 100644 --- a/packages/simplex_app/lib/main.dart +++ b/packages/simplex_app/lib/main.dart @@ -4,8 +4,8 @@ import 'package:simplex_chat/constants.dart'; import 'package:simplex_chat/custom_scroll_behavior.dart'; import 'package:simplex_chat/views/contacts/add_contact_view.dart'; import 'package:simplex_chat/views/group/add_group_view.dart'; -import 'package:simplex_chat/views/onBoarding/intro_view.dart'; -import 'package:simplex_chat/views/scanInvitation/scan_invitation_view.dart'; +import 'package:simplex_chat/views/onboarding/intro_view.dart'; +import 'package:simplex_chat/views/scan_invitation/scan_invitation_view.dart'; import 'package:simplex_chat/views/setup_profile_view.dart'; void main() { @@ -28,17 +28,17 @@ class MyApp extends StatelessWidget { ), builder: (context, widget) { return ScrollConfiguration( - behavior: ScrollBehaviorModified(), + behavior: const ScrollBehaviorModified(), child: widget!, ); }, initialRoute: AppRoutes.intro, routes: { - AppRoutes.intro: (_) => IntroView(), - AppRoutes.setupProfile: (_) => SetupProfileView(), - AppRoutes.addContact: (_) => AddContactView(), - AppRoutes.scanInvitation: (_) => ScanInvitationView(), - AppRoutes.addGroup: (_) => AddGroupView(), + AppRoutes.intro: (_) => const IntroView(), + AppRoutes.setupProfile: (_) => const SetupProfileView(), + AppRoutes.addContact: (_) => const AddContactView(), + AppRoutes.scanInvitation: (_) => const ScanInvitationView(), + AppRoutes.addGroup: (_) => const AddGroupView(), }, ); } diff --git a/packages/simplex_app/lib/views/contacts/add_contact_view.dart b/packages/simplex_app/lib/views/contacts/add_contact_view.dart index 9d17eaf1c0..6c2eb9a488 100644 --- a/packages/simplex_app/lib/views/contacts/add_contact_view.dart +++ b/packages/simplex_app/lib/views/contacts/add_contact_view.dart @@ -47,7 +47,7 @@ class _AddContactViewState extends State { ? Icons.flash_on : Icons.flash_off); } - return Icon(Icons.flash_off); + return const Icon(Icons.flash_off); }, ), onPressed: () async { @@ -59,7 +59,7 @@ class _AddContactViewState extends State { icon: FutureBuilder( future: _qrViewController?.getCameraInfo(), builder: (context, snapshot) { - return Icon(Icons.camera_alt); + return const Icon(Icons.camera_alt); }, ), onPressed: () async { @@ -103,7 +103,7 @@ class _AddContactViewState extends State { return QRView( key: qrKey, onQRViewCreated: (QRViewController controller) { - this._qrViewController = controller; + _qrViewController = controller; controller.scannedDataStream.listen((scanData) { setState(() async { result = scanData; diff --git a/packages/simplex_app/lib/views/contacts/qr_code_details_view.dart b/packages/simplex_app/lib/views/contacts/qr_code_details_view.dart index 6bcaa6ac27..fe8a6aad5e 100644 --- a/packages/simplex_app/lib/views/contacts/qr_code_details_view.dart +++ b/packages/simplex_app/lib/views/contacts/qr_code_details_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; import 'package:simplex_chat/constants.dart'; -import 'package:simplex_chat/widgets/customBtn.dart'; +import 'package:simplex_chat/widgets/custom_btn.dart'; class QRCodeDetailsView extends StatelessWidget { final Barcode? barcode; @@ -20,7 +20,7 @@ class QRCodeDetailsView extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - CircleAvatar( + const CircleAvatar( backgroundImage: AssetImage('assets/dp.png'), radius: 90, ), diff --git a/packages/simplex_app/lib/views/group/add_group_view.dart b/packages/simplex_app/lib/views/group/add_group_view.dart index 91adf3c897..f85881747d 100644 --- a/packages/simplex_app/lib/views/group/add_group_view.dart +++ b/packages/simplex_app/lib/views/group/add_group_view.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'package:simplex_chat/constants.dart'; -import 'package:simplex_chat/widgets/customTextField.dart'; +import 'package:simplex_chat/widgets/custom_text_field.dart'; class AddGroupView extends StatefulWidget { const AddGroupView({Key? key}) : super(key: key); @@ -35,7 +35,7 @@ class _AddGroupViewState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const SizedBox(height: 10.0), - Center( + const Center( child: GroupDP(), ), const SizedBox(height: 25.0), @@ -47,7 +47,7 @@ class _AddGroupViewState extends State { hintText: 'e.g College friends', validatorFtn: (value) { if (value!.isEmpty) { - return "Group name cannot be empty!"; + return 'Group name cannot be empty!'; } return null; }, @@ -59,12 +59,12 @@ class _AddGroupViewState extends State { onTap: () {}, ), const Divider(height: 30.0), - ListTile( + const ListTile( leading: CircleAvatar( backgroundImage: AssetImage('assets/dp.png'), ), - title: const Text('You'), - trailing: const Text( + title: Text('You'), + trailing: Text( 'Owner', style: TextStyle(color: Colors.grey, fontSize: 12.0), )), @@ -98,12 +98,12 @@ class _GroupDPState extends State { // Image Picker --> DP properties final imgPicker = ImagePicker(); File? image; - String photoUrl = ""; + String photoUrl = ''; bool _uploading = false; bool _imageUploaded = false; // image buttons options - final _dpBtnText = ["Remove", "Gallery", "Camera"]; + final _dpBtnText = ['Remove', 'Gallery', 'Camera']; final _dpBtnColors = [Colors.red, Colors.purple, Colors.green]; final _dpBtnIcons = [ Icons.delete, @@ -123,7 +123,7 @@ class _GroupDPState extends State { radius: 100.0, backgroundImage: FileImage(image!), ) - : CircleAvatar( + : const CircleAvatar( radius: 100.0, backgroundImage: AssetImage('assets/dp.png'), ), @@ -136,7 +136,7 @@ class _GroupDPState extends State { mini: true, onPressed: _updateProfilePic, child: _uploading - ? SizedBox( + ? const SizedBox( height: 18.0, width: 18.0, child: CircularProgressIndicator( @@ -157,7 +157,7 @@ class _GroupDPState extends State { void _updateProfilePic() { showModalBottomSheet( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0), @@ -177,10 +177,10 @@ class _GroupDPState extends State { width: 50.0, ), const SizedBox(height: 20.0), - Align( + const Align( alignment: Alignment.centerLeft, child: Text( - " Profile photo", + ' Profile photo', style: kHeadingStyle, ), ), @@ -193,7 +193,7 @@ class _GroupDPState extends State { children: [ MaterialButton( color: _dpBtnColors.map((e) => e).elementAt(index), - shape: CircleBorder(), + shape: const CircleBorder(), onPressed: index == 0 ? () => _removePic() : index == 1 @@ -250,7 +250,7 @@ class _GroupDPState extends State { Navigator.pop(context); } catch (e) { - throw e; + rethrow; } } @@ -279,7 +279,7 @@ class _GroupDPState extends State { Navigator.pop(context); } catch (e) { - throw e; + rethrow; } } } diff --git a/packages/simplex_app/lib/views/home/drawer.dart b/packages/simplex_app/lib/views/home/drawer.dart index 79b8199e19..aacd6efaa7 100644 --- a/packages/simplex_app/lib/views/home/drawer.dart +++ b/packages/simplex_app/lib/views/home/drawer.dart @@ -38,7 +38,7 @@ class MyDrawer extends StatelessWidget { subtitle: const Text('Get in touch with numbers!'), onTap: () {}, ), - Spacer(), + const Spacer(), ListTile( leading: const Icon(Icons.exit_to_app_rounded), title: const Text('Logout'), diff --git a/packages/simplex_app/lib/views/home/home_view.dart b/packages/simplex_app/lib/views/home/home_view.dart index 9bb71c3286..62035d4035 100644 --- a/packages/simplex_app/lib/views/home/home_view.dart +++ b/packages/simplex_app/lib/views/home/home_view.dart @@ -1,6 +1,6 @@ +import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'dart:math' as math; import 'package:simplex_chat/views/home/drawer.dart'; import 'package:simplex_chat/views/home/home_view_widget.dart'; @@ -28,7 +28,7 @@ class _HomeViewState extends State with TickerProviderStateMixin { void initState() { super.initState(); animationController = - AnimationController(vsync: this, duration: Duration(milliseconds: 250)); + AnimationController(vsync: this, duration: const Duration(milliseconds: 250)); } @override @@ -55,7 +55,7 @@ class _HomeViewState extends State with TickerProviderStateMixin { ..rotateY( math.pi / 2 * (1 - animationController!.value)), alignment: Alignment.centerRight, - child: MyDrawer(), + child: const MyDrawer(), ), ), Transform.translate( @@ -66,7 +66,7 @@ class _HomeViewState extends State with TickerProviderStateMixin { ..setEntry(3, 2, 0.001) ..rotateY(-math.pi / 2 * animationController!.value), alignment: Alignment.centerLeft, - child: HomeViewWidget()), + child: const HomeViewWidget()), ), Positioned( top: MediaQuery.of(context).padding.top, diff --git a/packages/simplex_app/lib/views/home/home_view_widget.dart b/packages/simplex_app/lib/views/home/home_view_widget.dart index e3822c7be7..99cdab1a7e 100644 --- a/packages/simplex_app/lib/views/home/home_view_widget.dart +++ b/packages/simplex_app/lib/views/home/home_view_widget.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:simplex_chat/animations/bottomAnimation.dart'; +import 'package:simplex_chat/animations/bottom_animation.dart'; import 'package:simplex_chat/app_routes.dart'; import 'package:simplex_chat/constants.dart'; class HomeViewWidget extends StatefulWidget { - HomeViewWidget({Key? key}) : super(key: key); + const HomeViewWidget({Key? key}) : super(key: key); @override _HomeViewWidgetState createState() => _HomeViewWidgetState(); @@ -68,15 +68,15 @@ class _HomeViewWidgetState extends State { child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( + children: const [ + Text( "You don't have any conversation yet!", style: kMediumHeadingStyle, textAlign: TextAlign.center, ), - const SizedBox(height: 8.0), - const Text( - "Click the icon below to add a contact", + SizedBox(height: 8.0), + Text( + 'Click the icon below to add a contact', textAlign: TextAlign.center, ), ], @@ -89,7 +89,7 @@ class _HomeViewWidgetState extends State { _userNames.length, (index) => WidgetAnimator( child: ListTile( - leading: CircleAvatar( + leading: const CircleAvatar( backgroundImage: AssetImage('assets/dp.png'), ), title: Text(_userNames[index]), @@ -114,7 +114,7 @@ class _HomeViewWidgetState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), ), - offset: Offset(-10, -180), + offset: const Offset(-10, -180), onSelected: (value) { if (value == _options[0]) { Navigator.pushNamed(context, AppRoutes.addContact); @@ -132,10 +132,10 @@ class _HomeViewWidgetState extends State { ), ) .toList(), - child: FloatingActionButton( + child: const FloatingActionButton( heroTag: 'connect', onPressed: null, - child: const Icon( + child: Icon( Icons.person_add, ), ), @@ -200,16 +200,16 @@ class _HomeViewWidgetState extends State { actions: [ InkWell( onTap: () => Navigator.pop(context), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: const Icon(Icons.check, color: Colors.green), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.check, color: Colors.green), ), ), InkWell( onTap: () => Navigator.pop(context), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: const Icon(Icons.cancel_outlined, color: Colors.red), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.cancel_outlined, color: Colors.red), ), ) ], @@ -247,16 +247,16 @@ class _HomeViewWidgetState extends State { actions: [ InkWell( onTap: () => Navigator.pop(context), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: const Icon(Icons.check, color: Colors.green), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.check, color: Colors.green), ), ), InkWell( onTap: () => Navigator.pop(context), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: const Icon(Icons.cancel_outlined, color: Colors.red), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.cancel_outlined, color: Colors.red), ), ) ], diff --git a/packages/simplex_app/lib/views/scanInvitation/scan_invitation_view.dart b/packages/simplex_app/lib/views/scan_invitation/scan_invitation_view.dart similarity index 92% rename from packages/simplex_app/lib/views/scanInvitation/scan_invitation_view.dart rename to packages/simplex_app/lib/views/scan_invitation/scan_invitation_view.dart index 1b494e19c2..265ef8691e 100644 --- a/packages/simplex_app/lib/views/scanInvitation/scan_invitation_view.dart +++ b/packages/simplex_app/lib/views/scan_invitation/scan_invitation_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:simplex_chat/constants.dart'; -import 'package:simplex_chat/widgets/customBtn.dart'; import 'package:share/share.dart'; +import 'package:simplex_chat/constants.dart'; +import 'package:simplex_chat/widgets/custom_btn.dart'; class ScanInvitationView extends StatelessWidget { const ScanInvitationView({Key? key}) : super(key: key); @@ -45,10 +45,10 @@ class ScanInvitationView extends StatelessWidget { color: kPrimaryColor, child: Row( mainAxisSize: MainAxisSize.min, - children: [ - const Icon(Icons.share, color: Colors.white), - const SizedBox(width: 8.0), - const Text( + children: const [ + Icon(Icons.share, color: Colors.white), + SizedBox(width: 8.0), + Text( 'Share', style: TextStyle(color: Colors.white), ), @@ -69,7 +69,7 @@ class ScanInvitationView extends StatelessWidget { content: Column( mainAxisSize: MainAxisSize.min, children: [ - CircleAvatar( + const CircleAvatar( backgroundImage: AssetImage('assets/dp.png'), radius: 70, ), diff --git a/packages/simplex_app/lib/views/setup_profile_view.dart b/packages/simplex_app/lib/views/setup_profile_view.dart index f27de68025..7e52382e2b 100644 --- a/packages/simplex_app/lib/views/setup_profile_view.dart +++ b/packages/simplex_app/lib/views/setup_profile_view.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'package:simplex_chat/constants.dart'; import 'package:simplex_chat/views/home/home_view.dart'; -import 'package:simplex_chat/widgets/customTextField.dart'; +import 'package:simplex_chat/widgets/custom_text_field.dart'; class SetupProfileView extends StatefulWidget { const SetupProfileView({Key? key}) : super(key: key); @@ -46,7 +46,7 @@ class _SetupProfileViewState extends State { onPressed: () => Navigator.pop(context), ), ), - Center(child: UserProfilePic()), + const Center(child: UserProfilePic()), const SizedBox(height: 25.0), const Text('Display Name', style: kSmallHeadingStyle), const SizedBox(height: 10.0), @@ -56,7 +56,7 @@ class _SetupProfileViewState extends State { hintText: 'e.g John', validatorFtn: (value) { if (value!.isEmpty) { - return "Display name cannot be empty!"; + return 'Display name cannot be empty!'; } return null; }, @@ -70,7 +70,7 @@ class _SetupProfileViewState extends State { hintText: 'e.g John Doe', validatorFtn: (value) { if (value!.isEmpty) { - return "Full name cannot be empty!"; + return 'Full name cannot be empty!'; } return null; }, @@ -122,12 +122,12 @@ class _UserProfilePicState extends State { // Image Picker --> DP properties final imgPicker = ImagePicker(); File? image; - String photoUrl = ""; + String photoUrl = ''; bool _uploading = false; bool _imageUploaded = false; // image buttons options - final _dpBtnText = ["Gallery", "Camera"]; + final _dpBtnText = ['Gallery', 'Camera']; final _dpBtnColors = [Colors.purple, Colors.green]; final _dpBtnIcons = [Icons.photo_rounded, Icons.camera_alt_rounded]; @@ -143,7 +143,7 @@ class _UserProfilePicState extends State { radius: 100.0, backgroundImage: FileImage(image!), ) - : CircleAvatar( + : const CircleAvatar( radius: 100.0, backgroundImage: AssetImage('assets/dp.png'), ), @@ -156,7 +156,7 @@ class _UserProfilePicState extends State { mini: true, onPressed: _updateProfilePic, child: _uploading - ? SizedBox( + ? const SizedBox( height: 18.0, width: 18.0, child: CircularProgressIndicator( @@ -177,7 +177,7 @@ class _UserProfilePicState extends State { void _updateProfilePic() { showModalBottomSheet( - shape: RoundedRectangleBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0), @@ -197,10 +197,10 @@ class _UserProfilePicState extends State { width: 50.0, ), const SizedBox(height: 20.0), - Align( + const Align( alignment: Alignment.centerLeft, child: Text( - " Profile photo", + ' Profile photo', style: kHeadingStyle, ), ), @@ -213,7 +213,7 @@ class _UserProfilePicState extends State { children: [ MaterialButton( color: _dpBtnColors.map((e) => e).elementAt(index), - shape: CircleBorder(), + shape: const CircleBorder(), onPressed: index == 0 ? () => _galleryPic() : () => _cameraPic(), child: Icon( @@ -259,7 +259,7 @@ class _UserProfilePicState extends State { Navigator.pop(context); } catch (e) { - throw e; + rethrow; } } @@ -288,7 +288,7 @@ class _UserProfilePicState extends State { Navigator.pop(context); } catch (e) { - throw e; + rethrow; } } } diff --git a/packages/simplex_app/lib/widgets/customBtn.dart b/packages/simplex_app/lib/widgets/custom_btn.dart similarity index 100% rename from packages/simplex_app/lib/widgets/customBtn.dart rename to packages/simplex_app/lib/widgets/custom_btn.dart diff --git a/packages/simplex_app/lib/widgets/customTextField.dart b/packages/simplex_app/lib/widgets/custom_text_field.dart similarity index 90% rename from packages/simplex_app/lib/widgets/customTextField.dart rename to packages/simplex_app/lib/widgets/custom_text_field.dart index b51d66a32f..9164056f98 100644 --- a/packages/simplex_app/lib/widgets/customTextField.dart +++ b/packages/simplex_app/lib/widgets/custom_text_field.dart @@ -44,7 +44,7 @@ class CustomTextField extends StatefulWidget { } class _CustomTextFieldState extends State { - FocusNode _node = FocusNode(); + final FocusNode _node = FocusNode(); @override void dispose() { @@ -72,15 +72,15 @@ class _CustomTextFieldState extends State { hintStyle: Theme.of(context).textTheme.caption, fillColor: Colors.grey[200], filled: true, - enabledBorder: OutlineInputBorder( + enabledBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.transparent)), - focusedBorder: OutlineInputBorder( + focusedBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.transparent), ), - errorBorder: OutlineInputBorder( + errorBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.red), ), - focusedErrorBorder: OutlineInputBorder( + focusedErrorBorder: const OutlineInputBorder( borderSide: BorderSide(color: Colors.red), ), ),