make linter happier

This commit is contained in:
Evgeny Poberezkin
2021-10-08 09:37:26 +01:00
parent 4d3b33d877
commit 17b4b62133
18 changed files with 260 additions and 100 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ stack.yaml.lock
.packages
.pub-cache/
.pub/
/build/
build/
# Web
lib/generated_plugin_registrant.dart
+1 -1
View File
@@ -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
+91
View File
@@ -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
@@ -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 = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
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 = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
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 = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
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 = "<group>";
};
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 = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -72,6 +97,8 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
5A0F33679D6B606E9775E794 /* Pods */,
415DD71D33C5D1C1BBA9E62B /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -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 */
@@ -4,4 +4,7 @@
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
@@ -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<Animator>
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<Animator>
}
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) {
+5 -7
View File
@@ -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';
}
+8 -8
View File
@@ -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: <String, WidgetBuilder>{
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(),
},
);
}
@@ -47,7 +47,7 @@ class _AddContactViewState extends State<AddContactView> {
? 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<AddContactView> {
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<AddContactView> {
return QRView(
key: qrKey,
onQRViewCreated: (QRViewController controller) {
this._qrViewController = controller;
_qrViewController = controller;
controller.scannedDataStream.listen((scanData) {
setState(() async {
result = scanData;
@@ -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,
),
@@ -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<AddGroupView> {
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<AddGroupView> {
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<AddGroupView> {
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<GroupDP> {
// 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<GroupDP> {
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<GroupDP> {
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<GroupDP> {
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<GroupDP> {
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<GroupDP> {
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<GroupDP> {
Navigator.pop(context);
} catch (e) {
throw e;
rethrow;
}
}
@@ -279,7 +279,7 @@ class _GroupDPState extends State<GroupDP> {
Navigator.pop(context);
} catch (e) {
throw e;
rethrow;
}
}
}
@@ -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'),
@@ -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<HomeView> 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<HomeView> 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<HomeView> 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,
@@ -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<HomeViewWidget> {
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<HomeViewWidget> {
_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<HomeViewWidget> {
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<HomeViewWidget> {
),
)
.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<HomeViewWidget> {
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<HomeViewWidget> {
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),
),
)
],
@@ -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,
),
@@ -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<SetupProfileView> {
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<SetupProfileView> {
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<SetupProfileView> {
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<UserProfilePic> {
// 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<UserProfilePic> {
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<UserProfilePic> {
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<UserProfilePic> {
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<UserProfilePic> {
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<UserProfilePic> {
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<UserProfilePic> {
Navigator.pop(context);
} catch (e) {
throw e;
rethrow;
}
}
@@ -288,7 +288,7 @@ class _UserProfilePicState extends State<UserProfilePic> {
Navigator.pop(context);
} catch (e) {
throw e;
rethrow;
}
}
}
@@ -44,7 +44,7 @@ class CustomTextField extends StatefulWidget {
}
class _CustomTextFieldState extends State<CustomTextField> {
FocusNode _node = FocusNode();
final FocusNode _node = FocusNode();
@override
void dispose() {
@@ -72,15 +72,15 @@ class _CustomTextFieldState extends State<CustomTextField> {
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),
),
),