Last active
June 21, 2019 17:40
-
-
Save handicraftsman/bcf04e0998177e3bd29b39ab01702769 to your computer and use it in GitHub Desktop.
Just some GUI stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang aurakit | |
(require aurakit/layout) | |
(require aurakit/material) | |
(define main-view-state% | |
(class ak-state% | |
(super-new) | |
(init-field [counter 0]) | |
(define/public (increment [value 1]) | |
(update (lambda () | |
(set! counter (+ counter value))))) | |
(define/public (decrement [value 1]) | |
(update (lambda () | |
(set! counter (- counter value)))))) | |
(define (main-view . children) | |
(define state (new main-view-state%)) | |
(ak-view | |
#:name "Hello, World!" | |
#:state state | |
#:build (lambda (ctx) | |
(mt-scaffold | |
#:appbar (mt-appbar | |
#:title "Hello, World!") | |
(lt-center | |
(lt-vbox | |
(mt-text "~a" (get-field counter state))) | |
(lt-hbox | |
(mt-button | |
#:label "Increment" | |
#:on-click (lambda (ctx) | |
(send state increment))) | |
(mt-button | |
#:label "Decrement" | |
#:on-click (lambda (ctx) | |
(send state decrement))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment