Skip to content

Commit

Permalink
Merge pull request #9 from felipecastrosales/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
felipecastrosales authored Jan 29, 2023
2 parents 87fe118 + 7fa00ce commit 9017de3
Show file tree
Hide file tree
Showing 48 changed files with 466 additions and 378 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# Project Relateds
.fvm
3 changes: 2 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
rules:
- sort_constructors_first
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 30
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -45,7 +45,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "br.com.felipecastrosales.app_filmes"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
4 changes: 2 additions & 2 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.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
}
Expand Down
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.3.3-all.zip
10 changes: 5 additions & 5 deletions lib/application/bindings/application_bindings.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import 'package:get/get.dart';

import 'package:app_filmes/application/rest_client/rest_client.dart';
import 'package:app_filmes/application/auth/auth_service.dart';
import 'package:app_filmes/repositories/login/login_repository_impl.dart';
import 'package:app_filmes/application/rest_client/rest_client.dart';
import 'package:app_filmes/repositories/login/login_repository.dart';
import 'package:app_filmes/repositories/login/login_repository_impl.dart';
import 'package:app_filmes/repositories/movies/movies_repository.dart';
import 'package:app_filmes/repositories/movies/movies_repository_impl.dart';
import 'package:app_filmes/services/movies/movies_service.dart';
import 'package:app_filmes/services/movies/movies_service_impl.dart';
import 'package:app_filmes/services/login/login_service.dart';
import 'package:app_filmes/services/login/login_service_impl.dart';
import 'package:app_filmes/services/movies/movies_service.dart';
import 'package:app_filmes/services/movies/movies_service_impl.dart';

class ApplicationBindings implements Bindings {
@override
Expand All @@ -27,7 +27,7 @@ class ApplicationBindings implements Bindings {
loginRepository: Get.find(),
),
fenix: true,
);
);
Get.put(
AuthService(),
).init();
Expand Down
30 changes: 30 additions & 0 deletions lib/application/movie_app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'package:app_filmes/modules/home/home_module.dart';
import 'package:app_filmes/modules/login/login_module.dart';
import 'package:app_filmes/modules/movie_detail/movie_detail_module.dart';
import 'package:app_filmes/modules/splash/splash_module.dart';

import 'bindings/application_bindings.dart';
import 'ui/filmes_app_ui_config.dart';

