Skip to content

Commit

Permalink
Add button icons, remove send button
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascdev committed May 17, 2024
1 parent 437b8f6 commit bd2f086
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ Changes:
- Added chat message limit setting
- Added close tab button
- Move settings out of chat tabs
- Add button icons
- Remove message send button
16 changes: 6 additions & 10 deletions fyne_ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"

"fyne.io/fyne/v2/dialog"

Expand Down Expand Up @@ -190,9 +191,7 @@ func NewChatTab(
}
return nil
}
sendButton := widget.NewButton("Send", func() {
text := msgEntry.Text

msgEntry.OnSubmitted = func(text string) {
err := msgEntry.Validate()
if err != nil {
dialog.ShowError(err, window)
Expand All @@ -209,11 +208,8 @@ func NewChatTab(
data = append(data, author+": "+text)
messageList.ScrollToBottom()
messageList.Refresh()
})
msgEntry.OnSubmitted = func(_ string) {
sendButton.OnTapped()
}
content := container.NewBorder(nil, container.NewBorder(nil, nil, nil, sendButton, msgEntry), nil, nil, messageList)
content := container.NewBorder(nil, container.NewBorder(nil, nil, nil, nil, msgEntry), nil, nil, messageList)
return container.NewTabItem(name, content)
}

Expand Down Expand Up @@ -265,10 +261,10 @@ func main() {

components := container.NewBorder(
container.NewHBox(
widget.NewButton("Settings", func() {
widget.NewButtonWithIcon("Settings", theme.SettingsIcon(), func() {
dialog.ShowCustom("Settings", "Close", container.NewBorder(nil, nil, nil, nil, NewSettingsTabs(hc, w)), w)
}),
widget.NewButton("Add tab", func() {
widget.NewButtonWithIcon("Add tab", theme.ContentAddIcon(), func() {
entry := widget.NewEntry()
entry.SetPlaceHolder("Channel")
items := []*widget.FormItem{
Expand All @@ -286,7 +282,7 @@ func main() {
}
dialog.ShowForm("Add tab", "Add", "Cancel", items, f, w)
}),
widget.NewButton("Close tab", func() {
widget.NewButtonWithIcon("Close tab", theme.CancelIcon(), func() {
tab, err := hc.GetSelectedTab()
if err != nil {
dialog.ShowError(err, w)
Expand Down

0 comments on commit bd2f086

Please sign in to comment.