| import core.widgets; |
| import core.material; |
| |
| widget Counter = Container( |
| color: 0xFF66AACC, |
| child: Center( |
| child: Button( |
| child: Padding( |
| padding: [ 20.0 ], |
| child: Text(text: data.counter, style: { |
| fontSize: 56.0, |
| color: 0xFF000000, |
| }), |
| ), |
| onPressed: event 'increment' { }, |
| ), |
| ), |
| ); |
| |
| widget Button { down: false } = GestureDetector( |
| onTap: args.onPressed, |
| onTapDown: set state.down = true, |
| onTapUp: set state.down = false, |
| onTapCancel: set state.down = false, |
| child: Container( |
| duration: 50, |
| margin: switch state.down { |
| false: [ 0.0, 0.0, 2.0, 2.0 ], |
| true: [ 2.0, 2.0, 0.0, 0.0 ], |
| }, |
| padding: [ 12.0, 8.0 ], |
| decoration: { |
| type: "shape", |
| shape: { |
| type: "stadium", |
| side: { width: 1.0 }, |
| }, |
| gradient: { |
| type: "linear", |
| begin: { x: -0.5, y: -0.25 }, |
| end: { x: 0.0, y: 0.5 }, |
| colors: [ 0xFFFFFF99, 0xFFEEDD00 ], |
| stops: [ 0.0, 1.0 ], |
| tileMode: "mirror", |
| }, |
| shadows: switch state.down { |
| false: [ { blurRadius: 4.0, spreadRadius: 0.5, offset: { x: 1.0, y: 1.0, } } ], |
| default: [], |
| }, |
| }, |
| child: DefaultTextStyle( |
| style: { |
| color: 0xFF000000, |
| fontSize: 32.0, |
| }, |
| child: args.child, |
| ), |
| ), |
| ); |