How to align currency symbol to the right - flutter

I want "1.284,00 AOA" instead of the default "AOA 1.284,00".
final Function currencyFormat = NumberFormat.currency(
decimalDigits: 2,
symbol: 'AOA',
).format('1284'); /// Current: AOA 1.284,00

You can use following code :
NumberFormat.currency(locale: 'eu', symbol: 'AOA').format(123456);
More examples here : https://www.woolha.com/tutorials/dart-formatting-currency-with-numberformat

Related

Flutter: How To display Currency In Indian Numbering Format?

have a question about formatting the Rupee currency (Indian Rupee - INR).
For example, numbers here are represented as:
1
10
100
1,000
10,000
1,00,000
10,00,000
1,00,00,000
10,00,00,000
But not able to find any reference library where I can separate comma number in Indian formate.
You can use Intl package as follow:
var format = NumberFormat.currency(locale: 'HI');
print(format.format(100000000));//10,00,00,000.00
You can use Intl package as follow:
final indianRupeesFormat = NumberFormat.currency(
name: "INR",
locale: 'en_IN',
decimalDigits: 0, // change it to get decimal places
symbol: '₹ ',
);
Or,
You can format any number as you want:
final numberFormatter = NumberFormat(
"##,##,###",
"en_US", // local US
)
An Extension to format numbers into Indian currency format:
extension RupeesFormatter on int {
String inRupeesFormat() {
return indianRupeesFormat.format(this);
}
}
use it like this:
Text(
2000.inRupeesFormat(), // output: ₹ 2,000
),
amount.toLocaleString('en-IN', {currency: 'INR', style: 'currency'}) is best jquery function to get Indian thousand comma seperator Format
toLocaleString
var amount="9887977998";
//if amount symbol required
console.log(addCommaSeperatorForAmt(amount,true))
function addCommaSeperatorForAmt(amount, symbolRequired) {
var amountDigit = "";
if (!symbolRequired) {
amountDigit = Number(amount).toLocaleString('en-IN', {currency: 'INR', style: 'currency'}).replaceAll(/₹/g, "");
} else {
amountDigit = Number(amount).toLocaleString('en-IN', {currency: 'INR', style: 'currency'});
}
return amountDigit;
}
Find this Ref:https://www.w3schools.com/jsref/jsref_tolocalestring.asp
Use locale 'en_IN' for English Indian formatting and 'HI' for Hindi Indian formatting
var indiaFormat = NumberFormat.compactCurrency(locale: 'HI');
print(indiaFormat.format(1000000));//10 लाख
var indiaFormat = NumberFormat.compactCurrency(locale: 'en_IN');
print(indiaFormat.format(1000000));//10L
If you want to show amount with ₹ symbol then use the following code:
Text(
NumberFormat.currency(
symbol: '₹ ',
locale: "HI",
decimalDigits: 3,
).format(amount),
),
Don't forget to import the intl package.

Leaflet: Draw a .gpx path with line and arrow both styled

I'm a bit new to leaflet, but I have spend hours without being able to solve this problem: I want to draw a line with arrows using a gpx file as source. This should be in a layer that can be displayed or not usin overlay.
I manage to style either the arrow or the line, but I did not manage to style both. Here is my code:
Can anyone give me advices on how to style the line ?
Many thanks.
var customLayer = L.geoJson(null, {onEachFeature: function (feature, layer) {
L.polylineDecorator(layer, {
patterns: [
{offset: 25, repeat: 15, symbol: L.Symbol.arrowHead({pixelSize: 10, pathOptions: {stroke: false, color: '#000', fillOpacity: 1, weight: 0}})}
]
}).addTo(customLayer); /// Adds each decorator to the map!!!!
}
}
);
var runLayer = omnivore.gpx('./FerneyGex.gpx', null, customLayer);
controlLayers2.addOverlay(runLayer, 'Ferney - Gex');

How to format word insid list which show when I do autocomplete?

