TVCardView's focusSizeIncrease not working? - tvos

I'm trying to manipulate the focusSizeIncrease property of a TVCardView like this:
cardView.contentSize = CGSize(width: 200, height: 200)
cardView.focusSizeIncrease = NSDirectionalEdgeInsets(top: -10, leading: -10, bottom: -10, trailing: -10)
The value of focusSizeIncrease is changed when I read it afterwards, but the new value is ignored.
When I read the property in shouldUpdateFocus(in: UIFocusUpdateContext) or didUpdateFocus(in: UIFocusUpdateContext, with: UIFocusAnimationCoordinator) it has been changed back to the default NSDirectionalEdgeInsets(top: -23.0, leading: -23.0, bottom: -23.0, trailing: -23.0).
Has anybody got this working?
Apple's Documentation: https://developer.apple.com/documentation/tvuikit/tvlockupview/2967067-focussizeincrease

This has fixed by Apple in tvOS 13.

Related

Remove spacing between bar in bar graph( react-chart-js)

issue that i am facing is, i have my bar graph made using react-chart-js. i want to remove space between the bar and center align the bar's . The bar's should have Thickness equal to 50
I try using dummy data ,that way i got the desired output but that is not the correct way of doing . Also I try using barPercentage , categoryPercentage option but didnt get the desired output
Link for CodeSandbox
I don't know if this actually works out of the box. There is nothing in the documentation about this use case either.
You could do it with ghost values to extend the chart in general.
This is not really a solution, but it may be an option.
const labels = ["","","January", "February", "March","",""];
export const data = {
labels,
datasets: [
{
label: "Dataset 1",
data: labels.map((elem, index) => {
if (index > 1 && index < 5)
return faker.datatype.number({ min: 0, max: 1000 })
}),
backgroundColor: "rgba(255, 99, 132, 0.5)",
barThickness: 50
}
]
};

Cannot change Tabs text and icon colors in KivyMD

