-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
274 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class AuthService extends GetxService { | ||
User? user; | ||
|
||
void init() { | ||
FirebaseAuth.instance.authStateChanges().listen( | ||
(User? user) { | ||
this.user = user; | ||
if (user == null) { | ||
Get.offAllNamed('/login'); | ||
} else { | ||
Get.offAllNamed('/home'); | ||
} | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// Flutter icons FilmesAppIcons | ||
/// Copyright (C) 2021 by original authors @ fluttericon.com, fontello.com | ||
/// This font was generated by FlutterIcon.com, which is derived from Fontello. | ||
/// | ||
/// To use this font, place it in your fonts/ directory and include the | ||
/// following in your pubspec.yaml | ||
/// | ||
/// flutter: | ||
/// fonts: | ||
/// - family: FilmesAppIcons | ||
/// fonts: | ||
/// - asset: fonts/FilmesAppIcons.ttf | ||
/// | ||
/// | ||
/// * Font Awesome 4, Copyright (C) 2016 by Dave Gandy | ||
/// Author: Dave Gandy | ||
/// License: SIL () | ||
/// Homepage: http://fortawesome.github.com/Font-Awesome/ | ||
/// | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class FilmesAppIcons { | ||
FilmesAppIcons._(); | ||
|
||
static const _kFontFam = 'FilmesAppIcons'; | ||
static const String? _kFontPkg = null; | ||
|
||
static const IconData heart = | ||
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); | ||
static const IconData heartEmpty = | ||
IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FilmesAppUiConfig { | ||
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, | ||
), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
extension ThemeExtension on BuildContext { | ||
Color get themeRed => const Color(0xffea4335); | ||
Color get themeOrange => const Color(0xffffba49); | ||
Color get themeGrey => const Color(0xff9b9b9b); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FavoritesPage extends StatelessWidget { | ||
const FavoritesPage({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Favorites'), | ||
automaticallyImplyLeading: false, | ||
), | ||
body: Container(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import 'home_controller.dart'; | ||
|
||
class HomeBindings implements Bindings { | ||
@override | ||
void dependencies() { | ||
Get.lazyPut( | ||
() => HomeController( | ||
loginService: Get.find(), | ||
), | ||
fenix: true, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import 'package:app_filmes/services/login/login_service.dart'; | ||
|
||
class HomeController extends GetxController { | ||
// ignore: constant_identifier_names | ||
static const NAVIGATOR_KEY = 1; | ||
// ignore: constant_identifier_names | ||
static const INDEX_PAGE_EXIT = 2; | ||
|
||
final LoginService _loginService; | ||
HomeController({ | ||
required LoginService loginService, | ||
}) : _loginService = loginService; | ||
|
||
final _pages = [ | ||
'/movies', | ||
'/favorites', | ||
]; | ||
|
||
final _pageIndex = 0.obs; | ||
|
||
int get pageIndex => _pageIndex.value; | ||
|
||
void goToPage(int page) { | ||
_pageIndex(page); | ||
if (page == INDEX_PAGE_EXIT) { | ||
_loginService.logout(); | ||
} else { | ||
Get.offNamed( | ||
_pages[page], | ||
id: NAVIGATOR_KEY, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import 'package:app_filmes/application/modules/module.dart'; | ||
import 'home_bindings.dart'; | ||
import 'home_page.dart'; | ||
|
||
class HomeModule extends Module { | ||
@override | ||
List<GetPage> routers = [ | ||
GetPage( | ||
name: '/home', | ||
page: () => const HomePage(), | ||
binding: HomeBindings(), | ||
), | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:get/get.dart'; | ||
|
||
import 'package:app_filmes/application/ui/filmes_app_icons_icons.dart'; | ||
import 'package:app_filmes/application/ui/theme_extension.dart'; | ||
import 'package:app_filmes/modules/favorites/favorites_page.dart'; | ||
import 'package:app_filmes/modules/movies/movies_page.dart'; | ||
import 'home_controller.dart'; | ||
|
||
class HomePage extends GetView<HomeController> { | ||
const HomePage({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
bottomNavigationBar: Obx(() { | ||
return BottomNavigationBar( | ||
selectedItemColor: context.themeRed, | ||
unselectedItemColor: context.themeGrey, | ||
onTap: controller.goToPage, | ||
currentIndex: controller.pageIndex, | ||
items: const [ | ||
BottomNavigationBarItem( | ||
icon: Icon(Icons.movie), | ||
label: 'Filmes', | ||
), | ||
BottomNavigationBarItem( | ||
icon: Icon(FilmesAppIcons.heartEmpty), | ||
label: 'Favoritos', | ||
), | ||
BottomNavigationBarItem( | ||
icon: Icon(Icons.logout_outlined), | ||
label: 'Sair', | ||
), | ||
], | ||
); | ||
}), | ||
body: Navigator( | ||
initialRoute: '/movies', | ||
key: Get.nestedKey(HomeController.NAVIGATOR_KEY), | ||
onGenerateRoute: (settings) { | ||
if (settings.name == '/movies') { | ||
return GetPageRoute( | ||
settings: settings, | ||
page: () => const MoviesPage(), | ||
); | ||
} | ||
if (settings.name == '/favorites') { | ||
return GetPageRoute( | ||
settings: settings, | ||
page: () => const FavoritesPage(), | ||
); | ||
} | ||
return null; | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class MoviesPage extends StatelessWidget { | ||
|
||
const MoviesPage({ Key? key }) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Movies'), | ||
), | ||
body: Container(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import 'package:get/get.dart'; | ||
|
||
class SplashController extends GetxController { | ||
@override | ||
void onReady() { | ||
super.onReady(); | ||
Get.offAllNamed('/login'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters