Flutter custom Fontweight is not working Fontweight.w200 - Fontweight.300 in between this - flutter-layout

I want to apply custom font weight like 210.
But flutter provide fontweight like 100, 200,300,400,500,600,700,800,900
But what about if we have assign between of this like I want to assign 230 bold weight than what should I do?

Related

React Native Constant Layout on Multiple Devices

I have a minimal app with basic views, texts, images and buttons in react native. The problem I am facing, is in managing layout for multiple devices.
Any suggestions on how can I maintain a same (proportionate) view & font size for multiple devices (multiple screen resolutions and screen sizes).
View:
For example, if I want a list view of items, where each row has one image on the left, some text in between and 2 buttons on the right (one below the other i.e. flex-direction: 'column'), how can I have this look good on a 5" device as well as a 10" device?
Also, consider the buttons have some borderRadius, if we are scaling the buttons, the borderRadius value will also need to be increased. How do I achieve this?
Fonts:
I have tried using PixelRatio.getFontScale() but this scales the font depending on only the resolution (from what I understood). Using this, makes a font of size 12 look bigger on a 5" device with higher resolution and smaller on a 10" device with lower resolution. So how can I manage font sizes for the react native app?
In addition to the PixelRatio.getFontScale() you can also use the Dimensions API to get the height and width of the window, and scale your components relative to that. I have built an app that runs on both iOS and android and use this to scale width's + heights.
Checkout the link Dimensions # Facebook - React Native
ie.
Dimensions.get('window').width;
Dimensions.get('window').height;
Will return you the size of the window
How about this library? react-native-scaled-layout
You can use scaled dimensions for your layout margin, height, padding ...
(36).scaled() /* or */ (36).d()
(36).widthScaled() /* or */ (36).w()
(36).heightScaled() /* or */ (36).h()
(24).fontScaled() /* or */ (24).f()
style={{
width: (100).w(),
height: (210).h() + safeAreaBottom,
borderRadius: (16).d(),
justifyContent: 'center',
paddingBottom: safeAreaBottom + (24).h(),
}}

How to convert inch value to a valid dpi

I have an image that is displayed in both browser and android app. When the user clicks on the image in browser android app will get the location of the click in terms of "inch".
Left 0.002 , top 0.0.52
Any help on how to convert the received "inch" to convert into valid value for my android app?
I got suggestion that for IPhone 96 is to multiplied which did not work from Android.
Android: image scale type is matrix.
You can convert various value types using
https://developer.android.com/reference/android/util/TypedValue.html
So if you want to convert inches to pixels, so that you could use pixels to position/draw things on the screen, try somethig like this:
Resources r = context.getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_IN, 0.002, r.getDisplayMetrics());

How to reduce the Font of a text in LWUIT TextArea

I have created LWUIT TextArea,and I have added paragraphs of text to my TextArea ,now i want to reduce my TextArea's font size,I have used the code below:
TextArea big = new TextArea(detailNews.getDescription());
Font createSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL);
big.getStyle().setFont(createSystemFont);
big.setEditable(false);
form2.addComponent(big);
form2.show();
But, why I am not able to reduce the font of my text?
Create font in Resource editor. Then, import the font from resource file in your app. By using this method, you can apply any font to your app that is installed in your system. You can also set any font size to the font.
Explore the link to know how to create font in resource editor.
http://docs.oracle.com/javame/dev-tools/lwuit-1.4/LWUIT_Developer_Guide_HTML/cjbcgcdd.html#z400088e1296018
Use:
TextArea big = new TextArea(detailNews.getDescription());
Font createSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC,Font.SIZE_SMALL);
big.getUnselectedStyle().setFont(createSystemFont);
big.getSelectedStyle().setFont(createSystemFont);
// Added TextArea object big to the Form object form.
form.addComponent(big);
form.show();

What manager is suggested for Gallery Manager?

I am working on implementing a gallery, I tried GridFieldManager for this, but the images of the thumbnail are not of same size. I sneaked through the gridfieldclass but there are no methods for making the cell size of each image constant.
Is it worth to use flowfieldmnager? When I tried overriding sublayout method for the above two managers it is not giving the desired reults.
Is it possible to sublayout flowfieldmanager?
Device : Blackberry 9780, OS 6.0
The below image is the desired result I am trying to get
I advice you to use a simple FlowFieldManager. But instead of BitmapField inside it, extend a Field to do the following:
setExtent to 1/4 of the Display width in the sublayout method
draw your own focus in the border of the image
draw your own borders and draw the image in the center of the field's extent

Making new colors in JExcelApi

I'm using JExcelApi for generating XLS files. From jxl.format.Colour, I see how to get any of the colors in the "standard Excel colour palette", but not how to create a new color (say, given its RGB).
But in Excel itself, I can pick any color at all.
Am I just missing it? Is there a way in JExcelApi to select an arbitrary color? I'm using a simple find-the-closest-standard-color method right now, which is OK but not great.
The way to override a palette index in JExcel API is to use the method [setColourRGB][1] on the writable workbook. For instance:
myWorkbook.setColourRGB(Colour.LIGHT_TURQUOISE2, 14, 67, 89);
if you want to change the color value in the palette entry where there is by default the second light turquoise. Or, more easily in some cases, directly with the palette index:
myWorkbook.setColourRGB(Colour.getInternalColour(myPaletteIdx), 14, 67, 89);
A small update: only the indexes from 8 to 64 can be customized according to a comment inside the source code of jxl.biff.PaletteRecord.
[1]: http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/write/WritableWorkbook.html#setColourRGB(jxl.format.Colour, int, int, int)
Excel versions before 2007 have a standard palette, and given that the API you are using does not support the 2007 format, you may be stuck with that. The reason you can choose any colour you want is probably because you are using a new version of Excel.
See this information on the Microsoft site.
I don't see how you could override the standard colour palette in the API you are using, but in Apache POI (which also lets you write Excel files) you can: see this link. Basically, what you need to do there is: assign certain standard colours (green, etc) to your cells; then override these colours with whatever custom colour you need.
WritableCellFormat cellFormat = new WritableCellFormat();
Colour customColor = new Colour(10000, "1", 255, 0, 0){
};
cellFormat.setBackground(customColor);
writableCell.setCellFormat(cellFormat);

Resources