Iam trying to learn how to program with KivyMD. After doing some research and watching some tutorials iam putting a GUI together with the trail-and-error approach.
At the moment iam trying to change the colors of the Tab text and icons. After hours of online searching iam still not able to change them. The text_color_normal:and text_color_active: in the .kv file simply
seems to have no effect on them. I have the feeling iam doing something fundamentally wrong here. Can somebody give me some tips how to proceed? Main.py and .KV file are below.
Thanks in advance!
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.uix.tab import MDTabsBase
from kivymd.font_definitions import fonts
from kivymd.icon_definitions import md_icons
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.uix.widget import Widget
Window.size = (300, 500) # voor develop doeleinden mobielscherm
class Screen1(Screen):
pass
class Screen2(Screen):
pass
class Screen3(Screen):
pass
class Screen4(Screen):
pass
class Tab(FloatLayout, MDTabsBase):
pass
class Tab1(FloatLayout, MDTabsBase):
pass
class DemoApp(MDApp):
def build(self):
self.theme_cls.primary_palette = 'Red'
screen = Builder.load_file('demo_file.kv')
return screen
def navigation_draw(self):
print('navigation')
DemoApp().run()
demo_file.kv
Screen:
NavigationLayout:
ScreenManager:
id:screen_manager
Screen1:
name: 'home_screen'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Home'
left_action_items: [['menu', lambda x: nav_drawer.set_state("open")]]
elevation: 0
specific_text_color: 0,0,0,1
MDTabs:
id:android_tabs
tab_bar_height: '35dp'
background_color: 1,0,0,0.85
elevation: 0
text_color_normal: 0, 1, 0, 1
text_color_active: 1, 0, 0, 1
color_indicator: 0.95, 0.95, 0.1, 1
Tab:
text: 'Tab1'
Tab1:
text: 'chart-pie'
MDBottomAppBar:
MDToolbar:
title: 'Start sessie'
mode: 'end'
type: 'bottom'
on_action_button: app.navigation_draw()
icon: 'beer'
icon_color: 0.95, 0.95, 0.1, 1
Screen2:
name: 'profile_screen'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Profiel'
left_action_items: [['menu', lambda x: nav_drawer.set_state("open")]]
elevation: 7
Widget:
Screen3:
name: 'session_screen'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Sessies'
left_action_items: [['menu', lambda x: nav_drawer.set_state("open")]]
elevation: 10
Widget:
Screen4:
name: 'logout_screen'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Uitloggen'
left_action_items: [['menu', lambda x: nav_drawer.set_state("open")]]
elevation: 10
Widget:
MDNavigationDrawer:
id:nav_drawer
BoxLayout:
orientation: 'vertical'
spacing: '8dp'
padding: '8dp'
Image:
source: 'avatar.jpg'
MDLabel:
text: ' Name'
front_style: 'Subtitle1'
size_hint_y: None
height: self.texture_size[1]
MDLabel:
text: ' email#hotmail.com'
front_style: 'Caption'
size_hint_y: None
height: self.texture_size[1]
ScrollView:
MDList:
OneLineIconListItem:
text: 'Profiel'
on_press: screen_manager.current = 'profile_screen'
IconLeftWidget:
icon: 'face-profile'
on_press: screen_manager.current = 'profile_screen'
OneLineIconListItem:
text: 'Drink sessies'
on_press: screen_manager.current = 'session_screen'
IconLeftWidget:
icon: 'beer'
on_press: screen_manager.current = 'session_screen'
OneLineIconListItem:
text: 'Uitloggen'
on_press: screen_manager.current = 'logout_screen'
IconLeftWidget:
icon: 'logout'
on_press: screen_manager.current = 'logout_screen'
<Tab>:
MDLabel:
text:'tab1'
user_font_size: "48sp"
pos_hint: {"center_x": .5, "center_y": .5}
<Tab1>:
MDLabel:
text:'tab2'
user_font_size: "48sp"
pos_hint: {"center_x": .5, "center_y": .5}
I finally figured out why my code was not working. While searching the web i stumbled across the change logs and i found out that the unreleased version contains a fix for text_color_normal and text_color_active. Which means that in my current version (0.104.1) the parameters did not work the way they should. Installing KivyMD with pip install https://github.com/kivymd/KivyMD/archive/master.zip works for me.
Thanks for your effort to solve this!
Change the color of the text/icon of the tabs? That is working for me.
Maybe try reinstall KivyMD.
test this instead : text_color : rgba(253, 0, 253,255)
it's worked for me

Range slide not going to max value when there is steps also

I am setting up range slider in my angular project. The all values for range slider is coming from api.Api response for slider is looking like this.
[{
toolValue: { defaultvalue: 120,
min: 30,
max: 120,
step: 30 }
}]
I am setting up these values in range slider and the slider is working but when step value is 30 or any other then the slider is not going to max position, instead of it is setting up at position 90. But when the steps are 0.1, that time slider is set to max position . I don't know what wrong with steps.
Html code:
<input type="range" class="slider" [value]="item.toolValue.defaultvalue" [min]="item.toolValue.min" [max]="item.toolValue.max" [step]="item.toolValue.step" id="rangeslider{{index}}" (mouseup)="onMouseupRangeslider($event.target.value,item,index)">
Please let me know how to
As you can see in the upper image, From API in both slider the default value is coming 100 and 120. In first slider steps are 0.1, so that it's going to max position but in the second slider, steps are 30 so that the slider is not going to max position, instead of it is stopped at 90. Please help me with this issue. Thank you
The api response for slider values are as per below.
[{
cols: 12
id: "dvetool0"
rows: 3
toolValue: {defaultvalue: 100, max: 100, min: 0, step: 0.1}
type: "rangeslider"
x: 0
y: 0 },
{
cols: 11
id: "dvetool1"
rows: 3
toolValue: {defaultvalue: 120, max: 120, min: 30, step: 30}
type: "rangeslider"
x: 0
y: 4 }]
Updated Answer:
To follow up after your clarification, I think your problem is the use of the [value] DOM property here. Instead, try tracking the value with ngModel instead.
Replace [value]="default" with [(ngModel)]="inputValue" and create the inputValue variable in your component.ts
Here's a working stackblitz as an example: https://stackblitz.com/edit/angular-szdxyn
By the way, the reason you were seeing 90 is because the browser calculates a a default value using rangeElem.min + (rangeElem.max - rangeElem.min)/2. See the MDN page: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#Value

