Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Luis Jorge Lopez Test #34

Open
wants to merge 19 commits into
base: master
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
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.13.9",
"flutterSdkVersion": "stable",
"flavors": {}
}
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: StormShadonw
custom: ["https://paypal.me/developezdo"]
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ app.*.map.json
/android/app/release

# fvm
.fvm/flutter_sdk
.fvm/flutter_sdk

#envied
.env
env.g.dart
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"dart.flutterSdkPath": ".fvm\\versions\\stable",
"search.exclude": {
"**/.fvm": true
"**/.fvm": true
},
"files.watcherExclude": {
"**/.fvm": true
"**/.fvm": true
}
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,15 @@ Just create a new issue in this repo and we will respond and get back to you qui
## Review

The coding challenge is a take-home test upon which we'll be conducting a thorough code review once complete. The review will consist of meeting some more of our mobile engineers and giving a review of the solution you have designed. Please be prepared to share your screen and run/demo the application to the group. During this process, the engineers will be asking questions.

# Here some screenshots of the app working
![image](https://github.com/StormShadonw/flutter_test/assets/20448268/1d054b77-5f1d-404f-880b-da6987e6603f)
![image](https://github.com/StormShadonw/flutter_test/assets/20448268/1f085cdd-3090-4333-968b-05986a042b6a)
![image](https://github.com/StormShadonw/flutter_test/assets/20448268/4c5b7b01-72ca-417a-a3b6-db1c8867e7da)
![image](https://github.com/StormShadonw/flutter_test/assets/20448268/fa734fe1-3e4f-460d-8fe5-8bcb093ee2e5)
![image](https://github.com/StormShadonw/flutter_test/assets/20448268/155ac3c5-689e-4916-8387-6211f4b4f6ef)





2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.restaurantour">
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:label="restaurantour"
android:name="${applicationName}"
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
10 changes: 10 additions & 0 deletions lib/env.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// lib/env/env.dart
import 'package:envied/envied.dart';

part 'env.g.dart';

@Envied(path: '.env')
abstract class Env {
@EnviedField(varName: 'YELP_KEY', obfuscate: true)
static String YELP_KEY = _Env.YELP_KEY;
}
69 changes: 28 additions & 41 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
import 'package:flutter/material.dart';
import 'package:restaurantour/repositories/yelp_repository.dart';
import 'package:provider/provider.dart';
import 'package:restaurantour/providers/favorites_helper.dart';
import 'package:restaurantour/pages/home_page.dart';
import 'package:restaurantour/providers/data_provider.dart';

void main() {
runApp(const Restaurantour());
}

class Restaurantour extends StatelessWidget {
// This widget is the root of your application.
const Restaurantour({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'RestauranTour',
theme: ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const HomePage(),
);
}
}

class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Restaurantour'),
ElevatedButton(
child: const Text('Fetch Restaurants'),
onPressed: () async {
final yelpRepo = YelpRepository();

try {
final result = await yelpRepo.getRestaurants();
if (result != null) {
print('Fetched ${result.restaurants!.length} restaurants');
} else {
print('No restaurants fetched');
}
} catch (e) {
print('Failed to fetch restaurants: $e');
}
},
),
],
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => DataProvider()),
ChangeNotifierProvider(create: (context) => FavoritesProvider()),
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'RestauranTour',
theme: ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,
colorScheme: const ColorScheme(
background: Colors.white,
brightness: Brightness.light,
primary: Colors.black87,
secondary: Colors.white,
onPrimary: Colors.white,
onSecondary: Colors.white,
error: Colors.redAccent,
onError: Colors.redAccent,
onBackground: Colors.black87,
surface: Colors.white,
onSurface: Colors.black87,
),
),
home: const HomePage(),
),
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/models/restaurant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ class User {
class Review {
final String? id;
final int? rating;
final String? text;
final User? user;

const Review({
this.id,
this.rating,
this.text,
this.user,
});

Expand Down
2 changes: 2 additions & 0 deletions lib/models/restaurant.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:restaurantour/widgets/restaurants_list_widget.dart';

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

@override
State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
bottom: const TabBar(tabs: [
Tab(
text: "All Restaurants",
),
Tab(
text: "My Favorites",
),
]),
title: const Text("RestauranTour"),
centerTitle: true,
titleTextStyle: Theme.of(context).textTheme.titleLarge!.copyWith(
fontWeight: FontWeight.bold,
),
),
body: TabBarView(
children: [
RestaurantsListWidget(),
RestaurantsListWidget(
favorites: true,
),
],
),
),
);
}
}
Loading