Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Mirai Network Request & Network Result #267

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/mirai/lib/mirai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ library mirai;

export 'package:mirai/src/action_parsers/action_parsers.dart';
export 'package:mirai/src/framework/framework.dart';
export 'package:mirai/src/network/network.dart';
export 'package:mirai/src/parsers/parsers.dart';
export 'package:mirai/src/utils/utils.dart';
export 'package:mirai_framework/mirai_framework.dart';
2 changes: 1 addition & 1 deletion packages/mirai/lib/src/action_parsers/action_parsers.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export 'package:mirai/src/action_parsers/mirai_dialog_action/mirai_dialog_action.dart';
export 'package:mirai/src/action_parsers/mirai_modal_bottom_sheet_action/mirai_modal_bottom_sheet_action_parser.dart';
export 'package:mirai/src/action_parsers/mirai_navigate_action/mirai_navigate_action_parser.dart';
export 'package:mirai/src/action_parsers/mirai_network_request/mirai_network_request.dart';
export 'package:mirai/src/action_parsers/mirai_none_action/mirai_none_action_parser.dart';
export 'package:mirai/src/action_parsers/mirai_request_action/mirai_request_action_parser.dart';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mirai/src/network/mirai_request.dart';
import 'package:mirai/src/action_parsers/mirai_network_request/mirai_network_request.dart';

export 'mirai_dialog_action_parser.dart';

