Skip to content

muhammadmateen027/github_issues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Github Issues

coverage coverage coverage coverage coverage coverage coverage coverage coverage coverage style: very good analysis


Getting Started πŸš€

In this project we will discuss:


Problem πŸ’₯

Build an application to load flutter related issues from github and navigate to the detail page on selected issues. In the detail page, preview the actual issue with the status.

Solution πŸ’ͺ

The solution is design so user can have nice experience and can scroll infinite.

You will notice a full page loading indicator. It's just for showing that, if we build a common Builder then we can use in Interceptor and can be shown whenever required.

State management

coverage coverage coverage

  • Thir project is using BLoC's 7.0.0 version as State management library. But as Bloc team is working on newer version that will help to remove boilerplate of writing mapEventsToSate and bloc will look like this:
    class IssueDetailBloc extends Bloc<IssueDetailEvent, IssueDetailState> {
        IssueDetailBloc(): super(IssueDetailInitial()) {
          // Load issue detail.
          on<LoadIssueDetail>(_loadIssueDetail);
        }
        
        // perform your action here
        void _loadIssueDetail(LoadIssueDetail event, Emit<IssueDetailState> emit) async {
            // your business logic will be here to handle state and event
        }
    }

Log controller

coverage

  • Sentry.io is being used to log all errors and issues in a server.

Flavours πŸš€

This project contains 3 flavors:

coverage coverage coverage

Before run application you need to create .env file in app directory and add these varaibles:

#Logs Controller --  create your key (https://sentry.io/welcome/) and add
SENTRY_IO=

API_URL=https://api.github.com/repos/flutter/flutter

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
$ flutter run --flavor development --target lib/main_development.dart

# Staging
$ flutter run --flavor staging --target lib/main_staging.dart

# Production
$ flutter run --flavor production --target lib/main_production.dart

*Github Issues works on iOS and Android.


Working with Translations 🌐

This project relies on flutter_localizations and follows the official internationalization guide for Flutter.

Note: For demo purposes, I have added two locales but have same strings. We can update and even add more locales to support.

Adding Strings

  1. To add a new localizable string, open the app_en.arb file at lib/l10n/arb/app_en.arb.
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}
  1. Then add a new key/value and description
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    },
    "helloWorld": "Hello World",
    "@helloWorld": {
        "description": "Hello World Text"
    }
}
  1. Use the new string
import 'package:github_issues/l10n/l10n.dart';

@override
Widget build(BuildContext context) {
  final l10n = context.l10n;
  return Text(l10n.helloWorld);
}

Adding Supported Locales

Update the CFBundleLocalizations array in the Info.plist at ios/Runner/Info.plist to include the new locale.

    ...

<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>

        ...

Adding Translations

  1. For each supported locale, add a new ARB file in lib/l10n/arb.
β”œβ”€β”€ l10n
β”‚   β”œβ”€β”€ arb
β”‚   β”‚   β”œβ”€β”€ app_en.arb
β”‚   β”‚   └── app_es.arb
β”‚   β”‚   └── ----------
  1. Add the translated strings to each .arb file:

app_en.arb

{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}

app_es.arb

{
    "@@locale": "es",
    "counterAppBarTitle": "Contador",
    "@counterAppBarTitle": {
        "description": "Texto mostrado en la AppBar de la pΓ‘gina del contador"
    }
}

Dependencies πŸ’‰

We like to highlight some major dependencies:

  • dio: ^4.0.0 -- A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc.
  • freezed: ^0.14.2 -- Welcome to Freezed, yet another code generator for unions/pattern-matching/copy.
  • get_it: ^7.1.3 -- This is a simple Service Locator for Dart and Flutter projects with some additional goodies
  • pull_to_refresh: ^2.0.0 -- A widget provided to the flutter scroll component drop-down refresh and pull up load.support android and ios
  • sentry_flutter: ^5.1.0 -- This package includes support to native crashes through Sentry's native SDKs: (Android and iOS). It will capture errors in the native layer, including (Java/Kotlin/C/C++ for Android and Objective-C/Swift for iOS).

Tests πŸ§ͺ

In this repository we have covered one widget and one unit test to show as a demo.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors