Skip to content

Commit

Permalink
Merge pull request #2051 from jonataslaw/4.6.0
Browse files Browse the repository at this point in the history
bump to 4.6.0
  • Loading branch information
jonataslaw committed Dec 13, 2021
2 parents ddec87b + c8517d2 commit 57ec329
Show file tree
Hide file tree
Showing 31 changed files with 88 additions and 81 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
## [4.5.1] - Big Update
## [4.6.0]
Add useInheritedMediaQuery to GetMaterialApp and GetCupertinoApp (@davidhole)
Add Circular reveal Transition (@parmarravi)
Add request to failed response (@heftekharm)
Fix internationalization with only country code (@codercengiz)
Add GetTickerProviderStateMixin when multiple AnimationController objects are used (@NatsuOnFire)
Add the followRedirects and maxRedirects fields to the Request object (@wei53881)
Fix to rx.trigger fires twice (@gslender)
Add proxy setting support to GetConnect (@jtans)
Fix markAsDirty used on permanent controllers (@zenalex)
Update Korean readme (@dumbokim)


## [4.5.1]
Fix Snackbar when it have action and icon the same time

## [4.5.0] - Big Update
To have a context-free, page-agnostic snackbar, we used OverlayRoute to display a partial route.
To have a page-agnostic snackbar, we used OverlayRoute to display a partial route.
However this had several problems:

1: There was no possibility to close the page without closing the snackbar
Expand Down
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

Expand Down
2 changes: 0 additions & 2 deletions example/lib/pages/home/presentation/views/home_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:get/get.dart';

