I would like to achieve in Flutter something like this in XAML:
<RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</RowDefinition>
I'm struggling with building a fraction in Flutter.
I would like my Column to render two independent containers: nominator and denominator.
And I would like them to be the same exact size. I mean when the nominator has another fraction in it, the denominator should be the same height.
Is it possible to have a Column with two elements of each size depending on the highest one?
I've been trying to use IntrinisicHeight but it doesn't work when the height isn't provided.
But XAML could render it because it would automatically be calculated and set 1:1 ratio for both elements.
Use the Expanded widget to do that:
Column(
children: [
Expanded(
flex: 1,
child: Container(),
),
Expanded(
flex: 1,
child: Container(),
),
],
);
The flex argument is 1 by default so you don't even need that. more about the expanded widget:
https://api.flutter.dev/flutter/widgets/Expanded-class.html
Related
I have multiple fields with the same name "item" inside json object, how can I combine their values under one field (as an array) using regex
sample input:
{"item":"A","item":"B","item":"C"}
expected output:
"item": ["A","B","C"]
note that we could have more than 3 items on above sample
I have tried {"item":"(.*?)","item":"(.*?)","item":"(.*?)"} but here I'm limited with 3 items, I need something to work for any number of items.
Thanks
The conversion you want can be performed quite easily in XSLT 2.0 or higher using:
<xsl:text>"item": [</xsl:text>
<xsl:value-of select="for $i in tokenize(translate($input, '{}', ''), ',') return substring-after($i, ':')" separator=","/>
<xsl:text>]</xsl:text>
Demo: https://xsltfiddle.liberty-development.net/eiorv1e
Of course, if your ultimate goal is to parse the input in order to use its values, then it's not necessary to put it back as JSON.
I am having trouble changing the font size of the text in the columns. I have used attribute fontsize and it does not work.
<cfform name="mainF">
<cfgrid name="record" query="getRecords" format="html">
<cfgridcolumn name="act" FONTSIZE="300" bold="yes" >
<cfgridcolumn name="sub" FONTSIZE="15">
<cfgridcolumn name="Mon" FONTSIZE="15" DATAALIGN="CENTER">
<cfgridcolumn name="date_of" fontsize="15" DATAALIGN="CENTER">
<cfgridcolumn name="Desc" width="510" display="yes" fontsize="15">
</cfgrid>
</cfform>
Yep, I never could get that to work. I had to do some digging, and ended up using CSS.
/* should set the whole grid */
.x-grid3{
font:Consolas;
}
/* grid title area */
.x-panel-header{
font-size:18px;
font:Consolas;
}
/* column headers */
.x-grid3-hd-inner{
font-size:12px;
}
/* cells with data */
.x-grid3-cell-inner{
font-size:14px;
}
I used 'Inspect Element with Firebug' to find the different areas. The grid itself is built (roughly) with a combination of table elements for the structure, and div elements for data (divs area used for other things too).
Good Luck
In my application i have used WebDataGrid Infragistics control. I have total 5 columns(Status,CandidateName,WorkOrderId,VenderName,Rate) in this grid. I needed to apply filter on 2 columns only i.e; Status and CandidateName. I have explicitly write code to set filter only in 2 columns. Below is my code. But, the problem is, Filter is applying on all the 5 columns regardless of setting the filter explicitly.
<ColumnFilters>
<ig:ColumnFilter ColumnKey="Status">
<ConditionWrapper>
<ig:RuleTextNode Rule="Contains" />
</ConditionWrapper>
</ig:ColumnFilter>
<ig:ColumnFilter ColumnKey="CandidateName">
<ConditionWrapper>
<ig:RuleTextNode Rule="Contains" />
</ConditionWrapper>
</ig:ColumnFilter>
</ColumnFilters>
Please any one can tell me how to apply filter only on specific columns defined explicitly.
Thanks in Advance !!!!
You should be able to disable the other columns by setting Enabled=false as follows:
<Behaviors>
<ig:Filtering>
<ColumnSettings>
<ig:ColumnFilteringSetting ColumnKey="WorkOrderId" Enabled="false" />
<ig:ColumnFilteringSetting ColumnKey="VenderName" Enabled="false" />
<ig:ColumnFilteringSetting ColumnKey="Rate" Enabled="false" />
</ColumnSettings>
</ig:Filtering>
</Behaviors>
I am having problems to create a exact similar list via HTML and XSL-Fo. The list labels have different orientations. A HTML ordered list has the labels right-aligned, XSL-FO left-aligned. This is only a minor problem but still annoying.
Example:
http://img69.imageshack.us/i/htmlxslfo.jpg/
Is there any way to change the orientation ind XSL-FO?
Thanks in advance
You can add text-align="right" to your fo:list-item-label:
<fo:list-item-label end-indent="label-end()" text-align="right">
<fo:block>1.</fo:block>
</fo:list-item-label>
I have the following codes in my page.
The style variable holds the custom style.
<cfchart chartheight="450" chartwidth="550" gridlines="9" yaxistitle="Score" scalefrom="20" scaleto="100" style="#style#" format="png" >
<cfchartseries query="variables.chart_query" type="scatter" seriescolor="##000000" itemcolumn="MyItem" valuecolumn="MyScore"/>
</cfchart>
Before I begin, please see chart_good.jpg. This is how I want my report to come up. On the x-axis, there will always be three items as long as at least one of them has values. If an item does not have any values (i.e. 2010), there would not be a marker in the chart.
The problem occurs only when only one item has value. Please see chart_bad.jpg. As you can see, 2008 and 2010 do not have any values; y-axis is now scaled from 0 to 100. I have tried setting one of the items (ex. 2008) a value of 0 or something off the chart; it would scale according to this off-the-chart value and the 2009 value. In short, I have to have at least two items with values between 20 and 100 in order for cfchart to scale from 20 to 100.
My question is, how can I correct the issue so that cfchart would ALWAYS scale from 20 to 100? I am running CF9.
What is inside your style variable?
I would suggest not using scaleFrom="" and scaleTo="" in the cfchart tag as they can be buggy sometimes. I believe that Coldfusion's cfchart tag attempts to scale the chart automatically to what it deems the best fit. Instead I would build the chart's minimum and maximum scales inside a frameChart tag.
Example of a style variable to build a chart
<cfsavecontent variable="style">
<?xml version="1.0" encoding="UTF-8"?>
<frameChart is3D="false" font="Arial-11-bold">
<frame xDepth="0" yDepth="0" outline="black" lightColor="#CCCCCC" darkColor="#CCCCCC"
wallColor="#CCCCCC" frameSize="5" dashSize="3" gridColor="#333333">
<background type="HorizontalGradient" maxColor="#828EB0"/>
</frame>
<!--- THE BREAD AND BUTTER
NOTE: if you use variables for the scaleMin and scaleMax
make sure to surround them with a cfoutput tag
--->
<yAxis scaleMin="20" scaleMax="100">
<!--- --------------------- --->
<labelFormat style="Currency" pattern="#,##0"/>
<parseFormat pattern="#,##0"/>
<titleStyle></titleStyle>
</yAxis>
<legend allowSpan="true" isVisible="false" placement="Bottom" valign="Bottom" foreground="black"
isMultiline="true">
<decoration style="None"/>
</legend>
<elements outline="black" shapeSize="40"/>
<popup background="#748BA6" foreground="white"/>
<paint palette="Modern" paint="Plain" isVertical="true"/>
<insets right="5"/>
</frameChart>
</cfsavecontent>
Then all you have to do is load the variable into the style attribute like you already mentioned.
<cfchart format="png" chartWidth="550" chartHeight="175" style="#style#">
Also a great resource to use, is the Webcharts program that will be in your C:/coldfusion/charting/ directory. Just open webcharts.bat, create your custom chart, copy the xml code into your style variable, and voila!
Make sure to remove the scaleTo= and scaleFrom= from your cfchart tag if you decide to go this route.