Jonny Borges
Committed by GitHub

Merge pull request #2714 from jonataslaw/release-candidate-2

add animations to changelog
## [5.0.0-release-candidate-2]
This version adds built-in support for animation in Flutter in an easy, clear way, and without having to create a StatefulWidget with controllers and animations. All you need to do is call the name of the animation.
If you want to add a "fadeIn" effect to any widget, simply add .fadeIn() to the end of it.
```dart
Container(
color: Colors.blue,
height: 100,
width: 100,
).fadeIn(),
```
https://user-images.githubusercontent.com/35742643/221383556-075a0b71-1617-4a31-a3c7-1acc68732f59.mp4
Maybe you want to merge two or more animations, just concatenate them at the end of the widget.
```dart
Container(
color: Colors.blue,
height: 100,
width: 100,
).fadeIn().bounce(begin: -0.8, end: 0.3),
```
https://user-images.githubusercontent.com/35742643/221383613-9044c92f-7c6b-48c4-aa79-0a0c20d4068a.mp4
Creating animation sequences in Flutter is one of the most painful things to do with the framework. You need to create tons of AnimationControllers. Well, using GetX 5 you just need to tell your animation that it is sequential. Just like that.
```dart
const FlutterLogo(size: 110)
.bounce(begin: -0.8, end: 0.4)
.fadeIn()
.spin(isSequential: true)
.wobble(isSequential: true, begin: 0, end: 8)
.flip(isSequential: true)
.fadeOut(isSequential: true),
```
Result:
https://user-images.githubusercontent.com/35742643/221393968-20cb2411-516b-44a7-8b85-45090bece532.mp4
## [5.0.0-release-candidate]
Refactor StateManager, RouteManager and InstanceManager from scratch
Fixed Bugs
... ...
... ... @@ -39,7 +39,7 @@ class GetHttpClient {
bool errorSafety = true;
final HttpRequestBase _httpClient;
final IClient _httpClient;
final GetModifier _modifier;
... ... @@ -58,12 +58,14 @@ class GetHttpClient {
List<TrustedCertificate>? trustedCertificates,
bool withCredentials = false,
String Function(Uri url)? findProxy,
}) : _httpClient = createHttp(
allowAutoSignedCert: allowAutoSignedCert,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy,
),
IClient? customClient,
}) : _httpClient = customClient ??
createHttp(
allowAutoSignedCert: allowAutoSignedCert,
trustedCertificates: trustedCertificates,
withCredentials: withCredentials,
findProxy: findProxy,
),
_modifier = GetModifier();
void addAuthenticator<T>(RequestModifier<T> auth) {
... ... @@ -86,7 +88,7 @@ class GetHttpClient {
_modifier.removeResponseModifier<T>(interceptor);
}
Uri _createUri(String? url, Map<String, dynamic>? query) {
Uri createUri(String? url, Map<String, dynamic>? query) {
if (baseUrl != null) {
url = baseUrl! + url!;
}
... ... @@ -155,7 +157,7 @@ class GetHttpClient {
bodyStream = _trackProgress(bodyBytes, uploadProgress);
}
final uri = _createUri(url, query);
final uri = createUri(url, query);
return Request<T>(
method: method,
url: uri,
... ... @@ -277,7 +279,7 @@ class GetHttpClient {
) {
final headers = <String, String>{};
_setSimpleHeaders(headers, contentType);
final uri = _createUri(url, query);
final uri = createUri(url, query);
return Future.value(Request<T>(
method: 'get',
... ... @@ -333,7 +335,7 @@ class GetHttpClient {
) {
final headers = <String, String>{};
_setSimpleHeaders(headers, contentType);
final uri = _createUri(url, query);
final uri = createUri(url, query);
return Request<T>(
method: 'delete',
... ... @@ -525,67 +527,6 @@ class GetHttpClient {
}
}
// Future<Response<T>> download<T>(
// String url,
// String path, {
// Map<String, String> headers,
// String contentType = 'application/octet-stream',
// Map<String, dynamic> query,
// }) async {
// try {
// var response = await _performRequest<T>(
// () => _get<T>(url, contentType, query, null),
// headers: headers,
// );
// response.bodyBytes.listen((value) {});
// return response;
// } on Exception catch (e) {
// if (!errorSafety) {
// throw GetHttpException(e.toString());
// }
// return Future.value(Response<T>(
// statusText: 'Can not connect to server. Reason: $e',
// ));
// }
// int byteCount = 0;
// int totalBytes = httpResponse.contentLength;
// Directory appDocDir = await getApplicationDocumentsDirectory();
// String appDocPath = appDocDir.path;
// File file = File(path);
// var raf = file.openSync(mode: FileMode.write);
// Completer completer = Completer<String>();
// httpResponse.listen(
// (data) {
// byteCount += data.length;
// raf.writeFromSync(data);
// if (onDownloadProgress != null) {
// onDownloadProgress(byteCount, totalBytes);
// }
// },
// onDone: () {
// raf.closeSync();
// completer.complete(file.path);
// },
// onError: (e) {
// raf.closeSync();
// file.deleteSync();
// completer.completeError(e);
// },
// cancelOnError: true,
// );
// return completer.future;
// }
Future<Response<T>> delete<T>(String url,
{Map<String, String>? headers,
String? contentType,
... ...
... ... @@ -9,8 +9,8 @@ import '../../response/response.dart';
import '../interface/request_base.dart';
import '../utils/body_decoder.dart';
/// A `dart:html` implementation of `HttpRequestBase`.
class HttpRequestImpl implements HttpRequestBase {
/// A `dart:html` implementation of `IClient`.
class HttpRequestImpl implements IClient {
HttpRequestImpl({
bool allowAutoSignedCert = true,
List<TrustedCertificate>? trustedCertificates,
... ... @@ -51,7 +51,7 @@ class HttpRequestImpl implements HttpRequestBase {
var reader = FileReader();
reader.onLoad.first.then((_) async {
var bodyBytes = BodyBytesStream.fromBytes(reader.result as List<int>);
var bodyBytes = (reader.result as List<int>).toStream();
final stringBody =
await bodyBytesToString(bodyBytes, xhr.responseHeaders);
... ...
... ... @@ -2,7 +2,7 @@ import '../../request/request.dart';
import '../../response/response.dart';
/// Abstract interface of [HttpRequestImpl].
abstract class HttpRequestBase {
abstract class IClient {
/// Sends an HTTP [Request].
Future<Response<T>> send<T>(Request<T> request);
... ...
... ... @@ -8,8 +8,8 @@ import '../../response/response.dart';
import '../interface/request_base.dart';
import '../utils/body_decoder.dart';
/// A `dart:io` implementation of `HttpRequestBase`.
class HttpRequestImpl extends HttpRequestBase {
/// A `dart:io` implementation of `IClient`.
class HttpRequestImpl extends IClient {
io.HttpClient? _httpClient;
io.SecurityContext? _securityContext;
... ...
... ... @@ -5,7 +5,7 @@ import '../utils/body_decoder.dart';
typedef MockClientHandler = Future<Response> Function(Request request);
class MockClient extends HttpRequestBase {
class MockClient extends IClient {
/// The handler for than transforms request on response
final MockClientHandler _handler;
... ... @@ -16,7 +16,7 @@ class MockClient extends HttpRequestBase {
@override
Future<Response<T>> send<T>(Request<T> request) async {
var requestBody = await request.bodyBytes.toBytes();
var bodyBytes = BodyBytesStream.fromBytes(requestBody);
var bodyBytes = requestBody.toStream();
var response = await _handler(request);
... ...
... ... @@ -3,7 +3,7 @@ import '../../request/request.dart';
import '../../response/response.dart';
import '../interface/request_base.dart';
class HttpRequestImpl extends HttpRequestBase {
class HttpRequestImpl extends IClient {
HttpRequestImpl({
bool allowAutoSignedCert = true,
List<TrustedCertificate>? trustedCertificates,
... ...
import '../http/stub/file_decoder_stub.dart'
if (dart.library.html) '../http/html/file_decoder_html.dart'
if (dart.library.io) '../http/io/file_decoder_io.dart';
import '../request/request.dart';
class MultipartFile {
... ... @@ -11,7 +10,7 @@ class MultipartFile {
this.contentType = 'application/octet-stream',
}) : _bytes = fileToBytes(data) {
_length = _bytes.length;
_stream = BodyBytesStream.fromBytes(_bytes);
_stream = _bytes.toStream();
}
final List<int> _bytes;
... ...
... ... @@ -68,7 +68,7 @@ class Request<T> {
return Request._(
url: url,
method: method,
bodyBytes: bodyBytes ??= BodyBytesStream.fromBytes(const []),
bodyBytes: bodyBytes ??= <int>[].toStream(),
headers: Map.from(headers),
followRedirects: followRedirects,
maxRedirects: maxRedirects,
... ... @@ -113,9 +113,11 @@ class Request<T> {
}
}
extension BodyBytesStream on Stream<List<int>> {
static Stream<List<int>> fromBytes(List<int> bytes) => Stream.value(bytes);
extension StreamExt on List<int> {
Stream<List<int>> toStream() => Stream.value(this).asBroadcastStream();
}
extension BodyBytesStream on Stream<List<int>> {
Future<Uint8List> toBytes() {
var completer = Completer<Uint8List>();
var sink = ByteConversionSink.withCallback(
... ...
... ... @@ -10,85 +10,6 @@ typedef OnTap = void Function(GetSnackBar snack);
typedef SnackbarStatusCallback = void Function(SnackbarStatus? status);
@Deprecated('use GetSnackBar')
class GetBar extends GetSnackBar {
const GetBar({
Key? key,
String? title,
String? message,
Widget? titleText,
Widget? messageText,
Widget? icon,
bool shouldIconPulse = true,
double? maxWidth,
EdgeInsets margin = const EdgeInsets.all(0.0),
EdgeInsets padding = const EdgeInsets.all(16),
double borderRadius = 0.0,
Color? borderColor,
double borderWidth = 1.0,
Color backgroundColor = const Color(0xFF303030),
Color? leftBarIndicatorColor,
List<BoxShadow>? boxShadows,
Gradient? backgroundGradient,
Widget? mainButton,
OnTap? onTap,
Duration? duration,
bool isDismissible = true,
DismissDirection? dismissDirection,
bool showProgressIndicator = false,
AnimationController? progressIndicatorController,
Color? progressIndicatorBackgroundColor,
Animation<Color>? progressIndicatorValueColor,
SnackPosition snackPosition = SnackPosition.bottom,
SnackStyle snackStyle = SnackStyle.floating,
Curve forwardAnimationCurve = Curves.easeOutCirc,
Curve reverseAnimationCurve = Curves.easeOutCirc,
Duration animationDuration = const Duration(seconds: 1),
double barBlur = 0.0,
double overlayBlur = 0.0,
Color overlayColor = Colors.transparent,
Form? userInputForm,
SnackbarStatusCallback? snackbarStatus,
}) : super(
key: key,
title: title,
message: message,
titleText: titleText,
messageText: messageText,
icon: icon,
shouldIconPulse: shouldIconPulse,
maxWidth: maxWidth,
margin: margin,
padding: padding,
borderRadius: borderRadius,
borderColor: borderColor,
borderWidth: borderWidth,
backgroundColor: backgroundColor,
leftBarIndicatorColor: leftBarIndicatorColor,
boxShadows: boxShadows,
backgroundGradient: backgroundGradient,
mainButton: mainButton,
onTap: onTap,
duration: duration,
isDismissible: isDismissible,
dismissDirection: dismissDirection,
showProgressIndicator: showProgressIndicator,
progressIndicatorController: progressIndicatorController,
progressIndicatorBackgroundColor: progressIndicatorBackgroundColor,
progressIndicatorValueColor: progressIndicatorValueColor,
snackPosition: snackPosition,
snackStyle: snackStyle,
forwardAnimationCurve: forwardAnimationCurve,
reverseAnimationCurve: reverseAnimationCurve,
animationDuration: animationDuration,
barBlur: barBlur,
overlayBlur: overlayBlur,
overlayColor: overlayColor,
userInputForm: userInputForm,
snackbarStatus: snackbarStatus,
);
}
class GetSnackBar extends StatefulWidget {
/// A callback for you to listen to the different Snack status
final SnackbarStatusCallback? snackbarStatus;
... ...
... ... @@ -3,10 +3,6 @@ import '../get_utils/get_utils.dart';
extension GetDynamicUtils on dynamic {
bool? get isBlank => GetUtils.isBlank(this);
@Deprecated(
'isNullOrBlank is deprecated and cannot be used, use "isBlank" instead')
bool? get isNullOrBlank => GetUtils.isNullOrBlank(this);
void printError(
{String info = '', Function logFunction = GetUtils.printFunction}) =>
// ignore: unnecessary_this
... ...
// TODO: resolve platform/desktop by JS browser agent.
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
... ...
name: get
description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
version: 5.0.0-release-candidate
version: 5.0.0-release-candidate-2
homepage: https://github.com/jonataslaw/getx
environment:
... ...