Skip to content

Commit

Permalink
Version 2.0.0 pre alpha completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelfante committed Nov 24, 2024
1 parent 36070cd commit 31c563f
Show file tree
Hide file tree
Showing 84 changed files with 2,361 additions and 413 deletions.
3 changes: 3 additions & 0 deletions example/.fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.24.5"
}
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# FVM Version Cache
.fvm/
9 changes: 6 additions & 3 deletions example/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand All @@ -24,14 +24,17 @@
*/

import 'package:flutter/material.dart';
import 'package:news_app/di/dependency_injector.dart';
import 'package:news_app/app.di.pine.dart';
import 'package:news_app/pages/home_page.dart';
import 'package:pine_annotations/pine_annotations.dart';

@SeedContainer()
class App extends StatelessWidget {
const App({super.key});

@override
Widget build(BuildContext context) => DependencyInjector(
Widget build(BuildContext context) => PineSeeded(
onNewsBlocInit: (_, bloc) => bloc.fetchNews(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'News App',
Expand Down
4 changes: 3 additions & 1 deletion example/lib/blocs/news/news_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -27,10 +27,12 @@ import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:news_app/models/article.dart';
import 'package:news_app/repositories/news_repository.dart';
import 'package:pine_annotations/pine_annotations.dart';

part 'news_event.dart';
part 'news_state.dart';

@Seed()
class NewsBloc extends Bloc<NewsEvent, NewsState> {
final NewsRepository newsRepository;

Expand Down
2 changes: 1 addition & 1 deletion example/lib/blocs/news/news_event.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion example/lib/blocs/news/news_state.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
60 changes: 0 additions & 60 deletions example/lib/di/dependency_injector.dart

This file was deleted.

32 changes: 0 additions & 32 deletions example/lib/di/mappers.dart

This file was deleted.

38 changes: 0 additions & 38 deletions example/lib/di/providers.dart

This file was deleted.

35 changes: 0 additions & 35 deletions example/lib/di/repositories.dart

This file was deleted.

2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion example/lib/models/article.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/webview_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down
5 changes: 3 additions & 2 deletions example/lib/repositories/mappers/article_mapper.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand All @@ -26,9 +26,10 @@
import 'package:news_app/models/article.dart';
import 'package:news_app/services/responses/article_dto.dart';
import 'package:pine/pine.dart';
import 'package:pine_annotations/pine_annotations.dart';

@Seed(singleton: false)
class ArticleMapper extends DTOMapper<ArticleDTO, Article> {

const ArticleMapper();

@override
Expand Down
4 changes: 3 additions & 1 deletion example/lib/repositories/news_repository.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -27,11 +27,13 @@ import 'package:news_app/models/article.dart';
import 'package:news_app/services/news_service.dart';
import 'package:news_app/services/responses/article_dto.dart';
import 'package:pine/pine.dart';
import 'package:pine_annotations/pine_annotations.dart';

abstract class NewsRepository {
Future<List<Article>> get news;
}

@Seed()
class NewsRepositoryImpl extends NewsRepository {
final NewsService newsService;
final DTOMapper<ArticleDTO, Article> mapper;
Expand Down
32 changes: 32 additions & 0 deletions example/lib/services/dio.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
*
* * Copyright (c) 2024 MyLittleSuite
* *
* * Permission is hereby granted, free of charge, to any person
* * obtaining a copy of this software and associated documentation
* * files (the "Software"), to deal in the Software without
* * restriction, including without limitation the rights to use,
* * copy, modify, merge, publish, distribute, sublicense, and/or sell
* * copies of the Software, and to permit persons to whom the
* * Software is furnished to do so, subject to the following
* * conditions:
* *
* * The above copyright notice and this permission notice shall be
* * included in all copies or substantial portions of the Software.
* *
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* * OTHER DEALINGS IN THE SOFTWARE.
*
*/

import 'package:dio/io.dart';
import 'package:pine_annotations/pine_annotations.dart';

@Seed()
class Dio extends DioForNative {}
19 changes: 12 additions & 7 deletions example/lib/services/news_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 MyLittleSuite
* Copyright (c) 2024 MyLittleSuite
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand All @@ -23,20 +23,25 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/

import 'package:dio/dio.dart';
import 'package:dio/dio.dart' hide Headers, Dio;
import 'package:news_app/services/dio.dart';
import 'package:news_app/services/responses/everything_response.dart';
import 'package:retrofit/retrofit.dart' as retrofit;
import 'package:pine_annotations/pine_annotations.dart';
import 'package:retrofit/retrofit.dart';

part 'news_service.g.dart';

@retrofit.RestApi()
@RestApi()
@Seed(constructorParams: {
'baseUrl': 'https://newsapi.org/v2/',
})
abstract class NewsService {
factory NewsService(Dio dio, {String? baseUrl}) =>
_NewsService(dio, baseUrl: baseUrl);

@retrofit.GET('everything')
@retrofit.Headers({'Authorization': 'Bearer <token>'})
@GET('everything')
@Headers({'Authorization': 'Bearer <token>'})
Future<EverythingResponse> articles({
@retrofit.Query('q') String query = 'italy',
@Query('q') String query = 'italy',
});
}
Loading

0 comments on commit 31c563f

Please sign in to comment.