Skip to content

Commit

Permalink
Merge pull request #18 from tadak1/feature/fix-flutter3-warning
Browse files Browse the repository at this point in the history
Fixed a warning in flutter 3.0.0
  • Loading branch information
Kurogoma4D authored May 23, 2022
2 parents 5e8cbe9 + f66c3e9 commit d33e05d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1.1
### FIX
- Fixed warnings for Flutter3.0.0
- Wrapped code containing warnings in `_ambiguate()`

## 1.1.0
### FEAT
- Added `InAppNotification.dismiss()` method that hides notification programmatically.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.1.1"
matcher:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion lib/src/size_listenable_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:flutter/widgets.dart';

// reference: https://qiita.com/najeira/items/0ff716971184042b1434

T? _ambiguate<T>(T? value) => value;

typedef SizeChangedCallback = void Function(Size size);

class SizeListenableContainer extends SingleChildRenderObjectWidget {
Expand Down Expand Up @@ -42,7 +44,7 @@ class _SizeListenableRenderObject extends RenderProxyBox {
}

void _callback(Size size) {
SchedulerBinding.instance!.addPostFrameCallback((_) {
_ambiguate(SchedulerBinding.instance)!.addPostFrameCallback((_) {
onSizeChanged(size);
});
}
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: in_app_notification
description: A Flutter package to show custom in-app notification with any Widgets.
version: 1.1.0
version: 1.1.1
repository: https://github.com/cb-cloud/flutter_in_app_notification

environment:
Expand Down
4 changes: 3 additions & 1 deletion test/in_app_notification_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:in_app_notification/in_app_notification.dart';
import 'package:in_app_notification/src/size_listenable_container.dart';

T? _ambiguate<T>(T? value) => value;

void main() {
Widget base(Key key) => MaterialApp(
home: InAppNotification(
Expand All @@ -17,7 +19,7 @@ void main() {

setUp(() {
TestWidgetsFlutterBinding.ensureInitialized();
WidgetsBinding.instance!.resetEpoch();
_ambiguate(WidgetsBinding.instance)!.resetEpoch();
});

testWidgets('SizeListenableContainer test.', (tester) async {
Expand Down

0 comments on commit d33e05d

Please sign in to comment.