diff --git a/.github/workflows/runnable.yml b/.github/workflows/runnable.yml index 8c6a9b8..30cf5c2 100644 --- a/.github/workflows/runnable.yml +++ b/.github/workflows/runnable.yml @@ -10,17 +10,17 @@ on: jobs: analyze: - name: Analyze on ${{ matrix.os }} + name: Analyze on ${{ matrix.os }} with flutter ${{ matrix.version }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ ubuntu-latest ] version: [ - '', # Stable - '3.0.0' # Minimum + '3.16.0', # Stable + '3.7.0' # Minimum ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: 'adopt' @@ -49,7 +49,7 @@ jobs: matrix: os: [ macos-latest ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: 'adopt' @@ -71,7 +71,7 @@ jobs: matrix: os: [ ubuntu-latest ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: 'adopt' diff --git a/CHANGELOG.md b/CHANGELOG.md index eb18783..7b3b0d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change log +## 3.4.0 + +Feat: + +- Wrapper a `Material` widget when the `OKToast` widget is not wrapped with `Material`. +- The min support of flutter SDK version to 3.7.0. + ## 3.3.2+1 - Fix `Theatre` constructor and get rid of `View` for compatibilities. (#103) diff --git a/lib/src/widget/oktoast.dart b/lib/src/widget/oktoast.dart index 87bd02b..a51c5ed 100644 --- a/lib/src/widget/oktoast.dart +++ b/lib/src/widget/oktoast.dart @@ -89,7 +89,7 @@ class _OKToastState extends State { ], ); - final Widget w = Directionality( + Widget w = Directionality( textDirection: widget.textDirection, child: overlay, ); @@ -102,6 +102,15 @@ class _OKToastState extends State { final OKToastAnimationBuilder animationBuilder = widget.animationBuilder ?? _defaultBuildAnimation; + final haveMaterialParent = Material.maybeOf(context) != null; + + if (!haveMaterialParent) { + w = Material( + color: Colors.transparent, + child: w, + ); + } + return ToastTheme( backgroundColor: widget.backgroundColor, radius: widget.radius, diff --git a/pubspec.yaml b/pubspec.yaml index ebd0443..83e5748 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: oktoast description: A pure flutter toast library, support custom style/widget, easy achieve the same effect with native toasts. repository: https://github.com/OpenFlutter/flutter_oktoast -version: 3.3.2+1 +version: 3.4.0 environment: sdk: '>=2.17.0 <4.0.0' - flutter: '>=3.0.0' + flutter: '>=3.7.0' dependencies: flutter: