Skip to content

Commit

Permalink
Merge pull request #87 from NaadiQmmr/81-continue-pr
Browse files Browse the repository at this point in the history
#81 continue pr
  • Loading branch information
cgrand committed May 23, 2022
2 parents 8264f21 + 6948822 commit 099e906
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions samples/datatable/deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{:paths ["src"] ; where your cljd files are
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
tensegritics/clojuredart
{:local/root "../../"}
#_{:git/url "git@github.com:tensegritics/ClojureDartPreview.git"
:sha "b4b20ee2e82af28360ea95ddd5ce3c1a71ba5b11"}}}
41 changes: 41 additions & 0 deletions samples/datatable/src/sample/datatable.cljd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(ns sample.datatable
(:require
["package:flutter/material.dart" :as m]
[cljd.flutter.alpha :as f]))

(defn data-table [& {:keys [cols rows]}]
(f/widget
(m/SingleChildScrollView
:scrollDirection m.Axis/horizontal
:child
(m/DataTable
:headingTextStyle (m/TextStyle
:fontWeight m.FontWeight/bold
:color m.Colors/blue)
;; :columnSpacing 18.0
;; :sortColumnIndex 2
;; :sortAscending true
:showBottomBorder true
:columns (mapv (fn [col] (m/DataColumn :label (m/Text col))) cols)
:rows (mapv (fn [row] (m/DataRow :cells (mapv (fn [cell] (m/DataCell (m/Text cell))) row))) rows)))))

(def demo
(f/widget
(m/Scaffold
:appBar (m/AppBar :title (m/Text "DataTable Sample"))
:body
(f/nest
m/Center
(data-table :cols ["#" "Name" "Age" "City"]
:rows [["1" "zm" "42" "guangzhou"]
["2" "zrj" "10" "guangzhou"]
["3" "wrp" "13" "hongkong"]
["4" "wrl" "11" "guangzhou"]
["5" "wrj" "10" "beijing"]])))))

(defn main
[]
(m/runApp
(m/MaterialApp
:home demo
:debugShowCheckedModeBanner false)))

0 comments on commit 099e906

Please sign in to comment.