Expand Down
2 changes: 1 addition & 1 deletion example/lib/shared/logger/logger_utils.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Logger {
mixin Logger {
// Sample of abstract logging function
static void write(String text, {bool isError = false}) {
Future.microtask(() => print('** $text. isError: [$isError]'));
Expand Down
23 changes: 11 additions & 12 deletions lib/get_connect/connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,17 @@ class GetConnect extends GetConnectInterface {

@override
GetHttpClient get httpClient => _httpClient ??= GetHttpClient(
userAgent: userAgent,
sendUserAgent: sendUserAgent,
timeout: timeout,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
maxAuthRetries: maxAuthRetries,
allowAutoSignedCert: allowAutoSignedCert,
baseUrl: baseUrl,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy
);
userAgent: userAgent,
sendUserAgent: sendUserAgent,
timeout: timeout,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
maxAuthRetries: maxAuthRetries,
allowAutoSignedCert: allowAutoSignedCert,
baseUrl: baseUrl,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy);

@override
Future<Response<T>> get<T>(
Expand Down
14 changes: 7 additions & 7 deletions lib/get_connect/http/src/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ class GetHttpClient {
int requestNumber = 1,
Map<String, String>? headers,
}) async {
var request = await handler();
var request = await handler();

headers?.forEach((key, value) {
request.headers[key] = value;
});
headers?.forEach((key, value) {
request.headers[key] = value;
});

if (authenticate) await _modifier.authenticator!(request);
final newRequest = await _modifier.modifyRequest<T>(request);
if (authenticate) await _modifier.authenticator!(request);
final newRequest = await _modifier.modifyRequest<T>(request);

_httpClient.timeout = timeout;
_httpClient.timeout = timeout;
try {
var response = await _httpClient.send<T>(newRequest);

Expand Down
1 change: 0 additions & 1 deletion lib/get_instance/src/extension_instance.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '../../get_core/src/get_interface.dart';
import '../../route_manager.dart';
import 'get_instance.dart';

Expand Down
3 changes: 0 additions & 3 deletions lib/get_navigation/src/extension_navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import '../../get_utils/get_utils.dart';
import '../get_navigation.dart';
import 'dialog/dialog_route.dart';
import 'root/parse_route.dart';
import 'root/root_controller.dart';
import 'routes/transitions_type.dart';
import 'snackbar/snackbar_controller.dart';

/// It replaces the Flutter Navigator, but needs no context.
/// You can to use navigator.push(YourRoute()) rather
Expand Down
1 change: 0 additions & 1 deletion lib/get_navigation/src/nav2/router_outlet.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';

import '../../../get.dart';
import 'get_router_delegate.dart';

class RouterOutlet<TDelegate extends RouterDelegate<T>, T extends Object>
extends StatefulWidget {
Expand Down
1 change: 0 additions & 1 deletion lib/get_navigation/src/root/get_cupertino_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import '../../../get_instance/get_instance.dart';
import '../../../get_state_manager/get_state_manager.dart';
import '../../../get_utils/get_utils.dart';
import '../../get_navigation.dart';
import 'root_controller.dart';

class GetCupertinoApp extends StatelessWidget {
final GlobalKey<NavigatorState>? navigatorKey;
Expand Down
2 changes: 0 additions & 2 deletions lib/get_navigation/src/root/get_material_app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

Expand All @@ -7,7 +6,6 @@ import '../../../get_instance/get_instance.dart';
import '../../../get_state_manager/get_state_manager.dart';
import '../../../get_utils/get_utils.dart';
import '../../get_navigation.dart';
import 'root_controller.dart';

class GetMaterialApp extends StatelessWidget {
final GlobalKey<NavigatorState>? navigatorKey;
Expand Down
1 change: 0 additions & 1 deletion lib/get_navigation/src/root/parse_route.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../../get_navigation.dart';
import '../routes/get_route.dart';

class RouteDecoder {
final List<GetPage> treeBranch;
Expand Down
5 changes: 0 additions & 5 deletions lib/get_navigation/src/root/root_controller.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import 'package:flutter/material.dart';

import '../../../get.dart';
import '../../../get_state_manager/get_state_manager.dart';
import '../../../get_utils/get_utils.dart';
import '../routes/custom_transition.dart';
import '../routes/observers/route_observer.dart';
import '../routes/transitions_type.dart';

class GetMaterialController extends SuperController {
bool testMode = false;
Expand Down
5 changes: 2 additions & 3 deletions lib/get_navigation/src/routes/circular_reveal_clipper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class CircularRevealClipper extends CustomClipper<Path> {

@override
Path getClip(Size size) {
final Offset center = this.centerAlignment?.alongSize(size) ??
this.centerOffset ??
final center = centerAlignment?.alongSize(size) ??
centerOffset ??
Offset(size.width / 2, size.height / 2);
final minRadius = this.minRadius ?? 0;
final maxRadius = this.maxRadius ?? calcMaxRadius(size, center);
Expand All @@ -44,4 +44,3 @@ class CircularRevealClipper extends CustomClipper<Path> {
return sqrt(w * w + h * h);
}
}

3 changes: 0 additions & 3 deletions lib/get_navigation/src/routes/default_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import 'package:flutter/material.dart';

import '../../../get.dart';
import '../router_report.dart';
import 'custom_transition.dart';
import 'get_transition_mixin.dart';
import 'route_middleware.dart';
import 'transitions_type.dart';

mixin PageRouteReportMixin<T> on Route<T> {
@override
Expand Down
6 changes: 3 additions & 3 deletions lib/get_navigation/src/routes/default_transitions.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'circular_reveal_clipper.dart';

class LeftToRightFadeTransition {
Widget buildTransitions(
BuildContext context,
Expand Down Expand Up @@ -185,7 +187,6 @@ class SizeTransitions {
}
}


class CircularRevealTransition {
Widget buildTransitions(
BuildContext context,
Expand All @@ -197,7 +198,7 @@ class CircularRevealTransition {
return ClipPath(
clipper: CircularRevealClipper(
fraction: animation.value,
centerAlignment: Alignment.center,
centerAlignment: Alignment.center,
centerOffset: Offset.zero,
minRadius: 0,
maxRadius: 800,
Expand All @@ -206,4 +207,3 @@ class CircularRevealTransition {
);
}
}

4 changes: 0 additions & 4 deletions lib/get_navigation/src/routes/get_route.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import '../../../get_core/src/get_main.dart';
import '../../../get_instance/get_instance.dart';
import '../../get_navigation.dart';
import 'custom_transition.dart';
import 'transitions_type.dart';

class GetPage<T> extends Page<T> {
final GetPageBuilder page;
Expand Down
15 changes: 7 additions & 8 deletions lib/get_navigation/src/routes/get_transition_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:flutter/material.dart';

import '../../../get.dart';
import 'default_transitions.dart';
import 'transitions_type.dart';

const double _kBackGestureWidth = 20.0;
const int _kMaxDroppedSwipePageForwardAnimationTime =
Expand Down Expand Up @@ -619,8 +618,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
onStartPopGesture: () => _startPopGesture<T>(route),
child: child)
: child);
case Transition.ciruclarReveal:

case Transition.circularReveal:
return CircularRevealTransition().buildTransitions(
context,
route.curve,
Expand All @@ -629,11 +628,11 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation,
route.popGesture ?? Get.defaultPopGesture
? CupertinoBackGestureDetector<T>(
gestureWidth: route.gestureWidth?.call(context) ??
_kBackGestureWidth,
enabledCallback: () => _isPopGestureEnabled<T>(route),
onStartPopGesture: () => _startPopGesture<T>(route),
child: child)
gestureWidth: route.gestureWidth?.call(context) ??
_kBackGestureWidth,
enabledCallback: () => _isPopGestureEnabled<T>(route),
onStartPopGesture: () => _startPopGesture<T>(route),
child: child)
: child);

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import '../../../../instance_manager.dart';
import '../../../get_navigation.dart';
import '../../dialog/dialog_route.dart';
import '../../router_report.dart';
import '../default_route.dart';

/// Extracts the name of a route based on it's instance type
/// or null if not possible.
Expand Down
3 changes: 2 additions & 1 deletion lib/get_navigation/src/routes/transitions_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ enum Transition {
cupertino,
cupertinoDialog,
size,
native
circularReveal,
native,
}

typedef GetPageBuilder = Widget Function();
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider {
@override
Ticker createTicker(TickerCallback onTick) {
_tickers ??= <_WidgetTicker>{};
final result = _WidgetTicker(onTick, this, debugLabel: kDebugMode ? 'created by ${describeIdentity(this)}' : null);
final result = _WidgetTicker(onTick, this,
debugLabel: kDebugMode ? 'created by ${describeIdentity(this)}' : null);
_tickers!.add(result);
return result;
}
Expand Down Expand Up @@ -143,13 +144,13 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider {
ErrorSummary('$this was disposed with an active Ticker.'),
ErrorDescription(
'$runtimeType created a Ticker via its GetTickerProviderStateMixin, but at the time '
'dispose() was called on the mixin, that Ticker was still active. All Tickers must '
'be disposed before calling super.dispose().',
'dispose() was called on the mixin, that Ticker was still active. All Tickers must '
'be disposed before calling super.dispose().',
),
ErrorHint(
'Tickers used by AnimationControllers '
'should be disposed by calling dispose() on the AnimationController itself. '
'Otherwise, the ticker will leak.',
'should be disposed by calling dispose() on the AnimationController itself. '
'Otherwise, the ticker will leak.',
),
ticker.describeForError('The offending ticker was'),
]);
Expand All @@ -160,11 +161,11 @@ mixin GetTickerProviderStateMixin on GetxController implements TickerProvider {
}());
super.onClose();
}

}

class _WidgetTicker extends Ticker {
_WidgetTicker(TickerCallback onTick, this._creator, { String? debugLabel }) : super(onTick, debugLabel: debugLabel);
_WidgetTicker(TickerCallback onTick, this._creator, {String? debugLabel})
: super(onTick, debugLabel: debugLabel);

final GetTickerProviderStateMixin _creator;

Expand Down
1 change: 0 additions & 1 deletion lib/get_state_manager/src/simple/get_responsive.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/widgets.dart';

import '../../../get.dart';
import 'get_view.dart';

mixin GetResponsiveMixin on Widget {
ResponsiveScreen get screen;
Expand Down
2 changes: 1 addition & 1 deletion lib/get_state_manager/src/simple/list_notifier.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:collection';
import 'package:flutter/foundation.dart';

import 'package:flutter/widgets.dart';

// This callback remove the listener on addListener function
Expand Down
2 changes: 1 addition & 1 deletion lib/get_state_manager/src/simple/mixin_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';

import '../../get_state_manager.dart';
import 'get_state.dart';

class MixinBuilder<T extends GetxController> extends StatelessWidget {
@required
Expand Down
1 change: 0 additions & 1 deletion lib/get_utils/src/extensions/context_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import '../platform/platform.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/get_utils/src/extensions/internacionalization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ extension Trans on String {
Map<String, String>? get _getSimilarLanguageTranslation {
final translationsWithNoCountry = Get.translations
.map((key, value) => MapEntry(key.split("_").first, value));
final containsKey =
translationsWithNoCountry.containsKey(Get.locale!.languageCode.split("_").first);
final containsKey = translationsWithNoCountry
.containsKey(Get.locale!.languageCode.split("_").first);

if (!containsKey) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: get
description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
version: 4.5.1
version: 4.6.0
homepage: https://github.com/jonataslaw/getx

environment:
Expand Down
6 changes: 4 additions & 2 deletions test/instance/get_instance_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: avoid_classes_with_only_static_members

import 'package:flutter_test/flutter_test.dart';
import 'package:get/get.dart';

Expand Down Expand Up @@ -146,8 +148,8 @@ void main() {
Get.create<Service>(() => Api());
final ct1 = Get.find<Service>();
final ct2 = Get.find<Service>();
expect(ct1 is Service, true);
expect(ct2 is Service, true);
// expect(ct1 is Service, true);
// expect(ct2 is Service, true);
expect(ct1 == ct2, false);
Get.reset();
});
Expand Down
Loading

0 comments on commit 57ec329

Please sign in to comment.