Skip to content

Commit 1f718b6

Browse files
committed
Code updates
1 parent a640615 commit 1f718b6

10 files changed

+75
-151
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package="com.example.image_cropper_demo_app">
33
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
44
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
5-
z <uses-permission android:name="android.permission.INTERNET"/>
5+
<uses-permission android:name="android.permission.INTERNET"/>
66
<application
77
android:label="image_cropper_demo_app"
88
android:name="${applicationName}"
@@ -28,6 +28,10 @@
2828
<category android:name="android.intent.category.LAUNCHER"/>
2929
</intent-filter>
3030
</activity>
31+
<activity
32+
android:name="com.yalantis.ucrop.UCropActivity"
33+
android:screenOrientation="portrait"
34+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
3135
<!-- Don't delete the meta-data below.
3236
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
3337
<meta-data

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

lib/constants/string_constants.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ class StringConstants {
66
static const String email = "Email";
77

88
static const String login = "Login";
9+
static const String dashboard = "Dashboard";
10+
static const String defaultLabel = "Default";
11+
static const String emailNotFound = "Email not found";
12+
static const String settings = "Settings";
13+
static const String profile = "Profile";
14+
static const String changePassword = "Change Password";
15+
static const String gallery = "Gallery";
916
static const String signup = "Sign Up";
1017
static const String signin = "Sign In";
1118
static const String poweredBy = "Powered by :";
@@ -21,6 +28,7 @@ class StringConstants {
2128
static const String fullname = "Full Name";
2229
static const String create_password = "Create Password";
2330
static const String gender_signup = " Gender: ";
31+
static const String logOut = "Log Out";
2432

2533
static const String already_have_account = "Already have an account?";
2634

lib/main.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:image_cropper_demo_app/screens/loginPage.dart';
32
import 'package:image_cropper_demo_app/screens/splash_screen.dart';
43

54
void main() {
@@ -13,7 +12,7 @@ class MyApp extends StatelessWidget {
1312
@override
1413
Widget build(BuildContext context) {
1514
return MaterialApp(
16-
title: 'Flutter Demo',
15+
title: 'Flutter Image Cropper Demo',
1716
debugShowCheckedModeBanner: false,
1817
theme: ThemeData(
1918
primarySwatch: Colors.blue,
@@ -22,12 +21,3 @@ class MyApp extends StatelessWidget {
2221
);
2322
}
2423
}
25-
26-
class MyHomePage extends StatelessWidget {
27-
const MyHomePage({super.key});
28-
29-
@override
30-
Widget build(BuildContext context) {
31-
return Container();
32-
}
33-
}

lib/screens/dashboardPage.dart

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import 'dart:io';
33

44
import 'package:flutter/material.dart';
55
import 'package:image_cropper/image_cropper.dart';
6-
import 'package:image_cropper_demo_app/screens/galleryPage.dart';
6+
import 'package:image_cropper_demo_app/constants/image_constants.dart';
7+
import 'package:image_cropper_demo_app/constants/string_constants.dart';
78
import 'package:image_cropper_demo_app/screens/loginPage.dart';
89
import 'package:image_cropper_demo_app/screens/profilePage.dart';
910
import 'package:image_picker/image_picker.dart';
10-
//import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
1111

1212
import '../helper/authenticationFunctions.dart';
1313

@@ -27,7 +27,6 @@ class _DashboardPageState extends State<DashboardPage> {
2727
final photo =
2828
await ImagePicker().pickImage(source: imageType, imageQuality: 100);
2929
if (photo == null) return null;
30-
// final tempImage = File(photo.path);
3130
tempImage = File(photo.path);
3231

3332
tempImage = await _cropImage(imageFile: tempImage);
@@ -53,17 +52,17 @@ class _DashboardPageState extends State<DashboardPage> {
5352
} catch (e) {
5453
print(e);
5554
}
55+
return null;
5656
}
5757

5858
@override
5959
Widget build(BuildContext context) {
6060
return Scaffold(
6161
appBar: AppBar(
62-
title: const Text("Dashboard"),
62+
title: const Text(StringConstants.dashboard),
6363
centerTitle: true,
6464
),
6565
body: Container(
66-
//alignment: Alignment.center,
6766
height: MediaQuery.of(context).size.height * 0.8,
6867
width: MediaQuery.of(context).size.width,
6968
child: Center(
@@ -81,7 +80,7 @@ class _DashboardPageState extends State<DashboardPage> {
8180
image: FileImage(pickedImage!), fit: BoxFit.cover)),
8281
),
8382
)
84-
: Image.asset("assets/successiveLogo.png",
83+
: Image.asset(ImageConstant.successiveSignupLogo,
8584
height: 150, width: 150),
8685
),
8786
),
@@ -108,7 +107,6 @@ class _DashboardPageState extends State<DashboardPage> {
108107
onTap: () async {
109108
pickedImage = await pickImage(ImageSource.gallery);
110109
setState(() {
111-
//openPopUp = true;
112110
pickedImage = pickedImage;
113111
});
114112
},
@@ -141,10 +139,16 @@ class _DashboardPageState extends State<DashboardPage> {
141139
// printing Name
142140
const SizedBox(height: 20),
143141

144-
Text(name == null ? "Default" : name ?? "",
142+
Text(
143+
name == null
144+
? StringConstants.defaultLabel
145+
: name ?? "",
145146
style: const TextStyle(
146147
color: Colors.black, fontWeight: FontWeight.bold)),
147-
Text(email1 == null ? "Email not found" : email1 ?? "",
148+
Text(
149+
email1 == null
150+
? StringConstants.emailNotFound
151+
: email1 ?? "",
148152
style: const TextStyle(
149153
color: Colors.black, fontWeight: FontWeight.bold))
150154
],
@@ -169,7 +173,7 @@ class _DashboardPageState extends State<DashboardPage> {
169173
),
170174
SizedBox(width: 10),
171175
Text(
172-
"Profile",
176+
StringConstants.profile,
173177
style: TextStyle(
174178
fontSize: 19,
175179
color: Colors.black87,
@@ -190,7 +194,7 @@ class _DashboardPageState extends State<DashboardPage> {
190194
),
191195
SizedBox(width: 10),
192196
Text(
193-
"Change Password",
197+
StringConstants.changePassword,
194198
style: TextStyle(
195199
fontSize: 19,
196200
color: Colors.black87,
@@ -204,12 +208,7 @@ class _DashboardPageState extends State<DashboardPage> {
204208
// Gallery
205209

206210
TextButton(
207-
onPressed: () {
208-
Navigator.push(
209-
context,
210-
MaterialPageRoute(
211-
builder: (context) => const GalleryPage()));
212-
},
211+
onPressed: () {},
213212
child: Row(
214213
children: const [
215214
Icon(
@@ -218,7 +217,7 @@ class _DashboardPageState extends State<DashboardPage> {
218217
),
219218
SizedBox(width: 10),
220219
Text(
221-
"Gallery",
220+
StringConstants.gallery,
222221
style: TextStyle(
223222
fontSize: 19,
224223
color: Colors.black87,
@@ -241,7 +240,7 @@ class _DashboardPageState extends State<DashboardPage> {
241240
),
242241
SizedBox(width: 10),
243242
Text(
244-
"Settings",
243+
StringConstants.settings,
245244
style: TextStyle(
246245
fontSize: 19,
247246
color: Colors.black87,
@@ -270,7 +269,7 @@ class _DashboardPageState extends State<DashboardPage> {
270269
),
271270
SizedBox(width: 10),
272271
Text(
273-
"Log Out",
272+
StringConstants.logOut,
274273
style: TextStyle(
275274
fontSize: 20,
276275
color: Colors.black87,
@@ -286,35 +285,4 @@ class _DashboardPageState extends State<DashboardPage> {
286285
),
287286
);
288287
}
289-
290-
Widget image_source_container(bool isCamera) {
291-
return InkWell(
292-
onTap: () async {
293-
File? tempImage;
294-
if (isCamera) {
295-
tempImage = await pickImage(ImageSource.camera);
296-
setState(() {
297-
pickedImage = tempImage;
298-
});
299-
} else {
300-
tempImage = await pickImage(ImageSource.gallery);
301-
setState(() {
302-
pickedImage = tempImage;
303-
});
304-
}
305-
},
306-
child: Container(
307-
height: 40,
308-
width: 40,
309-
decoration: const BoxDecoration(
310-
color: Colors.blue,
311-
shape: BoxShape.circle,
312-
),
313-
child: Icon(
314-
isCamera == true ? Icons.camera : Icons.image,
315-
color: Colors.white,
316-
),
317-
),
318-
);
319-
}
320288
}

lib/screens/galleryPage.dart

Lines changed: 0 additions & 44 deletions
This file was deleted.

lib/screens/loginPage.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import 'package:flutter/material.dart';
2+
import 'package:image_cropper_demo_app/constants/string_constants.dart';
23
import 'package:image_cropper_demo_app/screens/dashboardPage.dart';
34
import 'package:image_cropper_demo_app/screens/signupPage.dart';
45

6+
import '../constants/image_constants.dart';
57
import '../helper/authenticationFunctions.dart';
68
import '../helper/validationFunctions.dart';
79

@@ -151,12 +153,9 @@ class _LoginPageState extends State<LoginPage> {
151153
passwordController.text.toString());
152154

153155
// Setting up the info in profile page
154-
//getList();
155156

156157
List<String> personList = await getPersonList(
157158
emailController.text.toString());
158-
//await getEmail(emailController.text.toString());
159-
160159
if (credentialExists && personList.isNotEmpty) {
161160
Navigator.push(
162161
context,
@@ -184,7 +183,7 @@ class _LoginPageState extends State<LoginPage> {
184183
borderRadius: BorderRadius.circular(80.0),
185184
))),
186185
child: const Text(
187-
"Login",
186+
StringConstants.login,
188187
style: TextStyle(
189188
color: Colors.white,
190189
fontSize: 15,
@@ -195,7 +194,7 @@ class _LoginPageState extends State<LoginPage> {
195194
const SizedBox(height: 15),
196195
Container(
197196
child: const Text(
198-
'Continue with social media',
197+
StringConstants.continue_social_media,
199198
style: TextStyle(fontSize: 17),
200199
),
201200
),
@@ -206,14 +205,14 @@ class _LoginPageState extends State<LoginPage> {
206205
mainAxisAlignment: MainAxisAlignment.center,
207206
children: [
208207
Image.asset(
209-
'assets/fb.png',
208+
ImageConstant.FB_ICON,
210209
height: 70,
211210
),
212211
const SizedBox(
213212
width: 15,
214213
),
215214
Image.asset(
216-
'assets/google.png',
215+
ImageConstant.GOOGLE_ICON,
217216
height: 60,
218217
),
219218
],
@@ -225,7 +224,7 @@ class _LoginPageState extends State<LoginPage> {
225224
mainAxisAlignment: MainAxisAlignment.center,
226225
children: [
227226
const Text(
228-
" Don't have an Account?",
227+
StringConstants.dont_have_Account_msg,
229228
style: TextStyle(fontSize: 20),
230229
),
231230
Padding(
@@ -239,7 +238,7 @@ class _LoginPageState extends State<LoginPage> {
239238
const SignUpPage()));
240239
},
241240
child: Text(
242-
'Sign Up',
241+
StringConstants.signup,
243242
style: TextStyle(
244243
color: Colors.blue[900],
245244
fontSize: 20,

0 commit comments

Comments
 (0)