Skip to content

Commit fc6e3c8

Browse files
authored
Merge pull request #178 from hacktons/feature-support-shadowcolor
support shadow color
2 parents d8b46cd + ed118e9 commit fc6e3c8

File tree

12 files changed

+40
-15
lines changed

12 files changed

+40
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [3.1.0]
2+
* Bug fix;
3+
* New API to set shadow color
4+
* Fix lint warning
5+
16
## [3.0.0-nullsafety.1]
27
* Prepare for Flutter 2.
38

analysis_options.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ include: package:pedantic/analysis_options.yaml
66
analyzer:
77
exclude:
88
- example/**
9-
enable-experiment:
10-
- non-nullable
9+
- test/**

example/lib/data.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,20 @@ class Data {
4747

4848
static const namedColors = [
4949
NamedColor(Colors.blue, 'Blue'),
50-
NamedColor(Color(0xFFf44336), 'Read'),
50+
NamedColor(Color(0xFFf44336), 'Red'),
5151
NamedColor(Color(0xFF673AB7), 'Purple'),
5252
NamedColor(Color(0xFF009688), 'Green'),
5353
NamedColor(Color(0xFFFFC107), 'Yellow'),
5454
NamedColor(Color(0xFF607D8B), 'Grey'),
5555
];
56+
static const namedShadowColors = [
57+
NamedColor(Colors.black38, 'Black'),
58+
NamedColor(Color(0xeef44336), 'Red'),
59+
NamedColor(Color(0xee673AB7), 'Purple'),
60+
NamedColor(Color(0xee009688), 'Green'),
61+
NamedColor(Color(0xeeFFC107), 'Yellow'),
62+
NamedColor(Color(0xee607D8B), 'Grey'),
63+
];
5664
static const badges = [
5765
null,
5866
Badge('1'),

example/lib/default_appbar_demo.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class _State extends State<DefaultAppBarDemo>
9696
ChoiceValue<TabStyle> _style = kStyles.first;
9797
ChoiceValue<Curve> _curve = Data.curves.first;
9898
Color _barColor = Data.namedColors.first.color;
99+
Color _shadowColor = Data.namedColors.first.color;
99100
Gradient? _gradient = Data.gradients.first;
100101
Badge? _badge;
101102
TabController? _tabController;
@@ -112,6 +113,8 @@ class _State extends State<DefaultAppBarDemo>
112113
var options = <Widget>[
113114
const Heading('Appbar Color'),
114115
ColorsItem(Data.namedColors, _barColor, _onBarColorChanged),
116+
const Heading('Shadow Color'),
117+
ColorsItem(Data.namedShadowColors, _shadowColor, _onShadowColorChanged),
115118
const Heading('Background Gradient'),
116119
GradientItem(Data.gradients, _gradient, _onGradientChanged),
117120
const Heading('Badge Chip'),
@@ -190,6 +193,7 @@ class _State extends State<DefaultAppBarDemo>
190193
items: _tabItems.value,
191194
style: _style.value,
192195
curve: _curve.value,
196+
shadowColor: _shadowColor,
193197
backgroundColor: _barColor,
194198
gradient: _gradient,
195199
controller: _tabController,
@@ -208,6 +212,7 @@ class _State extends State<DefaultAppBarDemo>
208212
items: _tabItems.value,
209213
style: _style.value,
210214
curve: _curve.value,
215+
shadowColor: _shadowColor,
211216
backgroundColor: _barColor,
212217
gradient: _gradient,
213218
controller: _tabController,
@@ -252,6 +257,12 @@ class _State extends State<DefaultAppBarDemo>
252257
});
253258
}
254259

260+
void _onShadowColorChanged(Color value) {
261+
setState(() {
262+
_shadowColor = value;
263+
});
264+
}
265+
255266
void _onGradientChanged(Gradient? value) {
256267
setState(() {
257268
_gradient = value;

lib/src/bar.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ConvexAppBar extends StatefulWidget {
110110
/// Color of the AppBar.
111111
final Color? backgroundColor;
112112

113+
/// Color of the elevation.
114+
final Color? shadowColor;
115+
113116
/// Draw the background with topLeft and topRight corner; Only work work with fixed style
114117
///
115118
/// ![corner image](https://github.com/hacktons/convex_bottom_bar/raw/master/doc/appbar-corner.png)
@@ -196,6 +199,7 @@ class ConvexAppBar extends StatefulWidget {
196199
Color? color,
197200
Color? activeColor,
198201
Color? backgroundColor,
202+
Color? shadowColor,
199203
Gradient? gradient,
200204
double? height,
201205
double? curveSize,
@@ -219,6 +223,7 @@ class ConvexAppBar extends StatefulWidget {
219223
onTapNotify: onTabNotify,
220224
controller: controller,
221225
backgroundColor: backgroundColor,
226+
shadowColor: shadowColor,
222227
count: items.length,
223228
initialActiveIndex: initialActiveIndex,
224229
disableDefaultTabController: disableDefaultTabController ?? false,
@@ -257,6 +262,7 @@ class ConvexAppBar extends StatefulWidget {
257262
this.onTapNotify,
258263
this.controller,
259264
this.backgroundColor,
265+
this.shadowColor,
260266
this.gradient,
261267
this.height,
262268
this.curveSize,
@@ -308,6 +314,7 @@ class ConvexAppBar extends StatefulWidget {
308314
Color? color,
309315
Color? activeColor,
310316
Color? backgroundColor,
317+
Color? shadowColor,
311318
Gradient? gradient,
312319
double? height,
313320
double? curveSize,
@@ -339,6 +346,7 @@ class ConvexAppBar extends StatefulWidget {
339346
color: color,
340347
activeColor: activeColor,
341348
backgroundColor: backgroundColor,
349+
shadowColor: shadowColor,
342350
gradient: gradient,
343351
height: height,
344352
curveSize: curveSize,
@@ -553,6 +561,7 @@ class ConvexAppBarState extends State<ConvexAppBar>
553561
width: widget.curveSize ?? CONVEX_SIZE,
554562
height: widget.curveSize ?? CONVEX_SIZE,
555563
color: widget.backgroundColor ?? Colors.blue,
564+
shadowColor: widget.shadowColor ?? Colors.black38,
556565
gradient: widget.gradient,
557566
sigma: widget.elevation ?? ELEVATION,
558567
leftPercent: percent,

lib/src/painter.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
import 'package:flutter/material.dart';
18-
import 'package:flutter/widgets.dart';
1918

2019
import 'convex_shape.dart';
2120
import 'reused_gradient.dart';

lib/src/style/fixed_circle_tab_style.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import 'dart:ui';
1817
import 'package:flutter/material.dart';
1918

2019
import '../item.dart';

lib/src/style/fixed_tab_style.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import 'dart:ui';
18-
1917
import 'package:flutter/material.dart';
2018

2119
import '../item.dart';

lib/src/style/inner_builder.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import 'dart:ui';
18-
1917
import 'package:flutter/cupertino.dart';
2018

2119
import '../bar.dart';

lib/src/style/transition_container_builder.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import 'dart:math';
1818

19-
import 'package:flutter/animation.dart';
2019
import 'package:flutter/cupertino.dart';
2120

2221
import 'transition_container.dart';

0 commit comments

Comments
 (0)