Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission :3 #6

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 37 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
# Created by https://www.toptal.com/developers/gitignore/api/dart
# Edit at https://www.toptal.com/developers/gitignore?templates=dart
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Files and directories created by pub
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.packages
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock

# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/

# dotenv environment variables file
.env*

# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map

.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

### Dart Patch ###
# dotenv environment variables file
.env
.idea/
# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# End of https://www.toptal.com/developers/gitignore/api/dart
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
30 changes: 15 additions & 15 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled.

version:
revision: d9111f64021372856901a1fd5bfbc386cade3318
revision: eb6d86ee27deecba4a83536aa20f366a6044895c
channel: stable

project_type: app
Expand All @@ -13,26 +13,26 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: android
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: ios
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: linux
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: macos
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: web
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: windows
create_revision: d9111f64021372856901a1fd5bfbc386cade3318
base_revision: d9111f64021372856901a1fd5bfbc386cade3318
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c

# User provided section

Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cmake.sourceDirectory": "${workspaceFolder}/windows/flutter",
"java.configuration.updateBuildConfiguration": "interactive"
}
63 changes: 10 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,16 @@
## Challenge #2 – File Storage Flutter Challenge
# file_storage

#### Tasks to complete
A new Flutter project.

Fork [this repository](https://github.com/bepitome/flutter-file-storage-challenge) and create a new branch with prefix of your github username and challenge name. For example if my github account is `mutairibassam` thus my branch should be like `mutairibassam/basic-authentication`.
## Getting Started

---
This project is a starting point for a Flutter application.

In this challenge you need to develop a portfolio app which shows user profile, user personal image, and user resume. Below are some of the technical requirements which you need to meet.
A few resources to get you started if this is your first Flutter project:

#### Technical requirements:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

- Application should send device physical id for all requests in headers.
- For example: `x-physical-id: 9774d56d682e549c`
- Application should use multipart to create a new profile. User profile should contain the below data

```yml
{
"first_name": "Ellerey", # required
"last_name": "Ellary",
"national_id": "4114151177", # required
"email": "ellerey4149@bllerey.io", # required
"gender": "male", # [male, female, N/A]
"age": "37",
"mobile": "0571234567",
"qualification": "bachelor's degree", # [...qualifications]
"profile": "http://mypath/611666779607958.jpg", # image network path
"resume": "http://mypath/385611666779607958.pdf", # file network path
}
```

- Application should allow users to update only personal details in case they just want to update their personal details.
- Application should allow users to update only resume in case they just want to update their resume.
- Application should allow users to update only profile image in case they just want to update their profile image.
- Application should send files as base64.
- Application should limit resume to .pdf only.
- Application should limit profile image to [.png, .jpeg, .jpg] only.

#### Advance Technical requirements (optional):

- Application should limit uploaded files size up to 250KB for both resume and profile image.

#### Testing:

- Application should pass all test.

_To download challenge APIs, [click here](https://documenter.getpostman.com/view/20449209/2s8YCYnvWQ)_

<u>Note: We don’t expect something perfect. Just submit what you can do to evaluate your current skills and take you to the next step.</u>

---

#### Project Submission:

For code review - create a pull request and we will do our best to review your code within 72 hours. In case you faced any difficulty with git or github, you are welcome to book a support session [book now](https://calendly.com/mutairibassam).

In case you couldn’t be able to complete the project, don’t give up! We are still here to help you. You can also book a support session with field experts to guide you. For flutter related [Adnan](https://calendly.com/adnsawas), [Majid](https://calendly.com/majidraimi), or [Ayman](https://calendly.com/aymanz-dev) for challenge related [Bassam](https://calendly.com/mutairibassam).

<p style="color:red">Submissions with missing tasks, or buggy apps will be ignored.</p>
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -44,7 +44,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_file_storage_challenge"
applicationId "com.example.file_storage"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_file_storage_challenge">
package="com.example.file_storage">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_file_storage_challenge">
package="com.example.file_storage">
<application
android:label="flutter_file_storage_challenge"
android:label="file_storage"
android:name="${applicationName}"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.file_storage

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_file_storage_challenge">
package="com.example.file_storage">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterFileStorageChallenge;
PRODUCT_BUNDLE_IDENTIFIER = com.example.fileStorage;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -422,7 +422,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterFileStorageChallenge;
PRODUCT_BUNDLE_IDENTIFIER = com.example.fileStorage;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -444,7 +444,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterFileStorageChallenge;
PRODUCT_BUNDLE_IDENTIFIER = com.example.fileStorage;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
4 changes: 2 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Flutter File Storage Challenge</string>
<string>File Storage</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>flutter_file_storage_challenge</string>
<string>file_storage</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
47 changes: 42 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
import 'package:file_storage/models/api.dart';
import 'package:file_storage/screens/display_profile.dart';
import 'package:file_storage/screens/form_page.dart';
import 'package:flutter/material.dart';

void main() {
/**
* Welcome to File Storage challenge
* Make sure to read CHALLENGE.md before you start
*
*/
runApp(const MyApp());
}

class MyApp extends StatefulWidget {
const MyApp({super.key});

@override
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
bool isLoading = false;
Future checkPhysicalID() async {
await API.getUser();
setState(() {
isLoading = true;
});
}

@override
void initState() {
super.initState();
checkPhysicalID();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.red),
home: !isLoading
? const Scaffold(body: Center(child: CircularProgressIndicator()))
: API.isExist
? const Profile()
: const FormPage(),
);
}
}
Loading