Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mo7amedaliEbaid committed Nov 12, 2023
1 parent f23c5aa commit 96921fa
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 55 deletions.
1 change: 1 addition & 0 deletions .idea/tv-shows.iml

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:breakingbad/data/models/got_character_model.dart';
import 'package:flutter/material.dart';

import '../data/repositories/got_charactersrepository.dart';
import '../../data/repositories/got_charactersrepository.dart';

part 'got_characters_state.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:breakingbad/data/repositories/ram_charactersrepository.dart';
import 'package:meta/meta.dart';

import '../data/models/ram_characters_model.dart';
import '../../data/models/ram_characters_model.dart';

part 'ram_characters_state.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import 'package:breakingbad/constants/constants.dart';
import 'package:breakingbad/shared/constants.dart';
import 'package:dio/dio.dart';

class GOTCharactersWebServices{
Dio dio=Dio();
GOTCharactersWebServices(){
BaseOptions options =BaseOptions(
class GOTCharactersWebServices {
Dio dio = Dio();

GOTCharactersWebServices() {
BaseOptions options = BaseOptions(
baseUrl: GOTbaseurl,
receiveDataWhenStatusError: true,
connectTimeout: 20*1000,
receiveTimeout: 20*1000,
connectTimeout: 20 * 1000,
receiveTimeout: 20 * 1000,
);
dio=Dio(options);
dio = Dio(options);
}
Future<List<dynamic>> getAllGOTCharacters()async{
try{
Response response= await dio.get(allGOTcharacters);

Future<List<dynamic>> getAllGOTCharacters() async {
try {
Response response = await dio.get(allGOTcharacters);
print(response.data.toString());
return response.data;
}catch(e){
} catch (e) {
print(e.toString());
return [];
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import 'package:breakingbad/constants/constants.dart';
import 'package:breakingbad/shared/constants.dart';
import 'package:dio/dio.dart';

class RAMCharactersWebServices{
Dio dio=Dio();
RAMCharactersWebServices(){
BaseOptions options =BaseOptions(
baseUrl: RAMbaseurl,
receiveDataWhenStatusError: true,
connectTimeout: 20*1000,
receiveTimeout: 20*1000,
);
dio=Dio(options);
}
Future<List<dynamic>> getAllRAMCharacters()async{
try{
Response response= await dio.get(allRAMcharacters);
print(response.data.toString());
return response.data["results"];
}catch(e){
print(e.toString());
return [];
class RAMCharactersWebServices {
Dio dio = Dio();

RAMCharactersWebServices() {
BaseOptions options = BaseOptions(
baseUrl: RAMbaseurl,
receiveDataWhenStatusError: true,
connectTimeout: 20 * 1000,
receiveTimeout: 20 * 1000,
);
dio = Dio(options);
}

Future<List<dynamic>> getAllRAMCharacters() async {
try {
Response response = await dio.get(allRAMcharacters);
print(response.data.toString());
return response.data["results"];
} catch (e) {
print(e.toString());
return [];
}
}
}
}
13 changes: 12 additions & 1 deletion rickandMorty-GameofThrones-bloc/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import 'package:breakingbad/router.dart';
import 'package:breakingbad/shared/bloc_observer.dart';
import 'package:breakingbad/shared/router.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

void main() {

WidgetsFlutterBinding.ensureInitialized();

Bloc.observer = MyBlocObserver();

SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);

runApp(MyApp(
appRouter: AppRouter(),
));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:breakingbad/data/models/got_character_model.dart';
import 'package:flutter/material.dart';

import '../../constants/constants.dart';
import '../../shared/constants.dart';

class GotCharactersDetailsScreen extends StatelessWidget {
final GOTCharacter gotcharacter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:breakingbad/constants/constants.dart';
import 'package:breakingbad/shared/constants.dart';
import 'package:breakingbad/data/models/got_character_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_offline/flutter_offline.dart';

import '../../business-logic/got_characters_cubit.dart';
import '../../application/got_cubit/got_characters_cubit.dart';
import '../widgets/appbar_title.dart';
import '../widgets/gotcharacter_item.dart';
import '../widgets/loading.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:breakingbad/data/models/ram_characters_model.dart';
import 'package:flutter/material.dart';

import '../../constants/constants.dart';
import '../../shared/constants.dart';

class RAMCharactersDetailsScreen extends StatelessWidget {
final RAMCharacter ramcharacter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:breakingbad/business-logic/ram_characters_cubit.dart';
import 'package:breakingbad/application/ram_cubit/ram_characters_cubit.dart';
import 'package:breakingbad/presentation/widgets/ramcharacter_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_offline/flutter_offline.dart';

import '../../constants/constants.dart';
import '../../shared/constants.dart';
import '../../data/models/ram_characters_model.dart';
import '../widgets/appbar_title.dart';
import '../widgets/loading.dart';
Expand Down
29 changes: 29 additions & 0 deletions rickandMorty-GameofThrones-bloc/lib/shared/bloc_observer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// ignore_for_file: avoid_print, depend_on_referenced_packages

import 'package:flutter_bloc/flutter_bloc.dart';

class MyBlocObserver extends BlocObserver {
@override
void onCreate(BlocBase bloc) {
super.onCreate(bloc);
print('onCreate -- ${bloc.runtimeType}');
}

@override
void onChange(BlocBase bloc, Change change) {
super.onChange(bloc, change);
print('onChange -- ${bloc.runtimeType}, $change');
}

@override
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
print('onError -- ${bloc.runtimeType}, $error');
super.onError(bloc, error, stackTrace);
}

@override
void onClose(BlocBase bloc) {
super.onClose(bloc);
print('onClose -- ${bloc.runtimeType}');
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';

final allRAMcharacters = "character";
final RAMbaseurl = 'https://rickandmortyapi.com/api/';
final GOTbaseurl = "https://thronesapi.com/api/v2/";
final allGOTcharacters = "Characters";
const RAMcharactersScreen = '/ram';
const GOTcharactersScreen = '/';
TextStyle headstyle = TextStyle(
const String allRAMcharacters = "character";
const String RAMbaseurl = 'https://rickandmortyapi.com/api/';
const String GOTbaseurl = "https://thronesapi.com/api/v2/";
const String allGOTcharacters = "Characters";
const String RAMcharactersScreen = '/ram';
const String GOTcharactersScreen = '/';

const TextStyle headstyle = TextStyle(
color: Colors.transparent,
fontSize: 20,
fontWeight: FontWeight.bold,
Expand All @@ -16,5 +17,6 @@ TextStyle headstyle = TextStyle(
decorationThickness: 3,
shadows: [Shadow(color: Colors.brown, offset: Offset(0, -8))],
);
TextStyle hintstyle =

const TextStyle hintstyle =
TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:breakingbad/business-logic/got_characters_cubit.dart';
import 'package:breakingbad/business-logic/ram_characters_cubit.dart';
import 'package:breakingbad/constants/constants.dart';
import 'package:breakingbad/application/got_cubit/got_characters_cubit.dart';
import 'package:breakingbad/application/ram_cubit/ram_characters_cubit.dart';
import 'package:breakingbad/shared/constants.dart';
import 'package:breakingbad/data/repositories/got_charactersrepository.dart';
import 'package:breakingbad/data/repositories/ram_charactersrepository.dart';
import 'package:breakingbad/data/web_services/gotwebServices.dart';
Expand All @@ -9,7 +9,7 @@ import 'package:breakingbad/presentation/screens/ramcharacters_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'data/web_services/ram_charactersWebServices.dart';
import '../data/web_services/ram_charactersWebServices.dart';

class AppRouter {
late RAMCharactersRepository ramcharactersRepository;
Expand Down

0 comments on commit 96921fa

Please sign in to comment.