Skip to content

Commit

Permalink
🎉 It's support Null Safety now
Browse files Browse the repository at this point in the history
  • Loading branch information
nslogx committed Mar 12, 2021
1 parent bc6eee8 commit 1107bac
Show file tree
Hide file tree
Showing 21 changed files with 295 additions and 407 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [3.0.0] - 2021.03.12

* 🎉 It's support Null Safety now

## [2.2.2] - 2020.12.28

* fixed [#77](https://github.com/kokohuang/flutter_easyloading/issues/77)
Expand Down
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

```yaml
dependencies:
flutter_easyloading: ^2.2.2
flutter_easyloading: ^3.0.0
```
## 导入
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
flutter_easyloading: ^2.2.2
flutter_easyloading: ^3.0.0
```
## Import
Expand Down

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

3 changes: 1 addition & 2 deletions example/lib/custom_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ class CustomAnimation extends EasyLoadingAnimation {
AnimationController controller,
AlignmentGeometry alignment,
) {
double opacity = controller?.value ?? 0;
return Opacity(
opacity: opacity,
opacity: controller.value,
child: RotationTransition(
turns: controller,
child: child,
Expand Down
34 changes: 13 additions & 21 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
MyHomePage({Key? key, this.title}) : super(key: key);

final String title;
final String? title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Timer _timer;
double _progress;
Timer? _timer;
late double _progress;

@override
void initState() {
Expand All @@ -75,7 +75,7 @@ class _MyHomePageState extends State<MyHomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
title: Text(widget.title ?? ''),
),
body: Container(
width: MediaQuery.of(context).size.width,
Expand All @@ -89,8 +89,7 @@ class _MyHomePageState extends State<MyHomePage> {
runAlignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
children: <Widget>[
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('open test page'),
onPressed: () {
_timer?.cancel();
Expand All @@ -102,17 +101,15 @@ class _MyHomePageState extends State<MyHomePage> {
);
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('dismiss'),
onPressed: () async {
_timer?.cancel();
await EasyLoading.dismiss();
print('EasyLoading dismiss');
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('show'),
onPressed: () async {
_timer?.cancel();
Expand All @@ -123,8 +120,7 @@ class _MyHomePageState extends State<MyHomePage> {
print('EasyLoading show');
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('showToast'),
onPressed: () {
_timer?.cancel();
Expand All @@ -133,33 +129,29 @@ class _MyHomePageState extends State<MyHomePage> {
);
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('showSuccess'),
onPressed: () async {
_timer?.cancel();
await EasyLoading.showSuccess('Great Success!');
print('EasyLoading showSuccess');
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('showError'),
onPressed: () {
_timer?.cancel();
EasyLoading.showError('Failed with Error');
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('showInfo'),
onPressed: () {
_timer?.cancel();
EasyLoading.showInfo('Useful Information.');
},
),
FlatButton(
textColor: Colors.blue,
TextButton(
child: Text('showProgress'),
onPressed: () {
_progress = 0;
Expand Down
11 changes: 7 additions & 4 deletions example/lib/test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:dio/dio.dart';

class TestPage extends StatefulWidget {
@override
Expand Down Expand Up @@ -30,7 +31,10 @@ class _TestPageState extends State<TestPage> {
void loadData() async {
try {
await EasyLoading.show();
Response response = await Dio().get('https://github.com');
HttpClient client = HttpClient();
HttpClientRequest request =
await client.getUrl(Uri.parse('https://github.com'));
HttpClientResponse response = await request.close();
print(response);
await EasyLoading.dismiss();
} catch (e) {
Expand All @@ -46,8 +50,7 @@ class _TestPageState extends State<TestPage> {
title: Text('Test Page'),
),
body: Center(
child: FlatButton(
textColor: Colors.blue,
child: TextButton(
child: Text('loadData'),
onPressed: () {
loadData();
Expand Down
Loading

0 comments on commit 1107bac

Please sign in to comment.