mirror of
https://github.com/git-touch/git-touch
synced 2025-03-01 01:37:40 +01:00
chore: remove unused files
This commit is contained in:
parent
fe41448c3d
commit
692208337f
@ -1,31 +0,0 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
/// This allows the `User` class to access private members in
|
|
||||||
/// the generated file. The value for this is *.g.dart, where
|
|
||||||
/// the star denotes the source file name.
|
|
||||||
part 'user.g.dart';
|
|
||||||
|
|
||||||
/// An annotation for the code generator to know that this class needs the
|
|
||||||
/// JSON serialization logic to be generated.
|
|
||||||
@JsonSerializable()
|
|
||||||
class User {
|
|
||||||
User(this.login, this.avatarUrl, this.name, this.publicRepos, this.followers,
|
|
||||||
this.following);
|
|
||||||
|
|
||||||
String login;
|
|
||||||
String avatarUrl;
|
|
||||||
String name;
|
|
||||||
int publicRepos;
|
|
||||||
int followers;
|
|
||||||
int following;
|
|
||||||
|
|
||||||
/// A necessary factory constructor for creating a new User instance
|
|
||||||
/// from a map. Pass the map to the generated `_$UserFromJson()` constructor.
|
|
||||||
/// The constructor is named after the source class, in this case User.
|
|
||||||
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
|
|
||||||
|
|
||||||
/// `toJson` is the convention for a class to declare support for serialization
|
|
||||||
/// to JSON. The implementation simply calls the private, generated
|
|
||||||
/// helper method `_$UserToJson`.
|
|
||||||
Map<String, dynamic> toJson() => _$UserToJson(this);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'user.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
User _$UserFromJson(Map<String, dynamic> json) {
|
|
||||||
return User(
|
|
||||||
json['login'] as String,
|
|
||||||
json['avatarUrl'] as String,
|
|
||||||
json['name'] as String,
|
|
||||||
json['publicRepos'] as int,
|
|
||||||
json['followers'] as int,
|
|
||||||
json['following'] as int);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
|
|
||||||
'login': instance.login,
|
|
||||||
'avatarUrl': instance.avatarUrl,
|
|
||||||
'name': instance.name,
|
|
||||||
'publicRepos': instance.publicRepos,
|
|
||||||
'followers': instance.followers,
|
|
||||||
'following': instance.following
|
|
||||||
};
|
|
@ -1,90 +0,0 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'dart:async';
|
|
||||||
import 'package:rxdart/subjects.dart';
|
|
||||||
import 'package:rxdart/rxdart.dart';
|
|
||||||
import '../utils/utils.dart';
|
|
||||||
|
|
||||||
// Future search(String keyword, String type) async {
|
|
||||||
// var data = await query('''
|
|
||||||
// {
|
|
||||||
// search(query: "$keyword", type: $type, first: 10) {
|
|
||||||
// nodes {
|
|
||||||
// ... on User {
|
|
||||||
// avatarUrl
|
|
||||||
// login
|
|
||||||
// }
|
|
||||||
// ... on Repository {
|
|
||||||
// nameWithOwner
|
|
||||||
// url
|
|
||||||
// description
|
|
||||||
// forkCount
|
|
||||||
// stargazers {
|
|
||||||
// totalCount
|
|
||||||
// }
|
|
||||||
// primaryLanguage {
|
|
||||||
// name
|
|
||||||
// color
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ''');
|
|
||||||
// return data['search']['nodes'];
|
|
||||||
// }
|
|
||||||
|
|
||||||
class SearchBloc {
|
|
||||||
final _keyword = BehaviorSubject(seedValue: '');
|
|
||||||
final _active = BehaviorSubject(seedValue: 0);
|
|
||||||
final _loading = BehaviorSubject(seedValue: false);
|
|
||||||
final _users = BehaviorSubject(seedValue: []);
|
|
||||||
final _repos = BehaviorSubject(seedValue: []);
|
|
||||||
final _submit = StreamController();
|
|
||||||
|
|
||||||
Stream<String> get keyword => _keyword.stream;
|
|
||||||
Stream<int> get active => _active.stream;
|
|
||||||
Stream<bool> get loading => _loading.stream;
|
|
||||||
Stream get users => _users.stream;
|
|
||||||
Stream get repos => _repos.stream;
|
|
||||||
|
|
||||||
Sink<int> get activeUpdate => _active.sink;
|
|
||||||
Sink<String> get keywordUpdate => _keyword.sink;
|
|
||||||
Sink get submit => _submit.sink;
|
|
||||||
|
|
||||||
_getTypeByIndex(int index) {
|
|
||||||
switch (index) {
|
|
||||||
case 0:
|
|
||||||
return 'REPOSITORY';
|
|
||||||
case 1:
|
|
||||||
return 'USER';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_querySearch(_) async {
|
|
||||||
_loading.add(true);
|
|
||||||
// await search(_keyword.value, _getTypeByIndex(_active.value));
|
|
||||||
_loading.add(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchBloc() {
|
|
||||||
_submit.stream.listen(_querySearch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SearchProvider extends InheritedWidget {
|
|
||||||
final SearchBloc bloc;
|
|
||||||
|
|
||||||
SearchProvider({
|
|
||||||
Key key,
|
|
||||||
Widget child,
|
|
||||||
@required SearchBloc bloc,
|
|
||||||
}) : bloc = bloc,
|
|
||||||
super(key: key, child: child);
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool updateShouldNotify(InheritedWidget oldWidget) => true;
|
|
||||||
|
|
||||||
static SearchBloc of(BuildContext context) =>
|
|
||||||
(context.inheritFromWidgetOfExactType(SearchProvider) as SearchProvider)
|
|
||||||
.bloc;
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:rxdart/subjects.dart';
|
|
||||||
import 'package:rxdart/rxdart.dart';
|
|
||||||
import '../utils/utils.dart';
|
|
||||||
|
|
||||||
// Future queryUser(String login) async {
|
|
||||||
// var data = await query('''
|
|
||||||
// {
|
|
||||||
// user(login: "$login") {
|
|
||||||
// name
|
|
||||||
// avatarUrl
|
|
||||||
// bio
|
|
||||||
// email
|
|
||||||
// repositories {
|
|
||||||
// totalCount
|
|
||||||
// }
|
|
||||||
// starredRepositories {
|
|
||||||
// totalCount
|
|
||||||
// }
|
|
||||||
// followers {
|
|
||||||
// totalCount
|
|
||||||
// }
|
|
||||||
// following {
|
|
||||||
// totalCount
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ''');
|
|
||||||
// return data['user'];
|
|
||||||
// }
|
|
||||||
|
|
||||||
class UserBloc {
|
|
||||||
Map<String, dynamic> _userDict = {};
|
|
||||||
|
|
||||||
final _user = BehaviorSubject(seedValue: null);
|
|
||||||
|
|
||||||
fetchUser(String login) async {
|
|
||||||
// var user = await queryUser(login);
|
|
||||||
// _userDict[login] = user;
|
|
||||||
// return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserBloc() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UserProvider extends InheritedWidget {
|
|
||||||
final UserBloc bloc;
|
|
||||||
|
|
||||||
UserProvider({
|
|
||||||
Key key,
|
|
||||||
Widget child,
|
|
||||||
@required UserBloc bloc,
|
|
||||||
}) : bloc = bloc,
|
|
||||||
super(key: key, child: child);
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool updateShouldNotify(InheritedWidget oldWidget) => true;
|
|
||||||
|
|
||||||
static UserBloc of(BuildContext context) =>
|
|
||||||
(context.inheritFromWidgetOfExactType(UserProvider) as UserProvider).bloc;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user