lib/scarpe/flow.rb in scarpe-0.1.0 vs lib/scarpe/flow.rb in scarpe-0.2.0
- old
+ new
@@ -1,16 +1,19 @@
-module Scarpe
- class Flow
- include Scarpe::Container
-
- attr_reader :app
- def initialize(app, &block)
- @app = app
- @app.append(render)
- append(&block)
- end
-
- def render
- "<div style='display: flex; flex-direction: row' id=#{object_id}></div>"
- end
+# frozen_string_literal: true
+
+class Scarpe
+ class Flow < Scarpe::Widget
+ include Scarpe::Background
+ include Scarpe::Border
+
+ display_properties :width, :height, :margin, :padding
+
+ def initialize(width: nil, height: "100%", margin: nil, padding: nil, &block)
+ super
+
+ # Create the display-side widget *before* instance_eval, which will add child widgets with their display widgets
+ create_display_widget
+
+ instance_eval(&block)
end
- end
\ No newline at end of file
+ end
+end