Skip to content

Commit 735f631

Browse files
committed
export api of shadow color
1 parent d8b46cd commit 735f631

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

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,

0 commit comments

Comments
 (0)