Skip to content

Commit 052ba73

Browse files
committed
change code for flutter new update
1 parent 6391948 commit 052ba73

51 files changed

Lines changed: 404 additions & 111 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "3.27.0"
3+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# name: "Build"
2+
3+
# on:
4+
# pull_request:
5+
# branches:
6+
# - dev
7+
# - test
8+
# push:
9+
# branches:
10+
# - dev
11+
# - test
12+
13+
# jobs:
14+
# build:
15+
# name: Build & Release
16+
# runs-on: macos-latest
17+
18+
# steps:
19+
# #1 Checkout Repository
20+
# - name: Checkout Repository
21+
# uses: actions/checkout@v3
22+
23+
# #2 Setup Java
24+
# - name: Set Up Java
25+
# uses: actions/setup-java@v3.12.0
26+
# with:
27+
# distribution: 'oracle'
28+
# java-version: '17'
29+
30+
# #3 Setup Flutter
31+
# - name: Set Up Flutter
32+
# uses: subosito/flutter-action@v2
33+
# with:
34+
# flutter-version: '3.22.2'
35+
# channel: 'stable'
36+
37+
# #4 Install Dependencies
38+
# - name: Install Dependencies
39+
# run: flutter pub get
40+
41+
# #5 Setup Keystore
42+
# - name: Decode Keystore
43+
# run: |
44+
# echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks
45+
46+
# - name: Create key.properties
47+
# run: |
48+
# echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties
49+
# echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
50+
# echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
51+
# echo "storeFile=keystore.jks" >> android/key.properties
52+
53+
# #6 Building APK
54+
# - name: Build APK
55+
# run: flutter build apk --release
56+
57+
# #7 Building App Bundle (aab)
58+
# - name: Build appBundle
59+
# run: flutter build appbundle
60+
61+
# #8 Build IPA ( IOS Build )
62+
# - name: Build IPA
63+
# run: flutter build ipa --no-codesign
64+
65+
# - name: Compress Archives and IPAs
66+
# run: |
67+
# cd build
68+
# tar -czf ios_build.tar.gz ios
69+
70+
# #9 Upload Artifacts
71+
# - name: Upload Artifacts
72+
# uses: actions/upload-artifact@v2
73+
# with:
74+
# name: Releases
75+
# path: |
76+
# build/app/outputs/flutter-apk/app-release.apk
77+
# build/app/outputs/bundle/release/app-release.aab
78+
# build/ios_build.tar.gz
79+
80+
# #10 Extract Version
81+
# - name: Extract version from pubspec.yaml
82+
# id: extract_version
83+
# run: |
84+
# version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
85+
# echo "VERSION=$version" >> $GITHUB_ENV
86+
87+
# #11 Check if Tag Exists
88+
# - name: Check if Tag Exists
89+
# id: check_tag
90+
# run: |
91+
# if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
92+
# echo "TAG_EXISTS=true" >> $GITHUB_ENV
93+
# else
94+
# echo "TAG_EXISTS=false" >> $GITHUB_ENV
95+
# fi
96+
97+
# #12 Modify Tag if it Exists
98+
# - name: Modify Tag
99+
# if: env.TAG_EXISTS == 'true'
100+
# id: modify_tag
101+
# run: |
102+
# new_version="${{ env.VERSION }}-build-${{ github.run_number }}"
103+
# echo "VERSION=$new_version" >> $GITHUB_ENV
104+
105+
# #13 Create Release
106+
# - name: Create Release
107+
# uses: ncipollo/release-action@v1
108+
# with:
109+
# artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab,build/ios_build.tar.gz"
110+
# tag: v${{ env.VERSION }}
111+
# token: ${{ secrets.TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ app.*.map.json
4444
/android/app/debug
4545
/android/app/profile
4646
/android/app/release
47+
48+
# FVM Version Cache
49+
.fvm/

README.md

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,76 @@
22

33
This is a template project structure.
44