Expand All @@ -11,7 +11,7 @@ part 'mirai_dialog_action.g.dart';
class MiraiDialogAction with _$MiraiDialogAction {
const factory MiraiDialogAction({
Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
@Default(true) bool barrierDismissible,
String? barrierColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MiraiDialogAction _$MiraiDialogActionFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$MiraiDialogAction {
Map<String, dynamic>? get widget => throw _privateConstructorUsedError;
MiraiRequest? get request => throw _privateConstructorUsedError;
MiraiNetworkRequest? get request => throw _privateConstructorUsedError;
String? get assetPath => throw _privateConstructorUsedError;
bool get barrierDismissible => throw _privateConstructorUsedError;
String? get barrierColor => throw _privateConstructorUsedError;
Expand All @@ -44,15 +44,15 @@ abstract class $MiraiDialogActionCopyWith<$Res> {
@useResult
$Res call(
{Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
bool barrierDismissible,
String? barrierColor,
String? barrierLabel,
bool useSafeArea,
TraversalEdgeBehavior? traversalEdgeBehavior});

$MiraiRequestCopyWith<$Res>? get request;
$MiraiNetworkRequestCopyWith<$Res>? get request;
}

/// @nodoc
Expand Down Expand Up @@ -85,7 +85,7 @@ class _$MiraiDialogActionCopyWithImpl<$Res, $Val extends MiraiDialogAction>
request: freezed == request
? _value.request
: request // ignore: cast_nullable_to_non_nullable
as MiraiRequest?,
as MiraiNetworkRequest?,
assetPath: freezed == assetPath
? _value.assetPath
: assetPath // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -115,12 +115,12 @@ class _$MiraiDialogActionCopyWithImpl<$Res, $Val extends MiraiDialogAction>

@override
@pragma('vm:prefer-inline')
$MiraiRequestCopyWith<$Res>? get request {
$MiraiNetworkRequestCopyWith<$Res>? get request {
if (_value.request == null) {
return null;
}

return $MiraiRequestCopyWith<$Res>(_value.request!, (value) {
return $MiraiNetworkRequestCopyWith<$Res>(_value.request!, (value) {
return _then(_value.copyWith(request: value) as $Val);
});
}
Expand All @@ -136,7 +136,7 @@ abstract class _$$MiraiDialogActionImplCopyWith<$Res>
@useResult
$Res call(
{Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
bool barrierDismissible,
String? barrierColor,
Expand All @@ -145,7 +145,7 @@ abstract class _$$MiraiDialogActionImplCopyWith<$Res>
TraversalEdgeBehavior? traversalEdgeBehavior});

@override
$MiraiRequestCopyWith<$Res>? get request;
$MiraiNetworkRequestCopyWith<$Res>? get request;
}

/// @nodoc
Expand Down Expand Up @@ -176,7 +176,7 @@ class __$$MiraiDialogActionImplCopyWithImpl<$Res>
request: freezed == request
? _value.request
: request // ignore: cast_nullable_to_non_nullable
as MiraiRequest?,
as MiraiNetworkRequest?,
assetPath: freezed == assetPath
? _value.assetPath
: assetPath // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -233,7 +233,7 @@ class _$MiraiDialogActionImpl implements _MiraiDialogAction {
}

@override
final MiraiRequest? request;
final MiraiNetworkRequest? request;
@override
final String? assetPath;
@override
Expand Down Expand Up @@ -306,7 +306,7 @@ class _$MiraiDialogActionImpl implements _MiraiDialogAction {
abstract class _MiraiDialogAction implements MiraiDialogAction {
const factory _MiraiDialogAction(
{final Map<String, dynamic>? widget,
final MiraiRequest? request,
final MiraiNetworkRequest? request,
final String? assetPath,
final bool barrierDismissible,
final String? barrierColor,
Expand All @@ -321,7 +321,7 @@ abstract class _MiraiDialogAction implements MiraiDialogAction {
@override
Map<String, dynamic>? get widget;
@override
MiraiRequest? get request;
MiraiNetworkRequest? get request;
@override
String? get assetPath;
@override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MiraiDialogActionParser extends MiraiActionParser<MiraiDialogAction> {
return _showDialog(
context,
model,
Mirai.fromNetwork(model.request!),
Mirai.fromNetwork(context: context, request: model.request!),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mirai/src/network/mirai_request.dart';
import 'package:mirai/src/action_parsers/mirai_network_request/mirai_network_request.dart';
import 'package:mirai/src/parsers/mirai_border/mirai_border.dart';
import 'package:mirai/src/parsers/mirai_box_constraints/mirai_box_constraints.dart';

Expand All @@ -10,7 +10,7 @@ part 'mirai_modal_bottom_sheet_action.g.dart';
class MiraiModalBottomSheetAction with _$MiraiModalBottomSheetAction {
const factory MiraiModalBottomSheetAction({
Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
String? backgroundColor,
String? barrierLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MiraiModalBottomSheetAction _$MiraiModalBottomSheetActionFromJson(
/// @nodoc
mixin _$MiraiModalBottomSheetAction {
Map<String, dynamic>? get widget => throw _privateConstructorUsedError;
MiraiRequest? get request => throw _privateConstructorUsedError;
MiraiNetworkRequest? get request => throw _privateConstructorUsedError;
String? get assetPath => throw _privateConstructorUsedError;
String? get backgroundColor => throw _privateConstructorUsedError;
String? get barrierLabel => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -53,7 +53,7 @@ abstract class $MiraiModalBottomSheetActionCopyWith<$Res> {
@useResult
$Res call(
{Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
String? backgroundColor,
String? barrierLabel,
Expand All @@ -68,7 +68,7 @@ abstract class $MiraiModalBottomSheetActionCopyWith<$Res> {
bool? showDragHandle,
bool useSafeArea});

$MiraiRequestCopyWith<$Res>? get request;
$MiraiNetworkRequestCopyWith<$Res>? get request;
$MiraiBorderCopyWith<$Res>? get shape;
$MiraiBoxConstraintsCopyWith<$Res>? get constraints;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ class _$MiraiModalBottomSheetActionCopyWithImpl<$Res,
request: freezed == request
? _value.request
: request // ignore: cast_nullable_to_non_nullable
as MiraiRequest?,
as MiraiNetworkRequest?,
assetPath: freezed == assetPath
? _value.assetPath
: assetPath // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -169,12 +169,12 @@ class _$MiraiModalBottomSheetActionCopyWithImpl<$Res,

@override
@pragma('vm:prefer-inline')
$MiraiRequestCopyWith<$Res>? get request {
$MiraiNetworkRequestCopyWith<$Res>? get request {
if (_value.request == null) {
return null;
}

return $MiraiRequestCopyWith<$Res>(_value.request!, (value) {
return $MiraiNetworkRequestCopyWith<$Res>(_value.request!, (value) {
return _then(_value.copyWith(request: value) as $Val);
});
}
Expand Down Expand Up @@ -215,7 +215,7 @@ abstract class _$$MiraiModalBottomSheetActionImplCopyWith<$Res>
@useResult
$Res call(
{Map<String, dynamic>? widget,
MiraiRequest? request,
MiraiNetworkRequest? request,
String? assetPath,
String? backgroundColor,
String? barrierLabel,
Expand All @@ -231,7 +231,7 @@ abstract class _$$MiraiModalBottomSheetActionImplCopyWith<$Res>
bool useSafeArea});

@override
$MiraiRequestCopyWith<$Res>? get request;
$MiraiNetworkRequestCopyWith<$Res>? get request;
@override
$MiraiBorderCopyWith<$Res>? get shape;
@override
Expand Down Expand Up @@ -275,7 +275,7 @@ class __$$MiraiModalBottomSheetActionImplCopyWithImpl<$Res>
request: freezed == request
? _value.request
: request // ignore: cast_nullable_to_non_nullable
as MiraiRequest?,
as MiraiNetworkRequest?,
assetPath: freezed == assetPath
? _value.assetPath
: assetPath // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -369,7 +369,7 @@ class _$MiraiModalBottomSheetActionImpl
}

@override
final MiraiRequest? request;
final MiraiNetworkRequest? request;
@override
final String? assetPath;
@override
Expand Down Expand Up @@ -480,7 +480,7 @@ abstract class _MiraiModalBottomSheetAction
implements MiraiModalBottomSheetAction {
const factory _MiraiModalBottomSheetAction(
{final Map<String, dynamic>? widget,
final MiraiRequest? request,
final MiraiNetworkRequest? request,
final String? assetPath,
final String? backgroundColor,
final String? barrierLabel,
Expand All @@ -501,7 +501,7 @@ abstract class _MiraiModalBottomSheetAction
@override
Map<String, dynamic>? get widget;
@override
MiraiRequest? get request;
MiraiNetworkRequest? get request;
@override
String? get assetPath;
@override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MiraiModalBottomSheetActionParser
return _showModalBottomSheet(
context,
model,
Mirai.fromNetwork(model.request!),
Mirai.fromNetwork(context: context, request: model.request!),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mirai/src/network/mirai_request.dart';
import 'package:mirai/src/action_parsers/mirai_network_request/mirai_network_request.dart';

part 'mirai_navigate_action.freezed.dart';
part 'mirai_navigate_action.g.dart';
Expand All @@ -20,7 +20,7 @@ class MiraiNavigateAction with _$MiraiNavigateAction {
const MiraiNavigateAction._();

factory MiraiNavigateAction({
MiraiRequest? request,
MiraiNetworkRequest? request,
Map<String, dynamic>? widgetJson,
String? assetPath,
String? routeName,
Expand Down
Loading
Loading