class MovieApp extends StatelessWidget {
const MovieApp({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: FilmesAppUiConfig.title,
debugShowCheckedModeBanner: false,
theme: FilmesAppUiConfig.theme,
initialBinding: ApplicationBindings(),
getPages: [
...SplashModule().routers,
...LoginModule().routers,
...HomeModule().routers,
...MovieDetailModule().routers,
],
);
}
}
24 changes: 12 additions & 12 deletions lib/application/ui/filmes_app_ui_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ class FilmesAppUiConfig {
static String get title => 'Filmes App';

static ThemeData get theme => ThemeData(
scaffoldBackgroundColor: Colors.white,
fontFamily: 'Metropolis',
appBarTheme: const AppBarTheme(
backgroundColor:Colors.white,
iconTheme: IconThemeData(color: Colors.black),
titleTextStyle: TextStyle(
color: Color(0xff222222),
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
);
scaffoldBackgroundColor: Colors.white,
fontFamily: 'Metropolis',
appBarTheme: const AppBarTheme(
backgroundColor: Colors.white,
iconTheme: IconThemeData(color: Colors.black),
titleTextStyle: TextStyle(
color: Color(0xff222222),
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
);
}
22 changes: 11 additions & 11 deletions lib/application/ui/messages/messages_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mixin MessagesMixin on GetxController {
Get.snackbar(
model.title,
model.message,
backgroundColor: model.type.color(),
backgroundColor: model.type.color(),
);
}
},
Expand All @@ -20,25 +20,25 @@ mixin MessagesMixin on GetxController {
}

class MessageModel {
final String title;
final String message;
final MessageType type;

MessageModel({
MessageModel.info({
required this.title,
required this.message,
required this.type,
});
}) : type = MessageType.info;

MessageModel.error({
required this.title,
required this.message,
}) : type = MessageType.error;

MessageModel.info({
MessageModel({
required this.title,
required this.message,
}) : type = MessageType.info;
required this.type,
});

final String title;
final String message;
final MessageType type;
}

enum MessageType {
Expand All @@ -47,7 +47,7 @@ enum MessageType {
}

extension MessageTypeExtension on MessageType {
Color color() {
Color color() {
switch (this) {
case MessageType.error:
return Colors.red[600] ?? Colors.red;
Expand Down
4 changes: 2 additions & 2 deletions lib/application/ui/widgets/movie_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import 'package:app_filmes/models/movie_model.dart';

class MovieCard extends StatelessWidget {
MovieCard({
Key? key,
super.key,
required this.movie,
required this.favoriteCallback,
}) : super(key: key);
});

final MovieModel movie;
final dateFormat = DateFormat('dd/MM/y');
Expand Down
33 changes: 4 additions & 29 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,15 @@ import 'package:flutter/material.dart';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:get/get.dart';

import 'application/bindings/application_bindings.dart';
import 'application/ui/filmes_app_ui_config.dart';
import 'modules/home/home_module.dart';
import 'modules/login/login_module.dart';
import 'modules/movie_detail/movie_detail_module.dart';
import 'modules/splash/splash_module.dart';
import 'package:app_filmes/application/movie_app.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
RemoteConfig.instance.fetchAndActivate();
FirebaseRemoteConfig.instance.fetchAndActivate();
runApp(
// ignore: prefer_const_constructors
MyApp(), // it's not 'const' because void main is async
// ignore: prefer_const_constructors
MovieApp(), // it's not 'const' because void main is async
);
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: FilmesAppUiConfig.title,
debugShowCheckedModeBanner: false,
theme: FilmesAppUiConfig.theme,
initialBinding: ApplicationBindings(),
getPages: [
...SplashModule().routers,
...LoginModule().routers,
...HomeModule().routers,
...MovieDetailModule().routers,
],
);
}
}
22 changes: 11 additions & 11 deletions lib/models/cast_model.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import 'dart:convert';

class CastModel {
factory CastModel.fromMap(Map<String, dynamic> map) {
return CastModel(
name: map['original_name'] ?? '',
image: 'https://image.tmdb.org/t/p/w200${map['profile_path']}',
character: map['character'] ?? '',
);
}

factory CastModel.fromJson(String source) =>
CastModel.fromMap(json.decode(source));

CastModel({
required this.name,
required this.image,
Expand All @@ -19,16 +30,5 @@ class CastModel {
};
}

factory CastModel.fromMap(Map<String, dynamic> map) {
return CastModel(
name: map['original_name'] ?? '',
image: 'https://image.tmdb.org/t/p/w200${map['profile_path']}',
character: map['character'] ?? '',
);
}

String toJson() => json.encode(toMap());

factory CastModel.fromJson(String source) =>
CastModel.fromMap(json.decode(source));
}
22 changes: 11 additions & 11 deletions lib/models/genre_model.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import 'dart:convert';

class GenreModel {
factory GenreModel.fromMap(Map<String, dynamic> map) {
return GenreModel(
id: map['id'] ?? 0,
name: map['name'] ?? '',
);
}

factory GenreModel.fromJson(String source) =>
GenreModel.fromMap(json.decode(source));

GenreModel({
required this.id,
required this.name,
});

final int id;
final String name;
final String name;

Map<String, dynamic> toMap() {
return {
Expand All @@ -16,15 +26,5 @@ class GenreModel {
};
}

factory GenreModel.fromMap(Map<String, dynamic> map) {
return GenreModel(
id: map['id'] ?? 0,
name: map['name'] ?? '',
);
}

String toJson() => json.encode(toMap());

factory GenreModel.fromJson(String source) =>
GenreModel.fromMap(json.decode(source));
}
Loading

0 comments on commit 9017de3

Please sign in to comment.