How to change Slider label colour in Flutter?

Is it possible to change the Slider label colour in Flutter?
There is no such field in constructor of Slider class.
According to Flutter api use valueIndicatorColor which is the property of SliderThemeData As mention here SliderClass
and here SliiderThemeData
Simple Demonstration:
set local variables:
double feet = 0;
String heightInFeet = "null";
int height = 180;
and Here comes your Custom Slider Solution
SliderTheme(
data: SliderTheme.of(context).copyWith(
valueIndicatorColor: Colors.blue, // This is what you are asking for
inactiveTrackColor: Color(0xFF8D8E98), // Custom Gray Color
activeTrackColor: Colors.white,
thumbColor: Colors.red,
overlayColor: Color(0x29EB1555), // Custom Thumb overlay Color
thumbShape:
RoundSliderThumbShape(enabledThumbRadius: 12.0),
overlayShape:
RoundSliderOverlayShape(overlayRadius: 20.0),
),
child: Slider(
value: height.toDouble(),
onChanged: (double newValue) {
setState(() {
height = newValue.toInt();
feet = (height / 30.48);
heightInFeet = feet.toStringAsFixed(2) + " feet";
});
},
divisions: 220,
label: heightInFeet,
min: 90.0,
max: 305.0,
),
)
and if you want to change Text color text font etc. use
valueIndicatorTextStyle: TextStyle(
color: Colors.amber, letterSpacing: 2.0)
in SliderThemeData
that´s one way to do it, but that will change all the placer where accentTextTheme it´s use, you can use this:
Theme(
child: yourSlide,
data: Theme.of(context).copyWith(
accentTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)),
),
)
This way you will only change the widget you need to change and not the entire accentTextTheme that can be use for other that maybe you don't need to change.
Use SliderThemeData:
sliderTheme: ThemeData.dark().sliderTheme.copyWith(
valueIndicatorColor: _primaryColor,
valueIndicatorTextStyle: TextStyle(
backgroundColor: Colors.transparent
)
)
I have found that it is specified in Slider class above label field.
The label is rendered using the active [ThemeData]'s
[ThemeData.accentTextTheme.bodyText2] text style.
When creating the App widget it is necessary to specify the accentTextTheme and the bodyText2 field.
return MaterialApp(
theme: ThemeData(
accentTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)),
),
home: MyHomePage(),
);

JustGage - change gauge's background color

I'm using justgage.1.0.1.js on my ASP page. I have configured colors for the progress line into 4 sectors like this:
var g1 = new JustGage({
id: "gauge1",
value: 0,
min: 0,
max: 100,
title: "Some Title",
showMinMax: 0,
label: '0 of 2',
levelColorsGradient: false,
countComplete: 0,
countTotal: 2,
levelColors: [ "#ff0000", "#ff9900", "#ffcc00", "#cccc00" ]
});
And in case countComplete = 0 it chows me an empty pipe with a grey background color:
What I need is to change this empty pipe's background to red, but only if countComplete equals 0 and countTotal is greater than 0. In all other cases the background should stay gray:
``
If this is possible to do, can you show me how to do it?
Already figured this out. To change the background of the gauge line, you just have to add a parameter to the gauge's body:
gaugeColor: "#ff0000"