mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-14 12:43:16 +00:00
dd81053f42
rewrote OnboardingPage: * decomposed into separate widgets * now content stays centered on wide screens (set so width won't expand further than 480px) * pageController is now properly disposed * added some more code changes to * main (error widget builder) * brand_header (centerTitle instead of empty actions list) * console_page (listener callback fix, used gaps instead of SizedBox'es, added keys to list items) * service_page (just cleaner build method) * removed some dead code Co-authored-by: Aliaksei Tratseuski <aliaksei.tratseuski@gmail.com> Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/444 Co-authored-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org> Co-committed-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
76 lines
1.7 KiB
Dart
76 lines
1.7 KiB
Dart
import 'package:graphql/client.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
/// TODO(misterfourtytwo): add equality override
|
|
class Message {
|
|
Message({this.text, this.severity = MessageSeverity.normal})
|
|
: time = DateTime.now();
|
|
Message.warn({this.text})
|
|
: severity = MessageSeverity.warning,
|
|
time = DateTime.now();
|
|
|
|
final String? text;
|
|
final DateTime time;
|
|
final MessageSeverity severity;
|
|
|
|
static final DateFormat _formatter = DateFormat('hh:mm');
|
|
String get timeString => _formatter.format(time);
|
|
}
|
|
|
|
enum MessageSeverity {
|
|
normal,
|
|
warning,
|
|
}
|
|
|
|
class RestApiRequestMessage extends Message {
|
|
RestApiRequestMessage({
|
|
this.method,
|
|
this.uri,
|
|
this.data,
|
|
this.headers,
|
|
}) : super(text: 'request-uri: $uri\nheaders: $headers\ndata: $data');
|
|
|
|
final String? method;
|
|
final Uri? uri;
|
|
final String? data;
|
|
final Map<String, dynamic>? headers;
|
|
}
|
|
|
|
class RestApiResponseMessage extends Message {
|
|
RestApiResponseMessage({
|
|
this.method,
|
|
this.uri,
|
|
this.statusCode,
|
|
this.data,
|
|
}) : super(text: 'response-uri: $uri\ncode: $statusCode\ndata: $data');
|
|
|
|
final String? method;
|
|
final Uri? uri;
|
|
final int? statusCode;
|
|
final String? data;
|
|
}
|
|
|
|
class GraphQlResponseMessage extends Message {
|
|
GraphQlResponseMessage({
|
|
this.data,
|
|
this.errors,
|
|
this.context,
|
|
}) : super(text: 'GraphQL Response\ndata: $data');
|
|
|
|
final Map<String, dynamic>? data;
|
|
final List<GraphQLError>? errors;
|
|
final Context? context;
|
|
}
|
|
|
|
class GraphQlRequestMessage extends Message {
|
|
GraphQlRequestMessage({
|
|
this.operation,
|
|
this.variables,
|
|
this.context,
|
|
}) : super(text: 'GraphQL Request\noperation: $operation');
|
|
|
|
final Operation? operation;
|
|
final Map<String, dynamic>? variables;
|
|
final Context? context;
|
|
}
|