5+
# Articles App
6+
7+
# Medium Articles
8+
[Clean Architecture in Flutter](https://medium.com/@yamen.abd98/clean-architecture-in-flutter-mvvm-bloc-dio-79b1615530e1)
9+
10+
[Unit Testing with Clean Architecture in Flutter | Mockito](https://medium.com/@yamen.abd98/unit-testing-in-flutter-with-clean-architecture-49d403645b4d)
11+
12+
13+
14+
A new Flutter project with Clean Architecture to fetch thw New Work Time
15+
Articles, display article details, and see more about details from url.
16+
517
## Getting Started
618

7-
This project is a starting point for a Flutter application.
19+
## Prerequisites
20+
21+
- Flutter SDK
22+
- Android Studio or VS Code
23+
- Dart plugin for your IDE
24+
25+
## Installing
26+
27+
- Clone the repository ```git clone https://github.com/YAMMEN98/ny-times-flutter-app.git```
28+
- Open the project in Android Studio or VS Code.
29+
- Run the app on an emulator or physical device.
30+
31+
## Feature
32+
33+
- Get all ny times articles.
34+
- Search articles.
35+
- Filter article by ```period```
36+
- Display article details.
37+
- Apply Dark/Light theme.
38+
- Apply localization en/ar languages.
39+
- View Image And Zoom It.
40+
- Create a lane to generate apk automatically when upload code to the main branch.
41+
42+
![Text Coverage](https://github.com/YAMMEN98/ny-times-flutter-app/blob/main/actions.png)
43+
44+
- Apply Unit Testing .
45+
46+
## Built With
47+
48+
- [Flutter](https://github.com/vedranMv/dataDashboard/releases) - The framework used).
49+
- [The New Work a Times API](https://developer.nytimes.com/) - API used for weather data.
50+
51+
## Unit Test
52+
53+
To run test you should follow the steps:
54+
55+
- run command ```flutter test```
56+
- If you want to get coverage file from Unit Test run this.command ```flutter test --coverage```
57+
58+
There is many tools to generate text coverage,
59+
we will use [test_cov_console](https://pub.dev/packages/test_cov_console) to generate coverage
60+
report, follow these steps to run it:
61+
62+
- Run the following command to make sure all flutter library is up-to-date ```flutter pub get```,
63+
- Run the following command to generate lcov.info on coverage
64+
directory ```flutter test --coverage```,
65+
- Run the tool to generate report from lcov.info to the
66+
console ```flutter pub run test_cov_console```,
67+
- You can follow and see more of parameters
68+
in [test_cov_console](https://pub.dev/packages/test_cov_console).
69+
- You Can Output report to CSV file (-c, --csv, -o, --output)
70+
by ```flutter pub run test_cov_console -c --output=coverage/test_coverage.csv```
71+
- Open CSV file by excel and you will see like this result:
872

9-
A few resources to get you started if this is your first Flutter project:
73+
![Text Coverage](https://github.com/YAMMEN98/ny-times-flutter-app/blob/main/test_coverage.png)
1074

11-
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
75+
## Author
1376

14-
For help getting started with Flutter development, view the
15-
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
77+
Yamen Abdullrahman - Senior Flutter Developer;

TODO

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@
99
[] supabase Api provider
1010
[] notification service
1111

12+
[] Test Coverage test_cov_console
13+
[] Test mockito
14+
[] Device Preview
15+
[] Dio cancel token
16+
[*] Dio custom log interceptor
17+
[] Github action
18+
19+
20+
# Photo view to view image and control it
21+
photo_view: ^0.14.0
22+
1223
// TODO: List for start your new project

lib/core/app/di/injector_index.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ import 'package:flutter_template/core/app/service/interface/i_authentication_ser
66
import 'package:flutter_template/core/app/service/interface/i_navigation_service.dart';
77
import 'package:flutter_template/core/app/service/interface/i_network_info_service.dart';
88
import 'package:flutter_template/core/app/service/network_info_service.dart';
9-
import 'package:flutter_template/core/feature/data/data_source/remote/jwt_interceptor.dart';
10-
import 'package:flutter_template/core/feature/presentation/bloc/auth/auth_bloc.dart';
11-
import 'package:flutter_template/core/feature/presentation/bloc/network/network_bloc.dart';
12-
import 'package:flutter_template/core/feature/presentation/state/state_manager.dart';
9+
import 'package:flutter_template/core/shared/data/data_source/remote/jwt_interceptor.dart';
10+
import 'package:flutter_template/core/shared/presentation/bloc/auth/auth_bloc.dart';
11+
import 'package:flutter_template/core/shared/presentation/bloc/network/network_bloc.dart';
12+
import 'package:flutter_template/core/shared/presentation/state/state_manager.dart';
1313
import 'package:get_it/get_it.dart';
1414
import 'package:shared_preferences/shared_preferences.dart';
1515

16-
import '../../feature/data/data_source/local/app_preferences.dart';
17-
import '../../feature/data/data_source/local/app_secure_storage.dart';
18-
import '../../feature/data/data_source/remote/dio_wrapper.dart';
19-
import '../../feature/data/data_source/remote/token_interceptor.dart';
20-
import '../../feature/presentation/cubit/themes_cubit.dart';
16+
import '../../shared/data/data_source/local/app_preferences.dart';
17+
import '../../shared/data/data_source/local/app_secure_storage.dart';
18+
import '../../shared/data/data_source/remote/dio_wrapper.dart';
19+
import '../../shared/data/data_source/remote/token_interceptor.dart';
20+
import '../../shared/presentation/cubit/themes_cubit.dart';
2121
import '../res/const/app_nav_key.dart';
2222
import '../service/navigation_service.dart';
2323

lib/core/app/res/strings/app_language.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ extension LanguageTypeExtension on LanguageType {
2020
return persian;
2121
case LanguageType.turkish:
2222
return turkish;
23-
default:
24-
return english;
2523
}
2624
}
2725
}

lib/core/app/res/theme/custom_theme/app_checkbox_theme.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class AppCheckboxTheme implements IAppTheme<CheckboxThemeData> {
1818
@override
1919
CheckboxThemeData get lightTheme => CheckboxThemeData(
2020
mouseCursor: null,
21-
fillColor: MaterialStateProperty.resolveWith((states) {
22-
if (states.contains(MaterialState.disabled)) {}
23-
if (states.contains(MaterialState.selected)) {}
21+
fillColor: WidgetStateProperty.resolveWith((states) {
22+
if (states.contains(WidgetState.disabled)) {}
23+
if (states.contains(WidgetState.selected)) {}
2424
}),
2525
checkColor: null,
2626
overlayColor: null,

lib/core/app/routes/app_routes.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class RouteGenerator {
55
switch (routeSettings.name) {
66
case AppRoutes.splashRoute:
77
return MaterialPageRoute(
8+
settings: RouteSettings(name: routeSettings.name),
89
builder: (context) {
910
return const UiKitPreview();
1011
},

lib/core/app/service/authentication_service.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
22
import 'package:dartz/dartz.dart';
33
import 'package:flutter_template/core/app/service/interface/i_navigation_service.dart';
4-
import 'package:flutter_template/core/feature/data/data_source/local/app_preferences.dart';
5-
import 'package:flutter_template/core/feature/presentation/bloc/auth/auth_bloc.dart';
6-
7-
import '../../feature/data/data_source/error/failure.dart';
8-
import '../../feature/data/data_source/local/app_secure_storage.dart';
9-
import '../../feature/data/data_source/remote/dio_wrapper.dart';
10-
import '../../feature/data/data_source/remote/safe_call_extensions.dart';
11-
import '../../feature/data/model/token_model.dart';
4+
import 'package:flutter_template/core/shared/data/data_source/local/app_preferences.dart';
5+
import 'package:flutter_template/core/shared/presentation/bloc/auth/auth_bloc.dart';
6+
7+
import '../../shared/data/data_source/error/failure.dart';
8+
import '../../shared/data/data_source/local/app_secure_storage.dart';
9+
import '../../shared/data/data_source/remote/dio_wrapper.dart';
10+
import '../../shared/data/data_source/remote/safe_call_extensions.dart';
11+
import '../../shared/data/model/token_model.dart';
1212
import '../utility/logging_mixin.dart';
1313
import 'interface/i_authentication_service.dart';
1414

0 commit comments

Comments
 (0)