feat: add artemis

This commit is contained in:
Rongjian Zhang 2019-11-06 21:27:37 +08:00
parent 1b7578f4b4
commit 716924d27d
4 changed files with 35 additions and 1 deletions

View File

@ -21,3 +21,15 @@ targets:
# include_if_null: true
# nullable: true
# use_wrappers: false
artemis:
options:
schema_mapping:
- schema: lib/github.schema.json
output: lib/graphql/gh_user.dart
queries_glob: lib/graphql/user.graphql
- schema: lib/github.schema.json
output: lib/graphql/gh_repository.dart
queries_glob: lib/graphql/repository.graphql
scalar_mapping:
- graphql_type: URI
dart_type: String

View File

@ -1,6 +1,8 @@
import 'dart:io';
import 'dart:convert';
import 'dart:async';
// import 'package:artemis/client.dart';
// import 'package:gql_http_link/gql_http_link.dart';
import 'package:fimber/fimber.dart';
import 'package:http/http.dart' as http;
import 'package:uni_links/uni_links.dart';
@ -179,6 +181,20 @@ class AuthModel with ChangeNotifier {
var _timeoutDuration = Duration(seconds: 10);
// var _timeoutDuration = Duration(seconds: 1);
// ArtemisClient _gqlClient;
// ArtemisClient get gqlClient {
// if (token == null) return null;
// if (_gqlClient == null) {
// _gqlClient = ArtemisClient.fromLink(
// HttpLink(_apiPrefix + '/graphql',
// defaultHeaders: {HttpHeaders.authorizationHeader: 'token $token'}),
// );
// }
// return _gqlClient;
// }
Future<dynamic> query(String query, [String _token]) async {
if (_token == null) {
_token = token;

View File

@ -89,7 +89,7 @@ class ThemeModel with ChangeNotifier {
int get theme => _theme;
bool get ready => _theme != null;
Brightness _brightness = Brightness.dark;
Brightness _brightness = Brightness.light;
Brightness get brightness => _brightness;
Future<void> setBrightness(Brightness v) async {
// TODO: Save

View File

@ -37,6 +37,8 @@ dependencies:
uri: ^0.11.3
fimber: ^0.3.2
photo_view: ^0.7.0
gql: ^0.11.1
artemis: ^2.0.7
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
@ -48,6 +50,10 @@ dev_dependencies:
build_runner: ^1.7.1
json_serializable: ^3.2.2
# dependencies_overrides:
# flutter_highlight:
# path: ../pd4d10/highlight/flutter_highlight
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec