Skip to content

Commit

Permalink
Feat--wrapper-material (#106)
Browse files Browse the repository at this point in the history
Signed-off-by: CaiJingLong <cjl_spy@163.com>
  • Loading branch information
CaiJingLong authored Nov 17, 2023
1 parent 922a953 commit 3904903
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/runnable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
11 changes: 10 additions & 1 deletion lib/src/widget/oktoast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class _OKToastState extends State<OKToast> {
],
);

final Widget w = Directionality(
Widget w = Directionality(
textDirection: widget.textDirection,
child: overlay,
);
Expand All @@ -102,6 +102,15 @@ class _OKToastState extends State<OKToast> {
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,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 3904903

Please sign in to comment.