Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Lamp extends StatelessWidget {
- final BrightState brightState;
- final ColorState colorState;
- final bool onOffState;
- Lamp({this.brightState, this.colorState, this.onOffState});
- @override
- Widget build(BuildContext context) {
- return Center(
- child: Column(
- children: <Widget>[
- cable(context),
- fitting(context),
- bulb(brightState, colorState, onOffState, context)
- ],
- ),
- );
- }
- Widget cable(BuildContext context) {
- return Container(
- height: Sizes.height(context) * 0.3,
- width: 3.0,
- color: Colors.black,
- );
- }
- Widget fitting(BuildContext context) => Container(
- height: Sizes.height(context) * 0.014,
- width: 12.0,
- decoration: BoxDecoration(
- color: ColorPalette.black,
- borderRadius: BorderRadius.vertical(top: Radius.circular(5.0))),
- );
- Widget bulb(BrightState brightState, ColorState colorState, bool onOff,
- BuildContext context) {
- return Container(
- height: Sizes.width(context) * 0.3,
- width: Sizes.width(context) * 0.3,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: colorState == ColorState.BLUE
- ? [
- ColorPalette.blueGradientTop,
- ColorPalette.blueGradientBottom
- ]
- : [
- ColorPalette.yellowGradientTop,
- ColorPalette.yellowGradientBottom
- ],
- ),
- boxShadow: onOffState ? [
- BoxShadow(
- color: colorState == ColorState.BLUE
- ? ColorPalette.blueGradientBottom.withOpacity(0.5)
- : ColorPalette.yellowGradientBottom.withOpacity(0.5),
- blurRadius: 30.0,
- offset: Offset(0, 0),
- spreadRadius: brightState == BrightState.B100 ? 35.0 : 25.0
- )
- ] : []
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement