Skip to content

Commit fa48d20

Browse files
authored
Merge pull request #217 from payam-zahedi/fix/box-shadow-param
fix: add missing box shadow param to the ToastBuilder
2 parents be304bf + 711c974 commit fa48d20

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

example/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ dependencies:
1818
dart_style: ^3.0.1
1919
flutter_svg: ^2.0.6
2020
font_awesome_flutter: ^10.4.0
21-
flutter_sticky_header: ^0.7.0
21+
flutter_sticky_header: ^0.8.0
2222
highlight: ^0.7.0
2323
flutter_highlight: ^0.7.0
2424
responsive_framework: ^0.2.0
2525
flutter_riverpod: ^2.3.6
26-
freezed_annotation: ^2.2.0
26+
freezed_annotation: ^3.0.0
2727
iconsax_flutter: ^1.0.0
2828
url_launcher: ^6.1.12
2929
google_fonts: ^6.2.1
@@ -41,9 +41,9 @@ dev_dependencies:
4141
flutter_test:
4242
sdk: flutter
4343

44-
flutter_lints: ^5.0.0
44+
flutter_lints: ^6.0.0
4545
build_runner: ^2.4.4
46-
freezed: ^2.3.4
46+
freezed: ^3.0.6
4747
drift_dev: ^2.21.0
4848

4949
flutter:

lib/src/built_in/built_in_builder.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ class BuiltInToastBuilder extends StatelessWidget {
239239
padding: padding,
240240
borderRadius: borderRadius,
241241
borderSide: borderSide,
242+
boxShadow: boxShadow,
242243
progressIndicatorStrokeWidth: progressBarTheme?.linearMinHeight,
243244
progressIndicatorTheme: progressBarTheme,
244245
),

lib/src/built_in/layout/standard/style/style.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ abstract class BaseStandardToastStyle extends Equatable {
7373
providedValues?.descriptionMaxLines ?? defaults.descriptionMaxLines;
7474

7575
double get elevation => 0.0;
76-
List<BoxShadow> get boxShadow => [];
76+
List<BoxShadow> get boxShadow =>
77+
providedValues?.boxShadow ?? defaults.boxShadow;
7778

7879
double get progressIndicatorStrokeWidth =>
7980
providedValues?.progressIndicatorStrokeWidth ??
@@ -109,6 +110,7 @@ class DefaultStyleValues extends StandardStyleValues {
109110
BorderRadiusGeometry borderRadius = const BorderRadius.all(
110111
Radius.circular(12),
111112
),
113+
List<BoxShadow> boxShadow = const [],
112114
int titleMaxLines = 2,
113115
int descriptionMaxLines = 6,
114116
double progressIndicatorStrokeWidth = 2.0,
@@ -119,6 +121,7 @@ class DefaultStyleValues extends StandardStyleValues {
119121
padding: padding,
120122
borderSide: borderSide,
121123
borderRadius: borderRadius,
124+
boxShadow: boxShadow,
122125
titleMaxLines: titleMaxLines,
123126
descriptionMaxLines: descriptionMaxLines,
124127
progressIndicatorStrokeWidth: progressIndicatorStrokeWidth,
@@ -136,7 +139,8 @@ class DefaultStyleValues extends StandardStyleValues {
136139
BorderSide get borderSide => super.borderSide!;
137140
@override
138141
BorderRadiusGeometry get borderRadius => super.borderRadius!;
139-
142+
@override
143+
List<BoxShadow> get boxShadow => super.boxShadow!;
140144
@override
141145
int get titleMaxLines => super.titleMaxLines!;
142146

@@ -155,6 +159,7 @@ class DefaultStyleValues extends StandardStyleValues {
155159
padding,
156160
borderSide,
157161
borderRadius,
162+
boxShadow,
158163
titleMaxLines,
159164
descriptionMaxLines,
160165
progressIndicatorStrokeWidth,
@@ -169,6 +174,7 @@ class StandardStyleValues extends Equatable {
169174
this.padding,
170175
this.borderSide,
171176
this.borderRadius,
177+
this.boxShadow,
172178
this.titleMaxLines,
173179
this.descriptionMaxLines,
174180
this.progressIndicatorStrokeWidth,
@@ -181,7 +187,7 @@ class StandardStyleValues extends Equatable {
181187
final EdgeInsetsGeometry? padding;
182188
final BorderSide? borderSide;
183189
final BorderRadiusGeometry? borderRadius;
184-
190+
final List<BoxShadow>? boxShadow;
185191
final int? titleMaxLines;
186192
final int? descriptionMaxLines;
187193

@@ -199,6 +205,7 @@ class StandardStyleValues extends Equatable {
199205
padding,
200206
borderSide,
201207
borderRadius,
208+
boxShadow,
202209
titleMaxLines,
203210
descriptionMaxLines,
204211
progressIndicatorStrokeWidth,

test/src/built_in/layout/standard/style/style_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ void main() {
1212
padding: EdgeInsets.all(8.0),
1313
borderSide: BorderSide(color: Colors.red),
1414
borderRadius: BorderRadius.all(Radius.circular(8.0)),
15+
boxShadow: [
16+
BoxShadow(
17+
color: Colors.red,
18+
blurRadius: 10,
19+
offset: Offset(0, 10),
20+
),
21+
],
22+
titleMaxLines: 1,
23+
descriptionMaxLines: 2,
1524
progressIndicatorStrokeWidth: 4.0,
1625
);
1726

@@ -21,6 +30,15 @@ void main() {
2130
expect(values.padding, EdgeInsets.all(8.0));
2231
expect(values.borderSide, BorderSide(color: Colors.red));
2332
expect(values.borderRadius, BorderRadius.all(Radius.circular(8.0)));
33+
expect(values.boxShadow, [
34+
BoxShadow(
35+
color: Colors.red,
36+
blurRadius: 10,
37+
offset: Offset(0, 10),
38+
),
39+
]);
40+
expect(values.titleMaxLines, 1);
41+
expect(values.descriptionMaxLines, 2);
2442
expect(values.progressIndicatorStrokeWidth, 4.0);
2543
});
2644

@@ -54,6 +72,7 @@ void main() {
5472
expect(values.padding, EdgeInsetsDirectional.fromSTEB(20, 16, 12, 16));
5573
expect(values.borderSide, BorderSide(color: Colors.black12));
5674
expect(values.borderRadius, BorderRadius.all(Radius.circular(12)));
75+
expect(values.boxShadow, []);
5776
expect(values.progressIndicatorStrokeWidth, 2.0);
5877
});
5978
});

0 commit comments

Comments
 (0)