I define my own languge .... in my languge functions and I want to do autocomplete with my function .... I want to do 2 things ...
the first thing is :
for example :
if I have class called className contain fun1 and func2
I want when I Type className and press "." (className.) to show me list contain :
int fun1
double fun2
and when I select int fun1 only fun1 is selected (something like label and value ... the label here is :int fun1 and the value is : fun1 ...when I selected the label I want to value is type on codemirror ) How I can do it ?
the second thing is :
How I can color the words in label in different color for example :
in label (int fun1) I want do color the word int by red color and fun1 by blue color insid the label ... How I can do it ?
if I can't do it with codemirror there are any plugin to do it with codemirror ??
Thanks in advance
EDIT :
Hi I find this plugin here... But I did not knew How I can change displayText and text for my own language
I used this code for autocomplete my language :
var orig = CodeMirror.hint.anyword;
var inner;
CodeMirror.hint.anyword = function(cm) {
inner = orig(cm) || { from: cm.getCursor(), to: cm.getCursor()};
inner.list.length = 0;
inner.list.push("fun1");
inner.list.push("fun2");
return inner;
}
extraKeys: {
"Ctrl-Space": "autocomplete",
"Ctrl-Space":function(cm){ CodeMirror.showHint(cm, CodeMirror.hint.anyword); },
"'.'": "autocomplete",
"'.'" : function(cm) {
setTimeout(function(){cm.execCommand("autocomplete");}, 10);
CodeMirror.showHint(cm, CodeMirror.hint.anyword);
},
can any body help me How to change displayText and text for my CodeMirror.showHint .... plz help

Leaflet polylines not working

I'm trying to show Polylines in Leaflet but it doesn't seem to work. Am I missing anything or...? p.s. Coordinate pairs do not contain the same values, so it should yield lines...
//this adds markers to the map, which works
var d = {};
d.coordinates = [[lat,lng],[lat,lng]]
var latLngs = d.coordinates.map(function (c) {
var marker = L.marker(c).addTo(map);
return {
lat: c[0],
lng: c[1]
};
});
//This 'should' add polylines but doesn't ...
var polyline = L.polyline(d.coordinates, { color: 'red', weight: 12 }).addTo(map);
I tried all sorts of variations on the code above, varying with instantiation/factory method like: new L.polyline() vs L.polyline() and trying upper- and lowercase Polyline. I tried passing arrays of [double, double] and [L.LatLng, L.LatLng] and even [{lat:lat,lng:lng}] but nothing seems to work... I really must be overlooking a simple thing...
I'm using Leaflet 0.7.
Edit:
As shown in the jsFiddle by ghybs it should work. I updated my code to the following:
var firstpolyline = L.polyline(d.coordinates, {
color: 'red',
weight: 12
}).addTo(map);
I also added identical logging statements in both the jsFiddle and my solution.
console.log(firstpolyline); //polyline for jsFiddle
console.log(map);
console.log(d.coordinates);
Those yield this (left is custom solution which is not showing a line, right is jsFiddle which is showing a line). Manually copy-pasting different coordinates pairs of my solution to the jsFiddle just works...:
I'm really lost here :(
There is no reason to add an extra .polyline after the factory L.polyline().
var polyline2 = L.polyline(d.coordinates, {color: 'red', weight: 12}).addTo(map);
Demo: http://jsfiddle.net/ve2huzxw/48/
Side note: you should use a single equal sign (=) for assignment in d.coordinates == [[lat,lng],[lat,lng]]

HighCharts Display Marker Value

Is there any way we can enable highcharts to display marker value at all the times ?
I got it working. Posting for reference of others
plotOptions : {
line : {
dataLabels : {
enabled : true,
formatter : function() {
return this.y + '%';
}
}
},
series : {
name : 'Team Briefing',
shadow : false,
marker : {
lineWidth : 2,
radius : 6,
symbol : 'circle'
}
}
},
Check the Point Marker reference guide. What I remember about Highcharts is that still it does not provide anything such as.
when you initiate the chart with an object (as your first argument) : ' ...new Highcharts.Chart( { ... } )'
one of this object properties you can use is the plotOptions.series.marker
this marker is an object itself:
marker:{
enabled:true,
lineWith:0.0,
radius:0.0,
// more attributes...
}
those are the default setting. meaning: It is enabled by default, but the radius is also zero by default, and that is the reson you don't see the points .
make a long story short: you need to set the raduis (to be bigger than zero)
read more at http://api.highcharts.com/highcharts#plotOptions.series.marker.radius