Skip to content

Commit

Permalink
Add missing widgets from the list
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Aug 8, 2024
1 parent 3df7c57 commit ff25816
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 2 deletions.
23 changes: 21 additions & 2 deletions _gen/genwidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ var (

func makeDrawList() []drawItem {
prop := canvas.NewRectangle(color.Transparent)
prop.SetMinSize(fyne.NewSize(100, 0))
prop.SetMinSize(fyne.NewSize(50, 50))
ac := widget.NewActivity()
ac.Resize(fyne.NewSize(50, 50))
//test.WidgetRenderer(ac).(anim).Animate(0.33)

se := &widget.SelectEntry{}
se.Scroll = container.ScrollNone
se.SetOptions([]string{"1", "2"})
Expand All @@ -38,6 +42,7 @@ func makeDrawList() []drawItem {
{"accordion", widget.NewAccordion(
&widget.AccordionItem{Title: "A", Detail: widget.NewLabel("Hidden")},
widget.NewAccordionItem("B", widget.NewLabel("Shown item")))},
{"activity", container.NewStack(prop, ac)},
{"apptabs", container.NewAppTabs(
container.NewTabItemWithIcon("Tab1", theme.HomeIcon(), widget.NewLabel(" ")),
container.NewTabItemWithIcon("Tab2", theme.MailSendIcon(), widget.NewLabel(" ")))},
Expand All @@ -52,6 +57,7 @@ func makeDrawList() []drawItem {
{Text: "Username", Widget: widget.NewEntry()},
{Text: "Password", Widget: widget.NewPasswordEntry()}},
OnSubmit: func() {}, OnCancel: func() {}}},
{"gridwrap", makeGridWrap()},
{"hyperlink", widget.NewHyperlink("fyne.io", nil)},
{"icon", widget.NewIcon(theme.ContentPasteIcon())},
{"label", widget.NewLabel("Text label")},
Expand All @@ -63,6 +69,7 @@ func makeDrawList() []drawItem {
{"progress", &widget.ProgressBar{Value: 0.74}},
{"progressinf", widget.NewProgressBarInfinite()},
{"radiogroup", &widget.RadioGroup{Options: []string{"Item 1", "Item 2"}, OnChanged: func(string) {}, Selected: "Item 1"}},
{"richtext", widget.NewRichTextFromMarkdown("## Title\n\n* List item")},
{"scroll", container.NewScroll(widget.NewLabel("Scroll"))},
{"select", widget.NewSelect([]string{"1", "2"}, func(string) {})},
{"selectentry", se},
Expand All @@ -81,6 +88,18 @@ func makeDrawList() []drawItem {
}
}

func makeGridWrap() *widget.GridWrap {
l := widget.NewGridWrap(func() int { return 5 },
func() fyne.CanvasObject {
return container.NewHBox(widget.NewIcon(theme.DocumentIcon()), widget.NewLabel("It\n01"))
},
func(i int, item fyne.CanvasObject) {
item.(*fyne.Container).Objects[1].(*widget.Label).SetText(fmt.Sprintf("It\n%d", i+1))
})

return l
}

func makeInvalidEntry() *widget.Entry {
e := &widget.Entry{Scroll: container.ScrollNone}
e.Validator = func(_ string) error { return fmt.Errorf("reason") }
Expand Down Expand Up @@ -165,7 +184,7 @@ func draw(obj fyne.CanvasObject, name string, c fyne.Canvas, themeName string) {
time.Sleep(time.Second)
} else if name == "separator" {
c.(test.WindowlessCanvas).Resize(obj.MinSize().Add(fyne.NewSize(120+theme.Padding()*2, theme.Padding()*2)))
} else if name == "list" || name == "table" || name == "tree" || name == "accordion" {
} else if name == "list" || name == "table" || name == "tree" || name == "gridwrap" || name == "accordion" {
c.(test.WindowlessCanvas).Resize(fyne.NewSize(136, 120))
test.TapCanvas(c, fyne.NewPos(50, 60))
}
Expand Down
19 changes: 19 additions & 0 deletions explore/widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Accordion displays a list of AccordionItems. Each item is represented by a butto

{% include widget.html name="accordion" %}

### Activity

Display an animated activity indicator.

{% include widget.html name="activity" %}

### Button

[Button](/widget/button) widget has a text label and icon, both are optional.
Expand Down Expand Up @@ -94,6 +100,13 @@ RadioGroup widget has a list of text labels and radio check icons next to each.

{% include widget.html name="radiogroup" %}

### RichText

RichText widget is a text component that shows various styles and embedded objects.
It supports markdown parsing to construct the widget with ease.

{% include widget.html name="richtext" %}

### Select

Select widget has a list of options, with the current one shown, and triggers an event function when clicked.
Expand Down Expand Up @@ -156,6 +169,12 @@ Each of these widgets uses a series of callbacks, the minimum set is defined by

{% include widget.html name="tree" %}

### GridWrap

GridWrap is a collection widget that display each child item at the same size and wraps them to new lines as required.

{% include widget.html name="gridwrap" %}


## Container Widgets (in `container` package)

Expand Down
Binary file added images/widgets/activity-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widgets/activity-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widgets/gridwrap-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widgets/gridwrap-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widgets/richtext-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widgets/richtext-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff25816

Please sign in to comment.