• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fyne-io / fyne / 16413288862

21 Jul 2025 09:23AM UTC coverage: 62.38% (-0.01%) from 62.392%
16413288862

Pull #5838

github

Vinci10
increase rect coords by edge softness value to not crop edges, parametrize shaders edge_softness value
Pull Request #5838: rectangle edge smoothness fix

0 of 14 new or added lines in 1 file covered. (0.0%)

221 existing lines in 7 files now uncovered.

25236 of 40455 relevant lines covered (62.38%)

717.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.46
/container/theme.go
1
package container
2

3
import (
4
        "fyne.io/fyne/v2"
5
        "fyne.io/fyne/v2/internal/cache"
6
        intTheme "fyne.io/fyne/v2/internal/theme"
7
        "fyne.io/fyne/v2/widget"
8
)
9

10
// ThemeOverride is a container where the child widgets are themed by the specified theme.
11
// Containers will be traversed and all child widgets will reflect the theme in this container.
12
// This should be used sparingly to avoid a jarring user experience.
13
//
14
// Since: 2.5
15
type ThemeOverride struct {
16
        widget.BaseWidget
17

18
        Content fyne.CanvasObject
19
        Theme   fyne.Theme
20

21
        holder *fyne.Container
22

23
        mobile bool
24
}
25

26
// NewThemeOverride provides a container where the child widgets are themed by the specified theme.
27
// Containers will be traversed and all child widgets will reflect the theme in this container.
28
// This should be used sparingly to avoid a jarring user experience.
29
//
30
// If the content `obj` of this theme override is a container and items are later added to the container or any
31
// sub-containers ensure that you call `Refresh()` on this `ThemeOverride` to ensure the new items match the theme.
32
//
33
// Since: 2.5
34
func NewThemeOverride(obj fyne.CanvasObject, th fyne.Theme) *ThemeOverride {
42✔
35
        t := &ThemeOverride{Content: obj, Theme: th, holder: NewStack(obj)}
42✔
36
        t.ExtendBaseWidget(t)
42✔
37

42✔
38
        cache.OverrideTheme(obj, addFeatures(th, t))
42✔
39
        obj.Refresh() // required as the widgets passed in could have been initially rendered with default theme
42✔
40
        return t
42✔
41
}
42✔
42

43
func (t *ThemeOverride) CreateRenderer() fyne.WidgetRenderer {
42✔
44
        cache.OverrideTheme(t.Content, addFeatures(t.Theme, t))
42✔
45

42✔
46
        return widget.NewSimpleRenderer(t.holder)
42✔
47
}
42✔
48

49
func (t *ThemeOverride) Refresh() {
28✔
50
        if t.holder.Objects[0] != t.Content {
28✔
51
                t.holder.Objects[0] = t.Content
×
52
                t.holder.Refresh()
×
53
        }
×
54

55
        cache.OverrideTheme(t.Content, addFeatures(t.Theme, t))
28✔
56
        t.BaseWidget.Refresh()
28✔
57
}
28✔
58

59
// SetDeviceIsMobile allows a ThemeOverride container to shape the contained widgets as a mobile device.
60
// This will impact containers such as AppTabs and DocTabs, and more in the future, to display a layout
61
// that would automatically be used for a mobile device runtime.
62
//
63
// Since: 2.6
64
func (t *ThemeOverride) SetDeviceIsMobile(on bool) {
65
        t.mobile = on
1✔
66
        t.BaseWidget.Refresh()
1✔
67
}
1✔
68

1✔
69
type featureTheme struct {
70
        fyne.Theme
71

72
        over *ThemeOverride
73
}
74

75
func addFeatures(th fyne.Theme, o *ThemeOverride) fyne.Theme {
76
        return &featureTheme{Theme: th, over: o}
112✔
77
}
112✔
78

112✔
79
func (f *featureTheme) Feature(n intTheme.FeatureName) any {
80
        if n == intTheme.FeatureNameDeviceIsMobile {
6✔
81
                return f.over.mobile
12✔
82
        }
6✔
83

6✔
84
        return nil
UNCOV
85
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc