Skip to content

Commit

Permalink
Just Viewable list and Index Bar
Browse files Browse the repository at this point in the history
  • Loading branch information
amjil committed Feb 2, 2023
1 parent e384b68 commit 9587c88
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/anabapa_list/data.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
(defn convert-list []
(->> items
(map first)
(sort)
(group-by #(str (first %)))
(map (fn [[k v]] (map-indexed (fn [idx itm] {:name itm :idx idx :tag (str (first itm))}) v)))
(flatten)
Expand Down
17 changes: 10 additions & 7 deletions src/anabapa_list/index_bar.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,24 @@
(defn index-bar []
(f/widget
:context ctx
(m/Container .alignment (.center m/Alignment))
.child
;; (m/Container .alignment (.centerRight m/Alignment))
;; .child
(m/GestureDetector
.onVerticalDragDown
(fn [^m/DragDownDetails details])
(fn [^m/DragDownDetails details]
(dart:core/print "on vertical drag down"))
.onVerticalDragUpdate
(fn [^m/DragUpdateDetails details]
nil)
(dart:core/print ".onVerticalDragUpdate"))
.onVerticalDragEnd
(fn [^m/DragEndDetails details]
nil)
(dart:core/print ".onVerticalDragEnd"))
.onVerticalDragCancel
(fn [] nil)
(fn []
(dart:core/print ".onVerticalDragCancel"))
.onTapUp
(fn [^m/TapUpDetails details] nil)
(fn [^m/TapUpDetails details]
(dart:core/print ".onTapUp"))
.behavior (.translucent m/HitTestBehavior))
.child
(m/Column
Expand Down
13 changes: 8 additions & 5 deletions src/anabapa_list/indexed_list.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
(defn item-builder [items ctx i]
(let [item (nth items i)
sus-height 40]
(if true;(zero? (:idx item))
(m/ListTile .title (m/Text (:name item)))
(if (= 0 (:idx item))
(m/Column
.mainAxisSize (.min m/MainAxisSize)
.children
Expand All @@ -25,17 +24,21 @@
.softWrap false
.style (m/TextStyle .fontSize 14
.color (m/Color 0xFF666666))))
(m/ListTile .title (m/Text (:name item)))]))))
(m/ListTile .title (m/Text (:name item)))])
(m/ListTile .title (m/Text (:name item))))))

(defn indexed-list []
(let [items (sample-data/convert-list)]
;; (dart:core/print (str "aaaaa" (count items)))
(if (empty? items)
(m/Container)
(f/widget
:context ctx
:let [item-scroll-controller (scroll-list/ItemScrollController)
item-position-listener (.create scroll-list/ItemPositionsListener)]

item-position-listener (.create scroll-list/ItemPositionsListener)]
(m/Container
.width (-> m/MediaQuery (.of ctx) .-size .-width))
.child
(m/Stack
.children
[(.builder
Expand Down

0 comments on commit 9587c88

Please sign in to comment.